Experiences with ROS on multiple platforms
In this thread I hope to share my experiences over the last couple of months of getting ROS up and running on 5 different platforms. Some good and some bad. The platforms are:
- straight up linux in a dual boot
- ROS on a Raspberry Pi
- ROS on the Windows System Linux (WSL)
- ROS on Windows 10
- ROS on an Arduino
I will share my experiences and others hopefully will jump in on suggestions to do things better.
Today I'll talk briefly about item 1., Ubuntu Linux in a dual boot. I had some complication with this, but looking back I realize it was because I was climbing the Linux learning curve at the same time as the ROS learning curve. I have a lot of experience with Unix but it is long enough ago the Linux didn't even exist yet.
So it meant researching how to set up a dual boot system on my wife's old laptop because she still thinks after 7 years she may need some of the files on that machine. This is not a difficult thing but is a step you might have to be prepared to go through. I went with Ubuntu, not for any particular reason other then that name kept popping up.
Installing Ubuntu was a time consuming but straight forward process.
Next was installing the Melodic version of ROS. This is also a very easy thing to do on Ubuntu. Then I completed all of the tutorials through creating the Talker and Listener. For those who aren't familiar with the tutorials, the Talker and Listener are two ROS nodes that send msgs and receive them. Other relearning Linux along the way this was also straight forward. Tedious but straight forward. The main difficultly I has was trying to access the Linux box remotely and getting X-Windows to work. Still not happy with that yet.
Bottom line, ROS on Linux is good, straight forward and the tutorials are very complete and comprehensive. This is the place to start for someone just getting started. Even if you don't know Linux you can just google your question and you will probably find the answer.
OK more later if anyone is interested.
ROS on an Arduino
I'll be looking forward to this one. ?
Very interested in your write up of ROS on the various platforms. I'm still trying to work out if installing ROS and leaning to use it is a worthwhile exercise to undertake as opposed to writing (or copying) code in Python and C to make my robot obey. I will be following your exploits ?
... I'm still trying to work out if installing ROS and leaning to use it is a worthwhile exercise to undertake as opposed to writing (or copying) code in Python and C to make my robot obey. I will be following your exploits ?
Unfortunately, I haven't created any original applications yet, but I hope to get there soon.
I like to work on the theory of least complication first, then adding layers of complication a step at a time as I get things working
Since Robo-pi expressed an interest in Arduino, I think that gives me a game plan. I already talked about the Linux installation. Next I will talk about connecting Arduino to Linux and having the Linux control the Arduino. This would be like the Arduino controlling some stepper motors and the Linux box being the brain telling the Arduino what to do. After that I will move to the Raspberry Pi and cover how to get ROS on it and then have it control the Arduino. Finally, I will cover the Windows installations. I am leaving them last because while I had great hopes for them Windows just doesn't seem to work as well.
That's exactly what I've been trying (and failing miserably) to do, in exactly the same order
Please, lay on MacDuff
Getting ROS on Linux to talk to an Arduino Uno turns out to be incredibly easy. That is once to figure out why the Arduino IDE won't work on Linux. Now this is a problem not everybody will necessarily have. The symptom is you install Arduino IDE from the Arduino website, be sure to get the Linux version. You run the program and the menu choice for selecting your serial port is grayed out and you cannot select what port the Arduino is on. Note the Linux uses ports name dev/ttyAMC0 (that's a zero). If you are really paying attention you will notice in the terminal window where you started the IDE that there is an error message: "java.lang.nullpointerexception thrown while loading gnu.io.rxtxcommdriver". What does that mean??
So you do what you would normally do and google the error message, and maybe you even google "serial port grayed out". You will find lots of answers to both of these responses, most of them telling you to set your permissions, run IDE as root, edit the preferences.txt file, and that the problem has been fixed in some earlier release of Linux. Trust me none of this solves your problem.
So you try to reinstall Java, after all this is a Jave error message, and still no joy in Mudville. So what is the secret? I'll tell you in case you need to fix your version or you want to break your version.
The problem is the Arduino IDE is expecting Java 8 and does not work with at least Java 10. So to see what version of java you have installed run: "sudo update-alternatives --get-selections | grep java". Then to set the correct version of java run "sudo update-alternatives --config java". This will let you select between the various versions of java. I mean come on guys, it is supposed to be backward compatible.
I would also like to know how I got more than one version of java on the machine to begin with. I'm sure this is user error but I don't know what I did.
Well good luck, more on actually getting the Arduino to communicate in the next article.
Arduino on Linux
The ROS tutorial on this is really quite straight forward and should not be feared. It is even a good project if you only have a short amount of time. The main issue is that ROS uses what is called rosserial to be able to talk to the Arduino that does not have an Ethernet hat. (For an Ethernet hat here is a link to a code sample: Ethernet Arduino . I don't have a hat so can't try it.)
The commands to get you up and running are first installing the rosserial and the rosseerial-arduino (I have melodic Ros so if you have different version change the version name to match):
sudo apt-get install ros-melodic-rosserial-arduino
sudo apt-get install ros-melodic-rosserial
The you change directory to the Arduino IDE sketchbook/libraries, make sure you don't have an old version of the library, then build the arduino library (don't miss the period at the end of the command the means you want to build it in this directory. That kept me scratching my head, no wonder I don't have any hair.)
rm -rf ros_lib
rosrun rosserial_arduino make_libraries.py .
The useful thing is once you have this library build you can copy it to your Windows version of IDE and use it there. So you can program the Arduino now from either the Linux system or the Windows system.
Once you have it installed go to the IDE's example menu (be sure you restart the IDE after building the library) and you will see several examples to use. They are documented here: http://wiki.ros.org/rosserial_arduino/Tutorials
The only caveat I'd like to add so far is that you can't install arduino from apt-get. I mean, you can, but, it's gonna be an old version that doesn't work well. Lots of buttons left out. You need to install the latest (that I found) version, which is "arduino-1.8.9-linuxarm.tar.xz", and then, don't follow the instructions for installing
"arduino-linux-setup.sh" didn't work on the Pi, it might be for regular linux, I just used "install.sh" and that worked fine
Oh, and get the 32 bit.
I got the Pi3 and the Pi4 working with the arduino. I haven't tried the Jetson yet
On the Pi4, when I plugged it in, the USB picked it up nicely
And it labeled the port for the arduino without a problem
And the IDE picked it up and labeled it with all the info which my windows machine seems rather disinclined to do
Haven't tried the ROS yet on the Pi4 tho. All the images I have for ROS are for the Pi3
I'm wondering if you can't compile a ros image for the Pi4. I could get it to work on a Pi3+ but I think I ran out of memory and it hung up.
I ran into the same problem with both ros and tensorfow (before they made it simple) my solution to that was to install an 8g usb thumb drive and assign the whole thing as swap. It worked after that
The os for the pi4 is newly refabbed, and i dont know if it's campatible yet. I haven't tried it yet, too many detours
That is a good idea about the swap space, I will have to do that and try again.