end-to-end install and test ubuntu and ros on a vmware image and on a pi and arduino and all sensors

This script is my record of all the steps taken from an empty sd card and an empty vmware fusion on a mac to get to a setup where ros and all needed libraries are installed and working with each other. It assumes that the mac with vmware and the pi are in the same wifi network (which could be the mobile phone hotspot or your home network) for testing.

download ubuntu mate 64 bit 16.04.5 xenial from https://ubuntu-mate.org/download/ and install the iso file in vm ware fusion 11 to run the ros environment on the laptop to test.

download ubuntu mate arm 16.04.2 xenial from https://ubuntu-mate.org/download/ and install the iso file via etcher on a 16GB Sandisk Ultra HC1 to run ros in the robot on a raspberry pi.

(? configure vm to make use of 2 cores and 3d hardware acceleration and 1024 MB to make rviz work well)

boot raspberry pi 3 b+ from sd card connected to monitor, keyboard and mouse to configure it

system configuration

connect to wifi network behrens

change keyboard to german keyboard

set user marcusbehrens

set machine name rover

set password

set login automatically

run software updater - on a raspberry pi this will fail due to not enough space on boot partition - use sudo apt update and sudo apt upgrade instead (see https://ubuntu-mate.community/t/disk-space-error-boot/12386) - it will take some time

right-click on the terminal application to add an icon to the desktop or at the top - we will need a lot of terminal windows to launch different ros drivers for the lidar and for rosserial and for rviz ...

activate ssh via sudo systemctl enable ssh to allow remote access to the pi or to the workstation - this allows for example to remote control the robot via a ssh session

(failed: install ros using the two line method: http://wiki.ros.org/ROS/Installation/TwoLineInstall - did not work, indigo seems to be the default and file not found)

install ros following this guide: http://wiki.ros.org/kinetic/Installation/Ubuntu using ros-kinetic-desktop to have ros installed

configure workspace called catkin_ws based on this guide: http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment

do echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc to set your working directory permanently

install ydlidar driver following the YDLIDAR ROS Manual in rhe ros.zip for the X4 device to the letter to be able to run ydlidar node

run roscore in an extra window

try running the ydlidar node using connecting ydlidar to any serial port using roslaunch ydlidar lidar_view.launch

-> if you see the laserscan in the rviz window you know pi and ydlidar and ros know of each other and work together


sudo apt install python-pip to install python installer to install rosserial_python (do not upgrade it with pip install --upgrade pip to the latest version - then it will not work anymore), on the pi pip is already part of the ubuntu image but to make it work you need to add export LC_ALL=C to your .bashrc - otherwise you get a locale.Error.

pip install pyserial to install serial support for python

sudo apt-get install ros-kinetic-rosserial-python to install rosserial_python package which is required to read data from the arduino

sudo adduser marcusbehrens dialout to add your user to the dialout group so this user can access the serial port and reboot

----- on another pc

add arduino ide from arduino.cc

(on linux go through additional install scripts in arduino folder (not required on mac or windows) - but beware of howthese configuration changes might interfere with serial configuration for ydlidar or rosserial)

hook up arduino mega to your pc via usb

choose arduino mega from the boards menu

select the port to which the arduino mega is connected

upload blink sketch from examples to arduino mega

-> arduino led should be blinking

download rosserial library using library manager in arduino ide

upload helloworld example to arduino mega

------ on the pi or in the vm

hook up the arduino with helloworld example running via usb to the pi or the vm

run roscore in an extra terminal window

rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 to get data from the Arduino

rostopic list in an extra window to find the chatter topic

rostopic echo chatter to see the data beeing posted

-> now you know the connection arduino to vm or pi is working

------ next hookup the motor shield to the arduino

using excel hook up motors and encoders to shield and arduino pins

try mc33926 demo example from pololu first to only drive the motors

now try motors9 to see it work together with ros and the pi

on the pi start roscore

start rosserial by using rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0

sudo apt-get install ros-kinetic-teleop-twist-keyboard to install the remote control app
rosrun teleop_twist_keyboard teleop_twist_keyboard.py to start it

> robotshould now be controlled with remote keyboard commands, this should work both vomr the vmware or on thepi connected via ssh sessions via wireless

----- hook up bno055 to the arduino mega

connect the wires via a level shifter

start sensorapi example from adafruit library to see values via serial monitor

start orientation2 to see values posted as rostopic

----- hook up neo-6m-c to the arduino mega

connect the wires via a level shifter

start neogps example to test

--- bring workstation (vmware image on mac) and pi to consider pi the rosmaster - this way you can run rviz, rosbag, remote control app and rqplot on the vmware taking the message broker data from the pi

configure the vmware network to be a bridged network - this make the ubuntu machin show up in your network (see also "to simplify things" under https://superuser.com/questions/244324/how-can-i-set-it-up-so-i-can-ssh-into-my-vmware-guest-vm)

follow this tutorial to try out connection: http://wiki.ros.org/ROS/Tutorials/MultipleMachines

now you can run rviz in the vm and the sensors and motors on the pi

---- install webcam ros driver on the pi (help from https://www.youtube.com/watch?v=StHfHCPrHOw)

sudo apt-get install ros-kinetic-usb-cam


ls /dev | grep video

rosrun usb_cam usb_cam_node

---- move analyse_scan to the pi

rsync -rv catkin_ws marcusbehrens@rover:.

--- create roslaunch on the pi to start up core and its sensors with one command