Robotics StackExchange | Archived questions

arduino_rosserial sending data problem

i m working on robot arm , i want to send data from Arduino mega to ROS i m using a service server in Arduino and client to receive data in ROS . the problem when i send

res.res[0] = 0;
res.res[1] = 0;
res.res[2] = 0;

all works fine but if i send

res.res[0] = 0;
res.res[1] = 0;
res.res[2] = 0;
res.res[3] = 0;
res.res[4] = 0;
res.res[5]=0;
res.res[6]=0;

there is a problem as shown below :

[INFO] [1566974863.089982]: ROS Serial Python Node
[INFO] [1566974863.098233]: Connecting to /dev/ttyUSB0 at 57600 baud
[INFO] [1566974865.330754]: Note: publish buffer size is 1024 bytes
[INFO] [1566974865.333614]: Setup service server on /read_joint_state [robot/Floats_array]
[INFO] [1566974865.348716]: Note: subscribe buffer size is 1024 bytes
[WARN] [1566974870.492402]: Serial Port read returned short (expected 2 bytes, received 1 instead).
[WARN] [1566974870.493324]: Serial Port read failure:

Asked by houssem trabelsi on 2019-08-29 06:49:56 UTC

Comments

It is difficult to help you with these information. Could you provide a bit more like the type of res? Maybe res has a size smaller than 7 and the firmware crash?

Asked by rreignier on 2019-09-13 01:56:44 UTC

i found the error in fact its something like you said its about arrays size

Asked by houssem trabelsi on 2020-01-20 13:56:10 UTC

You should add an answer to your question and mark it as answered.

Asked by rreignier on 2020-08-28 02:58:11 UTC

Answers