Player driver for Khepera 3 K-Team SA, J. Tharin versions 1.0 2008.10.03 : first version 1.1 2008.11 : added missing kh3-plugin-20081003.tar.bz2 1.2 2008.11.26 : added player build instructions 1.3 2009.03.16 : corrected odometry, added details for Wifi instructions 1.4 2009.07.13 : - removed amplitude selection for US sensors because the Khepera 3's dspic was patched - updated usage: A) 6) 1.5 2009.12.14 : updated ftp folders (due to the split for the Korebot 2) You will find the instructions about the driver Player-Stage for Khepera 3. 3 Parts are available: A) Installing the compiled version and usage B) Modifying and rebuilding the driver of Player C) Rebuilding the player server for Khepera3 (for example adding a build-in driver) A) ============= Installing and using Player on the Khepera =============================== required : - linux 2.6 - player 2.1.1 - Khepera 3 with Korebot, Kernel 2.6 - from the binaries directory: (http://ftp.k-team.com/KheperaIII/player_stage/korebotLE/binaries/) KheperaIII.cfg KheperaIII.so libltdl3_1.5.10-r3_armv5te.ipk libstdc++6_4.1.1-r16_armv5te.ipk player_2.1.1-r0_armv5te.ipk 1) Establish a network connection with the Khepera 3 either by wifi or with the serial cable: i) Using a Wireless compact flash card a) insert a Wireless compact flash card in the Korebot b) load the module by typing: modprobe pxa2xx_cs You may load the Wifi module automatically by adding pxa2xx_cs in the file /etc/modules. You can use the following command echo to add the module name to the file: echo pxa2xx_cs>>/etc/modules c) for configuring the Wifi network I) WEP support a) for configuring the wifi connection, type: iwconfig wlan0 essid YOUR_SSID_OF_NETWORK b) if the network is secured, enter the key by typing : iwconfig wlan0 key YOUR_KEY c) then set an ip address to the korebot: ifconfig wlan0 YOUR_IP_ADDRESS d) configure the gateway by entering the gateway ip: route add default gw YOUR_GATEWAY_IP wlan0 e) insert the local domain name in /etc/resolv.conf echo search YOUR_LOCAL_DOMAIN_NAME>> /etc/resolv.conf f) and the dns server echo nameserver YOUR_DNS_SERVER_IP_ADDRESS>> /etc/resolv.conf You can also create a file in /etc/network/if-pre-up.d named wireless to have these settings saved and put the following into it: #!/bin/sh ifconfig wlan0 up iwconfig wlan0 essid YOUR_SSID_OF_NETWORK iwconfig wlan0 key s:YOUR_KEY ifconfig wlan0 YOUR_IP_ADDRESS route add default gw YOUR_GATEWAY_IP wlan0 and the following in a file named /etc/resolv.conf: search YOUR_LOCAL_DOMAIN_NAME nameserver YOUR_DNS_SERVER_IP_ADDRESS II) WEP, WPA and other encryptions: a) create a file named /etc/wpa_supplicant/wpa_supplicant.conf and insert your selected wireless encryption: WEP: #Shared WEP key connection (no WPA): network={ ssid="YOUR_SSID" key_mgmt=NONE wep_key0="YOUR_WEP_KEY" auth_alg=SHARED wep_tx_keyidx=0 priority=5 } WPA-TKIP: - see instructions at : http://ftp.k-team.com/korebot/kernel/modules/wpa-tkip/wpa-tkip_support.txt #/etc/wpa_supplicant/wpa_supplicant.conf #with WPA-PSK TKIT: network={ ssid="YOUR_SSID" psk="YOUR_PASS_KEY" key_mgmt=WPA-PSK group=TKIP pairwise=TKIP proto=WPA priority=5 } You can check the following link for other encryptions: http://hostap.epitest.fi/wpa_supplicant/ b) run the daemon controlling the wireless connection with the following command: wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -Dwext -B You can also add the command above to a file in /etc/network/if-pre-up.d named wireless: #!/bin/sh ifconfig wlan0 up ifconfig wlan0 YOUR_IP_ADDRESS route add default gw YOUR_GATEWAY wlan0 wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -Dwext -B ii) connect to the Khepera3 using the network through an usb connection a) launch the usb module : modprobe g_ether b) connect the computer to the Khepera3 USB slave port with an USB cable c) configure the usb port on the Khepera3: ifconfig usb0 10.0.0.2/24 d) on the computer, configure also the usb port (you must be root, or use sudo): ifconfig usb0 10.0.0.1/24 2) Copy and install the 3 following packages on the korebot: command for copying: scp FILE root@KHEPERA_IP_ADDRESS:/home/root installation procedure : ipkg install PACKAGE_NAME files: libstdc++6_4.1.1-r16_armv5te.ipk libltdl3_1.5.10-r3_armv5te.ipk player_2.1.1-r0_armv5te.ipk If there is not enough free space, delete each package after installation. 3) Copy KheperaIII.so and KheperaIII.cfg on the korebot 4) On the KoreBot, launch the server: player KheperaIII.cfg 5) On the computer in a terminal, export the library path and launch the viewer (player 2.1.1 must be installed on the computer): export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH playerv -h IP_ADDRESS_OF_THE_ROBOT --ir:0 --position2d:0 --sonar:0 --power:0 6) You can drive the robot I) either with the playerv interface : Go to "Devices/Position2d" and select "Command" A red cross appears on the robot. You can move it to drive the robot. II) or with "playerjoy": - the keyboard: playerjoy IP_ADDRESS_OF_THE_ROBOT - a standard joystick connected: playerjoy -speed 1.0 -turnspeed 90 -dev /dev/input/js0 IP_ADDRESS_OF_THE_ROBOT B ) ============ Modifying and rebuilding the driver for Player on the Khepera 3 from source ======= required : - linux 2.6 with the cross-compiler (http://ftp.k-team.com/korebot/toolchain-2.6-betaV0.1) - Khepera 3 with Korebot, Kernel 2.6 from the source directory: (http://ftp.k-team.com/KheperaIII/player_stage/korebotLE/sources/) khepera3toolbox-2008-05-05.zip khepera3toolbox.diff libtool1.5.10_lib.tar.bz2 player2.1.1_include.tar.bz2 player2.1.1_lib.tar.bz2 player_driver_dev.tar.bz2 kh3-plugin-2009.07.13.tar.bz2 1) Extract the 3 following files in the root directory (you must be root). These files are installed in the cross-compiler: command: tar -xjvf file.tar.bz2 -C / files: player2.1.1_include.tar.bz2 player2.1.1_lib.tar.bz2 libtool1.5.10_lib.tar.bz2 2) Extract the player_driver_dev.tar.bz2 file and enter into it, il will be your base directory: tar -xjvf player_driver_dev.tar.bz2 Modify KTEAM_HOME variable in the env.sh to point this directory 3) Extract the khepera toolbox in the base directory: unzip khepera3toolbox-2008-05-05.zip 4) In the toobox directory, patch the toolbox : patch -p1 < khepera3toolbox.diff 5) Source the env.sh file to have access to the cross-compiler source env.sh 6) Compile the following modules of the toolbox: i2cal khepera3 odometry_goto odometry_track # cd Modules/i2cal # make ... 7) Extract kh3-plugin-2009.07.13.tar.bz2 in the base directory 8) In kh3-plugin directory, compile by running the command : make Verify the Makefile, if there is any problem. 9) Then transfer the files KheperaIII.so and KheperaIII.cfg to the Korebot. See A) for usage. C ) ============ Rebuilding the player server for Khepera3 ========================= required : - full development tools of korebot 2.6: (see http://ftp.k-team.com/korebot/toolchain-2.6-betaV0.1/full_toolchain/ development_toolchain_full_version_2.6_readme.txt) - Khepera 3 with Korebot, Kernel 2.6 - bitbake recipe player-oe.tar.bz2 1) Install the full development tools for korebot 2.6, if not already done. (see http://ftp.k-team.com/korebot/toolchain-2.6-betaV0.1/full_toolchain/development_toolchain_full_version_2.6_readme.txt) 2) Extract the recipe player-oe.tar.bz2 in /usr/local/korebot-oetools-1.0 You can modify it to add a build in driver, by example urglaser: Edit the variable EXTRA_OECONF in the file /usr/local/korebot-oetools-1.0/custom/packages/player/player_2.1.1.bb: EXTRA_OECONF = "--disable-alldrivers --enable-urglaser" 3) Compile player ./start-build.sh build player 4) The output packages will be in /usr/local/korebot-oetools-1.0/build/tmp/deploy/glibc/ipk/armv5te/libstdc++6_4.1.1-r16_armv5te.ipk /usr/local/korebot-oetools-1.0/build/tmp/deploy/glibc/ipk/armv5te/libltdl3_1.5.10-r3_armv5te.ipk /usr/local/korebot-oetools-1.0/build/tmp/deploy/glibc/ipk/armv5te/player_2.1.1-r0_armv5te.ipk 5) Copy and install the packages, as decribed in A)