Unable to subscribe to string topic using rosserial arduino nano
I am working with arduino nano to subscribe to a topic which reads keystrokes(Raspberry pi ubuntu mate melodic) and publishes into onto the topic.I am trying subscribe to the topic on an arduino which then prints the value onto the serial monitor. The output on the serial monitor is not consistent its printing random values onto to screen. The terminal is also showing a few errors which I am not able to decipher.
This is my code
#include <ros.h>
#include <std_msgs/String.h>
ros::NodeHandle_<ArduinoHardware, 2, 2, 125, 125> nh;
void comCallback( const std_msgs::String& command)
{
if (command.data == "q")
{
Serial.println(command.data);
}
}
ros::Subscriber<std_msgs::String> sub("/ignis/move", comCallback);
void setup(){
nh.initNode();
nh.subscribe(sub);
}
void loop(){
nh.spinOnce();
delay(10);
}
These are the errors that popup on the terminal for rosrun rosserial_python serial_node.py
[WARN] [1550492941.390503]: Serial Port read failure: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
[INFO] [1550492941.498101]: wrong checksum for msg length, length 76
[INFO] [1550492941.502178]: chk is 1
[WARN] [1550492942.992464]: Serial Port read failure: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
[ERROR] [1550492943.095225]: Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial clien