Kobuki is a research mobile robot released from Yujin Robotics. Vacuum cleaner Robot is almost the same size as Roomba and can be controlled from a PC etc. via USB serial connection. It is equipped with IO, serial input/output, power supply connector, button, LED, etc. It is suitable for use as an experimental robot.
You can download the script that installs the software etc. necessary to operate the following Kobuki's sample from here.
$ wget http://svn.openrtm.org/Embedded/trunk/RaspberryPi/tools/rpi.sh $ chmod 755 rpi.sh $ sudo ./rpi.sh hostname --type kobuki
In the following explanation, the environment construction and Kobuki's sample are compiled automatically.
The figure below is the main panel of Kobuki.
We use 5V 1A DC output connector for power supply to Raspberry Pi, USB connector for connection with Raspberry Pi.
Kobuki has a DC output connector capable of outputting 5V 1A and you can supply the power of Raspberry Pi from here.
5V 1A output connector with the following model number is used.
Kobuki 5V 1A connector | |
Housing | Molex PN: 43645-0200 |
Terminal | Molex PN: 43030-0001 |
You can also purchase it at RT robot shop etc.
We will supply power to Raspberry Pi by creating DC connector and USB conversion cable as shown below.
In recent years, many batteries with a USB output terminal for smartphones are on sale so these power supplies can also be used.
Connect Kobuki and Raspberry Pi with the USB cable that came with Kobuki. From Raspberry Pi side it appears as /dev/ttyUSB0.
$ ls /dev/ttyUSB* /dev/ttyUSB0
Install Raspberry Pi in Kobuki and connect the power supply and USB. If you make Raspberry Pi wireless LAN connection, it becomes Kobuki which can be controlled wirelessly.
Since there is a possibility of dropping during Kobuki operation, it is good to fix Raspberry Pi with a Velcro tape or the like.
In the previous section we also tested the compilation of the RT component, but we will review it again here. First, check out the Kobuki AIST RT component from the following repository and build it.
$ svn co http://svn.openrtm.org/components/trunk/mobile_robots/kobuki $ cd kobuki $ mkdir build $ cd build $ cmake -DCMAKE_INSTALL_PREFIX=/usr .. $ make $ cd src $ sudo make install
Try to start it up. Since access to the device file /dev/ttyUSB0 requires root privilege, it is running with sudo.
$ rtm-naming $ sudo /usr/lib/openrtm-1.1/rtc/KobukiAISTComp
If you start RTSystemEditor and connect to Raspberry Pi's host name or IP address, you should see a component called KobukiAIST0. Please click to display the Configuration dialog.
Since it is designed to be able to operate LED1, LED2, etc, please click RED, GREEN etc. with the radio button. The LED will light up.
Kobuki AIST component is started automatically when Raspberry Pi is started. As a result, when you turn on the power to Kobuki, Raspberry Pi and Kobuki AIST components will start automatically and you will be able to operate Kobuki via RTC without having to login to Raspberry Pi every time.
Create the following script as /etc/kobuki.sh.
$ sudo vi /etc/kobuki.sh
The contents of kobuki.sh are as follows.
#!/bin/sh # # KobukiAIST RTC launch script # # Copyright Noriaki Ando <n-ando@openrtm.org> # 2011.03.27 # # This script should be executed from rc script like a rc.local # as the following command line. # # ns=/usr/bin/rtm-naming kobukiRTC=/usr/lib/openrtm-1.1/rtc/KobukiAISTComp workdir=/tmp/kobuki \$ns sleep 5 if test -d $workdir ; then echo "" else mkdir \$workdir fi cd $workdir while : do rm -f \$workdir/*.log \$kobukiRTC sleep 5 done
Give execute privilege.
$ sudo chmod 755 /etc/kobuki.sh
Furthermore, to start automatically, insert the following line before the last exit 0 of /etc/rc.local.
/etc/kobuki.sh 2>&1 | perl -p -e 's/\n/\r\n/g' 1>&2 & exit 0
Now, when Raspberry Pi starts up, the Kobuki AIST component also starts up automatically. Even if Kobuki AIST component is terminated by exit, it starts again after 5 seconds. As long as Kobuki is powered on, the Kobuki AIST component will continue to stay resident.
TkJoystick is a component included as a sample in OpenRTM-aist-Python. However, the output is only the XY value of the joystick and the output for the wheel speed of the opposed two-wheeled mobile robot, and there is no output of the two-dimensional velocity vector (TimedVelocity2D).
Improve the TkJoyStick component, output 2-D velocity vector (TimedVelocity2D), connect with Kobuki and operate.
On Windows, the following directories are also installed. (x.y is version)
In TkJoystick.py, the left and right wheel speeds are calculated. Considering the kinematics of the mobile robot from here, the speed v and the angular velocity ω can be calculated. (For reference, I will make a link to Professor Kumagai of Tohoku Gakuin University.
TimedVelocity2D has the following data structure.
struct Velocity2D { double va; // angular velocity [rad/s] double vx; // translation speed (forward) [m/s] double vy; // translation speed (lateral direction) [m/s] 0 for the opposite two-wheel type }; struct TimedVelocity2D { Time tm; Velocity2D data; };
I will move Kobuki autonomously using a sensor. Kobuki is equipped with bumper sensor, proximity sensor (far/near), Cliff sensor. Here, like Roomba, when continuing to move forward, when detecting a wall, I try to move it with an algorithm that goes down a little, rotates and moves forward again. (Roomba moves a bit more wisely ...)
The sensor output of Kobuki AIST RTC is as follows. The IR sensor is for receiving signals from infrared from the dock and can not be used for obstacle detection. Therefore, only bumpers and cliff sensors can be used to detect obstacles and cliffs.
No. | Enum | Meaning |
0 | RIGHT_BUMPER | Right bumper |
1 | CENTER_BUMPER | Central bumper |
2 | LEFT_BUMPER | Left bumper |
3 | RIGHT_WHEEL_DROP | Right wheel release |
4 | LEFT_WHEEL_DROP | Left wheel derailleur |
5 | RIGHT_CLIFF | Right cliff sensor |
6 | CENTER_CLIFF | Central cliff sensor |
7 | LEFT_CLIFF | Left cliff sensor |
8 | RIGHT_IRFAR_RIGHT | Right IR / dock right far |
9 | RIGHT_IRFAR_CENTER | Right IR / dock Middle distance |
10 | RIGHT_IRFAR_LEFT | Right IR / dock left |
11 | RIGHT_IRNEAR_RIGHT | Right IR / dock right near |
12 | RIGHT_IRNEAR_CENTER | Right IR / Dock Center Near |
13 | RIGHT_IRNEAR_LEFT | Right IR / Dock Sightseeing |
14 | CENTER_IRFAR_RIGHT | Central IR / dock far right |
15 | CENTER_IRFAR_CENTER | Central IR / Dock Central Distance |
16 | CENTER_IRFAR_LEFT | Central IR / dock left |
17 | CENTER_IRNEAR_RIGHT | Central IR / dock right near |
18 | CENTER_IRNEAR_CENTER | Central IR / Dock Center Near |
19 | CENTER_IRNEAR_LEFT | Central IR / Dock Sight-seeing |
20 | LEFT_IRFAR_RIGHT | Left IR / dock far right |
21 | LEFT_IRFAR_CENTER | Left IR / Dock Middle distance |
22 | LEFT_IRFAR_LEFT | Left IR / dock left |
23 | LEFT_IRNEAR_RIGHT | Left IR / dock right near |
24 | LEFT_IRNEAR_CENTER | Left IR / Dock Center Near |
25 | LEFT_IRNEAR_LEFT | Left IR / Dock Sightseeing |
26 | KOBUKI_DOCKED | Dock completed |
To receive these outputs, one InPort of RTC::TimedBooleanSeq type is required. In addition, one OutPort of TimedVelocity 2D type for outputting the movement speed command to Kobuki is required.
Basic profile | |
Component name | KobukiAutoMove |
Module overview | Kobuki auto move component |
Version | 1.0.0 |
Vendor name | AIST |
Activity | |
onInitialize, onFinalize, onActivated, onDeactivated, onExecute | |
Data port' | |
[in] bumper | |
Overview | sensor information true: obstacle detection (bumper contact, wheel fall, cliff detection) false: no obstacle |
Data type | TimedBooleanSeq |
Details | Data [0]: right bumper, data [1]: central bumper, ... data [7]: left cliff sensor (see table above) |
[out] targetVelocity | |
Overview | Speed vector of mobile robot |
Data type | TimedVelocity 2D |
Detail | vx: translation speed, vy: 0.0, va: angular velocity |
Unit | vx [m/s], va [rad/s] |
Using the above information as a clue, please create a simple component that will autonomously move Kobuki. If you are having trouble connecting components, please see Troubleshooting.
The speed command of Kobuki is TimedVelocity 2D type, which is also shown above, but has the following data structure.
struct Velocity2D { double va; // angular velocity [rad/s] double vx; // translation speed (forward) [m/s] double vy; // translation speed (lateral direction) [m/s] 0 for the opposite two-wheel type }; struct TimedVelocity2D { Time tm; Velocity2D data; };
In the opposed two-wheeled mobile robot, it is considered that vy is always 0.0, for example,
va = 0.0; vx = 0.2; vy = 0.0;
If you go backwards,
va = 0.0; vx = -0.2; vy = 0.0;
If it turns on the spot
va = 0.0; vx = 0.0; vy = 1.0;
If there is data to InPort, read the data and retrieve the bumper information. Bumper information is stored in a member of an array called .data of the data type TimedBoolSeq, and it can be seen that it is the 0th, 1st, 2nd element in the above table. If any of these are true, it means that a bumper has detected a collision, so once it gets down, it turns. And I will move forward again. If these movements are set to TimedVelocity 2D members and written to OutPort, speed command data will be transmitted to Kobuki. The algorithm flow chart is shown below.
It is ideal to control how much it goes down and goes down or turns or turns, but it is also possible to use the sleep function for the sake of simplicity. You can use coil::sleep on Linux
coil::sleep(coil::TimeValue(0.01); // Wait 10 ms
In Windows, coil::sleep has poor accuracy, so it is better to use the Sleep function. Based on these hints, please create a control component that makes Kobuki move autonomously
As an answer, the above TkJoyStick component and autonomous moving component are shown below.
Raspberry Pi is a single-board computer with an ARM processor developed by the Raspberry Pi Foundation in the UK.
The Raspberry Pi is very convenient because it runs normal Linux (Debian, Fedora, Arch Linux) and FreeBSD for ARM regardless of the size of the embedded board, and can also compile on the board. Currently, for the storage device, the SD card can be used. It is inexpensive and has a large capacity. Also, the main board price is very low, about 3,000 yen. Also, since basic I/O is provided and can be connected to various external devices, various applications such as robot control and measurement with sensors are conceivable.
The appearance of one type of Raspberry Pi is shown below.
The Raspberry Pi has three basic types (Model A, Model B, Model Zero), and there are multiple models for each basic type. Please refer to the following Wikipedia link for details.
The specifications of typical models are shown below.
CENTER:Specification | |||
3 Model B | 3 Model B + | 4 Model B (4G) | |
Target Price | $ 35 | $ 35 | $ 55 |
SoC | Broadcom BCM2837 | Broadcom BCM2837B0 | Broadcom BCM2711 |
CPU | ARM Cortex-A53 1.2GHz | ARM Coretex-A53 1.4GHz | ARM Coretex-A72 1.5GHz |
GPU | Broadcom VideoCore IV | Broadcom VideoCore VI | |
Memory (SDRAM) | 1GB (GPU sharing) | 4GB (GPU sharing) | |
USB 2.0 port | 4 (Integrated USB hub) | 4 | 2 |
USB 3.0 port | CENTER:- | 2 | |
Video output | Composite RCA (PAL & NTSC), HDMI (rev 1.3 & 1.4), MIPI DSI | Composite RCA (PAL/NTSC), micro-HDMI (up to 4kp60) 2.0 x 2, MIPI DSI | |
Audio output | 3.5mm jack, I2S, HDMI | 3.5mm jack, I2S, micro HDMI | |
Storage | SD memory card / MMC / SDIO card slot | ||
Network | 10/100 Mbps Ethernet (RJ45) | Gigabit Ethernet over USB 2.0 (maximum throughput 300Mbps) (RJ45) | Gigabit Ethernet (RJ45) |
Low-level peripherals | 8 × GPIO, UART, I2C, SPI and two chip select, + 3.3V, + 5V, ground | ||
Power supply | 2.5A (12.5W) | 3A (15W) | |
Power source | 5V/microUSB or GPIO | 5V/USB Type-C or GPIO | |
Size | 85.0mm x 56.5mm | 85.0mm x 56.0mm |
See the above Wiki for more details.
Using the I/O extension platform PiRT-Unit developed by AIST makes it possible to use external I/O relatively easily.
OpenRTM-aist (C++, Python, Java) can also be compiled and executed on the board, so even though it is an embedded board, it can be used in almost the same way as a normal Linux PC development process.
This section describes how to build an environment for developing and executing RT components with OpenRTM-aist, know-how for convenient use, how to control mobile robots, and how to use I/O.
This section explains installation of the execution environment for running RTC for Raspberry Pi (hereinafter referred to as RPI RTC).
The following installation procedure assumes Windows environment. If you are using a non-Windows environment please refer to the following site etc.
Here, we download the OS image from the Raspberry Pi official site and explain about various setups. The rough procedure to make OpenRTM available on Raspberry Pi is as follows.
In addition, since OpenRTM - aist installation and image where Kobuki component has already been installed are prepared here, the following procedure can be skipped.
The SD card you need is at least 2GB, but 4GB or more is required for actual use. Be sure to prepare an SD card of 4GB or more.
Download OS Raspbian "wheezy" for Raspberry Pi from the following site. Raspbian is a Debian-based Linux distribution for RaspberryPi.
Please unzip the downloaded file YYYY-MM-DD-wheezy-raspbian.zip. YYYY-MM-DD-wheezy-raspbian.img file of 2GB size should be expanded.
$ ls -al total 4752840 drwxr-xr-x 4 n-ando staff 136 5 18 13:30 . drwxr-xr-x 9 n-ando staff 306 5 18 13:30 .. -rw-r--r-- 1 n-ando staff 1939865600 2 9 12:44 2013-02-09-wheezy-raspbian.img -rwxr-xr-x 1 n-ando staff 493587826 5 7 21:08 2013-02-09-wheezy-raspbian.zip
If it can not be deployed successfully, the download may fail and the file may be broken. Please delete the corrupted file and try downloading again.
The expanded yyyy-mm-dd-hweezy-raspbian.img is called an image file, and the state of the disk started by Raspbian is extracted byte by byte from the beginning to the end of the disk. You can not use this file simply by copying it to SD card! !
Please write it to the SD card as described below.
In Windows, you can write images by using the tool called Win32 DiskImager. Download the image data writing tool Win32DiskImager binary from the following site.
Extract the downloaded file (win32diskimager-vX.X-binary.zip).
* Because Win32 DiskImager does not support double-byte characters, YYYY-MM-DD-wheezy-raspbian.zip decompresses to halfway pathname where double-byte characters and spaces are not included Please give me.
Insert the SD card used by Raspberry Pi into the PC and start Win32 DiskImager.
* Since SD card needs to be recognized as a drive, format it in FAT32 format beforehand
Specify the drive of the SD card in Raspbian image file (YYYY-MM-DD-wheezy-raspbian.img), "Drive" which decompressed to "Image File" and click "Write" button.
The preparation of the SD card is now complete. When writing is completed, install the SD card in the Raspberry Pi and turn on the power.
On Linux, you can read and write images using the dd command. The dd command is installed by default on most UNIX based operating systems.
After inserting the SD card, check the kernel message with the dmesg command.
$ dmesg : Omission [333478.822170] sd 3:0:0:0: [sdb] Assuming drive cache: write through [333478.822174] sdb: sdb1 sdb2 [333478.839563] sd 3:0:0:0: [sdb] Assuming drive cache: write through [333478.839567] sd 3:0:0:0: [sdb] Attached SCSI removable disk [333479.094873] EXT4-fs (sdb2): mounted filesystem with ordered data mode [333527.658195] usb 1-1: USB disconnect, address 2
From this message, check the device name of the SD card. In this example sdb seems to be the device name of the SD card. Let's look under/dev/.
ls -al /dev/sd* brw-rw---- 1 root disk 8, 0 May 7 17:28 /dev/sda brw-rw---- 1 root disk 8, 1 May 7 17:28 /dev/sda1 brw-rw---- 1 root disk 8, 2 May 7 17:28 /dev/sda2 brw-rw---- 1 root disk 8, 5 May 7 17:28 /dev/sda5 brw-rw---- 1 root disk 8, 16 May 18 14:19 /dev/sdb brw-rw---- 1 root disk 8, 17 May 18 14:19 /dev/sdb1 brw-rw---- 1 root disk 8, 32 May 18 14:19 /dev/sdc
Since sda is mostly a system disk, do not touch absolute.
Depending on the distribution, if there is a mountable file system in the SD card, there seem to be a case where it is mounted automatically. In that case, unmount the disk. (In Ubuntu, a folder of the file system mounted on the desktop appears, please remove it by right click, otherwise unmount with the umount command.)
dd if = Image file of = Device file of SD card bs = 1M Enter the command and execute it. However, since writing to the device file requires administrator (root) privilege, please use sudo.
$ unzip 2013-02-09-wheezy-raspbian.zip Archive: 2013-02-09-wheezy-raspbian.zip inflating: 2013-02-09-wheezy-raspbian.img $ sudo dd if=2013-02-09-wheezy-raspbian.img of=/dev/sdb bs=1M 1850+0 records in 1850+0 records out 1939865600 bytes (1.9 GB) copied, 201.543 s, 9.6 MB/s
During execution, you can check whether the writing is performed correctly by executing the iostat command on another terminal or the like. (In the latest distribution, it may not be installed by default.debian / ubuntu allows you to use the iostat command with apt-get install sysstat.)
$ iostat -mx 1 avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.00 50.25 0.00 49.75 Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 1.00 0.00 0.00 8.00 0.00 0.00 0.00 0.00 sdb 0.00 1856.00 0.00 78.00 0.00 9.14 240.00 143.40 1855.85 12.82 100.00
Looking at the item of sdb, we can see that the writing speed of 9.14 MB/sec has come up. If you have a speed of about 6 MB/sec for class 6 SD card and 10 MB/sec for class 10 SD card, you can think that it is being written without problem. Depending on distribution, it may be mounted automatically when writing is finished. In that case, please unmount and then remove the SD card.
Mac OS X also writes using the dd command like Linux. However, on Mac, it is mounted automatically when you insert an SD card, you can not write to the SD card with the dd command while mounting, you need to unmount (remove from OS).
When inserting the SD card, an SD card icon will appear in the Finder as shown. Please be careful not to push eject button as you intend to unmount.
The volume name of the SD card is Untitled here. Remember the volume name. When you enter the df command from the command prompt, the following message is displayed.
$ df -k Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on /dev/disk0s2 500000000 437664508 62079492 88% 109480125 15519873 88% / devfs 194 194 0 100% 679 0 100% /dev map -hosts 0 0 0 100% 0 0 100% /net map auto_home 0 0 0 100% 0 0 100% /home /dev/disk1s1 57288 18992 38296 34% 512 0 100% /Volumes/Untitled
The lowest /Volumes/Untitled is the mount point of the SD card. Remember the device name of the leftmost SD card /dev/disk1s1. Unmount this SD card. Use the command diskutil and enter diskutil umount <mount point>.
$ diskutil umount /Volumes/Untitled Volume (null) on disk1s1 unmounted $ df -k Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on /dev/disk0s2 500000000 437664716 62079284 88% 109480177 15519821 88% / devfs 194 194 0 100% 679 0 100% /dev map -hosts 0 0 0 100% 0 0 100% /net map auto_home 0 0 0 100% 0 0 100% /home
You can see that /Volumes/Untitled disappears and the SD card is unmounted. Then write the image using the dd command. dd if=image file of=/dev/rdisk1bs=1m. of=/dev/rdisk1 is the device name which takes the last s1 of the device file /dev/disk1s1 that you remembered earlier and also appended r to disk before the device is.
Since this command accesses the device file, it can not be executed unless it is an administrator (root). Execute as follows using sudo.
$ sudo dd if=2013-02-09-wheezy-raspbian.img of=/dev/rdisk1 bs=1m 1850+0 records in 1850+0 records out 1939865600 bytes transferred in 302.377337 secs (6415380 bytes/sec) $
While writing, you can see if the writing is performed correctly by looking at "Disk operation" in "Activity monitor". If you have a speed of about 6 MB / sec for class 6 SD card and 10 MB / sec for class 10 SD card, you can think that it is being written without problem.
When the writing is completed, it will automatically mount again, so press the eject button on the Finder this time to remove the SD card.
Please connect HDMI monitor, keyboard, network to Raspberry Pi.
After inserting the SD card and turning on the power to Raspberry Pi for the first time, the following setting screen (raspi-config) is displayed after the display screen of various drivers is displayed.
Note that raspi-config will not be displayed when operating from the PiRT-Unit serial console described below. You can initialize by logging in with the following user name and password and executing the raspi-config command.
Debian GNU/Linux 7.0 rtunit0 ttyAMA0 rtunit0 login: pi Password: Last login: Sat Feb 9 03:40:44 UTC 2013 on ttyAMA0 Linux rtunit0 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config' $ raspi-config
The contents of each item are shown below. Please set each item as necessary.
1 Expand Filesystem | Extend the partition of the SD card to be used.In the initial state, since you are not using the whole SD card, please extend it unless there is a particular reason. |
2 Change User Password | Change the password of the initial setting user "pi" Please change to the user's easy-to-understand password. |
3 Enable Boot to Desktop/Scratch | It is the setting of the screen at the time of starting, and the default is the console use. Set it if you want to change to GUI usage. |
4 Internationalisation Options | "Locale", "Time zone", "Keyboard layout" settings. |
I1 Change Locale | Set the locale, please set the keyboard layout to [ja_JP.ECU-JP ECU-JP] etc. If necessary, installation of Japanese fonts seems to be necessary. |
I2 Change Timezone | Set the time zone When using in Japan, set [Asia]-[Tokyo]. |
I3 Change Keyboard Layout Set the keyboard layout to match your keyboard | Make keyboard settings. Please set it as Japanese keyboard etc. as necessary. |
5 Enable Camera | Please set it when camera module is connected. |
6 Add to Rastrack | Registering with Rastrack |
7 Overclock | Overclocking |
8 Advanced Options | Other options. We will only cover items necessary for PiRT-Unit environment here. |
A6 SPI | To use SPI, set it to Enable. (Disable by default) |
A7 I2C | To use I2C, set it to Enable. (Disable by default) |
9 About raspi-config | Information about this tool is displayed. |
After setting the above items, please select [Finish] with [Tab] key and execute. Raspberry Pi main unit restarts, various settings become effective.
After rebooting, wait for command input and execute "startx", the Raspbian desktop screen will be displayed.
To terminate, please stop using the following command, then unplug the power from the main unit.
$ sudo halt
By inserting and setting a wireless LAN dongle in Raspberry Pi 's USB, you can wirelessize Raspberry Pi. It is convenient when installing it in a mobile robot.
First edit/etc/network/interfaces as follows.
$ sudo vi /etc/network/interfaces
Rewrite the following two places.
iface wlan0 inet manual ↓ iface wlan0 inet dhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf ↓ wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Next, register the ESSID and key of the wireless LAN.
$ sudo bash # cd /etc/wpa_supplicant # wpa_passphrase ESSID pass >> wpa_supplicant.conf
Enter the ESSID of the wireless LAN for SSID and the wireless LAN key for pass. Be careful to use >> (append) instead of > when redirecting. I think that the result is as follows.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="OpenRTM" #psk="4332221111" psk=142914b76be167767055ff945898baaaf83c42b3ad3b99afb0ae531e8fb15e5e }
Depending on the wireless LAN access point settings, additional configuration may be necessary. An example is shown below.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="OpenRTM" proto=WPA2 key_mgmt=WPA-PSK pairwise=TKIP CCMP group=TKIP CCMP #psk="4332221111" psk=142914b76be167767055ff945898baaaf83c42b3ad3b99afb0ae531e8fb15e5e }
Finally, initialize the interface.
# ifdown wlan0 # ifup wlan0 Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ : Omission DHCPREQUEST on wlan0 to 255.255.255.255 port 67 DHCPOFFER from 192.168.11.1 DHCPACK from 192.168.11.1 bound to 192.168.11.26 -- renewal in 34810 seconds.
If you can not connect to the wireless LAN here, please review the settings in /etc/network/interfaces, /etc/wpa_supplicant/wpa_supplicant.conf.
# ifconfig wlan0 wlan0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX inet addr:192.168.11.26 Bcast:192.168.11.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1218 errors:0 dropped:0 overruns:0 frame:0 TX packets:21 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:250608 (244.7 KiB) TX bytes:4506 (4.4 KiB)
Illegally, IP address was assigned to wireless LAN wlan0. 無事、無線LAN wlan0 に IPアドレスが割り振られました。
When you operate Raspberry Pi with remote login with ssh, if you do not allocate a fixed IP address, you usually need to consult the Raspberry Pi's IP address in the console and connect.
So install the service called avahi compatible with Bonjour. Bonjour is a service to automatically search and use services on the network advocated by Apple. If you use avahi, you can also access Raspberry Pi allocating IP address by DHCP by host name.
Select and set a host name that does not conflict with other host names.
$ sudo vi /etc/hostname
Write the host name in /etc/hostname in the first line. The initial value is raspberrypi. In addition, rewrite the portion of 127.0.1.1 raspberrypi in /etc/hosts to the host name you decided above.
$ sudo vi /etc/hosts
Install the avahi daemon with the following command.
$ sudo apt-get update $ sudo apt-get install avahi-daemon
I will try pinging my host. Use the host name followed by .local.
$ ping myhost.local
If ping is returned in this way, avahi is almost correctly set.
In order to access RaspberryPi with avahi set from PC, avahi or Bonjour must also be installed on the PC side.
On Linux, you can use it by installing avahi-daemon like RaspberryPi. Also Bonjour is installed by default on Mac, so you do not need to do anything in particular.
On Windows, Bonjour is not installed by default. The easiest way to install Bonjour is to install iTunes.
If you really do not want to install iTunes, you can also extract BonjourSetup.exe by unpacking the downloaded iTunesSetup.exe in an archiver application or the like.
Bonjour is also included in the following Apple Bonjour printing service. (The version seems to be slightly older than what is shipped with iTunes.)
Currently Applie does not distribute Bonjour for Windows alone, but there are also some sites redistributing things that were once distributed. (However, it seems that you can get only the old version.) Below are Bonjour download sites other than Apple site. Please use at your own risk.
Bonjour may not work well if the firewall is running. In that case, please open UDP port 5353 or turn off the firewall.
In order to login via ssh from Windows to RaspberryPi, you need to install the ssh client. There are many clients available on Windows, but here we introduce Tera Term.
After installing TeraTerm, when starting up, a connection dialog will appear. Enter the host name+.Local set earlier in the "Host" text box and press OK. If the password has not been changed,
You can login with. In addition, Linux and Mac open a terminal window
$ ssh pi@myhost.local
Since Raspberry Pi has no way to know the IP address etc. in the headless state (state where monitor and keyboard are not connected), it is a bit difficult to perform initial setting. It is possible to connect the monitor and the keyboard first, set the host name and know the IP address from the host name via Avahi as described above, but this method can not be used for Raspberry Pi which is not set at all .
xfinder is a tool for indexing and logging IP addresses from MAC (Media Access Control) addresses of Ethernet interfaces mounted on CPU boards such as Raspberry Pi and BeagleBone.
A 48-bit unique address (MAC (Media Access Control) address) is allocated to the Ethernet interface, and its high-order 24 bits are unique addresses of vendors (companies developing network devices, etc.). In Ethernet, it is necessary to know each other's MAC address in order to transmit and receive packets, and it is possible to use a protocol called ARP (Address Resolution Protocol) to check the MAC address from the IP address. In xfinder, by finding a pattern of a specific MAC address connected on the network, it is possible to check the IP address of a headless system such as Raspberry Pi, support login by ssh etc. to facilitate setting and development I will.
xfinder is an executable file which can be used as two types of command line tool (CUI mode) and graphical user interface tool (GUI mode). This section explains how to use xfinder in GUI mode.
You can download xfinder from the following location.
How to use xfinder is the following three steps.
When you start xfinder.exe, the following screen will be displayed.
First, designate the scanning conditions (interface, board, MAC address pattern etc.) in the upper left pane, start scanning, ② select the list of Raspberry Pi etc found by scanning the next, so select ③ In the lower left pane, specify the login conditions and start the terminal application. After the terminal application starts up, you can log in to the target Raspberry Pi and perform settings, program development and so on.
You can also start the terminal application and log in by double clicking the list of boards displayed in the right pane.
In Scan settings in the upper left corner, set conditions for scanning the network.
Select the network interface of the current PC to search for Raspberry Pi. When there are multiple network interfaces, since multiple IP addresses are displayed, it is important to know which network (for example, one is on the global side and the other on the private side network and Raspberry Pi in the private side network If you want to find it, select a private address here) Select whether to scan.
Select ALL to scan all network interfaces. If you do not know which IP address corresponds to which network interface, go to Control Panel → Network and Internet Network and Sharing Center → Change Adapter Settings Click on the adapter icon to see what kind of IP address is assigned.
You can also open the command prompt and execute the ipconfig command to check the interface and assigned IP address.
Choose which board to look for from the combo box. You can select Raspberry Pi or BeagleBone, by default Raspberry Pi is selected.
If you do not have the board you want to find in this list, you need to check the 6 digits above the MAC address of the corresponding network interface and enter it in the next Match Pattern text box to scan.
If you connect Raspberry Pi with a USB wireless LAN adapter and wireless LAN only, you can not find it even if you select Raspberry Pi here. Enter the 6 digits above the MAC address of the MAC address of the wireless LAN adapter (for example, 10: 6 f: 3 f in Buffaro) in the Match Pattern and search for it.
When looking for a board other than Raspberry Pi or BeagleBone, enter the pattern of the MAC address you want to search here.
Also, even if you install a wireless LAN adapter etc. in Raspberry Pi, it is possible to search by entering 6 digits on MAC address unique to the manufacturer. However, there are times when many wireless LAN adapters etc. of major manufacturers are discovered when scanning.
Press the Scan button to execute the scan. It can not be pressed during scanning. Press the Abort button if you want to quit while scanning is in progress. It can only be pressed during scanning. The progress bar under the button shows the progress of the scan.
The Found nodes pane on the right displays the IP address, MAC address and host name of the board found by scanning.
If you double click on the list displayed here, you can start the terminal application and log in according to the setting of Terminal launcher on the left.
The Terminal launcher pane on the left is used to log in to the found host using the terminal application.
Board type | User name | Password |
RaspberryPi | pi | raspberry |
BeagleBone | root | (no password) |
By installing the development environment on Raspberry Pi, it is possible to develop by self-compiling on Raspberry Pi. (On embedded Linux boards of this size, development by cross compiling is usually usual.)
Therefore, you can compile and execute the RT component code generated by RTC Builder on PC on Raspberry Pi. Unfortunately it seems difficult to install Eclipse and use it at practical speed.
In this section we will install the necessary packages to develop RT components.
OpenRTM-aist can be installed using apt-get. First, modify sources.list.
$ sudo vi /etc/apt/sources.list
Add the following line to source list.
deb http://openrtm.org/pub/Linux/raspbian/ wheezy main
Next, install according to the following procedure.
# apt-get update # apt-get -y --force-yes install gcc g++ make uuid-dev # apt-get -y --force-yes install libomniorb4-dev omniidl omniorb-nameserver # apt-get -y --force-yes install openrtm-aist openrtm-aist-dev openrtm-aist-example # apt-get -y --force-yes install openrtm-aist-python openrtm-aist-python-example
After installing OpenRTM-aist, start the sample component and check whether OpenRTM-aist was installed correctly.
As shown below, execute the name server and ConsoleOut component on the PC side with the name server and ConsoleIn component, Raspberry Pi side. By default, the component connects to the localhost name server, so you can use it to easily access the component without setting up a specific name server in rtc.conf. In the RTSystemEditor on the PC, connect to the PC's name server and the name server on Raspberry Pi and connect the ConsoleIn component and the ConsoleOut component.
After connecting to Raspberry Pi with TeraTerm etc., start the component. Launch ConsoleOut after starting the naming service.
$ rtm-naming $ /usr/share/OpenRTM-x.y/examples/ConsoleOutComp or $ python /usr/share/OpenRTM-x.y/examples/python/SimpleIO/ConsoleOutComp.py
When installing omniorb-nameserver above, omniORB naming service is started automatically at system startup. However, depending on the startup timing of the name service and startup timing of the network interface, it may not be able to access the name server correctly from the outside. In that case, you may be able to deal with the problem by restarting the name server with the rtm-naming command.
First, start the name server. In Windows, start from "Start Naming Service" under "OpenRTM-aist x.y" > "C++" > "tools" from the start menu. Also, start RTSystemEditor.
Next, start ConsoleIn. Click "ConsoleOut" under "OpenRTM-aist x.y" > "C++" > "examples" to start the ConsoleOut component.
Click the outlet icon in NameService View on the left side of RTSystemEditor and connect to the name server. First, connect to the name server of the local host. Enter localhost in the connection dialog.
Next, connect to the name server of Raspberry Pi. Click on the connection icon of NameService View again and enter the host name of Raspberry Pi+.local in the dialog.
The name service view shows the status of the two name servers and you should see two components, ConsoleIn0 and ConsoleOut0, under each name server. Click on the online editor icon (icon marked ON) on the RTSystemEditor menu bar to open SystemEditor. Drag and drop ConsoleIn0 and ConsoleOut0 from NameService View onto SystemEditor and connect InPort and OutPort respectively.
Click the green play button on the menu bar to activate the two components and to the state shown above.
Enter the appropriate number from the window of the ConsoleIn component on the PC side.
Then, the numerical value entered in ConsoleIn appears on the display of ConsoleOut on Raspberry Pi side as shown below.
Depending on the network environment and PC settings, the above procedure may not work. Please refer to the troubleshooting below and solve the problem.
In addition, if there are two or more network interfaces such as Raspberry Pi's wired LAN and wireless LAN etc., there are cases to resolve by using only one network used for connection with PC.
Also, if there are two or more network interfaces such as Raspberry Pi's wired LAN and wireless LAN, there are cases to solve by using only one network used for connection with PC.
Check the IP address of the PC with ipconfig from the command prompt and set the IP address of the one used for rtc.conf as follows.
corba.endpoints: 192.168.11.20
However, in Vista and later Windows, files below C:\Program Files can not be edited easily. Take action by copying (or newly creating) ConsoleIn.exe and rtc.conf in an appropriate directory such as C:\tmp.
corba.endpoints: 192.168.11.21
cmake can be installed using apt-get. Install as a user with root authority.
$ sudo apt-get update $ sudo apt-get install cmake
In the CMake-based RT component project, it is set to generate documents by using doxygen by default. However, installing doxygen will install LaTeX and others at the same time, which puts pressure on the capacity of the SD card, so we will not install Doxygen in this tutorial.
To suppress document generation by doxygen in CMake based RTC project, at the top level CMakeLists.txt,
option(BUILD_DOCUMENTATION "Build the documentation" ON) ↓ option(BUILD_DOCUMENTATION "Build the documentation" OFF)
Change it as follows.
If the SD card has enough capacity doxygen can be installed with apt-get as follows.
$ sudo apt-get install doxygen
It will take about ten minutes before Doxygen installation is complete.
It is recommended to install subversion / git because it is used frequently to acquire the source code from the outside.
$ sudo apt-get install subversion git
I will test whether the component can be compiled. There are components for mobile robot Kobuki in the following repository, so check it out and compile it.
Let's check out the source code.
$ svn co http://svn.openrtm.org/components/trunk/mobile_robots/kobuki : Omission A kobuki/libkobuki/doc/CMakeLists.txt A kobuki/libkobuki/License.rtf A kobuki/libkobuki/CMakeLists.txt A kobuki/rtc.conf A kobuki/CMakeLists.txt Checked out revision 2. $
kobuki directory How the source code has been checked out, create a build directory, build and install within it.
$ cd kobuki $ mkdir build $ cd build $ cmake -DCMAKE_INSTALL_PREFIX=/usr .. $ make $ cd src $ make install
kobuki directory How the source code has been checked out, create a build directory, build and install within it....
In the following example, using GPIO, you can create a component (DigitalIn-RTC, DigitalOut-RTC) that detects the ON/OFF of the switch and light up the LED and understand the use of GPIO which is the feature of Raspberry Pi I will deepen. The source code of the sample component can be downloaded from the following.
Raspberry Pi has a GPIO terminal, which allows you to use various external devices.
The pin assignment of the GPIO that is attached to the Raspberry Pi main unit is shown below.
When using GPIO, pay attention to the position of each pin, especially if using 5V terminal, mistake in wiring may damage the Raspberry Pi main unit and SD card, so be careful enough please.
Create a circuit that lights the LED and a circuit that detects ON/OFF of the switch. If you have a breadboard etc, you can easily build a circuit, but since there are few parts even if it is not, you can easily form a circuit by soldering lead wires etc. Below is a list of necessary parts.
Bill of Material | |
LED circuit | |
LED | 1piece |
Resistance | 100Ω(brown black tea gold) - 330Ω(orange orange tea gold) |
Lead wire | Somewhat |
Switch LED circuit | |
LED | 1piece |
Resistance | 330Ω(Orange Orange Tea) - 1kΩ(Brown Black Red Gold) |
Lead wire | Somewhat |
If there is only one Raspberry Pi, connect the following LED and switch circuit to the same Raspberry Pi. If there are two Raspberry Pi, it may be interesting to install LEDs and switches on each Raspberry Pi.
DigitalIn-RTC is a component that outputs the bool value (true/false) input to the data port to the specified GPIO port. In order to observe the output value of the GPIO port, connect the LED and resistor to the Ground pin and GPIO 18 pin and create a circuit as shown below.
This is the case when creating this circuit with breadboard.
DigitalOut-RTC is a component that outputs the bool value (true/false) input to the GPIO port from the data port. In order to input the value to GPIO, connect a resistor and a switch to Ground, 3.3V Power, GPIO 17 and create a circuit as shown below.
This is the case when creating this circuit with breadboard.
Download the source code to Raspberry Pi from below and compile the DigitalIn-RTC/DigitalOut-RTC component.
$ unzip RaspberryPi_sample.zip $ cd RaspberryPi_sample/DigitalInRPI/ $ vi CMakeLists.txt
Now rewrite CMakeLists.txt and set it to suppress document generation.
option(BUILD_DOCUMENTATION "Build the documentation" OFF) ↓ option(BUILD_DOCUMENTATION "Build the documentation" ON) $ mkdir build $ cd build $ cmake .. -- The C compiler identification is GNU 4.6.3 -- The CXX compiler identification is GNU 4.6.3 : Omission -- Configuring done -- Generating done -- Build files have been written to: /home/pi/RaspberryPi_sample/DigitalInRPI/build
If OpenRTM-aist is correctly installed, configure will terminate without problems. If an error occurs due to lack of OpenRTM or coil, please confirm that OpenRTM-aist (C++ version) is correctly installed (dpkg -l |grep openrtm etc.).
$ make : Omission Scanning dependencies of target DigitalInComp [ 66%] Building CXX object src/CMakeFiles/DigitalInComp.dir/DigitalInComp.cpp.o [100%] Building CXX object src/CMakeFiles/DigitalInComp.dir/DigitalIn.cpp.o Linking CXX executable DigitalInComp [100%] Built target DigitalInComp $
The compiled component DigitalInComp is under src.
$ ls src/ CMakeFiles cmake_install.cmake DigitalInComp DigitalIn.so Makefile
Compile like DigitalIn-RTC.
$ cd RaspberryPi_sample/DigitalOutRPI/ $ mkdir build $ vi CMakeLists.txt
Now rewrite CMakeLists.txt and set it to suppress document generation.
option(BUILD_DOCUMENTATION "Build the documentation" OFF) ↓ option(BUILD_DOCUMENTATION "Build the documentation" ON) $ mkdir build $ cd build $ cmake .. -- The C compiler identification is GNU 4.6.3 -- The CXX compiler identification is GNU 4.6.3 : Omission -- Configuring done -- Generating done -- Build files have been written to: /home/pi/RaspberryPi_sample/DigitalOutRPI/build
$ make -- OpenRTMConfig.cmake found. -- Configrued by configuration mode. : Omission Scanning dependencies of target DigitalOutComp [ 66%] Building CXX object src/CMakeFiles/DigitalOutComp.dir/DigitalOutComp.cpp.o [100%] Building CXX object src/CMakeFiles/DigitalOutComp.dir/DigitalOut.cpp.o Linking CXX executable DigitalOutComp [100%] Built target DigitalOutComp $
The compiled component DigitalOutComp is under src.
$ ls src/ CMakeFiles cmake_install.cmake DigitalOutComp DigitalOut.so Makefile
Once each RTC has been successfully compiled, start up each RTC after launching NameServer.
$ rtm-naming $ sudo /home/pi/RaspberryPi_sample/DigitalOutRPI/build/src/DigitalOutComp & $ sudo /home/pi/RaspberryPi_sample/DigitalInRPI/build/src/DigitalInComp &
&color(red){Since the sample component uses GPIO, it must be executed with root authority.} &color(red){※サンプルコンポーネントは GPIO を利用するので root 権限で実行する必要があります。}
Launch RTSystemEditor on PC and connect to NameServewr on Raspberry Pi. After placing each RTC, connecting between the ports, activate.
When each RTC starts normally, the LED turns on/off according to the status of the takt switch.
This Book explains how to combine Raspberry Pi and PiRT-Unit from OpenRTM-aist.
PiRT-Unit is an IO expansion board for Raspberry Pi developed at AIST. It is on sale from Win electronics industry.
You can use AD (4ch), DA (2ch), PWM (1ch), I2C (1ch), RS232C/XBee (1ch) from PiRT-Unit respectively.
Raspberry Pi extended IO board | |
AD converter | 10bit, 4ch & br; chip: ADC104S021 sampling 200kHz |
DA converter | 12bit, 2ch & br; chip MCP4822 |
PWM output | 1ch, for RC servomotor drive photo coupler insulation |
RS232C | D-SUB 9 pin connector Switch with XBee and jumper |
XBee | XBee connection connector XBee: Digi International made Zigbee module Switch with XBee and jumper |
Power supply input | 5V DC input Supply power to Raspberry Pi Power supply from Raspberry Pi also works |
Academic SCARA robot is a horizontal articulated robot arm for robot control learning that Viston sells.
Academic scalar For RTC of robot control please refer to the following page.
This chapter explains the procedure to fix the academic SCARA robot to Kobuki's plate.
Name | Quantity |
Kobuki | 1unit |
Plate | 1sheet |
Support pillar (5cm) | 8pcs |
Academic SCARA robot | 1unit |
Wood screw (2cm or more) | 4pcs |
Academic SCARA robot specification | |
Degree of freedom | 4 degrees of freedom + hand |
Servo motor | RS304MD |
Communication method | HID USB - UART bridge |
I will explain the procedure to attach the SCARA robot directly to the plate.
First of all, I will puncture a hole in the plate etc. Please drill a hole at the position of the red dot below.
I will explain how to attach the SCARA robot to the base and fix the base to the plate.
In order to fix it to the plate of Kobuki, a hole is made in the base of the SCARA robot. Please drill a hole in the red part of the figure below. Please decide the size of the hole by the size of the wooden screw to be used.
First attach the SCARA robot to the base. After installing in the opposite direction as shown in the figure, secure with urea screw.
Please prepare a pilot hole in the plate beforehand with dust etc. It is completed by inserting the wooden screw in the part where the hole of the foundation was opened and joining with the plate with the screw.
First of all, I will prepare four posts for Kobuki. Please adhere to Kobuki with laser range sensor, Raspberry Pi with double sided tape etc etc.
In this chapter, we will explain the procedure for installing the 4 degree of freedom robot arm sold by sign smart to Kobuki.
Please refer to the following page for RTC of 4 degree of freedom robot arm control.
The necessary items for this work are as follows.
Name | Quantity |
Kobuki | 1unit |
Plate | 1sheet |
Support pillar (5 cm) | 8pcs |
4 degrees of freedom robot arm | 1unit |
Arduino Uno | 1unit |
Jumper code | 15 or more |
Breadboard | 1sheet |
Battery compartment single 3x4pcs | 1pc |
AA battery | 4pcs |
Wood screw (2cm or more) | 4pcs |
When controlling from Intel Edison, Raspberry Pi, it is possible to use a servo driver equipped with PCA 9685
CENTER: Specification of 4 degrees of freedom robot arm | |
Degree of freedom | 4 degrees of freedom |
Servomotor | MG995, SG90 9G |
Processing to here is unnecessary because the 4-degree-of-freedom robot arm has a hole for mounting from the beginning.
It is the same as procedure of academic scalar robot.
By setting SSH to be effective on Raspberry Pi setting screen (Raspi-config), sFTP can be used.When connecting to Raspberry Pi with sFTP from Windows, software supporting sFTP (WinSCP etc. )Use the.
Here to the WinSCP download page.
Install the VNC server to operate Raspbian's GUI environment on the development PC.
You can download VNC from here.
$ su # apt-get install tightvncserver
During installation, you will be prompted to enter a password to connect to the VNC server, so set an appropriate password. After installing the VNC server, SSH connection to Raspberry Pi using the terminal from the development PC and start up the VNC server.
$ vncserver :1 -geometry 1024x600 -depth 16 -pixelformat rgb565
When connecting to VNC server from Windows, use VNC client software (such as RealVNC).