ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
523 stars 527 forks source link

Error in rosserial_python/SerialClient.py, Exception in thread Thread-6 #571

Open SantiagoCanete opened 3 years ago

SantiagoCanete commented 3 years ago

I am running a rosserial node on an Arduino, I am using ROS Noetic. I initialize the node using the following:

    <launch>
      <node pkg="rosserial_python" type="serial_node.py" name="motor_control" output="screen">
      <param name="~port" value="/dev/ttyACM0" />
      <param name="~baud" value="57600" />
      </node>
    </launch>

The connection is established as shown below:

process[motor_control-1]: started with pid [5063]
[INFO] [1632597275.309702]: ROS Serial Python Node
[INFO] [1632597275.358828]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1632597277.494118]: Requesting topics...
[INFO] [1632597277.839086]: Note: subscribe buffer size is 280 bytes
[INFO] [1632597277.847758]: Setup subscriber on velocity_command [geometry_msgs/Twist]

I publish the msg from the command line:

rostopic pub /velocity_command geometry_msgs/Twist  "{linear:  {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0, z: 0.0}}"

but when I publish a command to the topic that the node subscribes to I get the following error:

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 778, in processWriteQueue
    self._send(topic, msg)
  File "/home/ubuntu/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 758, in _send
    topic_bytes = struct.pack('<h', topic)
struct.error: short format requires (-0x7fff - 1) <= number <= 0x7fff
[INFO] [1632597808.464485]: Sending tx stop request

This error seems a bit cryptic and I am not quite sure how to tackle it. Any ideas what it may be due to?

C-Crowd-Control-C commented 1 year ago

I have the same issue. Didn't find anything on the internet to fix this. Some people suggested to update python but it didn't help. Did you get it fixed?