MARRtino can be controlled from a Linux box.
You need one of the following operating systems.
To build the initial ROS-free installation you need the following packages
Install them by typing on a terminal.
$ sudo apt-get install g++ arduino arduino-mk libncurses5-dev make libwebsockets-dev libreadline-dev
The software to control the robot requires the following packages (with provided version). These packages can be extracted in any folder (e.g. $HOME/src/srrg) and linked from the src directory of your ROS catkin workspace.
SRRG_HOME=$HOME/src/srrg/
mkdir -p $SRRG_HOME
cd $SRRG_HOME
git clone https://gitlab.com/srrg-software/srrg_cmake_modules.git
git clone https://gitlab.com/srrg-software/srrg_core.git
git clone https://gitlab.com/srrg-software/srrg_core_ros.git
git clone https://gitlab.com/srrg-software/srrg2_orazio_core.git
git clone https://gitlab.com/srrg-software/srrg2_orazio_ros.git
In srrg_core/src/CMakeLists.txt
comment out the lines referring to examples and applications that are not needed for MARRtino robot.
CATKIN_DIR=$HOME/ros/catkin_ws
cd $CATKIN_DIR/src
ln -s $SRRG_HOME/srrg_cmake_modules .
ln -s $SRRG_HOME/srrg_core .
ln -s $SRRG_HOME/srrg_core_ros .
ln -s $SRRG_HOME/srrg2_orazio_core .
ln -s $SRRG_HOME/srrg2_orazio_ros .
cd ..
catkin_make -j1
The first step is to upload the firmware on the Arduino. Be sure that you belong to the dialout group, that has access to the serial lines.
To this end type the following command on a terminal.
$ sudo addgroup <your username> dialout
Of course you replace <your username> with your login name. After this step, you might want to logout and login again, to be sure
the settings are properly reloaded. After you log in again type
$ groups
on a terminal and see if the string dialout is in the list that appears on the terminal.
Once you do that, connect the arduino, and type the dmesg on a terminal. With this command we can see if the system has correctly detected our board. You should see /dev/ttyACM0 somewhere in the dmesg log. Sometimes arduino is reported as /dev/ttyACM1, depending if you have other serial devices connected to the system. For now we assume that the board is detected as /dev/ttyACM0.
Create a file (e.g., /etc/udev/rules.d/90-arduino.rules) with the following lines
#Arduino MEGA
SUBSYSTEMS=="usb", ATTRS{idProduct}=="0042", ATTRS{idVendor}=="2341", SYMLINK+="orazio arduino_mega_$attr{serial}", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idProduct}=="0242", ATTRS{idVendor}=="2341", SYMLINK+="orazio arduino_mega_$attr{serial}", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idProduct}=="0010", ATTRS{idVendor}=="2341", SYMLINK+="orazio arduino_mega_$attr{serial}", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idProduct}=="0042", ATTRS{idVendor}=="2a03", SYMLINK+="orazio arduino_mega_$attr{serial}", MODE="0666"
Note: these settings should work with many models of Arduino and clones, but you should double check the idProduct and idVendor with 'dmesg' command.
Now restart the udev service
$ sudo service udev restart
Connect an Arduino board and check proper connections
$ ls -l /dev/ttyACM0
crw-rw-rw- 1 root dialout 166, 0 <...> /dev/ttyACM0
$ ls -l /dev/orazio
lrwxrwxrwx 1 root root 7 mag 13 14:27 /dev/orazio -> ttyACM0
Note: In the Virtual Machine, after connecting the USB cable, you have to select the "Arduino Mega" device from the menu Devices/USB (Dispositivi/USB). Verify that the operation completes successfully by using command dmesg
from terminal and checking the results as shown below.
$ dmesg | grep -C 3 Arduino
[ 418.721981] usb 2-2: new full-speed USB device number 3 using ohci-pci
[ 419.068602] usb 2-2: New USB device found, idVendor=2a03, idProduct=0042
[ 419.068606] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 419.068608] usb 2-2: Product: Arduino Mega
[ 419.068610] usb 2-2: Manufacturer: Arduino Srl
[ 419.068612] usb 2-2: SerialNumber: 85438333036351C041E2
[ 419.617324] cdc_acm 2-2:1.0: ttyACM0: USB ACM device
[ 419.638054] usbcore: registered new interface driver cdc_acm