ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

wrong checksum for topic id and msg

asked 2018-03-26 17:48:37 -0600

MiMo gravatar image

updated 2018-03-27 11:02:03 -0600

gvdhoorn gravatar image

Hello All, Would you please help me, I am trying to publish many topics using Teensy 3.6. I am running the comment below:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 __name:=node1 _baud:=115200

I get the error below:

[INFO] [WallTime: 1522103896.287668] ROS Serial Python Node
[INFO] [WallTime: 1522103896.295912] Connecting to /dev/ttyACM0 at 115200 baud
[INFO] [WallTime: 1522103898.568405] Note: publish buffer size is 512 bytes

[INFO] [WallTime: 1522103898.607305] Setup publisher on /Force [std_msgs/Float32].........
[INFO] [WallTime: 1522103898.612464] Note: subscribe buffer size is 512 bytes

[INFO] [WallTime: 1522103898.637525] Setup subscriber on /th_pac1 [std_msgs/Float32].........
[INFO] [WallTime: 1522103899.149705] wrong checksum for topic id and msg
[ERROR] [WallTime: 1522103899.722798] Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [WallTime: 1522103899.723073] Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+)
[INFO] [WallTime: 1522103900.296360] wrong checksum for topic id and msg
[INFO] [WallTime: 1522103901.439353] wrong checksum for topic id and msg
[INFO] [WallTime: 1522103902.013452] wrong checksum for topic id and msg

The Arduino Code is as follow:

#include <MovingAverage.h>
#include <ros.h>
#include <std_msgs/Float32.h>


//Declearing the Variables

int Valve1 = 8; int Valve2 = 9; int Valve3 = 10;
int Pump1 = 3; int Pump2 = 5; int Pump3 = 6; //PWM
int Buzz1 = 11; int Buzz2 = 12; int Buzz3 = 13; //PWM


float ff_Pdc; float ff_Pac1, lf_Pdc; float lf_Pac1, th_Pdc; float th_Pac1;

float v1, v2, v3,y,x1,x2, gram,z1, z2, z3,p1, p2, p3;

float  Press_Volt1,  Press_Volt2,  Press_Volt3;
float e1, e2, e3;
float psi1, psi2, psi3;
float Kpa1, Kpa2, Kpa3;
float Kpa1_Ave,  Kpa2_Ave,  Kpa3_Ave;

ros::NodeHandle nh;

//Publish Errors
std_msgs::Float32 Error1_msg;
ros::Publisher pub_Error1("/Error1", &Error1_msg);

std_msgs::Float32 Error2_msg;
ros::Publisher pub_Error2("/Error2", &Error2_msg);

std_msgs::Float32 Error3_msg;
ros::Publisher pub_Error3("/Error3", &Error3_msg);

// Pressure Sensor Float32 Msg
std_msgs::Float32 Pressure1_msg;
ros::Publisher pub_Pressure1("/Pressure1", &Pressure1_msg);

std_msgs::Float32 Pressure2_msg;
ros::Publisher pub_Pressure2("/Pressure2", &Pressure2_msg);

std_msgs::Float32 Pressure3_msg;
ros::Publisher pub_Pressure3("/Pressure3", &Pressure3_msg);

// Pdc_Ave Sensor Float32 Msg
std_msgs::Float32 ffPdcArd_msg;
ros::Publisher pub_ffPdcArd("/ffPdcArd", &ffPdcArd_msg);

std_msgs::Float32 lfPdcArd_msg;
ros::Publisher pub_lfPdcArd("/lfPdcArd", &lfPdcArd_msg);

std_msgs::Float32 thPdcArd_msg;
ros::Publisher pub_thPdcArd("/thPdcArd", &thPdcArd_msg);

//Publish Pump Volt
std_msgs::Float32 Force_msg;
ros::Publisher pub_Force("/Force", &Force_msg);

// LoadCell Float32 Msg
std_msgs::Float32 LoadCell_msg;
ros::Publisher pub_LoadCell("/LoadCell", &LoadCell_msg);


//callback function for our subscriber to read Baxter Gripper Position

std_msgs::Float32 ff_pdc_msg;

void callbackff( const std_msgs::Float32& ff_pdc_msg){

ff_Pdc = ff_pdc_msg.data;
}

std_msgs::Float32 ff_pac1_msg;

void callbackff1( const std_msgs::Float32& ff_pac1_msg){

ff_Pac1 = ff_pac1_msg.data;
}
//////////////////////////////////////////////////////
std_msgs::Float32 lf_pdc_msg;

void callbacklf( const std_msgs::Float32& lf_pdc_msg){

lf_Pdc = lf_pdc_msg.data;
}

std_msgs::Float32 lf_pac1_msg;

void callbacklf1( const std_msgs::Float32& lf_pac1_msg){

lf_Pac1 = lf_pac1_msg.data;
}

//////////////////////////////////////////////////////
std_msgs::Float32 th_pdc_msg;

void callbackth( const std_msgs::Float32& th_pdc_msg){

th_Pdc = th_pdc_msg.data;
}

std_msgs::Float32 th_pac1_msg;

void callbackth1( const std_msgs::Float32& th_pac1_msg){

th_Pac1 = th_pac1_msg.data;
}

ros::Subscriber<std_msgs::Float32> subff("/ff_pdc", &callbackff );

ros::Subscriber<std_msgs::Float32> subff1("/ff_pac1", &callbackff1 );

ros::Subscriber<std_msgs::Float32> sublf("/lf_pdc", &callbacklf );

ros::Subscriber<std_msgs::Float32> sublf1("/lf_pac1", &callbacklf1 );

ros::Subscriber<std_msgs::Float32> subth("/th_pdc", &callbackth );

ros ...
(more)
edit retag flag offensive close merge delete

Comments

1

Does the message type that you're supplying to your subscriber match that of your publisher? That's usually the message that I'll see if they don't match.

jayess gravatar image jayess  ( 2018-03-26 19:12:42 -0600 )edit

I am trying to publish many topics

this could be a buffer overrun situation. How many msgs and at what rate are you trying to publish exactly?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-27 02:42:57 -0600 )edit

jayess: the messages type (Floate32) are the same for both publishers and subscribers.

gvdhoom: I have one message for each publisher of type Floate32 since I have 11 publishers and 4 subscribers. I think it is not possible to specify the publishing rate in Arduino IDE please correct me.

MiMo gravatar image MiMo  ( 2018-03-27 09:54:17 -0600 )edit

Publication rate is determined by how often you call publish(..), which is typically inside your loop() function. Afaik you can influence how often that runs by using delay(..).

I have 11 publishers

do you really need 11 publishers? What sort of data are you publishing?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-27 10:40:37 -0600 )edit

Perhaps you can show us some pieces of code. How is your loop() structured, fi?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-27 10:41:48 -0600 )edit

I don't have any delay in my loop() function in this case what is my publishing rate? Yes I need all the topics and I am publishing pressure reading from pressure sensor all my data are of type Float32.

MiMo gravatar image MiMo  ( 2018-03-27 10:44:41 -0600 )edit
1

I don't have any delay in my loop() function in this case

then I would suggest you add one.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-27 10:45:52 -0600 )edit

p1 = analogRead(A0); e1 = (ff_Pdc - Kpa1_Ave); pub_Error1.publish( &Error1_msg); pub_Pressure1.publish( &Pressure1_msg); pub_ffPdcArd.publish( &ffPdcArd_msg); pub_LoadCell.publish( &LoadCell_msg);

I am subscribing to a topic from BioTac Sensor and I am controlling the pressure of soft actuator.

MiMo gravatar image MiMo  ( 2018-03-27 10:52:06 -0600 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2020-10-13 03:09:51 -0600

fjp gravatar image

I had the same info and errors showing up and like in the comments suggested, the solution was to add a delay(). In my case using delay(3) of 3 ms solved the issue.

Note also that the delay() won't block any interrupts (e.g using attachInterrupts) which is described in the notes of the arduino docs:

Certain things do go on while the delay() function is controlling the Atmega chip, however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values and pin states are maintained, and interrupts will work as they should.

edit flag offensive delete link more

Comments

This fixed a similar issue for me.

TrentonH1 gravatar image TrentonH1  ( 2020-12-09 17:10:05 -0600 )edit

delay() did help to solve the buffer overrun issue, another solution is to use millis() to create timer for publishing messages

JC Chia gravatar image JC Chia  ( 2022-03-01 21:44:01 -0600 )edit
0

answered 2022-09-07 07:13:15 -0600

My solution was a bit different. I was facing the same issue and the above mentioned delay handling did not resolve it. I was using 115200 baudrate with arduino mega and it was not working. While running rosserial_arduino, I used 57600 baudrate and the "Mismatched protocol version" message was resolved, but still the "checksum" message was present. Then I realised the topic my arduino was supposed to subscribe to was not published yet. I first started the publisher node, then the rosserial with 57600 baud rate. This time there was no error message and it was working fine.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-03-26 17:48:37 -0600

Seen: 6,822 times

Last updated: Oct 13 '20