@@ -107,42 +107,31 @@ class GracefulController : public nav2_core::Controller
107
107
void setSpeedLimit (const double & speed_limit, const bool & percentage) override ;
108
108
109
109
protected:
110
- /* *
111
- * @brief Get motion target point.
112
- * @param motion_target_dist Optimal motion target distance
113
- * @param path Current global path
114
- * @return Motion target point
115
- */
116
- geometry_msgs::msg::PoseStamped getMotionTarget (
117
- const double & motion_target_dist,
118
- const nav_msgs::msg::Path & path);
119
-
120
110
/* *
121
111
* @brief Simulate trajectory calculating in every step the new velocity command based on
122
112
* a new curvature value and checking for collisions.
123
113
*
124
- * @param robot_pose Robot pose
125
- * @param motion_target Motion target point
114
+ * @param motion_target Motion target point (in costmap local frame?)
126
115
* @param costmap_transform Transform between global and local costmap
127
116
* @param trajectory Simulated trajectory
117
+ * @param cmd_vel Initial command velocity during simulation
128
118
* @param backward Flag to indicate if the robot is moving backward
129
119
* @return true if the trajectory is collision free, false otherwise
130
120
*/
131
121
bool simulateTrajectory (
132
- const geometry_msgs::msg::PoseStamped & robot_pose,
133
122
const geometry_msgs::msg::PoseStamped & motion_target,
134
123
const geometry_msgs::msg::TransformStamped & costmap_transform,
135
124
nav_msgs::msg::Path & trajectory,
136
- const bool & backward);
125
+ geometry_msgs::msg::TwistStamped & cmd_vel,
126
+ bool backward);
137
127
138
128
/* *
139
129
* @brief Rotate the robot to face the motion target with maximum angular velocity.
140
130
*
141
131
* @param angle_to_target Angle to the motion target
142
132
* @return geometry_msgs::msg::Twist Velocity command
143
133
*/
144
- geometry_msgs::msg::Twist rotateToTarget (
145
- const double & angle_to_target);
134
+ geometry_msgs::msg::Twist rotateToTarget (double angle_to_target);
146
135
147
136
/* *
148
137
* @brief Checks if the robot is in collision
@@ -153,6 +142,21 @@ class GracefulController : public nav2_core::Controller
153
142
*/
154
143
bool inCollision (const double & x, const double & y, const double & theta);
155
144
145
+ /* *
146
+ * @brief Compute the distance to each pose in a path
147
+ * @param poses Poses to compute distances with
148
+ * @param distances Computed distances
149
+ */
150
+ void computeDistanceAlongPath (
151
+ const std::vector<geometry_msgs::msg::PoseStamped> & poses,
152
+ std::vector<double > & distances);
153
+
154
+ /* *
155
+ * @brief Control law requires proper orientations, not all planners provide them
156
+ * @param path Path to add orientations into, if required
157
+ */
158
+ void validateOrientations (std::vector<geometry_msgs::msg::PoseStamped> & path);
159
+
156
160
std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
157
161
std::string plugin_name_;
158
162
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros_;
@@ -164,6 +168,9 @@ class GracefulController : public nav2_core::Controller
164
168
double goal_dist_tolerance_;
165
169
bool goal_reached_;
166
170
171
+ // True from the time a new path arrives until we have completed an initial rotation
172
+ bool do_initial_rotation_;
173
+
167
174
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<nav_msgs::msg::Path>> transformed_plan_pub_;
168
175
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<nav_msgs::msg::Path>> local_plan_pub_;
169
176
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<geometry_msgs::msg::PointStamped>>
0 commit comments