-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alberto Tudela <[email protected]>
- Loading branch information
Showing
12 changed files
with
159 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
nav2_graceful_motion_controller/include/nav2_graceful_motion_controller/utils.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 Alberto J. Tudela Roldán | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef NAV2_GRACEFUL_MOTION_CONTROLLER__UTILS_HPP_ | ||
#define NAV2_GRACEFUL_MOTION_CONTROLLER__UTILS_HPP_ | ||
|
||
#include "geometry_msgs/msg/point_stamped.hpp" | ||
#include "geometry_msgs/msg/pose_stamped.hpp" | ||
#include "visualization_msgs/msg/marker.hpp" | ||
|
||
namespace nav2_graceful_motion_controller | ||
{ | ||
/** | ||
* @brief Create a PointStamped message of the motion target for | ||
* debugging / visualization porpuses. | ||
* | ||
* @param motion_target Motion target in PoseStamped format | ||
* @return geometry_msgs::msg::PointStamped Motion target in PointStamped format | ||
*/ | ||
geometry_msgs::msg::PointStamped createMotionTargetMsg( | ||
const geometry_msgs::msg::PoseStamped & motion_target); | ||
|
||
/** | ||
* @brief Create a flat circle marker of radius slowdown_radius around the motion target for | ||
* debugging / visualization porpuses. | ||
* | ||
* @param motion_target Motion target | ||
* @param slowdown_radius Radius of the slowdown circle | ||
* @return visualization_msgs::msg::Marker Slowdown marker | ||
*/ | ||
visualization_msgs::msg::Marker createSlowdownMarker( | ||
const geometry_msgs::msg::PoseStamped & motion_target, const double & slowdown_radius); | ||
|
||
} // namespace nav2_graceful_motion_controller | ||
|
||
#endif // NAV2_GRACEFUL_MOTION_CONTROLLER__UTILS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2023 Alberto J. Tudela Roldán | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "nav2_graceful_motion_controller/utils.hpp" | ||
|
||
namespace nav2_graceful_motion_controller | ||
{ | ||
|
||
geometry_msgs::msg::PointStamped createMotionTargetMsg( | ||
const geometry_msgs::msg::PoseStamped & motion_target) | ||
{ | ||
geometry_msgs::msg::PointStamped motion_target_point; | ||
motion_target_point.header = motion_target.header; | ||
motion_target_point.point = motion_target.pose.position; | ||
motion_target_point.point.z = 0.01; | ||
return motion_target_point; | ||
} | ||
|
||
visualization_msgs::msg::Marker createSlowdownMarker( | ||
const geometry_msgs::msg::PoseStamped & motion_target, const double & slowdown_radius) | ||
{ | ||
visualization_msgs::msg::Marker slowdown_marker; | ||
slowdown_marker.header = motion_target.header; | ||
slowdown_marker.ns = "slowdown"; | ||
slowdown_marker.id = 0; | ||
slowdown_marker.type = visualization_msgs::msg::Marker::SPHERE; | ||
slowdown_marker.action = visualization_msgs::msg::Marker::ADD; | ||
slowdown_marker.pose = motion_target.pose; | ||
slowdown_marker.pose.position.z = 0.01; | ||
slowdown_marker.scale.x = slowdown_radius * 2.0; | ||
slowdown_marker.scale.y = slowdown_radius * 2.0; | ||
slowdown_marker.scale.z = 0.02; | ||
slowdown_marker.color.a = 0.2; | ||
slowdown_marker.color.r = 0.0; | ||
slowdown_marker.color.g = 1.0; | ||
slowdown_marker.color.b = 0.0; | ||
return slowdown_marker; | ||
} | ||
|
||
} // namespace nav2_graceful_motion_controller |
Oops, something went wrong.