0
$\begingroup$

Rosanswers logo

Hello everyone,

I'm using an Arduino Mega 2560 (with Adafruit Motor Shield on it) and I'm trying to transfer data from it to a Rasperry Pi 3B using rosserial. However I have an error in communication when using the "Hello World" example that appears only with the RPi3 and not with my main computer.

When using rosserial from my main computer everything is working well:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=57600
[INFO] [WallTime: 1535317376.974559] ROS Serial Python Node
[INFO] [WallTime: 1535317376.977290] Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [WallTime: 1535317380.120512] Note: publish buffer size is 512 bytes
[INFO] [WallTime: 1535317380.120794] Setup publisher on chatter [std_msgs/String]

When running the same code from the RPi3 I got this error:

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=56700
[INFO] [1535317489.629288]: ROS Serial Python Node
[INFO] [1535317489.650718]: Connecting to /dev/ttyACM0 at 56700 baud
[INFO] [1535317491.929815]: wrong checksum for msg length, length -2296
[INFO] [1535317491.931260]: chk is 10
[ERROR] [1535317491.934192]: Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [1535317491.935558]: Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+)
[INFO] [1535317492.933539]: wrong checksum for msg length, length 16
[INFO] [1535317492.934947]: chk is 175
[INFO] [1535317493.933598]: wrong checksum for msg length, length -4348
[INFO] [1535317493.936049]: chk is 125
[INFO] [1535317494.935642]: wrong checksum for msg length, length 16
[INFO] [1535317494.938213]: chk is 175
[ERROR] [1535317494.946257]: Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [1535317494.948985]: Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+)
[INFO] [1535317495.936054]: wrong checksum for msg length, length -4348
[INFO] [1535317495.938623]: chk is 125
[ERROR] [1535317496.935010]: Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [1535317496.937569]: Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+)
[INFO] [1535317497.934976]: wrong checksum for msg length, length -4348
[INFO] [1535317497.937484]: chk is 125
[INFO] [1535317498.934526]: wrong checksum for msg length, length 16
[INFO] [1535317498.936874]: chk is 175
[INFO] [1535317499.938173]: wrong checksum for msg length, length -4336
[INFO] [1535317499.940590]: chk is 125
[INFO] [1535317500.937859]: wrong checksum for msg length, length -4336
[INFO] [1535317500.940557]: chk is 125

Seems to be a version related issue but I checked and the rosserial arduino library is up to date in the arduino (0.7.9). Maybe it's from the version difference between the computer and the RPi3 but I don't know what I can do about it.

Computer characteristics:

  • Ubuntu 14.04.5 LTS
  • ROS distro: indigo
  • ROS version: 1.11.21
  • rosserial_python version: 0.6.4

Raspberry Pi 3B characteristics:

  • Ubuntu 16.04.2 LTS
  • ROS distro: kinetic
  • ROS version: 1.12.13
  • rosserial_python version: 0.7.7

FYI, the "HelloWorld" code in the arduino is the following:

/*
 * rosserial Publisher Example
 * Prints "hello world!"
 */

#include <ros.h>
#include <std_msgs/String.h>
ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()
{
  nh.initNode();
  nh.advertise(chatter);
}

void loop()
{
  str_msg.data = hello;
  chatter.publish( &str_msg );
  nh.spinOnce();
  delay(1000);
}

Any help would be appreciated!


Originally posted by Binson on ROS Answers with karma: 13 on 2018-08-26

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You are using the wrong baud rate on your RPi, it should be 57600 instead of 56700.


Originally posted by pcoenen with karma: 249 on 2018-08-27

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Binson on 2018-08-27:
Indeed... I feel so stupid now, I will check it later and close the question if it works.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.