-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Servo] Refactoring servo #2224
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2224 +/- ##
==========================================
+ Coverage 50.50% 50.68% +0.18%
==========================================
Files 386 386
Lines 31736 31912 +176
==========================================
+ Hits 16026 16172 +146
- Misses 15710 15740 +30
☔ View full report in Codecov by Sentry. |
56fe805
to
da306b6
Compare
099607b
to
e46b036
Compare
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
943191d
to
045f6f7
Compare
48734de
to
8fb94f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a first pass through!
moveit_ros/moveit_servo/include/moveit_servo/collision_monitor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
moveit_ros/moveit_servo/include/moveit_servo/command_processor.hpp
Outdated
Show resolved
Hide resolved
8d6de23
to
30142bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests looking nice! Took another look and have a few suggestions.
I guess one of my biggest questions on the tests is... given that we took care to make a standalone C++ API, is there no way to write unit tests that do not require standing up a ROS node? Like, see here for example for a way to get a robot model: https://github.com/PickNikRobotics/pick_ik/blob/main/tests/robot_tests.cpp#L97C1-L100
Not sure how one would load an IK plugin in the similar way. Maybe something like this? https://github.com/ros-planning/moveit2/blob/main/moveit_kinematics/test/test_kinematics_plugin.cpp#LL187C53-L187C53
moveit_ros/moveit_servo/tests/config/panda_simulated_config.yaml
Outdated
Show resolved
Hide resolved
The tests for the |
Looking at the most recent commit (24f907 Fix twist frame conversion), I have some questions.
^ I believe this only works if EE frame == command frame == ik_solver_->getTipFrame(). Are we OK with that? Can you think of any unusual use cases where that wouldn't work? I can think of one. Before, we talked about the case where somebody is using a VR hand controller to move the robot, like this video. If we go with this approach, the user would be necessary for transforming the twist before they publish it to Servo. Otherwise, it won't be correct. I guess that's OK, it just requires extra work from the user. I'd suggest searching the Servo codebase for "command frame" and "ee frame" --> replace with "ik tip frame" It will be confusing to have 3 different names for the same frame. |
moveit_ros/moveit_servo/tests/config/panda_simulated_config.yaml
Outdated
Show resolved
Hide resolved
Can you add a test where a twist command has the wrong frame and it gets rejected by Servo? |
Have added the rejection test for both twist and pose. |
7c66202
to
b60d078
Compare
ec6249a
to
78f5c43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again with MoveIt Studio.
Things worked in mock hardware, except that after the stale command timeout occurs, the controller never stops publishing. It now sustains the rate even after you stop commanding the robot for a long time. The idea is the controller should sustain its rate until the incoming_command_timeout
is reached, and then stop.
For a robot with perfect sensors, this is fine, but eventually the controller must stop publishing-- take, for example, Gazebo:
2023-08-03.17-25-16.mp4
Also, seems one of the unit tests for invalid vector is actually segfaulting?
@@ -46,6 +46,7 @@ namespace | |||
{ | |||
const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_servo.servo"); | |||
constexpr double ROBOT_STATE_WAIT_TIME = 5.0; // seconds | |||
constexpr double STOPPED_VELOCITY_EPS = 1e-4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be a parameter (we found issues with that on Kinova robots), but definitely not for this PR!
Have to check what is happening in the CI, only the "leaving singularity" test fails for me locally, no segfaults. |
eaba892
to
f4fe2b0
Compare
8451b20
to
061fb69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! My last tests with MoveIt Studio before the test/clang updates confirmed that all the functionality we expected to be in this refactor is all set.
I'll approve the moveit_msgs
PR and left some very small things here.
|
||
## Stopping behaviour | ||
incoming_command_timeout: 0.1 # Stop servoing if X seconds elapse without a new command | ||
ee_frame: panda_link8 # The name of the end effector link, used to return the EE pose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not sure why we had to change from panda_hand
to panda_link8
-- what was this again?
Weird that just adding a comment broke clang-tidy again... maybe move the comment above the EDIT: Oh I see because the inline comment made it wrap into 2 lines. Went ahead and fixed it. |
Not sure if we need these https://github.com/ibrahiminfinite/moveit2/blob/eda31330572e27faf1e1cb4366cda3e6de843f7c/moveit_ros/moveit_servo/src/servo_node.cpp#L226 |
Sure, feel free to get rid of it -- or put it as a DEBUG? How about just publishing it while halting, but not after it's stopped? |
Description
This is an effort supported by GSoC 2023 to refactor the MoveIt Servo package to improve its usability and performance.
The primary focus is on implementing clearly seperated and performant C++ and ROS APIs to interact with Servo.
An effort has also been made to make the logic more readable.
The moveit_msgs PR moveit/moveit_msgs#161 must be merged before this can go in.
Please feel free to test it out and provide your feedback.
JontJog: Video, Code
Twist: Video, Code
Pose: Video, Code
Using the ROS APIs
To run the demo:
NOTE : The moveit_msgs package should be updated to https://github.com/ibrahiminfinite/moveit_msgs/tree/new_servo
Once the demo is running, the jointjog and twist inputs can be tried out using
demos/servo_keyboard_input.cpp
by running.The servo loop runs automatically on Servo instance creation.
Servo can be paused/ unpaused using the bool type service
/servo_node/pause_servo
.There is no notion of start/stop in the current implementation.
Before sending any commands, you should set the command type for servo using the
/servo_node/switch_command_type
service.0 - JointJog
1 - Twist
2 - Pose
So if you want to send pose command
And then you can send the specific type of commands to their respective topics:
Timings for C++ API calls:
JointJog ~ 100 us
Twist ~ 350 us
Pose ~ 350 us
TODO :