Feat/waypoint manager - #645
Conversation
Andeshog
left a comment
There was a problem hiding this comment.
Would be nice to see a four corner test (similar to what we did in easter testing) addition to the integration tests.
| std::bind(&WaypointManagerNode::handle_waypoint_goal, this, | ||
| std::placeholders::_1, std::placeholders::_2), | ||
| std::bind(&WaypointManagerNode::handle_waypoint_cancel, this, | ||
| std::placeholders::_1), | ||
| std::bind(&WaypointManagerNode::handle_waypoint_accepted, this, | ||
| std::placeholders::_1)); |
There was a problem hiding this comment.
Generally, consider using lambda instead of std::bind.
| bool persistent_action_mode_{false}; | ||
| bool priority_mode_{false}; | ||
|
|
||
| ReferenceFilterAction::Feedback latest_ref_feedback_; | ||
| bool have_reference_pose_{false}; | ||
| bool cancel_in_progress_{false}; |
There was a problem hiding this comment.
persistent_action_mode_active_
priority_mode_active_
has_reference_pose_
is_cancel_in_progress_
perhaps?
|
|
||
| std::uint64_t mission_id_ = 0; |
There was a problem hiding this comment.
Cant wait to see mission number 18,446,744,073,709,551,615 😂
|
|
||
| (void)goal_handle; // suppress unused variable warning |
There was a problem hiding this comment.
could also just do
rclcpp_action::CancelResponse WaypointManagerNode::handle_waypoint_cancel(
const std::shared_ptr<WaypointManagerGoalHandle> /*goal_handle*/)| Eigen::Vector6d fill_reference_goal(const geometry_msgs::msg::Pose& goal); | ||
|
|
There was a problem hiding this comment.
The function did not use the header, so no need to pass more than what is required
There was a problem hiding this comment.
vortex utils ros conversion here instead?
| case vortex_msgs::msg::Waypoint::FORWARD_HEADING: { | ||
| double dx = r_in(0) - x_(0); | ||
| double dy = r_in(1) - x_(1); | ||
|
|
||
| double forward_yaw = std::atan2(dy, dx); |
There was a problem hiding this comment.
2 things:
- No reason to use both heading and yaw in this block, choose one.
r_andx_are really poor names. Would be better off using something likereference_poseandcurrent_drone_state. Would not be bad to integrate some of the new structs in vortex utils either, but that is probably out of scope for this PR
There was a problem hiding this comment.
'out of scope for this PR' my favorite words
| case vortex_msgs::msg::Waypoint::ONLY_POSITION: | ||
| r_out(3) = x_(3); | ||
| r_out(4) = x_(4); | ||
| r_out(5) = x_(5); | ||
| break; |
There was a problem hiding this comment.
Why isn't logic like ONLY_POSITION and ONLY_ORIENTATION handled in the motion controller(s) instead? Also with this you risk locking the desired orientation in awkward ways, instead of just not controlling said DOFs. If the locking behavior (fixing the desired value of one or more DOF) is something that is desired, that could easily be handled in the controller(s) in the same logic segment
There was a problem hiding this comment.
I do think its fine that the wp manager/guidance controls which mode and so on, but the controller(s) should probably also know what mode it is performing
There was a problem hiding this comment.
The locking is desired for this use case.
There was a problem hiding this comment.
I agree that the mode logic could be handled in the controller, but this setup currently works as a MVP, and fits nicely within the scope of the action.
I feel the guidance and controller system could use a refactor with a "main orchestrator" or something, and this mode logic can be revamped then. The waypoint manager could potentially be incorporated into this "main orchestrator" and be extended to support LOS/velocity controller as well.
There was a problem hiding this comment.
locking the drone to a desired orientation could be something that the state machine requests and guidance system does i don't see the point of the (DP) controller differenciating between locking orientation and locking pose it is the same thing but simpler, albeit could be better tuned to some extent if we separate them.
The use case in this situation is more that we do not really want to change the position which would require the state machine to remember its last waypoint, recover the (x,y,z) coordinates and then send the same waypoint but with changed orientation which seemes tedious. Same goes for position only vice versa.
The thing that could be something to discuss is if we want the state machine to only communicate its desires with the orchistrator/manager node, otherwise we could make the state machine directly send requests to DP guidance about locking orientation.
There was a problem hiding this comment.
Possible to just let each dof be addressable (i.e. Eigen::Index, strongly typed) and let whatever thing thats managing task execution lock whatever axes as required? (could also alias "common" things like position only, orientation only, z only, etc, etc). That way you keep the controller "dumb" in the sense that it has no knowledge of "mode", just "which axes are currently constrained". (I don't know anything about the current dp code so correct me if this is already the case 🔥)
| tf2::Quaternion q; | ||
| q.setRPY(fb.reference.roll, fb.reference.pitch, fb.reference.yaw); | ||
|
|
||
| pose.orientation = tf2::toMsg(q); |
There was a problem hiding this comment.
seems to me this would make a nice vortex_utils function.
There was a problem hiding this comment.
| rclcpp_action::GoalResponse WaypointManagerNode::handle_waypoint_goal( | ||
| const rclcpp_action::GoalUUID&, | ||
| std::shared_ptr<const WaypointManager::Goal> goal) { |
There was a problem hiding this comment.
A better way of handling unused parameters:
rclcpp_action::GoalResponse WaypointManagerNode::handle_waypoint_goal(
const rclcpp_action::GoalUUID& /*goal_uuid*/,
std::shared_ptr<const WaypointManager::Goal> goal)| case vortex_msgs::msg::Waypoint::ONLY_POSITION: | ||
| r_out(3) = x_(3); | ||
| r_out(4) = x_(4); | ||
| r_out(5) = x_(5); | ||
| break; |
There was a problem hiding this comment.
locking the drone to a desired orientation could be something that the state machine requests and guidance system does i don't see the point of the (DP) controller differenciating between locking orientation and locking pose it is the same thing but simpler, albeit could be better tuned to some extent if we separate them.
The use case in this situation is more that we do not really want to change the position which would require the state machine to remember its last waypoint, recover the (x,y,z) coordinates and then send the same waypoint but with changed orientation which seemes tedious. Same goes for position only vice versa.
The thing that could be something to discuss is if we want the state machine to only communicate its desires with the orchistrator/manager node, otherwise we could make the state machine directly send requests to DP guidance about locking orientation.
| pose.position.x = x | ||
| pose.position.y = y | ||
| pose.position.z = z | ||
| half = yaw * 0.5 |
The nodetests/launch tests should not depend on stonefish? Those tests are only testing the ros part for a node. Integration/system tests can stay as they are (the bash scripts) IMO, from this comment. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #645 +/- ##
===========================================
+ Coverage 24.01% 35.63% +11.62%
===========================================
Files 38 38
Lines 2286 2256 -30
Branches 612 686 +74
===========================================
+ Hits 549 804 +255
+ Misses 1588 1273 -315
- Partials 149 179 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| const geometry_msgs::msg::Pose goal = | ||
| goal_handle->get_goal()->waypoint.pose; | ||
| uint8_t mode = goal_handle->get_goal()->waypoint.mode; | ||
| double convergence_threshold = | ||
| goal_handle->get_goal()->convergence_threshold; |
There was a problem hiding this comment.
I would try to use auto here, and elsewhere where it makes sense. It avoids visual clutter and potential accidental implicit conversions. However, do not use auto with Eigen types (eigen common pitfalls)
|
|
||
| if(BUILD_TESTING) |
* waypoint mode handling * update tests with new message * initial package setup * ros interface function declaration * node setup * working prototype * reentrant cb, multithreaded * single threaded impl * conv threshold action goal * default thresholdref conv value * removed switching logic * removed timer execution * sim test utils * waypoint_manager_test setup * no rendering test arg * waypoint tests, timeout error * test refactor * format * rename utils package * test suite and description * first waypoint test * removed unused function * renamed service field to priority. Added simple tests * waypoint manager readme * uniform attitude naming convention * fix pr requests * update tests with new service fields * four corner test * update util func name * update with new action def * removed failing build type * test dependencies * ignore failing yasmin package * remove __init__ files * quat_to_euler in make_pose helper * added __init__ file * removed sim deps for test packages * added action shutdown handling * removed waypoint manager set setup * added waypoint manager node tests * waypoint manager 4 corner sim test * added missing launch testing test dependency * add sleep for topic discovery * fix action member field name * removed unnecessary if here
* waypoint mode handling * update tests with new message * initial package setup * ros interface function declaration * node setup * working prototype * reentrant cb, multithreaded * single threaded impl * conv threshold action goal * default thresholdref conv value * removed switching logic * removed timer execution * sim test utils * waypoint_manager_test setup * no rendering test arg * waypoint tests, timeout error * test refactor * format * rename utils package * test suite and description * first waypoint test * removed unused function * renamed service field to priority. Added simple tests * waypoint manager readme * uniform attitude naming convention * fix pr requests * update tests with new service fields * four corner test * update util func name * update with new action def * removed failing build type * test dependencies * ignore failing yasmin package * remove __init__ files * quat_to_euler in make_pose helper * added __init__ file * removed sim deps for test packages * added action shutdown handling * removed waypoint manager set setup * added waypoint manager node tests * waypoint manager 4 corner sim test * added missing launch testing test dependency * add sleep for topic discovery * fix action member field name * removed unnecessary if here
|
🎉 This PR is included in version 2.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
vortexntnu/vortex-msgs#35
Added mode logic for waypoints in reference filter.
Added waypoint manager + some basic tests