Ask Your Question

Bukmop's profile - activity

2019-05-20 02:06:15 -0500 marked best answer Rosserial examples for arduino

Hello

I had problems with the rosserial communication from, the Host (PC,Ubuntu Xenial, ROS Kinetic) to the Device (Arduino Leonardo). The code (HW Input/Output) in the Arduino worked but it did not published or subscribed any topic.

Introduction: Load Rosserial Hello World Example in Arduino:

/*
 * rosserial Publisher Example
 * Prints "hello world!"
 */
//#define USE_USBCON        //<--this is new

#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);
}

Start roscore

roscore

and start the rosserial communication:

rosrun rosserial_python serial_node.py _port:=/dev/tACM0

After this I had two cases. First: without any error output

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0
[INFO] [1497606946.599728]: ROS Serial Python Node
[INFO] [1497606946.612089]: Connecting to /dev/ttyACM0 at 57600 baud

here I thought the communication works well, I had a rosnode but no topics

    rosnode list 
    /rosout
    /serial_node
    rostopic list 
    /diagnostics
    /rosout
    /rosout_agg

Second: with error

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0
[INFO] [1497607058.864885]: ROS Serial Python Node
[INFO] [1497607058.876586]: Connecting to /dev/ttyACM0 at 57600 baud
[ERROR] [1497607075.987434]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

the nodes and topics where the same.

Then I searched for three days for a solution and found this page: http://answers.ros.org/question/16419...

The solution for me was the USE_USBCON definition.

/*
 * rosserial Publisher Example
 * Prints "hello world!"
 */
#define USE_USBCON        //<--this is new

#include <ros.h>
#include <std_msgs/String.h>

after that I had the desired topic and was able to echo it.

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0
[INFO] [1497607701.288109]: ROS Serial Python Node
[INFO] [1497607701.298771]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1497607704.031868]: Note: publish buffer size is 512 bytes
[INFO] [1497607704.033017]: Setup publisher on chatter [std_msgs/String]


rosnode list 
/rosout
/serial_node
rostopic list 
/chatter
/diagnostics
/rosout
/rosout_agg
rostopic echo /chatter
data: hello world!
---
data: hello world!
---

Conclusion: For me the problem lies in the rosserial examples which are not up to date and the error messages.

So I have two questions: Is my conclusion right? And where or whom do I have to write for the updating of the tutorials and editing the error messages?

Best regards Bukmop

2017-10-10 09:26:01 -0500 received badge  Enthusiast
2017-10-04 05:30:57 -0500 commented question joint_states not been published

I guess you have more code in your launch file than this, because the node has no start at the first example. In the sec

2017-09-30 18:19:01 -0500 received badge  Famous Question (source)
2017-08-21 13:40:08 -0500 received badge  Notable Question (source)
2017-06-16 18:14:14 -0500 received badge  Popular Question (source)
2017-06-16 08:03:47 -0500 edited question Rosserial examples for arduino

Rosserial examples for arduino Hello I had problems with the rosserial communication from, the Host (PC,Ubuntu Xenial,

2017-06-16 06:00:24 -0500 asked a question Rosserial examples for arduino

Rosserial examples for arduino Hello I had problems with the rosserial communication from, the Host (PC,Ubuntu Xenial,