0
$\begingroup$

Rosanswers logo

Hello everyone,

I'm new to ROS and I was trying to learn how to send a message from ROS to Arduino and the other way using rosserial. I am using ROS Kinetic with Ubuntu 16.04.4 .

Until now I could include ros_lib into the Arduino IDE as it says in the following link http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup , so I tried to do the next tutorials, first one is the example step by step for publisher (with HelloWorld program) as http://wiki.ros.org/rosserial_arduino/Tutorials/Hello%20World and the second one is the example for subscriber (with blinking of led program) as this link http://wiki.ros.org/rosserial_arduino/Tutorials/Blink.

First, I compile the code in the Arduino IDE and it does not show any error and then I upload it. Also, I checked the port and the baud of Arduino.

So next, I am giving the following commands in the terminal:

  1. Roscore
  2. rosrun rosserial_python serial_node.py /dev/ttyACM0 _baud:=9600

And when I try to run that node I get the following error in both programs (so that's why I think I have the error in the node):

Traceback (most recent call last):
  File "/home/sofia_ws/src/rosserial/rosserial_python/nodes/serial_node.py", line 39, in <module>
    from rosserial_python import SerialClient, RosSerialServer
File "/home/sofia_ws/devel/lib/python3/dist-packages/rosserial_python/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'SerialClient'

Since I'm new and I'm following the tutorials I do not know where is my error. I tried to look if there is something similar to this but I couldn't find anything resolved.

Thank you in advanced!! :)


Originally posted by Naussicca on ROS Answers with karma: 13 on 2019-08-13

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It looks like there is a problem with your rosserial_python installation. You have a setup mixed up between python 2 and 3. I suspect you installed rosserial_python with pip3. Uninstall it there and install it with sudo apt install ros-YOURDISTRO-rosserial-python.


Originally posted by ct2034 with karma: 862 on 2019-08-14

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ct2034 on 2019-08-14:
But also welcome to ROS. ;-) Please stay - we have cookies.

Comment by Naussicca on 2019-08-14:
Hii! I love cookies hahaha :D I did what you say and it works perfectly, so thank you so much!! Greetings and hope you are having a good day! Sofi

Comment by ct2034 on 2019-08-15:
Good to hear. Can you please accept my answer (click the little tick)

$\endgroup$

Your Answer

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