By using ROS Humble, Moveit2, and ros2_control, I am trying to accomplish manipulation tasks with the CRX-10iA/L Fanuc robot. Currently, I am implementing ros2_control hardware_interface part. Inside the default write function I am sending motion commands to robot.

I have two motion command options from the provided robot interface. One of them should be sent except the last write command and the other one must be sent lastly. Otherwise, communication can't go further.

I was wondering whether I can access to the total number of write commands that will be sent by hardware_interface? Then I can set a simple if-else logic.

I thought about accessing total number of joint trajectory commands but I realized that when moveit generated a joint trajectory point with 22 positions, write() function was called 5 times in hardware_interface. Less than ideal as expected due to real hardware constraints.

Any suggestion is appreciated. Thank you for your time.


1 Answer 1


the write() method will be called with the update rate of your controller manager, if you need a different rate we added some docs here. Which sampling time has your joint_trajectory, and which one the controller_manager? It sounds strange that it would be called 5 times only.

You cannot access the trajectory from your hardware_component, because the joint_trajectory_controller is sampling the trajectory at the current time instance and sends only the current command to the hardware component.

I'm not sure if I understand your problem right, but you simply can add a buffer to save the old commands for the next call to write()?

  • $\begingroup$ Sorry for my late response, I have been trying to fix the issue by considering your answer. The first problem was the wrong structured communication between the robot and laptop. Even though the write() function was called with the default update rate, I was printing the commands which I could send to the robot not the one write() function generates. And due to communication waiting time I was able to send only 5 messages but I thought that write function is called only 5 times.. Second one which is understanding the last command, buffer method worked! Two problems are solved. Thank you!! $\endgroup$ Mar 12 at 10:15
  • $\begingroup$ Glad I could help. Please mark the answer as solving the question (the tick mark next to it). $\endgroup$ Mar 12 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.