Connect Arduino with Raspberry with ROS

1,238 views
Skip to first unread message

M jz

unread,
Dec 25, 2016, 12:34:30 PM12/25/16
to HomeBrew Robotics Club
Hi all,
I am going to make a robot with Raspberry pi 3 and Arduino mega with ROS, I have installed ROS kinetic on both of Pi's and laptop.When I want to connect Arduino with Raspberry I stucked over there ,I read that the best way to connect them is using USB,but I do not know how to do that?Can any one help me?
Note:My Raspberry ubuntu version is Ubuntu 16.04 lts server.

Chris Albertson

unread,
Dec 25, 2016, 5:09:42 PM12/25/16
to hbrob...@googlegroups.com, maisa...@gmail.com


On Sun, Dec 25, 2016 at 9:25 AM, M jz <maisa...@gmail.com> wrote:
> Hi all,
> I am going to make a robot with Raspberry pi 3 and Arduino mega with ROS, I
> have installed ROS kinetic on both of Pi's and laptop.When I want to connect
> Arduino with Raspberry I stucked over there ,I read that the best way to
> connect them is using USB,but I do not know how to do that?Can any one help
> me?
--

Chris Albertson
Redondo Beach, California

Mark Womack

unread,
Dec 25, 2016, 8:30:35 PM12/25/16
to hbrob...@googlegroups.com, maisa...@gmail.com
I have been using ros arduino with a Teensy and I just connected the Teensy to one of the USB ports of the Pi3. I imagine it would be something similar for the Mega? I guess another way would be to connect via the serial connection from the Pi3, but I have not attempted that. 

With the connection using the USB ports, I have been able to run all the ros arduino examples. 

Mark

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

Camp Peavy

unread,
Dec 26, 2016, 5:30:27 PM12/26/16
to hbrob...@googlegroups.com
    I've made many robots with Arduino over the years and the process has always been to flash the Arduino... disconnect from the computer and the Arduino was it's own stand alone robot. The only reason for the computer was to compile code and load it onto the Arduino. While it may seem obvious... when using the Arduino with ROS the Arduino becomes a subsystem to a bigger structure instead of being the entire system. There are a few ways to "connect" the Arduino to ROS. Chris has mentioned "Arduino Bridge" I use http://wiki.ros.org/rosserial This is basically a way to bring serial data into your ROS environment.
 
Enjoy,
Camp



To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

Griswald Brooks

unread,
Dec 26, 2016, 6:52:05 PM12/26/16
to hbrob...@googlegroups.com, maisa...@gmail.com
ros_serial

M jz

unread,
Dec 27, 2016, 4:46:48 PM12/27/16
to HomeBrew Robotics Club, maisa...@gmail.com

I have downloaded ROS_arduino_bridge but I do not know what's the next step I must to do.I'm completely confused 

بتاريخ الثلاثاء، 27 ديسمبر، 2016 1:52:05 ص UTC+2، كتب Griswald Brooks:
ros_serial

On 25 December 2016 at 14:58, Mark Womack <mwo...@gmail.com> wrote:
I have been using ros arduino with a Teensy and I just connected the Teensy to one of the USB ports of the Pi3. I imagine it would be something similar for the Mega? I guess another way would be to connect via the serial connection from the Pi3, but I have not attempted that. 

With the connection using the USB ports, I have been able to run all the ros arduino examples. 

Mark
On Dec 25, 2016 2:09 PM, "Chris Albertson" <alberts...@gmail.com> wrote:

Look here: http://wiki.ros.org/ros_arduino_bridge

On Sun, Dec 25, 2016 at 9:25 AM, M jz <maisa...@gmail.com> wrote:
> Hi all,
> I am going to make a robot with Raspberry pi 3 and Arduino mega with ROS, I
> have installed ROS kinetic on both of Pi's and laptop.When I want to connect
> Arduino with Raspberry I stucked over there ,I read that the best way to
> connect them is using USB,but I do not know how to do that?Can any one help
> me?
--

Chris Albertson
Redondo Beach, California

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

Camp Peavy

unread,
Dec 27, 2016, 7:31:57 PM12/27/16
to hbrob...@googlegroups.com, maisa...@gmail.com
> I have downloaded ROS_arduino_bridge but I do not know what's the next step I must to do.I'm completely confused
 
Do you have a goal in mind? That is to "move wheels" or "monitor sensors"... without a goal it will never make sense.
 
- Camp

Mark Womack

unread,
Dec 27, 2016, 9:11:34 PM12/27/16
to hbrob...@googlegroups.com, maisa...@gmail.com
Well, one very simple goal is to be able to execute the HelloWorld example from the ros_arduino code.  That will demonstrate that you have everything installed and functioning correctly.  Then you can look at figuring out how to spin wheels.  :-)

1) I am assuming that you have ROS installed on your Pi.
2) I am assuming that you have installed the Arduino IDE.  I installed it on my Pi as well, I have the Ubuntu Mate desktop installed on it, so it makes it easy to run ROS and the Arduino IDE on it.  And it just convenient to have everything to develop with on a single machine (the Pi).  Actual deployment for real usage may differ after the development is done (wait, is it ever really 'done'? ~:0 )

Assuming the above are true, you should follow the instructions here to install the ros_arduino:


I did step 2.1.1 (using 'kinetic' instead of 'indigo' as shown in the example), skipped 2.1.2 (not needed), and then did 2.2.  At the end of that, you should have the ros_lib installed in your Arduino IDE.

At this point, I would connect your Mega to your Pi via a USB cable and make sure you can see it using the Arduino IDE.  Try uploading the basic Blink example to it to make sure you can upload sketches to it.  If you get an error like "Error opening serial port", then see the "Please read" section of this page: https://www.arduino.cc/en/Guide/Linux

So, now you have ROS installed.  You have ros_lib installed on the Arduino IDE.  You have your Mega attached to the Pi.  Now you will want to try out the Hello World ros_arduino example.


You should be able to open the ros_lib->HelloWorld example in the Arduino IDE.  Upload the code and then try running it per the instruction on the HelloWorld link.

If you can get it the HelloWorld running on the Mega to publish "hellow world!" to ROS running on the Pi, then you are up and running.  You can move onto the Blink example to test out ROS subscribers:


I hope this helps.

-Mark

To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

M jz

unread,
Dec 28, 2016, 2:44:29 PM12/28/16
to HomeBrew Robotics Club, maisa...@gmail.com
Yes sure,I want to make robot do mapping by SLAM.I want to use arduino for low level control(to get the encoders value and determine the speed and velocity)
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

Chris Albertson

unread,
Dec 29, 2016, 12:06:01 PM12/29/16
to hbrob...@googlegroups.com
On Tue, Dec 27, 2016 at 12:38 PM, M jz <maisa...@gmail.com> wrote:
>
> I have downloaded ROS_arduino_bridge but I do not know what's the next step
> I must to do.I'm completely confused

Tell us this

1) what works. Can program the Arduino and make it do stuff, Can you
install and new libraries into the Arduino IDE can you build a robot
that uses only the arduino and have it to simple things lie drive one
meter forward then stop. I would progress to this stage before even
thinking about ROS

2) do you have a working ROS system and can you have a simulated robot
and also run code you wrote yourself as a node in this system. Don't
even bother with real robots, just write a node in C++ or Pyton and
get it working in simulation.

After you can work on both worlds at the level stated above, pos
serial or the bridge will allow you to connect those worlds but it
will do nothing for you iff you can write and run software for each
end. It is a tool for developers who are writing nodes, not
something you can download and just run

Jeffrey Cicolani

unread,
Dec 29, 2016, 3:10:23 PM12/29/16
to hbrob...@googlegroups.com
I've been using ros_serial with my Nomad project. With it I've been able to read my sensors and operate servos for the pan-tilt.

Jeffrey Cicolani
President; The Robot Group; http://therobotgroup.org
Chair; Chupacabracon; http://chupacabracon.com

See my most recent geekiness at www.cicolanistudios.com and http://nomadrobot.info

"Power to the people powerful enough to crush the other people" Joss Whedon
"Always be yourself... unless you suck." Joss Whedon


To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

Camp Peavy

unread,
Dec 29, 2016, 7:36:08 PM12/29/16
to hbrob...@googlegroups.com
> Yes sure,I want to make robot do mapping by SLAM.I want to use arduino for low level control(to get the encoders value and determine the speed and velocity)
 
A lot of us have standardized on the Neato Botvac  platform with this ROS package: https://github.com/SV-ROS/intro_to_ros
 
Enjoy,
Camp



To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@ googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/ group/hbrobotics.
For more options, visit https://groups.google.com/d/ optout.

Mark Womack

unread,
Dec 30, 2016, 2:22:29 PM12/30/16
to hbrob...@googlegroups.com
M,

Did any of that help?  Are you able to pass ROS messages between your Pi and Mega?

-Mark

To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

Maisa Jazba

unread,
Dec 30, 2016, 5:02:34 PM12/30/16
to hbrob...@googlegroups.com
when I typed arduino on the terminal it gave me an error :
Exception in thread "main" java.lang.ExceptionInInitializerError
    at processing.app.Preferences.save(Preferences.java:735)
    at processing.app.Preferences.init(Preferences.java:249)
    at processing.app.Base.main(Base.java:117)
Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
    at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:236)
    at processing.core.PApplet.<clinit>(Unknown Source)
    ... 3 more
I googled about it but no solve for this issue
You received this message because you are subscribed to a topic in the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hbrobotics/KVtf0ognkJ4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hbrobotics+unsubscribe@googlegroups.com.

Griswald Brooks

unread,
Dec 30, 2016, 5:54:59 PM12/30/16
to hbrob...@googlegroups.com
The arduino cli is still linked to the ide, which needs to connect to an X11 session (a screen).

There is a work around to redirect that, but I never got it to work, 

though it must work somehow, as there are travis implementations that use it.

Maybe you can get some leads from this?

Mark Womack

unread,
Dec 30, 2016, 7:49:50 PM12/30/16
to hbrob...@googlegroups.com
Maisa, I assume you are trying to launch the Arduino IDE? That is going to require a desktop (or an X11 session I guess) to run properly. Can you describe your setup and exactly what you are doing? 

M jz

unread,
Jan 4, 2017, 11:19:49 AM1/4/17
to HomeBrew Robotics Club

I try to launch Arduino by the command :arduino by ssh.I try lots of solutions but none of them worked.
I follow this page to install arduino on Raspberry pi.

Mark Womack

unread,
Jan 4, 2017, 11:48:55 AM1/4/17
to hbrob...@googlegroups.com
I don't think you will be able to run the Arduino IDE via ssh in a terminal window.  I think it will require version of Ubuntu with a desktop in order to launch.  The Ubuntu Mate system that I installed on my Pi3 is one that does just that.  I have some instructions that I am creating to show how to install and setup.  They are the steps we are using for the Team Victoria RoboMagellan Pi3/Arduino setup.  At least for development.  Actual deployment for competition may differ.  Let me finish those up this week and send out the link.

-Mark

On Wed, Jan 4, 2017 at 6:31 AM, M jz <maisa...@gmail.com> wrote:

I try to launch Arduino by the command :arduino by ssh.I try lots of solutions but none of them worked.
I follow this page to install arduino on Raspberry pi.

--

M jz

unread,
Jan 4, 2017, 11:49:03 AM1/4/17
to HomeBrew Robotics Club

بتاريخ الأربعاء، 4 يناير، 2017 6:19:49 م UTC+2، كتب M jz:

I try to launch Arduino by the command :arduino by ssh.I try lots of solutions but none of them worked.
I follow this page to install arduino on Raspberry pi:http://blog.abarbanell.de/raspberry/2015/08/16/raspberry-arduino/

Maisa Jazba

unread,
Jan 4, 2017, 11:54:57 AM1/4/17
to hbrob...@googlegroups.com
yes please I am waiting our help

Chris Albertson

unread,
Jan 4, 2017, 11:58:12 AM1/4/17
to hbrob...@googlegroups.com
Yes you can launch the IDE on one computer and forward the X11 display
back to your desktop on some other computer that is running an X11
server.

Test you ability to forward the GUI using some app that is "easy" for
example ssh in and then type "xterm" and xterm should run on the Pi
and pop up on your screen.

I did not read the entire blog post you linked to but I did see he was
using "ssh -X" try ssh -Y and be sure to read the ssh man page first
to see if my sufggestion makes sense, don't just follow instructions.

Can you cast and past from your screen, just saying "I did what was in
this long blog post" is not helpful, say EXACTLY what you did, best
if you cut and past off your own screen

In short: Experiment and len how to forward "easy" things like eyes
and xterm and then apply what you did to Arduino IDE. or "crawl, walk
then run"
> --
> You received this message because you are subscribed to the Google Groups
> "HomeBrew Robotics Club" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hbrobotics+...@googlegroups.com.
> To post to this group, send email to hbrob...@googlegroups.com.
> Visit this group at https://groups.google.com/group/hbrobotics.
> For more options, visit https://groups.google.com/d/optout.



--

Reply all
Reply to author
Forward
0 new messages