arduino_rosserial sending data problem

asked 2019-08-29 06:49:56 -0500

houssem trabelsi gravatar image

updated 2019-08-29 09:32:04 -0500

jayess gravatar image

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:
edit retag flag offensive close merge delete

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?

rreignier gravatar image rreignier  ( 2019-09-13 01:56:44 -0500 )edit

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

houssem trabelsi gravatar image houssem trabelsi  ( 2020-01-20 12:56:10 -0500 )edit

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

rreignier gravatar image rreignier  ( 2020-08-28 02:58:11 -0500 )edit