Hi all,
I am a beginner to ros2 humble and moveit2 and navigating myself into getting more experienced with the moveit2 framework. I am currently working on path planning using UR10e robot arm.
I am using
ROS_DISTRO: HUMBLE
UBUNTU: 22.04
Moveit2: built from source
I used the moveit2 C++ APIs to execute my path planning sequence. Upon receiving a signal from an external source, I am able to start and finish my path planning and achieve desirable results.
I am using the “scaled_joint_trajectory_controller” provided by UR which is similar to the “joint_trajectory_controller” and is of the same type “FollowJointTrajectory”.
My current objective is to immediately stop active trajectory execution in moveit2 using moveit2’s C++ APIs and prevent any upcoming trajectory execution upon receiving a signal from this external source. The desired outcome is that until this signal is released, move_group will not execute any trajectories and halt any active trajectory execution.
I tried the below strategies
- using asyncExecute() in one thread and using move_group->stop() in another thread to halt the trajectory.
- using “ros2 service call” to stop controllers.
- having a separate ros2 action client node that sends a zero velocity trajectory to the action server “scaled_joint_trajectory_controller/follow_joint_trajectory”.
Observed outcomes for the above strategies
- The move_group->stop() function is not being called at the right time. It’s only being called after the asyncExecute() function completes its execution. Which provides no value at all even though both the functions are run in separate threads.
- Using this approach, I was able to abruptly stop my active trajectory execution, but I was not able to regain control over my controllers, even though I deactivate and then reactivate my controllers. I got this error message from ros2_control_node stating that “goal_handle attempted invalid transition from state EXECUTING with event CANCELED”.
- This approach gave me chaotic results as I had trajectories from path planning node conflicting with trajectories from this action client node. So, I am forced to drop this strategy.
I am really curious on stopping an active trajectory execution in moveit2 and kindly request your support and this community’s support for my learning. I hope I had provided as much information to the best of my abilities and please let me know if you require any further information.
I hope this is solvable and I look forward to an engaging discussion.