Home
Trademark Acknowledgments: Legal Notice:
Contents
1. 4 4 1 Bluetooth communication with Kheperalll 4 4 2 Bluetooth communication with KoreBot IJ 44 4 Khepera3served ccnn 4 4 5 Bluetooth communication on Linux Khepera III manual ver 3 3 Table Of Contents 5 9 1 Testing a simple interactio en Se ee ee I nas sad ad II wes tae da a a AAA a as ia VETO TREC Tee TT ere Stokes eh ee Perera ee er EMT ede S big MEN RR TH E E EA Bina kee ese 6 3 17 kmot ConfigurePID 6 3 18 kmot_SetSpeedProfild 6 8 19 kmot_SetPoint 6 3 20 kmot GetMeasurd A Communication protoco B Warranty Khepera III manual ver 3 3 31 31 32 33 33 35 35 36 42 42 43 43 44 45 45 46 46 47 47 47 48 48 48 49 49 49 50 50 50 51 59 1 INTRODUCTION 1 1 How to Use this Manual This manual is introducing the Khepera III robot For a quick start and overview of the robot s functions please read chapter 1 to 4 Refer to the following summary if a particular information is needed If the manual does not cover a particular problem many more technical doc umentation is available online from K Team website http www k team com and especially a Frequently Asked Question document to solve most common problems and questions Unpacking and Inspection Khepera s package description The robot and its accessories Khepera
2. I INCPATH L LIBPATH lkorebot tinclude lt korebot korebot h gt static knet_dev_t dsPic static knet_dev_t moti static knet_dev_t mot2 motor position factor define PULSE_TO_MM_FIRMWARE_S_3 0 04629 for version lt 3 0 define PULSE_TO_MM_FIRMWARE_BE_3 0 03068 motor speed factor define MM_S_TO_SPEED_FIRMWARE_S_3 144 01 for version lt 3 0 define MM_S_TO_SPEED_FIRMWARE_BE_3 218 72 display bar length for sensor define IR_BAR_LEN 15 int main float fpos long lpos rpos char Buffer 100 bar 11 IR_BAR_LEN 5 int sensors 11 i n revision version short index value char usvalues 5 long motspeed float pulsestomm PULSE_TO_MM_FIRMWARE_S_3 if version of the mot lt 3 0 float mmstospeed MM_S_TO_SPEED_FIRMWARE_S_3 if version of the mot lt 3 0 kh3_init Khepera III manual ver 3 3 37 6 Robot programming open various socket and store the handle in their respective pointers dsPic knet open Khepera3 dsPic KNET BUS I2C O NULL moti knet open Khepera3 moti KNET_BUS_I2C O NULL mot2 knet_open Khepera3 mot2 KNET_BUS_I2C 0 NULL initialize the motor controler 1 kmot_SetMode moti kMotModeldle kmot SetSampleTime moti 1550 kmot SetMargin moti 6 kmot_SetOptions moti OxO kMotSWOptWindup kMotSWOptStopMotorBlk kMotSWOptDirectionInv kmot ResetError moti kmot_SetBlockedTime moti 10
3. kmot ConfigurePID moti kMotRegSpeed 620 3 10 kmot ConfigurePID moti kMotRegPos 600 20 30 kmot SetSpeedProfile moti 15000 30 initialize the motor controler 2 kmot_SetMode mot2 kMotModeldle kmot_SetSampleTime mot2 1550 kmot_SetMargin mot2 6 kmot Set ptions mot2 0x0 kMotSWOptWindup kMotSWOptStopMotorBlk kmot_ResetError mot2 kmot_SetBlockedTime mot2 10 kmot ConfigurePID mot2 kMotRegSpeed 620 3 10 kmot ConfigurePID mot2 kMotRegPos 600 20 30 kmot SetSpeedProfile mot2 15000 30 get revision if kh3_revision char Buffer dsPic version Buffer 1 Buffer 2 lt lt 8 revision Buffer 3 Buffer 4 8 printf WrYn c 4 4u 44 4u gt Version u Revision 4u r n Buffer 0 version revision version revision change motor speed and position factor if version lt 3 pulsestomm PULSE_TO_MM_FIRMWARE_S_3 Khepera III manual ver 3 3 38 6 Robot programming mmstospeed MM_S_TO_SPEED_FIRMWARE_S_3 else pulsestomm PULSE_TO_MM_FIRMWARE_BE_3 mmstospeed MM_S_TO_SPEED_FIRMWARE_BE_3 get battery voltage if kh3 battery voltage char Buffer 0 dsPic printf r nic 43 3u 3 3u gt battery voltage Zu uV r n Buffer 0 Buffer 1 Buffer 2 lt lt 8 Buffer 3 Buffer 4 8 Buffer 1 Buffer 2 lt lt 8 Buffer 3 Buffer 4 lt lt 8 For ever loop while 1 1 Wait 2 second
4. Return nothing 6 3 20 kmot_GetMeasure Call long kmot GetMeasure knet dev t hDev int regtype Function get motor speed or position Parameter hDev is a handle to an opened knet socket Khep era3 dsPic regtype type of position to get kMotRegPos for posi tion kMotRegSpeed for speed Return position or speed Khepera III manual ver 3 3 50 A COMMUNICATION PROTOCOL This communication protocol allows complete control of the robot functions through a RS232 serial line The required configuration is presented in section 4 3 The serial line set up on your host computer must match the one set on the robot according to the chosen running mode The protocol is made of commands and responses all in standard ASCII codes A command is sent from the host computer to the robot it is starting with an upper case character and followed if necessary with numerical or literal parameters separated with comma and terminated by a line feed The response is sent by the robot to the host computer it is starting with the same character that was initiating the command but using lower case and followed if necessary with numerical or literal parameters separated with comma and terminated by a line feed Xn and a carriage return M When a command ask for a value bigger than 8 bits bigger than 255 the following prefixes must be added d for a 16 bits value smaller than 32768 and bigger or equal than 32768 1 for a 3
5. II Khepera III manual ver 3 3 23 4 3 4 3 This 4 Connections Configuration for Communication in slave mode with KoreBot II 1 Serial link configuration allows communicating between the KoreBot II plugged on the robot and a host computer through a serial link In this configuration it is not possible to communicate with the robot base itself as explained in the previous chapter T he host computer is linked to the interface module using a standard RS232 line The adaptation RS232 TTL is made on the KoreBot II To use the serial communication mode please make sure the following are correct A KoreBot II is connected on the Khepera III The charged Battery or a power supply is plugged and the robot is turned ON The robot must be connected to a KoreConnect module using the serial cable The KoreConnect should be connected to the host computer using a standard RS232 cable in this mode the cable has to be connected on the DB9 connector number 1 see fig 4 2 You can easily purchase such a cable from your host computer dealer Serial port configured as followed 115200bps 8 Data bits 1 stop bit no parity no hardware control RS232 cables 2 KoreConnect Figure 4 2 Connection when the robot is used with a KoreBot II Khepera III manual ver 3 3 24 4 Connections 4 3 2 USB link This configuration allows communicating
6. LEDs two for the battery charger one for the Power ON one for the state of the motors controller and two pro grammables by the end user see figure 3 2 When the Motor controller state LED is on one of the two motor con troller is in error mode This could append when a motor is blocked or a current limit is detected In this case the controller must be reset by the dsPIC M command in serial interface mode or call initKH3 in a KoreBot II program For the battery charger the red one indicates that charge is in progress and the green one signals when the charge is complete If there s no battery pack when you plug an external power supply the green one will turn on The led 5 and 6 can be set by the user with K command See annexe A Serial communication protocol Figure 3 2 LEDs of the Khepera III Motor Controllers state LED redD Power ON LED green Charge completed LED green Charge in progress LED red Programmable LED green Programmable LED red ano FF WN orn Khepera III manual ver 3 3 8 3 The Robot and Its Accessories 3 1 4 Serial connector The serial connector contains various serial lines One serial line which is at TTL level 0V 4 5V is used to connect a personal computer to the Khepera III dsPIC with a KoreConnect Used only when there is no KoreBot II connected Please see section There is another RS232 10V 10V used to communicate with the Kore
7. OF WARRANTY NEG LIGENCE OR OTHERWISE SAVE THAT NOTHING HEREIN SHALL LIMIT EITHER PARTY S LIABILITY FOR DEATH OR PERSONAL IN JURY ARISING FROM ITS NEGLIGENCE NEITHER PARTY SHALL HAVE ANY LIABILITY TO THE OTHER FOR INDIRECT OR PUNI TIVE DAMAGES OR FOR ANY CLAIM BY ANY THIRD PARTY EX CEPT AS EXPRESSLY PROVIDED HEREIN Khepera III manual ver 3 3 61
8. are coming from kmot h of the korebot library 6 3 1 kh3 init Call int kh3 init void Function initializes some things like the GPIO40 pin This function needs to be called BEFORE any other functions Parameter none Return lt 0 on error 0 on success Khepera III manual ver 3 3 42 6 Robot programming 6 3 2 kh3_configure_os Call int kh3_configure_os char outbuf unsigned char index un signed char value knet dev t hDev Function configures the current firmware operation mode a configu ration array is used by the khepera3 to decide its mode of operation Parameters outbuf is a buffer where the data will be stored on index is the index pointing one of the configuration word in the config array See paragraph C Configure the current firmware operation in Annexes for details value is the value to store in the configuration array See paragraph C Configure the current firmware op eration in Annexes for details hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame 6 3 3 kh3_proximity_ir Call int kh3_proximity_ir char outbuf knet dev t hDev Function retrieves an instant IR measure Parameters outbuf is a buffer where the data will be stored on Where the sensor i outbuf i 2 1 outbuf i 2 2 lt lt 8 iis 0 10 in the sensor order back left left 90 left
9. battery Units 1V 0 1mV 1 Read the current of the battery Units 1A 0 1mA 2 Read the battery Average Current Units 1A 0 1mA 3 Read the battery Absolute Remaining Capac ity Units 1mAh 4 Read the Temperature of the battery Units 1 C 0 1 C 5 Read the battery Relative Remaining Capacity Units hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame 6 3 6 kh3_reset_tstamp Call int kh3_reset_tstamp char outbuf knet_dev_t hDev Function resets the absolute timestamp Parameters outbuf is a buffer where the data will be stored on in this case the only answer to expect is z which is a ack hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame Khepera III manual ver 3 3 45 6 Robot programming 6 3 7 kh3_revision Call int kh3_revision char outbuf knet_dev_t hDev Function retrieves the current OS version revision Parameters outbuf is a buffer where the data will be stored on hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame 6 3 8 kh3 measure us Call int kh3_measure_us char outbuf unsigned char usnbr knet_dev_t hDev Function retrieves measure from a given US transm
10. battery_measure_unit battery measure decimal 0 Read the voltage of the battery Units 1V 0 1mV 1 Read the current of the battery Units 1A 0 1mA 2 Read the battery Average Current Units 1A 0 1mA 3 Read the battery Absolute Remaining Capacity Units 1mAh 4 Read the Temperature of the battery Units 1 C 0 1 C 5 Read the battery Relative Remaining Capacity Units W Reserved Khepera III manual ver 3 3 57 A Communication protocol X Binary read Command X Answer 65 bytes 1 byte x char 22 bytes proximity sensor 22 bytes proximity ambient light sensor 8 bytes motor speed 8 bytes motor position 4 bytes time stamp 1 byte line feed n 1 byte carriage return r Effect read sensors in binary mode Y Unused Z Zero the relative time stamp Command Z Answer Z Effect Reset the relative time counter Khepera III manual ver 3 3 58 B WARRANTY Z K TEAM warrants that the Khepera III is free from defects in materials and workmanship and in conformity with the respective specifications of the product for the minimal legal duration respectively one year from the date of delivery Upon discovery of a defect in materials workmanship or failure to meet the specifications in the Product during the afore mentioned period Cus tomer must request help on K Team Internet forum on http www k team com forum by detailing the version of the Khepera III the programming enviro
11. between the KoreBot II plugged on the robot and a host computer through a USB link There are two ways to connect the USB to the KoreBot II With a KoreConnect and standard USB cable or with only a mini USB cable For more information about the USB communication protocole with a KoreBot II please refer to the KoreBot II documentation found on web site www k team com To use the USB communication mode please make sure the following are correct A KoreBot Il is plugged on the Khepera III The charged battery or a power supply is plugged and the robot is turned ON The robot must be connected to a KoreConnect module and then a USB cable or a mini USB cable is plugged directly on the USB miniAB connector of the robot see figure 3 1 The USB cable standard or mini should be connected to the host computer These two type of cable can be easily purchased from any computer dealer Khepera III manual ver 3 3 25 4 Connections 4 4 Bluetooth Communication A Bluetooth device is mount on every KheperallI with the firmware 2 0 or bigger The device is a WT12 from BlueGiga has the I Wrap license and is configured by AT command The device is completely configured for a cable replacement for the KheperalII But can be used with the KoreBot II too when plugged on the KheperallI Then the bluetooth connection will be available via the serial port dev ttyS1 of the KoreBot II The configuration is the following 115200bps data r
12. com Khepera III manual ver 3 3 10 3 The Robot and Its Accessories 3 1 7 How to plug a KoreBot II The Khepera III has been designed to work together with a KoreBot II but as it isn t mandatory in the default pack there is no KoreBot II with the robot You can buy it at the same time in this case the KoreBot II will be mounted into the robot But if you buy it afterward you must first unmount the upper body of the Khepera III then plug the KoreBot II on the extansion connectors see figure 3 5 If you have any other extansion KoreIO KoreSound KoreVision etc you must only remove the black metal plate and plug your extension on the KoreBot II 1 Korebot II 3 Remove the battery of the Khepera III and an len a EK the screw of its cover 5 Put the cover of the Khepera III and screw it 6 Insert the upper part of the Korebot II Figure 3 5 Details of the KoreBot II assembly Khepera III manual ver 3 3 11 3 The Robot and Its Accessories 3 2 Motors and motor control Before reading this section please look at the firmware version of your Khep eralll Since the firmware version 3 0 the gear of the motors have changed 3 2 1 Kheperalll with a firmware 3 0 or greater Each wheel is moved by a DC motor coupled with the wheel through a 65 6 1 reduction The motor itself having a 41 1 reduction and the gear box having a 1 6 1 reduction The motor has its own embedded incremental encoder placed on the
13. flat and safe surface The battery switch must be OFF A terminal emulator should be running on the host computer Make sure the terminal is connected to the correct serial port The termi nal configuration must be set to 115200 Baud 8 bit 1 start bit 1 stop bit no parity and no hardware control When powered on the robot should send a message see fig 5 1 to the terminal emulator To test that the KheperallI is able to receive command try to send the B command to ask the Khepera for the operating system version and revision r File Edit View Terminal Tabs Help Khepera3 OS Battery Pac Front extens Master OS mode 2C Has been initialised as i Right motor F Satior Protocol Figure 5 1 Boot message of the Khepera III Khepera III manual ver 3 3 31 5 2 5 Serial Communication Mode Testing the secondary serial link As the robot is suited to be used with a KoreBot II it is important to test the serial link between the host computer and the KoreBot II itself Make sure all connections are correct see chapter 4 for details The robot should be placed on a flat and safe surface The battery switch must be OFF A KoreBot II needs to be plugged on the appropriate socket A terminal emulator should be running on the host computer Make sure the terminal is connected to the correct serial port The termi nal configuration must be set to 115200 Baud 8 bit 1 start bit 1 stop bit no parity and no hard
14. removing the upper body Each measure return the number of founded echos the distance in cm of each echo the amplitude of each and the time time stamp when the echo was seen The value returned by the command is the white noise measured before than a Ultrasonic pulse was sent Then the real amplitude of each echo will be its amplitude minus the white noise See command G in chapter A for more details about the ultrasonic command For more details about the ultrasonic sensor please check at Midas com ponent the transceiver is 400ST100 and the receiver is a 400SR100 5 J 1 UE Pe r Y 4 PON 7 Figure 3 10 Position of the 5 UltraSonic sensors Khepera III manual ver 3 3 20 3 The Robot and Its Accessories 3 5 Battery The Khepera III is equipped with a battery pack composed of two Li Ion Polymer element This provides a 7 4V volt battery with a 1400 mAH capacity Using its embedded power the robot is able to run completely autonomously during more than four hours running with a basic configu ration When additional equipment are used the autonomy is reduced as Khepera s extensions as the KoreBot II rely on Khepera s batteries as a power source There is no specific power management system on the Khepera When the batteries voltage falls under 6V the battery cut himself the power supply to avoid a too important discharge of the cell Users can implement their own software power management system to handle Ko
15. 2 bits value f for a floating value Example to set the Speed D 120000 120000 To better understand this protocol please refer to the following simple test Set the connection configuration presented in section 4 3 Start a terminal emulator on your host computer with the serial line set to 115200 Baud 8 bit data 1 start bit 1 stop bits no parity Type the capital letter B followed by a carriage return or a line feed The robot must respond with b followed by an indication of the version of software running on the robot and terminated by a line feed Type the capital letter N followed by a carriage return or a line feed The robot must respond with n followed by 11 numbers separated by a comma and terminated by a line feed These numbers are the values of the proximity sensors presents on the robots Retry the same command N putting some obstacles on the front of the robot The response must change Try other commands Khepera III manual ver 3 3 51 A Communication protocol A Start Braitenberg mode Command A mode 8 bits Answer a Effect Start the Braitenberg mode with the Infrared sensor mode 0 or with the ultrasonic sensor mode 1 To stop the Baintenberg mode send the A 2 command Syntax A O B Read software version Command B Answer b version_of_BIOS revision of BIOS Effect Give the software version stored in the robot s EEPROM C Configure the current firmwar
16. 45 front left front right right 45 right 90 back right back ground right ground left A time stamp can be obtained with outbuf 19 outbuf 20 8 outbuf 21 outbuf 22 8 16 hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame Khepera III manual ver 3 3 43 6 Robot programming 6 3 4 kh3 ambiant ir Call int kh3_ambiant_ir char outbuf knet_dev_t hDev Function retrieves an instant IR measure Parameters outbuf is a buffer where the data will be stored on Where the sensor i outbuf ix 2 1 outbuf i x 2 2 lt lt 8 iis 0 10 in the sensor order back left left 90 left 45 front left front right right 45 right 90 back right back ground right ground left A time stamp can be obtained with outbuf 19 outbuf 20 lt lt 8 outbu f 21 outbu f 22 lt lt 8 lt lt 16 hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame Khepera III manual ver 3 3 44 6 Robot programming 6 3 5 kh3 battery voltage Call int kh3_battery_voltage char outbuf unsigned char argu ment knet dev t hDev Function retrieves the actual battery voltage Parameters outbuf is a buffer where the data will be stored on argument parameter of the command 0 Read the voltage of the
17. 5 Serial Communication Mode The robot must start turning on place and respond with d and a line feed To stop the robot type the protocol command D 10 10 followed by a carriage return or a line feed Try other commands following the description given in Appendix A Khepera III manual ver 3 3 34 6 ROBOT PROGRAMMING m The robot cannot be directly programmed but an optional Korebot 2 board that can be plugged into the robot See sections 6 2 and 6 3 below You can also use any software that can access the serial port like Mat lab See following section 6 1 for Matlab programming The serial protocol is in Appendix A 6 1 Matlab programing The serial commands and protocol are explained in Appendix A You can see below a small Matlab script example connecting to serial port COM getting robot version and US sensors data configure serial port and open it S serial COM5 BaudRate 115200 fopen s empty serial input buffer Khepera3 boot message if s BytesAvailable fread s s BytesAvailable end get Khepera3 BIOS version and revision fprintf s B out fscanf s 4 should return b VERSION REVISION where VERSION and REVISION are 2 numbers configure all US fprintf s C 0 d31 out fscanf s for 1 echo only fprintf s C l dl 4 out fscanf s get data of US sensors for i 1 5 Khepera III manual ver 3 3 35 6 Robot programming fprintf s sprint
18. Bot II ie to see the KoreBot II s boot message Please see section 4 3 It is also possible to use the USB link of the KoreConnect to communicate with the KoreBot II The length of the serial cable should be limited to two meters for proper operation 1 Korebot RXD 7 USB D 2 Korebot TXD 8 USB D 3 dsPIC RXD 11 GND 4 dsPIC TXD 12 GND 6 VCC 5V IA SIS O Figure 3 3 Details of the Khepera III serial connector Pin 5 9 amp 10 are not connected Khepera III manual ver 3 3 9 3 The Robot and Its Accessories 3 1 5 Cable unroller connector The cable unroller connector is a serial and a power connector see fig ure 3 4 You can supply your robot and communicate with the robot through it This connector is usefull if you want to supply your robot with an external power supply 9V and keep its mobility with an cable un roller However if you want to recharge your battery at the same time it is mandatory to use the power jack connector 1 VCC 9V 4 GND 2 dsPIC RXD 5 GND 3 dsPIC TXD 6 GND 135 246 Figure 3 4 Details of the cable unroller connector 3 1 6 USB connector The mini USB connector is usefull only when a KoreBot II is plugged in the Khepera III You can connect directly your PC to the Khepera III with an ordinary mini USB cable To communicate with the KoreBot II through the USB connector please refer to the documentation of the KoreBot II found on the web site www k team
19. Documentation Author F Lambercy and J Tharin for K Team S A chemin des Plans Praz CH 1337 Vallorbe Switzerland email info k team com Url www k team com Documentation Version e 3 3 29 03 2012 J Tharin added Matlab instructions kh3 server cor rected errors e 3 2 15 12 2011 J Tharin added khepera3 C functions documentation e 1 0 01 09 2006 F Lambercy and G Caprari first version TRADEMARK ACKNOWLEDGMENTS Matlab MathWorks Corp IBM PC International Business Machine Corp Khepera K Team and LAMI LEGAL NOTICE e The content of this manual is subject to change without notice e All effort have been made to ensure the accuracy of the content of this manual However should any error be detected please inform K Team S A e The above notwithstanding K Team can assume no responsibility for any error in this manual Khepera III manual ver 3 3 1 TABLE OF CONTENTS 1 Introductio 1 1 How to Use this Manua 1 2 Safety Precautio 2 Unpacking and Inspectio 3 The Robot and Its Accessories 31 The Khepera I Robo 02 3 1 1 Overview ee 3 1 2 ON OFF Battery Switc neo Pu AME E aes de en ee 3 1 7__How to plug a KoreBot II MA o ad poe daa de e Bey ee 3 8 1 Ambient light measurements 4 1 Configuration for batteries chargd 4 2 Configuration for Communication in standalond
20. Hardware overview and main functions and accessories description Connections detailed cables connections for various usage Serial Communication mode detailed description for the Serial com munication mode between a computer and the robot 1 2 Safety Precaution Check the unit s operating voltage before operation It must be identical with that of your local power supply The operating voltage is indicated on the nameplate at the rear of the power supply All connnections including extension addition or disconnection must be made when the robot and the interface are switched OFF Otherwise damages can occur Switch OFF the robot if you will not use it for more than a day Disconnect the power supply removing it from the wall socket Do not manually force any mechanical movement Avoid to force by any mechanical way the movement of the wheels or any other part If you have any question or problem concerning the robot please contact your local Khepera dealer Khepera III manual ver 3 3 4 1 Introduction 1 3 Recycling Think about the end of life of your robot Parts of the robot can be recycled and it is important to do so It is for instance important to keep batteries out of the solid waste stream When you throw away a battery it eventually ends up in a landfill or municipal incinerator These batteries which contain heavy metals can contribute to the toxicity levels of landfills or incinerator ash By recycling
21. IC has direct control on the motor power through a double H bridge and can read the pulses of the incremental encoder The motor control block acts as slave devices on the I2C bus When the KoreBot II is not connected to the Khepera III robot the main robot CPU will turns itself into an i2c master When the KoreBot II is connectedm it becomes the i2c master Each motor controller switches its motor ON and OFF at a given fre quency and during a given time By this way the motor react to the time average of the power supply which can be modified by changing the period the motor is switched ON This means that only the ratio between ON and OFF periods is modified as illustrated in figure 3 6 This power control method is called pulse width modulation PWM The PWM value is defined as the time the motor is switched ON basic period 50us ON period gt power basic period gt ON ON period F time time Figure 3 6 The Pulse Width Modulation PWM motor supply mode is based on a ratio between the ON time and the total time The basic switch ing frequency is constant Khepera III manual ver 3 3 13 3 The Robot and Its Accessories Each motor controller can perform the control of the speed or the position of the motor setting the correct PWM value according to the real speed or position read on the incremental encoders Both DC motors can be controlled by a PID controll
22. LEN 1 sprintf bar i gt 33 dC IR_BAR_LEN 1 else sprintf bar i 33 dC gt 33 dC IR BAR LEN 1 n n J printf n near far nback left 4 4u s nleft 90 4 4u s nleft 45 4 4u s nfront left 44 4uN 4sNnfront right 44 4u s nright 45 4 4u s nright 90 h4 4u 4sNnback right 4 4u s nback 4 4u s nbottom right 44 4uN 4sNnbottom left 44 4u s ntime stamp 4 lu r n sensors 0 bar 0 sensors 1 bar 1 sensors 2 bar 2 sensors 3 bar 3 sensors 4 bar 4 sensors 5 bar 5 Khepera III manual ver 3 3 40 6 Robot programming sensors 6 bar 6 sensors 7 bar 7 sensors 8 bar 8 sensors 9 bar 9 sensors 10 bar 10 Buffer 19 Buffer 20 8 Buffer 21 Buffer 22 lt lt 8 lt lt 16 configure us sensors index 0 value 31 all us sensors active if kh3 configure os char Buffer index value dsPic printf r n US sensors configured NrNn else printf NrXnconfigure OS error r n get and print us sensors for i 0 i lt 5 i if kh3_measure_us char Buffer i 1 dsPic usvalues i Buffer 0 8 3 Buffer 0 8 4 lt lt 8 else printf r ng error printf US sensors distance cm nleft 90 3d nleft 45 3d nfront 43dNnright 45 3d nright 90 3d n usvalues 0 usvalues 1 usvalues 2 usvalues 3 usvalues 4 while This source code can be cross compiled using arm
23. ON and the green led is switched OFF The process is reversed at the end of the charging process The charging time for an empty battery is about 180 minutes At this moment the power supply can be unplugged When charging the battery can be as hot as 40 degrees Khepera III manual ver 3 3 22 4 Connections 4 2 Configuration for Communication in standalone This configuration allows communicating between the robot and a host com puter through a serial link The host computer is linked to the interface module using a standard RS232 line while the interface module converts RS232 signal into a TTL level signal to communicate with the robot To use the standalone serial communication mode please make sure the following are correct No KoreBot II is connected on the Khepera III The robot battery is charged that means the power led is switched on The robot must be connected to a KoreConnect module using the serial cable The KoreConnect should be connected to the host computer using a standard RS232 cable in this mode the cable has to be connected on the DB9 connector number 2 see fig I T You can easily purchase such a cable from your host computer dealer Serial port configured as followed 115200bps 8 Data bits 1 stop bit ho parity no hardware control RS232 cables 2 KoreConnect Figure 4 1 Connection when the robot is used without a KoreBot
24. Syntax G 3 Example g 1 27 2900 100000 0 0 0 0 0 0 0 0 0 0 0 0 1800 H Configure the PID controler Command H T 16bits Kp 16bits Ki 16bits Kd 16bits Answer h Effect Set the proportional Kp the integral Ki and the deriva tive Kd parameters of the T regulator where T can be 0 speed controler or 1 position controler Syntax H d1 d200 d5 d10 I Set position Command I position motor left 32bits position motor right 32bits Answer i Effect Set the 32 bit position counter of the two motors The unit is the pulse each one corresponds to 0 047 mm with old firmware 0 031 mm with new firmware with encoder reso lution x4 default see section 3 2 3 Syntax 1 11000 11000 Khepera III manual ver 3 3 54 A Communication protocol J Configure the speed profile controller Command J max speed 16bits acceleration 8bits Answer j Effect Set the speed and the acceleration for the trapezoidal speed shape of the position controller The max_speed parameter indicates the maximal speed reached during the displace ment See section 3 2 3 for more details At the reset these parameters are set to standard values max_speed to 20000 acc to 64 Syntax J d15000 10 K Set Programmable Led Command K LED 8bits State 8bits Answer k Effect Set the state of the two Programmable Leds see section Led 5 amp 6 LED select which one must be set 0 led 5 1 Led 6 State select t
25. a III manual ver 3 3 59 B Warranty any such software is provided AS IS unless expressly provided for in any enclosed software limited warranty Please refer to the End User License Agreements included with the Product for your rights with regard to the licensor or supplier of the software parts of the Product and the parties respective obligations with respect to the software This limited warranty is non transferable It is likely that the contents of Customer s flash memory will be lost or reformatted in the course of the service and K TEAM will not be responsible for any damage to or loss of any programs data or other information stored on any media or any part of the Product serviced hereunder or damage or loss arising from the Product not being available for use before during or after the period of service provided or any indirect or consequential damages resulting therefore IF DURING THE REPAIR OF THE PRODUCT THE CONTENTS OF THE FLASH MEMORY ARE ALTERED DELETED OR IN ANY WAY MODIFIED K TEAM IS NOT RESPONSIBLE WHATEVER CUS TOMER S PRODUCT WILL BE RETURNED TO CUSTOMER CON FIGURED AS ORIGINALLY PURCHASED SUBJECT TO AVAILABIL ITY OF SOFTWARE Be sure to remove all third parties hardware software features parts options alterations and attachments not warranted by K TEAM prior to Product service K TEAM is not responsible for any loss or damage to these items This warranty is limited as set out herein
26. and does not cover any con sumable items such as batteries supplied with the Product any accessory products which is not contained in the Product cosmetic damages damage or loss to any software programs data or removable storage media or dam age due to 1 acts of God accident misuse abuse negligence commercial use or modifications of the Product 2 improper operation or maintenance of the Product 3 connection to improper voltage supply or 4 attempted repair by any party other than a K TEAM authorized module service facility This limited warranty does not apply when the malfunction results from the use of the Product in conjunction with any accessories products or an cillary or peripheral equipment or where it is determined by K Team that there is no fault with the Product itself K TEAM EXPRESSLY DISCLAIMS ALL OTHER WARRANTIES THAN STATED HEREINBEFORE EXPRESSED OR IMPLIED INCLUDING Khepera III manual ver 3 3 60 B Warranty WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABIL ITY AND FITNESS FOR A PARTICULAR PURPOSE TO THE FULLEST EXTENT PERMITTED BY LAW Limitation of Liability IN NO EVENT SHALL EITHER PARTY BE LIABLE TO THE OTHER FOR ANY INDIRECT SPECIAL INCIDEN TAL OR CONSEQUENTIAL DAMAGES RESULTING FROM PERFOR MANCE OR FAILURE TO PERFORM UNDER THE CONTRACT OR FROM THE FURNISHING PERFORMANCE OR USE OF ANY GOODS OR SERVICE SOLD OR PROVIDED PURSUANT HERETO WHETHER DUE TO A BREACH OF CONTRACT BREACH
27. angstrom linuz gnueabi gcc which supports most standard gcc options Open a terminal in your de velopment folder as installed with the toolchain see Korebot 2 User manual chapter 4 2 2 Then run the folowing commands source env sh arm angstrom linux gnueabi gcc kh3test c o k3test Khepera III manual ver 3 3 Al 6 Robot programming I INCPATH L LIBPATH lkorebot L LIBKOREBOT _ROOT build korebot 2 6 lib lkorebot The last command with arm angstrom linux gnueabi gcc is in one line ending with Ikorebot An kh3test executable file should be created that can be executed on the KoreBot II or eventually another arm linux machine To execute the program simply copy kh3test to the nfs shared direc tory then execute it from a KoreBot II terminal If the shared directory is mounted on the default mnt nfs first change working directory cd mnt nfs Then check that kh3test is present ls 1 And execute it k3test 6 3 Functions available The functions available for the Khepera III are listed below They are a subset of the libkorebot library The whole API description can be found there http ftp k team com KorebotlI software common libkorebot api html index html For the include files you just to use this one Zzinclude lt korebot korebot h gt Below the functions are described The function names starting with kh3_ are coming from kb khepera3 h and the other starting with kmot_
28. ate 8 data bits no parity one stop bit no hardware flow control connection securised security code is 0000 4 4 1 Bluetooth communication with KheperalII Here a procedure as example to etablish a Bluetooth communication between Kheperalll and a PC and how to validate the connection with a terminal example for WinXp No KoreBot II must plugged on the KheperallI for this case First connect your Bluetooth dongle to your PC if necessary Check if your system recognize your dongle and then install the driver If you have Bluetooth integrated in your laptop just activate it Verify that your connection is securised and that a COM port is reserved for the Bluetooth serial communication Menu Bluetooth Advanced Configuration Client Application Check if your KheperalII is correctly powered Led green ON Start a device research View device in range The KheperalII must appear with a PDA logo and the name KHIII SerialNumber The Serial Number is the same as the label on the bottom Create a connection with the Kheperalll your program will ask you for a security code then enter 0000 Your program assign a COM port to your device Open a terminal with the assigned COM port and the correct config uration as above Try to read the IR sensor value or another command see chapter A to validate the communication Then you can use any other program which used a COM port like Matlab to remote co
29. e operation Command C array_index 8bits array_value 16bits Answer c Effect Configure the actual firmware state The configuration array is to be seen as a table Each line in the table means a parameter and a value may be associated with Syntax C 0 d3 Index Default Value Description 0 0b00000100 Decide how many US sensor will be active See the table bellow for supported configurations 1 3 Decide the maximum echo numbers 2 0 Not Used 3 0 Not used 4 OxFFFF IR sensor mask manage the active IR sensor bitO IRO bit IRI etc 5 12 IR gain for Braintenberg 6 1 Upper body mounted If the upper body isn t mounted change this value to O to get better US measure Khepera III manual ver 3 3 52 A Communication protocol The supported US sensors configuration are listed in the following table Mask NONE JSIONLY JS20NLY JS3ONLY JS4ONLY JS5ONLY s1TO2 S2TO3 S3TO4 S4TO5 SITO3 S2TOA JS3TO5 JS1TO4 JS2TO5 SALL ake 4 GC CG Gee Cee E EEE Binary Decimal Description 0b00000000 0 None of the US sensor 0b00000001 1 Only the US sensor 1 0b00000010 2 Only the US sensor 2 0500000100 4 Only the US sensor 3 0b00001000 8 Only the US sensor 4 0b00010000 16 Only the US sensor 5 0500000011 3 US sensor 1 to 2 0500000110 6 US sensor 2 to 3 0b00001100 12 US sensor 3 to 4 0b00011000 24 US sensor 4 to 5 0500000111 7 US sensor 1 to 3 0b00001110 14 US sensor 2 to 4 0b00011100 28 US sens
30. er Every term of this controller Proportional Integral Derivative is associated to a constant setting the weight of the corresponding term Kp for the proportional Ki for the integral Kd for the derivative The motor controller can be used in two control modes the speed or position mode The active control mode is set according to the kind of command received If the controller receives a speed control command it switches to the speed mode If the controller receives a position control command the control mode is automatically switched to the position mode Different control parameters Kp Ki and Kd can be set for each of the two control modes Khepera III manual ver 3 3 14 3 The Robot and Its Accessories 3 2 3 Speed Used in speed mode the controller has as input a speed value of the wheels and controls the motor to keep this wheel speed The speed value is a division of a constant value by the time between encoder pulsations In default mode encoder resolution x4 and postscaler 1 4 a measure is made four times every pulse Then each revolution of the wheel 4198 measures are made firmware 3 0 or greater or 2764 measures Old firmware The constant value is defined by the maximum time multi plied by 256 OxFFFF 256 16 776 960 This operation allows a better PID calculation for the lower speed 16 776 960 Motor Speed ASS Timer5bvalue To convert into a real time use the following calc
31. f G d i fscanf s end close port and delete variable fclose s delete s clear s 6 2 Example of source code This section explain how to write a simple program for the KoreBot II to control the Khepera III base The Khepera III will act as peripheral of the KoreBot II Please refer to the KoreBot II user manual found on http ftp k team com KorebotII UserManual for further details on KoreBot II programming This document only provides a basic example of program compilation and execution The functions specific to the Khepera III are described in the next sec tion The first simple executable for KoreBot II Khepera III will be built assuming A working arm linux toolchain is installed on your host computer The NFS link is active and a shared directory mySharedDirectory is mounted on mnt nfs A source file should be first created and edited with a very simple C program such as the following People familiar with the KoreMotor will notice that the code is quite similar The controllers have been embedded in the robot but act as two I2C slaves file kh3test c brief This is an application example for the Khepera3 Nauthor Julien Tharin K Team SA Khepera III manual ver 3 3 36 6 Robot programming note Copyright C 2012 K TEAM SA bug none discovered todo nothing compile with command arm angstrom linux gnueabi gcc kh3test c o kh3test
32. ght conditions Objects color materials and surfaces do have an influence on the sensors response Moreover as any sensor IR sensors are subject to environmental noise For all these reasons graphics below are given for information only and should not be considered as references 6 e n 0 2 I Gre Relative Collector Current o 0 0 2 4 6 8 10 12 14 16 96 11766 d Distance to Reflecting Card mm Figure 3 9 Relative collector current vs distance Khepera III manual ver 3 3 19 3 The Robot and Its Accessories 3 4 Ultrasonic sensors In its base set 5 sensors are placed around the robot and are positioned and numbered as shown in figure 3 10 5 sensors are in fact 5 pairs of ultrasonic devices where each pair is composed of one transmitter and one receiver The ultrasonic sensor are powered by a 20 Vdc source The nominal frequency of these transducers is 40kHz 1kHz Parameters such as max number of echo timeout and active sensors are parametrizable through a configuration api See C command in chapter A By default you have maximum 3 echos sensor 3 front is active timeout is set to see from 20cm to 4 meters The last parameter is if the upper body is mounted or not default mounted When the upper body is mounted there s some noise because of inside rebound echo which are deleted in software In fact you could improve the detection of the nearest obstacles 20cm to 40cm
33. he motor blicked time Parameter hDev is a handle to an opened knet socket Khep era3 dsPic time time before detecting that the motor is blocked by default 10 Return nothing 6 3 17 kmot_ConfigurePID Call void kmot_ConfigurePID knet dev t hDev int regtype int16 t Kp int16_t Kd int16 t Ki Function configure the motor PID Parameter hDev is a handle to an opened knet socket Khep era3 dsPic regtype kMotRegSpeed for speed control kMotRegPos for position control Kp proportional factor default speed position 620 600 Kd derivative factor default speed position 3 20 Ki integral factor default speed position 10 30 Return nothing Khepera III manual ver 3 3 49 6 Robot programming 6 3 18 kmot_SetSpeedProfile Call void kmot_SetSpeedProfile knet_dev_t hDev int maxspeed int acceleration Function configure the motor speed profile Parameter hDev is a handle to an opened knet socket Khep era3 dsPic maxspeed maximum speed to reach acceleration to use Return nothing 6 3 19 kmot SetPoint Call void kmot SetPoint knet dev t hDev int regtype long set Point Function set motor speed or position Parameter hDev is a handle to an opened knet socket Khep era3 dsPic regtype type of regulation kMotRegPosProfile for po sition using profile kMotRegSpeed for speed setPoint speed or position command to reach
34. he operation 0 OFF 1 ON 2 Change state Syntax K 0 1 L Set speed open loop Command L speed motor left 32bits speed_motor_right 32bits Answer Effect Set the speed of the two motors without a PID controller Where a value of 1023 correspond to PWM of 100 Syntax L 1500 1500 M Init Motors Command M Answer m Effect Initialise or reset the motor controllers Must be used if an error like motor blocked or current limit occured Khepera III manual ver 3 3 55 A Communication protocol N Read proximity sensors Command N Answer n val sens back left val sens left 90 val sens left 45 val sens front left val sens front right val sens right 45 val sens right 90 val_sens_back_right val_sens_back val_sens_ground_right val_sens_ground_left time_stamp Effect Read the 12 bit values of the 11 proximity sensors The last argument is the relative time stamp of the measure in ms section 3 3 from the front sensor situated at the left of the robot turning clockwise to the back left sensor O Read ambient light sensors Command O Answer n val_sens_back_left val sens left 90 val sens left 45 val sens front left val sens front right val sens right 45 val sens right 90 val_sens_back_right val_sens_back val_sens_ground_right val_sens_ground_left time_stamp Effect Read the 12 bit values of the 11 light sensors section 3 3 1 from the front left sensor turning clock
35. ith Bluetooth Warning making an error in the file etc inittab may prevent the board booting please modify carefully 4 4 4 Khepera3 server For running Khepera3 Interface http ftp k team com Kheperalll applications Interface Khepera3 Setup Vi 1 port com zip or any other program responding to A Z commands defined in chapter A if the Korebot 2 installed you must run the application kh3server on the Khepera III manual ver 3 3 27 4 Connections Korebot2 Follow the intructions below to install configure and run the server Get the server from here http ftp k team com Kheperalll applications kh3 server tar bz2 connect to the korebot2 mounted on your Khepera3 edit the file etc inittab and comment line 1 2345 respawn sbin getty 115200 ttyS1 by adding a comment char in the beginning of the line WARNING The line may not be present if the Korebot was shipped alone Don t comment any other line Pay attention to comment the right line Making any error in this file may prevent the board booting reboot your Khepera3 command reboot configure your Bluetooth to connect to the Khepera3 as mentioned in chapter 4 4 1 copy kh3server to the Korebot 2 make it executable with chmod x kh3server run it with kh3server connect Khepera3 interface or any other program and run A Z com mands as usual to stop it push CTRL and c keys 4 4 5 Bluetooth communication
36. itter Parameters outbuf is a buffer where the data will be stored on usnbr is a number of the us to read 1 to 5 hDev is a handle to an opened knet socket Khep era3 dsPic Return lt 0 on error gt 0 on success returns should be the size of frame Normally an end user don t want to use these two functions below as they are assumed as low level functions Khepera III manual ver 3 3 46 6 Robot programming 6 3 9 kh3 getcommand Call int kh3_getcommand knet_devt hDev unsigned char out Function gets a command frame from a given khepera3 device Parameter hDev is a handle to an opened knet socket Khep era3 dsPic out is a pointer to a buffer where the command frame will be stored on Return lt 0 on error gt 0 on success returns should be the size of frame 6 3 10 kh3 sendcommand Call int kh3 sendcommand knet dev t hDev unsigned char in Function sets a command frame to a given khepera3 device Parameter hDev is a handle to an opened knet socket Khep era3 dsPic in is a pointer to a buffer where the command frame to be sent is stored on Return lt 0 on error gt 0 on success returns should be the size of frame 6 3 11 kmot_SetMode Call void kmot_SetMode knet dev t hDev int mode Function sets a command frame to a given khepera3 device Parameter hDev is a handle to an opened knet socket Khep era3 dsPic mode mode type sho
37. motor axis gives 16 pulses per revolution of the motor This allows a resolution of 1049 6 per revolution of the wheel that corresponds to 82 pulses per ten millimeter of path of the robot diameter of the wheel 41m m thus each revolution the robot make 128 8mm By default the robot is set in mode encoder resolution x4 in this case for each wheel revolution the controller motor make 4198 measures The other encoder configuration mode is 2x 1382 measures turn Reminder 1 revolution 128 8mm 4198 measures 3 2 2 Kheperalll with an older firmware Each wheel is moved by a DC motor coupled with the wheel through a 43 2 1 reduction T he motor itself having a 27 1 reduction and the gear box having a 1 6 1 reduction The motor has its own embedded incremental encoder placed on the motor axis gives 16 pulses per revolution of the motor This allows a resolution of 691 2 per revolution of the wheel that corresponds to 54 pulses per ten millimeter of path of the robot diameter of the wheel 41mm thus each revolution the robot make 128 8mm By default the robot is set in mode encoder resolution x4 in this case for each wheel revolution the controller motor make 2764 measures The other encoder configuration mode is 2x 1382 measures turn Reminder 1 revolution 128 8mm 2764 measures Khepera III manual ver 3 3 12 3 The Robot and Its Accessories Each motor is driven by its own motor controller implemented in a PIC18F4431 The P
38. n and a maximal speed Using this values the controller accelerates the wheel until the maximal speed is reached and decelerates in order to reach the target position This movement follows a trapezoidal speed profile as described in figure 3 3 BA max_speed acc acc d time S de E ZA a target position start position time Figure 3 7 Speed profile to reach a target position with a fixed acceleration acc and maximal speed max speed The input values and the control mode of this controller can be changed at every moment The controller will update and execute the new profile in the position mode or control the wheel speed following the new value in the speed mode First configure the speed profile J command with the needed param eters Then you can perform a move with the position profile mode F command See annexe A for more details about communication protocole Khepera III manual ver 3 3 17 3 The Robot and Its Accessories 3 3 Infra red Proximity sensors Khepera III hase nine sensors placed around the robot and two placed on the bottom The latters allow experiments like line following They are positioned and numbered as shown in figure Figure 3 8 Bottom view of the IR sensors These sensors embed an infra red light emitter and a receiver For de tailed description please refer to the manufacturer s datasheet The eight sensors are TCRT5000 reflective optical sensors f
39. nication the host computer is acting as a master and the Khepera as slave All communications are initiated by the master Two different types of interactions are possible The first set of inter actions is used to set up the robot configuration from the host computer set up serial line changing controllers configuration the second set of interactions is used to control the robot controlling motors reading sensors value A set of commands is available as detailed in appendix 5 3 1 Testing a simple interaction Testing some basic commands is the best method to understand the serial protocol and tools available on the Khepera Using a properly configured serial link between the robot and a computer please follow the instructions bellow Type the capital letter B followed by a carriage return or a line feed The robot must respond with b followed by an indication of the version of software running on the robot and terminated by a line feed Type the capital letter N followed by a carriage return or a line feed The robot must respond with n followed by 11 numbers separated by a comma and terminated by a line feed These numbers are the values of the robot proximity sensors presented in section 3 1 6 Retry the same command N putting some obstacles in front of the robot The response must change Type the protocol command D 110000 1 10000 followed by a carriage return or a line feed Khepera III manual ver 3 3 33
40. nment of the Korebot II if mounted standard version OS the standard use of Product before the appearance of the problem the description of the problem If no answers have been received within two working days Customer can contact K TEAM support by phone or by electronic mail with the full reference of its order and Korebot II serial number K TEAM shall then at K TEAM s sole discretion either repair such Product or replace it with the equivalent product without charging any technical labor fee and repair parts cost to Customer on the condition that Customer brings such Product to K TEAM within the period mentioned before In case of repair or replacement K TEAM may own all the parts removed from the defective Product K TEAM may use new and or recondi tioned parts made by various manufacturers in performing warranty repairs and replacement of the Product Even if K TEAM repairs or replaces the Product its original warranty term is not extended This limited warranty is invalid if the factory applied serial number has been altered or removed from the Product This limited warranty covers only the hardware and software compo nents contained in the Product It does not cover technical assistance for hardware or software usage and it does not cover any software products contained in the Product K TEAM excludes all warranties expressed or implied in respect of any additional software provided with Product and Kheper
41. ntrol your KheperalII Khepera III manual ver 3 3 26 4 Connections 4 4 2 Bluetooth communication with KoreBot II The procedure will be the same as above but with a KoreBot II plugged on the KheperallII Create a Bluetooth a connection with the Kheperalll as explained above To validate the communication connect a KoreConnect to the Kore Bot II see section 4 3 Log on the KoreBot II login root password none push RETURN key open a minicom on the KoreBot II minicom s dev ttyS1 Configure your terminal as describe above and select the dev ttyS1 device Now the KoreBot II can send received information to from the PC via Bluetooth 4 4 3 Log On the KoreBot II with a Bluetooth connection There s a way to use the dev ttyS1 Bluetooth serial Port to log on the KoreBot II To do this you need to modify the inittab file in the directory etc of the KoreBot II as following modified by default if the KorebotII is shipped with a robot Log on the KoreBot II with a KoreConnect login root password none push RETURN key Open the etc inittab files with command vi etc inittab In the end of the files you will see this line S 2345 respawn sbin getty 115200 ttySO Modify it to S0 2345 respawn sbin getty 115200 ttySO And add this line below 1 2345 respawn sbin getty 115200 ttyS1 Save and close the file Then in the next restart you will be able to log on your KoreBot II w
42. on Linux For using Bluetooth communication with the Khepera3 Linux Ubuntu follow the instructions below Install the Linux package Irzsz containing communications programs sudo apt get install Irzsz If Minicom is not installed you have to install this package install it with sudo apt get install minicom Install blueman a Bluetooth manager for Linux sudo apt get install blueman A bluetooth icon is on the Ubuntu panel if your Bluetooth is on Double click on that icon to open the Blueman and search for a new Khepera III manual ver 3 3 28 4 Connections device The robot will appear as KHIII ABCD where ABCD is the serial number Select the KHIII ABCD and push the key button or right click and pair with the access key 0000 four zeros A key should be added at the left of KHIII ABCD icon Right click on the paired KHIII ABCD choose Setup then Serial Port Run minicom with the command sudo minicom o Set its parameters with the sub menu Serial port setup of the menu configuration keys Ctrl a o to access it as described in below Push RETURN key to validate each time SIA A A Serial Device dev rfcommO B Lockfile Location var lock C Callin Program D Callout Program E Bps Par Bits 115200 8N1 F Hardware Flow Control No G Software Flow Control No Change which setting Save the settings with the command Save setup as of
43. or 3 to 5 0b00001111 15 US sensor 1 to 4 0b00011110 30 US sensor 2 to 5 0b00011111 31 All US sensors D Set speed Command Answer Effect Syntax D speed_motor_left 32bits speed_motor_right 32bits d Set the speed of the two motors See in section to calculate the equivalent Speed D 120000 120000 E Read speed Command Answer Effect Example E e speed motor left speed_motor_right Read the instantaneous speed of the two motors section 3 2 3 to calculate the equivalent Speed e 20000 20000 See in Khepera III manual ver 3 3 53 A Communication protocol F Set Target Profile Command F target_position_motor _left 32bits tar get_position_motor_right 32bits Answer f Effect Set a position to be reached The move will be performed with three phase a acceleration to reach the maximum speed a constant speed and a deceleration phase before the finish position The unit is the pulse each one corresponds to 0 047 mm with old firmware 0 031 mm with new firmware with encoder resolution x4 default see section 3 2 3 Syntax F 11000 11000 G Get a measure from the US peripheral Command G US number 8bits Answer g EchoNbr Distl Ampll Timel Dist2 Ampl2 Time2 Dist3 Ampl3 Time3 Dist4 Ampl4 Time4 Dist5 Ampl5 Timed Noise Effect Retrieve US measures distance in cm and time in ms from a given sensor number The sensor number is supposed to be 1 to 5
44. reBot II to shutdown properly before this case happend See command V in chapter A for more details about battery management Do not short circuit the battery pins or put down the battery on a metallic surface This will damage the battery pack itself 3 6 Power Supply If an external power source is required or during batteries charge power can be supplied through the power jack connector or through the micro Match cable unroller connector See section 4 for detailed description of connections Use only the power supply deliver by K Team If you want to supply the Khepera III with another device make sure that the Voltage is 9V and that the power supply can deliver 2A SAFETY PRECAUTION The power supply must be con nected to the wall socket after all other connections are already made Khepera III manual ver 3 3 21 4 CONNECTIONS 4 1 Configuration for batteries charge To charge robot s batteries make sure the following are correct The power supply shall be connected to the robot Warning the robot battery may be charged with the robot ON or OFF Be attentive that when the robot is ON the charging time will be a bit longer The power supply have to be connected on a wall plug There are three leds A green led tells if the robot is powered or not And two other leds are here if the robot is charging red led ON or if the charge is complete green led ON During the charge the red led is switched
45. rom Vishay Telefunken Khepera III manual ver 3 3 18 3 The Robot and Its Accessories This sensor device allows two measures The normal ambient light This measure is made using only the re ceiver part of the device without emitting light with the emitter A new measurement is made every 33 ms During the 33 ms the eleven sensors are read in a sequential way every 3 ms The value returned at a given time is the result of the last measurement made The light reflected by obstacles proximity This measure is made emitting light using the emitter part of the device The returned value is the difference between the measurement made emitting light and the light measured without light emission ambient light A new measurement is made every 33 ms During the 33 ms the eleven sensors are read in a sequential way every 3 ms The value returned at a given time is the result of the last measurement made 3 3 1 Ambient light measurements Ambient light measurement is strongly influenced by the robot s environ ment Depending on the light source type color and distance ambient light measurement profile might vary It is not recommended to use light source with large emission in the infrared range as this could confuse the IR sensors 3 3 2 Reflected light measurements proximity Sensors are mainly meant to detect obstacles around the Khepera Mea surements for reflected light depends on objects reflectivity and on ambient li
46. s sleep 2 move forward read old encoder position lpos kmot_GetMeasure mot1 kMotRegPos rpos kmot_GetMeasure mot2 kMotRegPos fpos 20 0 10 0 pulsestomm printf nMoving forward 1f cm in 1f pulses with position control encoders left 41d right 1d n 20 0 fpos 1lpost long fpos rpos long fpos tell motor controllers to move K3 forward using speed and accel profile kmot_SetPoint moti kMotRegPosProfile lpos long fpos kmot_SetPoint mot2 kMotRegPosProfile rpos long fpos Wait 5 seconds printf n wait 10s n sleep 10 Tell to the motor controller to move the Khepera III backward Khepera III manual ver 3 3 39 6 Robot programming motspeed long 40 0 mmstospeed kmot_SetPoint moti kMotRegSpeed motspeed kmot_SetPoint mot2 kMotRegSpeed motspeed printf nMoving backward 1f cm at 1f mm s internal speed d withN speed control n 20 0 40 0 motspeed Wait 5 seconds sleep 5 Tell to the motor controller to stop the Khepera III kmot SetPoint moti kMotRegSpeed 0 kmot_SetPoint mot2 kMotRegSpeed 0 Wait 5 seconds sleep 5 get ir sensor if kh3 proximity ir char Buffer dsPic 1 for i 0 i lt 11 i 1 sensors i Buffer i 241 Buffer ix 2 2 lt lt 8 n int sensors i 4096 0 IR_BAR_LEN if n 0 sprintf bar i 33 dC gt IR_BAR_LEN 1 else if n gt IR_BAR_
47. the batteries through recycling programs you can help to create a cleaner and safer environment for generations to come For those reasons please take care to the recycling of your robot at the end of its life cycle for instance sending back the robot to the manufacturer or to your local dealer Thanks for your contribution to a cleaner environment Khepera III manual ver 3 3 5 2 UNPACKING AND INSPECTION Open the bag and check each item in the box You should having the following material 1 Khepera III robot KoreBot II not included in the Khepera III base package Power Supply with a primary plug Battery Pack Optional KoreConnect o Fe WwW N Khepera III manual ver 3 3 6 3 THE ROBOT AND ITS ACCESSORIES 5 3 1 The Khepera III Robot 3 1 1 Overview Figure 3 1 Overview of the Khepera III robot Make an external inspection of the robot Note the location of the fol lowing parts 1 Infrared sensors Ultrasonic sensors Main serial connector USB miniAB connector Power jack connector Reset On Off Cable unroller connector 00 O CO wp Khepera III manual ver 3 3 7 3 The Robot and Its Accessories 3 1 2 ON OFF Battery Switch It allows the user to switch the robot ON or OFF When ON the robot is powered The robot may even be powered without the battery pack using the external power supply connector See figure number 7 3 1 3 Indication LEDs The Khepera III has six indication
48. the menu config uration cf below and choose bluetooth as configuration name You will be able to run again the program and load this configuration with sudo minicom o bluetooth Then exit the config configuration Filenames and paths File transfer protocols Serial port setup Modem and dialing Screen and keyboard Save setup as dfl Save setup as Exit In the file etc inittab of the robot check if the console on the Blue tooth port is configured correctly the following line is present see chapter 4 4 3 Khepera III manual ver 3 3 29 4 Connections S1 2345 respawn sbin getty 115200 ttyS1 PAY ATTENTION to not make mistakes while modifying this file as it may prevent booting and you will have to reflash the Korebot Reboot the robot if you modified this line Reboot the robot anyway but by pushing the reset button and you should see these line if it works OpenEmbedded Linux korebot2 ttyS1 Angstrom 2007 9 test 20090708 korebot2 ttyS1 korebot2 login You can connect to it Khepera III manual ver 3 3 30 5 SERIAL COMMUNICATION MODE 5 1 Testing the primary serial link Before any further operations the serial link between the host computer and the robot should be tested Please read the following instructions to test the serial communication mode Make sure all connections are correct see chapter A for details The robot should be placed on a
49. ulation example for the old firmware this time is the delay between two measures Timerbvalue Postscaler fosc 4 Tmr5Prescaler Time where fose 20MHz and Tmr5Prescaler 8 default To get the real speed in mm s WheelCircum ference d HORDE Time x 2764 where WheelCircumference is 128 8mm and 2764 correspond to the number of measures per revolution of the wheel For the old firmware the one encoder unit corresponds to 128 8 2764 0 047 mm and for the new on 128 8 4198 0 031 mm Here s an example with MotorSpeed 207000 Tmr5Prescaler 8 Postscaler 4 and encoder resolution x4 16 776 960 Timerd5value 320000 839 839 Time 0 336 ms 39007 00074 8 128 8 0 000336 2764 Motor Speed K speed Emus Where Kspeed is 144 01 when default configuration is used with the old firmware For firmware 3 0 or greater the Kspeed is 218 72 RealSpeed 138 9 mm s RealSpeed Khepera III manual ver 3 3 15 3 The Robot and Its Accessories The maximum reachable speed is 48 000 333 mm s old 219 mm s new in open loop and 43 000 298 mm s for old 196 mms s for new in regulation mode And the minimum is 2 000 13 9 mm s for old 9 mm s for new with regulation control Khepera III manual ver 3 3 16 3 The Robot and Its Accessories Used in position profile mode F command the controller has as in put a target position of the wheel an acceleratio
50. uld be kMotModeldle for normal usage Return nothing Khepera III manual ver 3 3 47 6 Robot programming 6 3 12 kmot_SetSampleTime Call void kmot_SetSampleTime knet_dev_t hDev int sample Function sets the sample time for the motor control Parameter hDev is a handle to an opened knet socket Khep era3 dsPic sample time for the motor control should be 1550 by default Return nothing 6 3 13 kmot_SetMargin Call void kmot_SetMargin knet_dev_t hDev int margin Function sets the margin for position control Parameter hDev is a handle to an opened knet socket Khep era3 dsPic margin margin for position should be 6 by de fault Return nothing 6 3 14 kmot_SetOptions Call void kmot_SetOptions knet dev t hDev int hwOptions int swOptions Function sets the options for the motor control Parameter hDev is a handle to an opened knet socket Khep era3 dsPic hwOptions hardware flag should be by 0 by default swOptions software should be kMotSWOptWindup kMotSWOptStopMotorBlk by default Return nothing Khepera III manual ver 3 3 48 6 Robot programming 6 3 15 kmot_ResetError Call void kmot_ResetError knet_dev_t hDev Function reset the motor Parameter hDev is a handle to an opened knet socket Khep era3 dsPic Return nothing 6 3 16 kmot_SetBlockedTime Call void kmot_SetBlockedTime knet_dev_t hDev int time Function set t
51. ware control When powered on the KoreBot II will send the normal Linux boot message to the terminal emulator see fig 5 2 If any of the serial link is not working properly it is then important to ensure that the serial communication settings has been configured correctly F File Edit View Terminal Tabs Help oinitrd roc Figure 5 2 Boot message of the KoreBot II Khepera III manual ver 3 3 32 5 Serial Communication Mode 5 3 Serial communication protocol When the robot is used as standalone without a KoreBot II the serial communication protocol is designed to control all Khepera s functions using a RS232 serial line The serial line configuration baudrate as well as data start stop and parity bits for the host computer must match the robot s configuration The host computer and the Khepera robot are communicating with ASCII messages Each single interaction is composed by A command beginning with one ASCII capital letters and followed if necessary by numerical or literal parameters separated by a comma and terminated by a carriage return or a line feed sent by the host computer to the Khepera robot A response beginning with the same one ASCII letters of the com mand but in lower case and followed if necessary by numerical or lit eral parameters separated by a comma and terminated by a carriage return and a line feed sent by the Khepera to the host computer During the entire commu
52. wise to the back left sensor The last argument is the relative time stamp of the measure in ms P Set Target Position Command P target position motor left 32bits tar get position motor right 32bits Answer p Effect Set a position to be reached The move will be performed without acceleration and deceleration The unit is the pulse each one corresponds to 0 047 mm with old firmware 0 031 mm with new firmware with encoder resolution x4 de fault see section 9 2 3 Syntax P 11000 11000 Q Reserved Khepera III manual ver 3 3 56 A Communication protocol R Read position Command R Answer r position motor left position_motor_right Effect Read the 32 bit position counter of the two motors The unit is the pulse each one corresponds to 0 047 mm with old firmware 0 031 mm with new firmware with encoder resolution x4 default see section 9 2 3 S Reserved T Reserved U Enter the serial boot loader mode Command U Answer Effect u Switch to the firmware upgrade mode Be careful not to upload a bad hex file into the dsPic memory space If the dsPic memory is corrupted an external programmer will be required to reflash the memory Do not turn off or reset the KheperalII when the uploader mode running This will corrupt the dsPic memory If you have run the mode by mistake wait until the timeout occurs 5 7 seconds V Get Battery State Command V Answer Effect v
Download Pdf Manuals
Related Search
Related Contents
Directives ATEX Composants pneumatiques - Catalogue English - Tesseract Mode d`emploi de la Boîte de Couplage LDG AT HANGING SCALE USER MANUAL Deutsch - Motorola 日本語 取扱説明書 5作作業前に取扱い説明書をお読み下さい。 File - The underground Poste-publications MC Samsung D908i 用户手册 SERIE CVM-96 MANUAL DE INSTRUCCIONES Copyright © All rights reserved.
Failed to retrieve file