-
Notifications
You must be signed in to change notification settings - Fork 366
Add motion_primitives_forward_controller
for interfacing motion primitive messages with hardware interfaces
#1636
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
base: master
Are you sure you want to change the base?
Conversation
…time --> added gitignore, to not push it to github --> remove it after everything is done
… the hardware interface can receive a new motion primitive — replaces the previous, more complex handling via execution_status
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.
There is a lot of stuff coming from templates in this PR and you either used some AI tool for coding or you are very good at writing AI-style comments.
Please try removing all commented code or fix them and remove all comments that add nothing to the code itself (which in this code is almost all comments...)
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_EXPORT __attribute__((dllexport)) | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_IMPORT __attribute__((dllimport)) | ||
#else | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_EXPORT __declspec(dllexport) | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_IMPORT __declspec(dllimport) | ||
#endif | ||
#ifdef MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_BUILDING_DLL | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_EXPORT | ||
#else | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_IMPORT | ||
#endif | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC_TYPE MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_LOCAL | ||
#else | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_EXPORT __attribute__((visibility("default"))) | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_IMPORT | ||
#if __GNUC__ >= 4 | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC __attribute__((visibility("default"))) | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_LOCAL __attribute__((visibility("hidden"))) | ||
#else | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_LOCAL | ||
#endif | ||
#define MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_PUBLIC_TYPE | ||
#endif |
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.
we don't do this sort of stuff anymore, please take a look at how other controllers do it
<description>Package to control robots using motion primitives like PTP, LIN and CIRC</description> | ||
<maintainer email="[email protected]">todo</maintainer> | ||
<author>Mathias Fuhrer</author> | ||
<license>BSD-3-Clause</license> |
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.
It would be ideal to update this license to Apache 2 if possible.
@@ -0,0 +1,6 @@ | |||
repositories: |
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.
these repos files are not needed
<version>0.0.0</version> | ||
<description>Package to control robots using motion primitives like PTP, LIN and CIRC</description> | ||
<maintainer email="[email protected]">todo</maintainer> | ||
<author>Mathias Fuhrer</author> |
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.
email for you could be defined, the release version could be updated to match the rest of the repo and please copy the maintainer fields from other controllers in t his repo
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<build_depend>generate_parameter_library</build_depend> | ||
|
||
<depend>control_msgs</depend> | ||
|
||
<depend>controller_interface</depend> | ||
|
||
<depend>hardware_interface</depend> | ||
|
||
<depend>pluginlib</depend> | ||
|
||
<depend>industrial_robot_motion_interfaces</depend> | ||
|
||
<depend>rclcpp</depend> | ||
|
||
<depend>rclcpp_lifecycle</depend> | ||
|
||
<depend>realtime_tools</depend> | ||
|
||
<depend>std_srvs</depend> | ||
|
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.
that's a lot of whitespace that could be removed ;)
// int main(int argc, char ** argv) | ||
// { | ||
// ::testing::InitGoogleTest(&argc, argv); | ||
// rclcpp::init(argc, argv); | ||
// int result = RUN_ALL_TESTS(); | ||
// rclcpp::shutdown(); | ||
// return result; | ||
// } |
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.
2 problems:
- it's all commented out :D
- it's always better to use gmock, not gtest. You get much better prints.
.gitignore
Outdated
@@ -0,0 +1 @@ | |||
**/COLCON_IGNORE |
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'm afraid it won't be this PR pioneering on the .gitignore file ;) please keep this to your local workspace
# install( | ||
# DIRECTORY include/ | ||
# DESTINATION include/${PROJECT_NAME} | ||
# ) |
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.
boop
|
||
|
||
1. **Command Reception** | ||
Python scripts can publish motion primitives to the `~/reference` topic. These messages are received by the `reference_callback()` method in the controller. |
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.
Do they have to be Python scripts? CLI, C++ or Rust are disqualified? ;)
// callback for topic interface | ||
MOTION_PRIMITIVES_CONTTROLLER_PKG__VISIBILITY_LOCAL | ||
void reference_callback(const std::shared_ptr<ControllerReferenceMsg> msg); // callback for reference message | ||
// std::atomic<bool> new_msg_available_ = false; // flag to indicate if new message is available |
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.
boop
…ls according to other controllers in the repo
This PR adds the
motion_primitives_forward_controller
, a controller for forwarding motion primitive commands to motion-primitive-capable hardware interfaces.It was developed alongside the
motion_primitive_ur_driver
and is intended to support future hardware interfaces for additional robot manufacturers.The corresponding PR for integrating the
motion_primitive_ur_driver
into the official Universal Robots ROS 2 driver can be found here: UniversalRobots/Universal_Robots_ROS2_Driver#1341.The controller subscribes to
MotionPrimitive.msg
from theindustrial_robot_motion_interfaces
package. TheMotionPrimitive.msg
has been extended with additional helper types:STOP_MOTION
: Immediately interrupts execution and clears all queued primitives.MOTION_SEQUENCE_START
andMOTION_SEQUENCE_END
: Define a sequence of primitives to be executed as a blended motion block.The controller uses the following interfaces:
Command Interfaces
motion_type
: Type of motion primitive (e.g., LINEAR_JOINT, LINEAR_CARTESIAN, CIRCULAR_CARTESIAN, etc.)q1
–q6
: Target joint positions for joint-based motionpos_x
,pos_y
,pos_z
: Target Cartesian positionpos_qx
,pos_qy
,pos_qz
,pos_qw
: Orientation quaternion of the target posepos_via_x
,pos_via_y
,pos_via_z
: Intermediate via-point position for circular motionpos_via_qx
,pos_via_qy
,pos_via_qz
,pos_via_qw
: Orientation quaternion of via-pointblend_radius
: Blending radius for smooth transitionsvelocity
: Desired motion velocityacceleration
: Desired motion accelerationmove_time
: Optional duration for time-based executionState Interfaces
execution_status
: Indicates the current execution state of the primitive.ready_for_new_primitive
: Boolean flag indicating whether the interface is ready to receive a new motion primitiveI'd appreciate any feedback or suggestions – thanks in advance!