dynamixel-community / dynamixel_hardware

ros2_control packages for ROBOTIS Dynamixel
Apache License 2.0
109 stars 47 forks source link

`[TxRxResult] Port is in use!` error working with XC330-M288T on ROS2 Humble #88

Open soham2560 opened 1 month ago

soham2560 commented 1 month ago

System Info

I am encountering the following errors in my log

[INFO] [launch]: All log files can be found below /home/container_user/.ros/log/2024-05-11-14-00-18-474799-E14-7727
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ros2_control_node-1]: process started with pid [7736]
[INFO] [robot_state_publisher-2]: process started with pid [7738]
[INFO] [spawner-3]: process started with pid [7740]
[ros2_control_node-1] [INFO] [1715416218.928573690] [robot.controller_manager]: Subscribing to '~/robot_description' topic for robot description file.
[ros2_control_node-1] [INFO] [1715416218.929964564] [robot.controller_manager]: update rate is 200 Hz
[ros2_control_node-1] [INFO] [1715416218.930277923] [robot.controller_manager]: RT kernel is recommended for better performance
[robot_state_publisher-2] [INFO] [1715416218.978141700] [robot.robot_state_publisher]: got segment wheel_link
[robot_state_publisher-2] [INFO] [1715416218.978346253] [robot.robot_state_publisher]: got segment world
[ros2_control_node-1] [INFO] [1715416219.144636252] [robot.controller_manager]: Received robot description file.
[ros2_control_node-1] [INFO] [1715416219.146690928] [resource_manager]: Loading hardware 'Wheel' 
[ros2_control_node-1] [INFO] [1715416219.148623249] [resource_manager]: Initialize hardware 'Wheel' 
[ros2_control_node-1] [INFO] [1715416219.149287259] [DynamixelHardware]: joint_id 0: 101
[ros2_control_node-1] [INFO] [1715416219.149321060] [DynamixelHardware]: usb_port: /dev/ttyUSB0
[ros2_control_node-1] [INFO] [1715416219.149333352] [DynamixelHardware]: baud_rate: 57600
[ros2_control_node-1] [INFO] [1715416219.213230954] [DynamixelHardware]: Position control
[ros2_control_node-1] [INFO] [1715416219.229221121] [DynamixelHardware]: Torque enabled
[ros2_control_node-1] [INFO] [1715416219.229490831] [resource_manager]: Successful initialization of hardware 'Wheel'
[ros2_control_node-1] [INFO] [1715416219.229742245] [resource_manager]: 'configure' hardware 'Wheel' 
[ros2_control_node-1] [INFO] [1715416219.236202030] [resource_manager]: Successful 'configure' of hardware 'Wheel'
[ros2_control_node-1] [INFO] [1715416219.236272636] [resource_manager]: 'activate' hardware 'Wheel' 
[ros2_control_node-1] [ERROR] [1715416219.240448750] [DynamixelHardware]: [TxRxResult] Port is in use!
[ros2_control_node-1] [ERROR] [1715416219.240558395] [DynamixelHardware]: groupSyncRead getdata failed
[ros2_control_node-1] [ERROR] [1715416219.240573689] [DynamixelHardware]: groupSyncRead getdata failed
[ros2_control_node-1] [ERROR] [1715416219.240585910] [DynamixelHardware]: groupSyncRead getdata failed
[ros2_control_node-1] [ERROR] [1715416219.240726423] [DynamixelHardware]: [TxRxResult] Port is in use!
[ros2_control_node-1] [ERROR] [1715416219.245845826] [DynamixelHardware]: groupSyncWrite addparam failed

I am however able to control the motor using Dynamixel Wizard 2.0

soham2560 commented 1 month ago

I seem to have solved this issue, it was a combination of below

I believe one of the reasons for this is that the read and write functions are called once init fucntion is done, if we can delay till after on activate function, this problems go away at 200hz+ on my system, will put a pr for the same