NiryoRobotics / ned_ros

Ned ros stack
https://niryo.com
GNU General Public License v3.0
28 stars 16 forks source link

Error on second move command on modbus #10

Closed djeepy1 closed 10 months ago

djeepy1 commented 2 years ago

In the modbus sample (move_command), I got an error on second move command. The first one works.

Required argument is not an integer
  File "C:\CodeRoot\GitHub\ned_ros\niryo_robot_modbus\examples\client_move_command.py", line 58, in <module>
    client.write_registers(0, joints_to_send)

Error comes from Pymodbus during encoding and I cannot understand what's going wrong.

File "C:\Users\....\pymodbus\register_write_message.py", line 164, in encode
    packet += struct.pack('>H', value)

Any idea ?

jmottier-niryo commented 11 months ago

Hello, sorry for the late reply. As modbus doesn't support floats in its registers, you have to send integers in the write_registers function. That's why we're using mrads instead of rad in order to not loose to much precision. See https://docs.niryo.com/dev/ros/v4.1.1/en/source/modbus/api_documentation.html