Open geppetto32 opened 1 week ago
Hi geppetto32
Thank you for bringing up this issue. When I initially developed the software, I only had access to one CyberGear, so I couldn't test it with multiple motors. Now that I have access to multiple CyberGears, I will work on testing and provide a solution for running multiple motors simultaneously.
Once we find a solution to the problem, we will share it here.
Thats Great Naoki , we are waiting for you :) .
We have confirmed that it is possible to control multiple CyberGear servo motors. Below is the procedure for doing so:
Start a node for each motor you want to control.
terminal 1
ros2 run cybergear_socketcan_driver cybergear_position_driver_node --ros-args -p device_id:=127 -p joint_name:=cybergear_1 -r __node:=cybergear_1
terminal 2
ros2 run cybergear_socketcan_driver cybergear_position_driver_node --ros-args -p device_id:=126 -p joint_name:=cybergear_2 -r __node:=cybergear_2
Enable torque on the CyberGear servo motors.
ros2 service call /cybergear_1/enable_torque std_srvs/srv/SetBool "data: true"
ros2 service call /cybergear_2/enable_torque std_srvs/srv/SetBool "data: true"
Send control commands to each CyberGear.
ros2 topic pub /joint_trajectory trajectory_msgs/msg/JointTrajectory "{header: {stamp: now}, joint_names: [cybergear_1, cybergear_2], points: [{positions: [0.0, 0.0], time_from_start: {sec: 2}}, {positions: [0.5, -0.5], time_from_start: {sec: 4}}]}" --once
Please verify whether the CyberGear servo motors rotate correctly using the above procedure.
Thank you Naoki very much, i will test them later at evening. I have a consideration : if we attach a node to each cybergear we want to use ... isnt that going to use much more cpu usage? instead of using one node that controls every motor in an array-list of motors? Another valuble option would be by converting your work or adding a hardware interface for ros2 control.... e.g I am not that expert on programming and also i dont know if is ok writting here... if not ,i am sorry.
Thank you for raising this issue.
As you mentioned, starting multiple nodes will increase CPU usage. For instance, on a Raspberry Pi 5 running at 100 Hz, the CPU usage per node averages around 1.3%. The primary overhead comes from the topic transfer between nodes.
If this CPU usage is a concern, it can be mitigated by using the rclcpp_components
format, which we support.
Given these considerations, we chose to design the system with one node per motor to enable distributed processing. Specifically, we wanted to split the setup across two computers—one handling CAN as a ROS 2 topic, and the other focused on joint trajectory planning.
If ros2_control
's hardware_interface
is supported, more responsive control can be achieved. However, optimal performance would require an RT-kernel, and the choice of OS may introduce contractual limitations. We do plan to support ros2_control
in the future, though we don't have a confirmed timeline at this point.
Hello Naoki as i told before your code is the most advanced among others. My thing ... i tried to modify the cybergear_socketcan_driver_node.cpp to accept more motors but nothing seems to work ... so i reset everything and i am here now to ask if there is any simpler way to send msgs at diferent motors. I also tried to modify the node.parameters.md like this part of code below and send msg to each one seperatly but nothing happend. Thank you indeed.
cybergear_socketcan_driver_node: ros__parameters: anguler_effort: max: 12.0 min: -12.0 anguler_position: max: 12.56637061 min: -12.56637061 anguler_velocity: max: 30.0 min: -30.0 command_topic_type: trajectory
header: { stamp: {sec: 0, nanosec: 0}, frame_id: '' }, joint_names: ['cybergear_2'], points: [ { positions: [10.0], # Move to 0.5 radian (~28.6 degrees) time_from_start: {sec: 0.3, nanosec: 0} # Move to the position in 1 second } ] }" ...................................................................................................................................................................... saifer@saifer:~/ros2_ws$ ros2 topic pub /joint_trajectory trajectory_msgs/msg/JointTrajectory "{ header: { stamp: {sec: 0, nanosec: 0}, frame_id: '' }, joint_names: ['cybergear_1'], points: [ { positions: [10.0], # Move to 0.5 radian (~28.6 degrees) time_from_start: {sec: 0.3, nanosec: 0} # Move to the position in 1 second } ] }"