I installed Ubuntu-16.04, ROS Kinetic on Raspberry Pi 3 and tried running the sample.
--Installing Ubuntu-16.04 --OS initial settings --Installing ROS kinetic --Installing roomba_500_series --Package creation ――Try to move
Reference: Using Ubuntu 14.04 with Raspberry Pi 2 Reference: Burn Raspberry Pi OS image on Mac OS X-@ledsun blog
Download the Ubuntu-16.04 image (ubuntu-16.04-preinstalled-server-armhf + raspi3.img.xz) from below ARM/RaspberryPi - Ubuntu Wiki
Unzip below.
$ xz -dv ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz
Identify the SD card with diskutil list
etc. This time / dev / disk2
Burn to SD card.
$ diskutil unmountDisk /dev/disk2
$ sudo dd if=ubuntu-16.04-preinstalled-server-armhf+raspi3.img of=/dev/rdisk2 bs=1m
The IP address of RPi for Roomba is assumed to be fixed at 192.168.0.1
.
$ sudo apt-get install -y wpasupplicant wireless-tools linunx-firmware
$ sudo vi /etc/network/interfaces.d/wlan.cfg
$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
$ sudo vi /etc/default/networking
$ sudo ifup wlan0
text:/etc/network/interfaces.d/wlan.cfg
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.1
netmask 255.255.255.0 #In your own environment
gateway 192.168.0.254 #Set together
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
/etc/wpa_supplicant/wpa_supplicant.conf
update_config=1
network={
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
ssid="your_ssid"
psk=**************** #See below
}
/etc/default/networking
CONFIGURTE_INTERFACES=no
** Reference ** The passphrase generation is as follows
$ sudo sh -c "wpa_passphrase your_ssid > /etc/wpa_supplicant/wpa_supplicant.conf"
# reading passphrase from stdin
pass_phrase
network={
ssid="your_ssid"
#psk="pass_phrase"
psk=****************
}
Reference: Install ROS kinetic on Ubuntu 16.04 LTS of Raspberry Pi3 | GarretCafe
It is almost the same as Try running ROS sample easily on a virtual machine.
$ sudo apt-get update
$ sudo apt-get install -y chrony ntpdate
$ sudo ntpdate ntp.nict.jp
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install -y ros-kinetic-ros-base # No GUI tools
$ sudo rosdep init
$ rosdep update
$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
$ sudo apt-get install -y python-rosinstall
$ source /opt/ros/kinetic/setup.bash
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ cd ~/catkin_ws/
$ catkin_make
$ source ~/catkin_ws/devel/setup.bash
$ vi ~/.bashrc
$ source ~/.bashrc
.bashrc
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
export ROS_IP=192.168.0.1
export ROS_MASTER_URI=http://${ROS_IP}:11311
export DISPLAY=:0
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'
Reference: Run Roomba with ROS (catkin compatible) --cryborg Robotics blog Reference: Catkin Super Introduction (Part 3) -Use the rosbuild package: Bouquet for Hanaoka
Repository: https://github.com/NetBUG/roomba_500_series
Once, catkin_make
or catkin_make install
fails, but if you run it several times, it will eventually succeed.
$ cd ~/catkin_ws/src
$ git clone https://github.com/NetBUG/cereal_port
$ git clone https://github.com/NetBUG/roomba_500_series
$ rosdep install cerial_port
$ rosdep install roomba_500_series
$ cd ~/catkin_ws
$ catkin_make
$ catkin_make install
$ cd ~/catkin_ws/src
$ catkin_create_pkg roomba rospy std_msgs
roscore starts without permission even if it is not described.
$ roscd roomba
$ mkdir launch
$ mkdir scripts
$ vi launch/roomba.launch
$ vi scripts/sample.py
roomba.launch
<launch>
<node pkg="roomba_500_series" name="roomba560_node" type="roomba560_node" />
</launch>
sample.py
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
rospy.init_node("sample")
pub = rospy.Publisher("cmd_vel", Twist, queue_size=10)
while not rospy.is_shutdown():
vel = Twist()
direction = raw_input("f: forward, b: backward, l: left, r: right, s: stop, q: quit > ")
if "f" in direction:
vel.linear.x = +0.1
if "b" in direction:
vel.linear.x = -0.1
if "l" in direction:
vel.angular.z = +1.0
if "r" in direction:
vel.angular.z = -1.0
if "s" in direction:
vel.linear.x = 0.0
vel.angular.z = 0.0
if "q" in direction:
break
print vel
pub.publish(vel)
$ roscd roomba_ctl/scripts
$ chmod 755 sample.py
catkin_make
$ cd ~/catkin_ws
$ catkin_make
$ source ~/catkin_ws/devel/setup.bash
roslaunch
$ roslaunch roomba roomba.launch
Direct transmission of rostopic
$ export ROS_IP=<Your IP address> #Check with ifconfig
$ rostopic pub -1 cmd_vel geometry_msgs/Twist "[0, 0, 0]" "[0, 0, 0.1]" && rostopic pub -1 cmd_vel geometry_msgs/Twist "[0, 0, 0]" "[0, 0, 0]"
Or below (operate from sample.py)
$ export ROS_IP=<Your IP address> #Check with ifconfig
$ roscd roomba
$ ./sample.py
Recommended Posts