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

Why would rosserial_python fail when it connect to arduino?

asked 2017-11-01 22:22:47 -0600

Liuche gravatar image

Hi! I running in 14.04 indigo, I need a hand to fix this problem :

I followed the tutorial of arduino in ros , try to create a publisher but it failed

$rosrun rosserial_python /dev/ttyACM0

[ERROR] [WallTime: 1509590980.692109] Creation of publisher failed: line: yaml osx unsupported pickle protocol: 4

I tried to use $rosdep update to fix but nothing happend

Arduino code is here:

#include <SPI.h>
#include <MFRC522.h>

#include <ros.h>
#include <std_msgs/String.h>
#include <std_msgs/Byte.h>
#include <std_msgs/Char.h>
#include <std_msgs/Int32.h>

ros::NodeHandle  nh;
std_msgs::String str_msg;
ros::Publisher chatter("RFID", &str_msg);
char hello[13] = "hello world!";
char RFID[32];


constexpr uint8_t RST_PIN = 9;     // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10;     // Configurable, see typical pin layout above

MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key; 

// Init array that will store new NUID 
byte nuidPICC[4];

void setup() 
  //////node setup///////

  SPI.begin(); // Init SPI bus
  rfid.PCD_Init(); // Init MFRC522 

  for (byte i = 0; i < 6; i++) {
    key.keyByte[i] = 0xFF;

void loop() 
  /////////ROS setup/////////
  // = RFID;
  //chatter.publish( &str_msg );

  // Look for new cards
  if ( ! rfid.PICC_IsNewCardPresent())

  // Verify if the NUID has been readed
  if ( ! rfid.PICC_ReadCardSerial())

  if (rfid.uid.uidByte[0] != nuidPICC[0] || 
    rfid.uid.uidByte[1] != nuidPICC[1] || 
    rfid.uid.uidByte[2] != nuidPICC[2] || 
    rfid.uid.uidByte[3] != nuidPICC[3] ) {

    nh.loginfo("A new card has been detected.");
    nh.loginfo("The NUID tag is:");

    sprintf(RFID,"%d %d %d %d",rfid.uid.uidByte[0],rfid.uid.uidByte[1],rfid.uid.uidByte[2],rfid.uid.uidByte[3]); = RFID;

    //show data
    chatter.publish( &str_msg );
    // Store NUID into nuidPICC array
    for (byte i = 0; i < 4; i++) {
      nuidPICC[i] = rfid.uid.uidByte[i];
  nh.loginfo("Card read previously.");   
  // Halt PICC
  // Stop encryption on PCD

And my launch file is here

  <node pkg="rosserial_python" type="" name="serial_node" output="screen">
    <param name="port" value="/dev/ttyACM0"/>
    <param name="baud" value="57600"/>

But I run these script on the other computer it's doesn't happened...

Can somebody help me?

edit retag flag offensive close merge delete


That's a very strange error message. Is there anything different between the computer where it works and where it doesn't work? Are they using different operating systems?

ahendrix gravatar image ahendrix  ( 2017-11-01 22:58:25 -0600 )edit

They are the same . Both 14.04 and also install rosserial package and arduino is 1.8.4

It's very strange. I can't find similar question on website.

But there is a important thing. It can be used before...

Liuche gravatar image Liuche  ( 2017-11-02 01:09:17 -0600 )edit

I solved the problem! I reinstalled the entire ROS system!

Liuche gravatar image Liuche  ( 2017-11-03 01:14:31 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-03 01:15:34 -0600

Liuche gravatar image

I solved the problem! I reinstalled the entire ROS system

Maybe I delete some file in ros? I don't know,but Finally I solved it

edit flag offensive delete link more

Question Tools



Asked: 2017-11-01 22:22:47 -0600

Seen: 385 times

Last updated: Nov 03 '17