Repository navigation
Raspberry Pi 3 Setup
- download image from here
cd Downloads- Put tiny sd card into adapter, insert into laptop.
- use gparted GUI to delete existing partitions, and create a new maximally-sized ext4 partition
- assuming the card is mounted to
/dev/sdb/,xzcat ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz | sudo dd bs=4M of=/dev/sdb. This copy operation will take a few minutes, and gives no feedback while running.
Hook up peripherals to pi -- hdmi display (TV), usb keyboard -- then plug it in to a 5V power supply. This copy operation will take a few minutes, and gives no feedback while running.Follow the wizard to set up wifi, create usrer name, etc.
sudo apt-get update
sudo apt-get upgrade
Ubuntu 16.04 has automatically scheduled updates by default. This is a problem, since I don't want to be using resources to upgrade packages when I start up a robot. Disable these with sudo systemctl disable apt-daily.service and sudo systemctl disable apt-daily.timer.
Install wifi following the instructions here::
sudo apt-get install wireless-tools wpasupplicant
sudo apt-get install openssh-server
Edit /etc/hosts and append the new hostname to the 127.0.0.1 line so it reads 127.0.0.1 localhost raspberrypi.
Unplug the pi, and plug it back in. Should be connected to wifi! I edited my laptop's /etc/hosts to have a line 192.168.0.102 raspberrypi. Can now connect with ssh raspberry pi. Note that the pi won't work at 5ghz wifi, your router must be set to 2.4ghz.
Set up public key authentication:
- run
ssh-keygen -t rsato generate a key if you don't already have one. Don't overwrite old key file (answer no when prompted). Log on to pi and run: touch ~/.ssh/authorized_keyscat ~/id_rsa.pub >> ~/.ssh/authorized_keysrm ~/id_rsa.pub
One could now set a static ip address with the instructions here. However, I used the router settings to reserve and IP address for the raspberry pi.
Note that a raspberry pi 3 with ubuntu 16.04 boots in only 30 sec.
At some point, ssh was hanging immediately upon authentication -- it wouldn't even respond to control-C. The fix was as shown here: add IPQoS 0x00 to the bottom of the files /etc/ssh/ssh_config and /etc/ssh/sshd_config. I had to plug it into ethernet in order to do this.
-
Followed the directions here
-
sudo apt-get install ros-kinectic-openni-launchto control the kinect. Also installs many dependencies. -
Some of my packages don't have dependencies set up right. To get the catkin build to work, I had to
sudo apt install ros-kinetic-ar-track-alvar,sudo apt install ros-kinetic-octomap,sudo apt install ros-kinetic-libg2o,sudo apt install xacro,sudo apt install ros-kinetic-joint-state-publisher,sudo apt install ros-kinetic-robot-state-publisher. -
There's some weird error compiling rgbdslam on raspberry pi. I had to edit
src/rgbdslam_v2/external/SiftGPU/makefileon the pi and comment out lines 19 and 20 (siftgpu_enable_sseandsiftgpu_sse_options). -
sudo rosdep init,sudo rosdep fix-permissions,rosdep update -
Clone this repo, change to
ROS/workspace/, initialize ROS withsource /opt/ros/kinetic/setup.bash, and build the workspace withcatkin_make. I got weird random build errors unless I didcatkin_make -j1, but the build never finishes on the pi (it's paging memory). In the end, I compiled on the laptop and just rsynced everything to the pi. I kinda doubt this will work for rgbdslam -- it probably has to be built on ARM... -
Edit your
.bashrcto add the linessource /opt/ros/kinetic/setup.bash source /home/brian/ROS/workspace/devel/setup.bash
Also need to set ROS_IP on all computers that will be connecting to the master node on the raspberry pi. On ubuntu, you can get your ip address with ip route get 8.8.8.8 | awk '{print $NF; exit}', so on my Ubuntu laptop, I added a line like export ROS_IP="$(ip route get 8.8.8.8 | awk '{print $NF; exit}')" to a script in my PATH. I created an executable bash script in my PATH named rospi_init with the following contents
source /opt/ros/kinetic/setup.bash
source ~/robotics_code/ROS/workspace/devel/setup.bash
export ROS_MASTER_URI=http://raspberrypi:11311/
export ROS_IP="$(ip route get 8.8.8.8 | awk '{print $NF; exit}')"
Now, in order to start the robot, plug in the raspberry pi, wait 30 seconds, ssh raspberrypi, start roscore on the pi. In a separate terminal on my laptop, source rospi_init. If all goes well, rostopic list should produce output
/rosout
/rosout_agg
I generally develop on my laptop and push new code to the pi with rsync -a <local_dir> raspberrypi:~, e.g., rsync -av robotics_code raspberrypi:~. It's probably a good idea when first setting up the pi to delete the devel and build folders in the ROS workspace, and build from scratch with catkin_make. Pretty sure it's safe thereafter to move python scripts around with rsync. For C++ source files, I'll probably need to set up an automated build on the pi...
sudo usermod -a -G dialout brian
sudo chmod a+rw /dev/ttyACM0
I installed the arduino IDE as usual (using the ARM distribution). I can then connect using ssh -X and use the arduino IDE to upload sketches.
It is convenient to allow for passwordless sudo. Run sudo visudo and add the line brian ALL=(ALL) NOPASSWD:ALL to the end. Make sure the ROS is properly initialize for root sudo cp ~/.bashrc /root/ In an ROS launch file, specify the "launch-prefix" like so, <node pkg="my_pkg" type="my_node" name="my_super_node" launch-prefix="sudo"/>. However, I couldn't figure out how to get sudo -E rosrun working; even with the -E flag, I'm getting rosrun: command not found.