Home
USER MANUAL - K
Contents
1. Pan tilt cco USER MANUAL Version 2 0 K Team S A Lausanne 20 February 2001 Contents 1 GETTING STARTED essssssesssiesdesssccsscsessessscesseessscedissecdesavsnceosenses odeesesseducoesdebsseedsecdscessudbesesssessbesasecvusoesdessssedussedcodevenccosees 2 2 USING THE CAMERA STANDALONE isscsisssscssssesssessossssasossessesiasesesesddescescssiseeseasessssssdessessconcsessecaasssssasiessooseesesscaccesess 3 2 1 USING THE FUNCTIONS FROM A TERMINAL ccccccccccccccccscscscscscscscsuscsusesusesesesusesusesuscsusesusesusesuscsuscsuscausceusvausvavevevsvavevans 3 222 WRITING A G PROGRAM wisi ccccvccsscccsccarcacecacseatvennscucvasedectvecteducyvevaceuteeyecucvwevacsavwoueduevuses anu seus anevasedendvese cabevenesansvecyecuevesveaee 3 3 USING A KOALA 6 osssscssssssiscesscavsenssssssesesiesests ssssessassasesvessexsssessosestesesecseessse seusccss siessdessitessavsaeas avaeessiaesesessexcseasueesassssavesvassie 4 Bode MISTING A TBR MUNA Missi so355 cas cgteschetccciacssedcsedececcsaaseceucevuecesnceseecseceseces a A E E EE EE ENA 5 322 WIRTTING A C PROGRA V ses ccdesecsscdesassaccacay sua cascsceesecesadesaessecsuaceuecesseuaceeseceucdesagssaccuauecacevovss ceesauusadesaesbecsuanecede 5 4 PAN TILT COMMAND PROTOCOL scassisisssnsessectesescactesssocsesessecvecessccdssescccdesteeccsexestschesscsectansccsctnstevecsesessesdesossacdoseseeses 6 5S SORT WARE EXAMPLES issecs scsssscsesessscsnsscssssodesssnesdsesessedsdesasecesesesnsesoscst des
2. clude lt sys kos h gt include lt stdlib h gt include lt stdio h gt include lt string h gt int32 _limits 4 int32 _pan 2 1 int32 _tilt 2 0 0 0 0 r li 1 1 void Send char string note that com_reserve_channel use com_send_buffer itself to test whether the port is free or not while com_send_buffer string int32 sgn int32 num return num lt 0 1 1 int32 InitializeMotor uint8 numMotor int32 range uint32 torque speed does NOT seem to work strlen string mot_config_speed_1lm numMotor 150 4 0 mot_put_sensors_1lm numMotor 0 turn slowly mot_new_speed_l1m numMotor TEST_SPEED tim_suspend_task 500 check to see if if it doesn t torque sens_get if mot_get_posi loop until we do tim_suspend_tas the motor exists tion numMotor hit the stop pin k 100 move AND has low torque _ana_value TORQUE_OFFSET numMotor 0 amp amp lt 0 it isn t there torque lt TORQUE_LIMIT her there are the pan and suitable for manual testing or for use Instead we tim_switch_fast return 1 PAN TILT USER MANUAL speed mot_get_speed numMotor while abs speed gt 0 mot_stop_1lm numMotor mot_put_sensors_1m numMotor 0 move in other direction now mot_new_speed_lm numMotor TEST_SPEED do tim_suspend_task 100 sp
3. cribed in section 1 Plug the power cable from the camera into the corresponding port on the REB and connect the RCA video output jack to your monitor or frame grabber Now connect the two power cables to the Kameleon 8 pin AMP connector and to the REB 2 pin Wago connector and hook them up to a 12v DC source You may either command the camera from a simple ASCII terminal via the serial port or write your own custom C program It is recommended you first test the camera from a terminal before writing your custom C program 2 1 Using the Functions from a Terminal First you must set the Kameleon into Serial Communications SerCom mode by adjusting the DIP switches located near the power connector as shown in figure 2 SerCom 38400 Figure 2 DIP switch modes You may use any standard ASCII terminal program to communicate with the Kameleon e g HyperTerminal for Windows Microphone for Mac Minicom for Linux Ensure it is properly configured for 38400 baud 8 bit no parity and 1 stop bit Connect a standard serial cable to the Kameleon 9 pin DSUB serial port connector and turn on the power to the Kameleon You should see the following on your terminal screen the version number may vary depending on your BIOS version ROM of K376SBC C E Franzi P Arnaud K Team SA R1 15 11 Jul 2000 REB support by C Jaquet K Team SA Serial Communication Protocol A test program has been stored in the Kameleon s flash memory T
4. do status mma_receive_byte_0 if status f 1 RecBuf i char status if char status n amp char status printf Received char s 2li c r n else printf Received char s 2li CR or LF r n while status n RecBuf i 0 printf nComplete buffer is s r n RecBuf i 0 The Led number 2 on the slave card must blink every r n char status PAN TILT USER MANUAL 12 RELEASE_MMAO kill_task tim_get_id Sei MAIN Initialise the used managers Launch all the processes FF F void main void uint32 vIDProcess 3 int32 status static char prName_0O User 0 process EF 98 Rev 1 static char prName_1 User 1 process EF 98 Rev 1 com_reset var_reset mot_reset tim_reset mma_reset status install_task prName_0 800 process_0 if status 1 exit 0 vIDProcess 0 uint32 status status install_task prName_1 800 process_1 if status 1 exit 0 viIDProcess 1 uint32 status tim amp bios are initialised at the Kill the main At this moment only the launched processes are start up executed 00 r n 00 r n PAN TILT USER MANUAL 13
5. ed near the power connector as shown in figure 4 SerCom communication on MMA MMA slave 0 Figure 4 DIP switch setting for MMA mode Connect to the Koala with a terminal program as you normally would to command the Koala Now open a dedicated MMA channel to the Kameleon by typing REMOTE MMAO All subsequent commands will be passed directly to the Kameleon SerCom module You may now initialize and control the camera exactly as described above in section 2 1 To leave dedicated mode and return to the Koala SerCom type exit 3 2 Writing a C program You may write a custom C program onboard the Koala to control the camera by using the MMA extensions Simply include the call mma_reset at the beginning of your program and you will then be able to use the command mma_send_buffer_0 to send the standard terminal commands over the MMA channel and mma_receive_byte_0 to read the responses Please see the included test_MMA c example file for more details For complete flexibility you may wish to write a custom C program on both the Koala and Kameleon In this case you need to use mma_reset on both sides and then simply pass text strings back and forth between the two giving you the flexibility to develop your own communications protocol In this case you must not deviate SerCom to the MMA channel but instead leave SerCom to communicate over the serial port using the DIP switch configuration shown in Figure 5 SerCom communication
6. eed mot_get_speed numMotor fflush stdout while abs speed gt 0 range mot_get_position numMotor mot_stop_lm numMotor mot_config_speed_1m numMotor 200 0 0 go to centre mot_new_position_1lm numMotor range 2 wait until we ve stopped moving check bit 18 on position while mot_get_status numMotor amp 0x01 lt lt 18 0 tim_switch_fast set center position to be zero mot_put_sensors_1lm numMotor 0 mot_new_position_1lm numMotor 0 veturn limit just a bit inside the stop pins return range 2 200 int32 NewMotorPosition uint8 numMotor int32 newPosition char buffer 80 if numMotor gt 3 return 1 invalid motor if _limits numMotor 0 return 2 no motor or motor not configured if abs newPosition gt _limits numMotor out of bounds sprintf buffer WARNING motor position ld out of bounds newPosition Send buffer newPosition _limits numMotor sgn newPosition sprintf buffer set to limit ld r n newPosition Send buffer mot_new_position_1lm numMotor newPosition return 0 void procInit void numMotor _limits uint8 numMotor InitializeMotor uint8 numMotor exit 0 void PrintHelp uint8 numMotors Send Wsssss s SSeS Sses Ss SSS c n Send PAN TILT module Venj y Send TERA nn SS r n if numMotors 2 Send P pos move PAN motor center
7. nf userCommand T ld amp parms 0 1 sprintf buffer t ld r n mot_get_position _tilt parms 0 Send buffer else Send Did not understand input r n else if sscanf userCommand T ld amp parms 0 1 NewMotorPosition _tilt 0 parms 0 Send t r n else sprintf buffer t ld r n mot_get_position _tilt 0 Send buffer break default PrintHelp numMotors return 0 PAN TILT USER MANUAL 11 test _MMA c E Dn a A ha a E Oc sn een Author Jaquet C 15 05 2000 Project Kameleon376SBC Goal Test MMA communication between two systems EEE EEE EEE E Ne ee ee ee ee E EEE xf include lt sys kos h gt include lt stdlib h gt include lt stdio h gt include lt string h gt Process 0 This process changes the state of the LED 0 every 500ms af static void process_0 for 77 tim_suspend_task 5000 var_change_led 0 Process 1 xf define kMaxRecBuf 50 void process_1 uint8 RecBuf kMaxRecBuf uint8 SndBuf uint8 i 0 uints8 Cmd uint32 status 0 printf Test communication between two system via MMA channel r n Te e a s a ee r n n printf printf two seconds r n RESERVE_MMAO for 77 tim_suspend_task 2000 SndBut Lyilyp2 aver s status mma_send_buffer_0 SndBuf strlen SndBuf printf Message sent s n r SndBuf
8. nt them such that the brass gears of each camera cannot touch each other Recommended mounting holes are 2 3 and 12 3 when viewing the Koala from the front where the front leftmost hole is 1 1 e Connect the Kameleon to the Koala s MMA port marked as number 7 in figure 3a using the MMA ribbon cable If you are using a PC 104 as well you will need to connect it to the Koala and Kameleon using the provided 3 way MMA ribbon cable e Connect the 2 pin REB power connector to the power supply connector number 5 shown in figure 3b e You do not need to connect the 8 pin AMP connector to the Kameleon it is powered via the MMA cable a Q S SESESSESEEL 0000004000000 000000000000 KOS 70 OL ONO NOP OO Gs o o o o o0oo0 o0 o0 0o0 0 0 O 0 0 U OO OOOO o o o o0oo0o0 o0 o0 0o0 00 0 Figure 3a left MMA port on Koala number 7 Figure 3b right Power connectors inside the Koala numbers 5 8 and 14 You may either command the camera from a simple ASCII terminal via the serial port or write your own custom C program It is recommended you first test the camera from a terminal before writing your custom C program PAN TILT USER MANUAL 4 3 1 Using a Terminal First you must set the Kameleon into MMA mode by adjusting the DIP switches locat
9. o run it type run user flash The pan tilt camera should perform an automatic calibration and center itself when finished A simple ASCII protocol is provided for commanding the motors either from a terminal or from another device communicating over the serial port Please see section 4 for a description of this protocol 2 2 Writing a C Program The source code of the above mentioned test program pan tilt c is included to demonstrate how to program the pan tilt camera You are invited to study it and use elements of it in your own applications For more information on available C functions for the Kameleon or the REB please see their respective documentation available from the K Team website http www k team com For general information on how to compile your C program and download to the Kameleon please see the GNU cross compiler documentation also available from the K Team website PAN TILT USER MANUAL 3 3 Using a Koala If you are using the camera with the Koala robot you must e Securely mount the Kameleon to the robot by fixing it under the removable cover to the four attachment points labeled number 2 in figure 3a If you are also using a PC 104 onboard the Koala you need to mount the Kameleon on top of the PC 104 by using spacers you will no longer be able to use the Koala cover e Mount the camera to the Koala accessory deck using its M3 mounting hole Note that if you mount two cameras you must be careful to mou
10. on RS232 at 38400 MMA slave 0 Figure 5 DIP Switch setting for bi directional MMA programs If you wish your program on the Kameleon to start automatically at boot up you must first put your program in flash memory by following the instructions in the Kameleon documentation You can then tell the Kameleon to automatically load your program in the user flash by choosing the following DIP switch settings shown in Figure 6 User FLASH application MMA slave 0 Figure 6 DIP Switch setting to start the User Flash with MMA PAN TILT USER MANUAL 5 4 Pan Tilt Command Protocol On startup the program in the user flash of the Kameleon performs a calibration of the cameras and then presents one of two possible menus depending on whether you have two cameras or not One camera If you have one pan tilt camera installed the following self explanatory menu will appear after calibration Each command is confirmed by a lowercase character p or t You may either use the commands interactively or write a program to use this protocol over the serial port or the MMA port PAN TILT module P pos move PAN motor center pos 0 P print current PAN position T pos move TILT motor center pos 0 T print current TILT position x exit to SerCom 38400 baud Two cameras If you have two pan tilt cameras installed the following self explanatory menu will appear after calibration Each command is confirmed b
11. ouscesesonssestesocsusesecsesduedassededessessdcesssnsesessesdesocates 7 1 Getting Started Pan tilt camera systems are shipped with a Kameleon SBC controller and a custom REB Robotics Extension Board interface The camera s can be used stand alone in any custom application or can be interfaced with a Koala mobile robot as shown in Figure la If the REB is not already connected to the Kameleon install it by lining up the two double rows of pins under the REB with the connection holes on the Kameleon Squeeze the REB and Kameleon together firmly being careful not to bend any of the pins The two motors from the camera plug into the provided ports on the REB as shown in Figure 1b If you have two pan tilt cameras the REB will have two additional ports for motors 2 and 3 not shown Each camera also has a video cable and a power cable the form of which depends on your system configuration Please proceed to section 2 if you are using the camera in standalone mode or to section 3 if you are connecting the camera to a Koala robot power 12v TILT motor 1 PAN motor 0 Figure 1a left Double Pan Tilt Camera mounted on Koala robot Figure 1b right REB motor ports 0 and 1 PAN TILT USER MANUAL 2 2 Using the Camera Standalone Mount the Kameleon securely to your desired system using its four mounting holes and then fix the camera using the M3 threaded hole on its bottom plate Connect the camera to the REB as des
12. pos 0 WENANG Send P print current PAN position r n Send T pos move TILT motor center pos 0 Sen 9 Send T print current TILT position Vern 9 else Send P cam pos move PAN motor cam 0 or 1 center pos 0 r n Send P cam print current PAN position cam 0 or 1 r n Send T cam pos move TILT motor cam 0 or 1 center pos 0 r n Send T cam print current TILT position cam 0 or 1 Ven 3 Send x exit to SerCom 38400 baud Ven 3 PAN TILT USER MANUAL int main uint8 i 0 numMotor numMotors 0 uint32 taskID 8 int32 parms 20 int32 receivedByte char userCommand 80 char buffer 80 ext_reset mot_reset var_reset sens_reset str_reset configure all 2 or 4 motors simultaneously by launching parallel tasks Send Configuring motors r n for numMotor 0 numMotor lt 4 numMotort t taskID numMotor install_task_parms Init r n 800 procInit void numMotor now wait until all four tasks have finished for numMotor 0 numMotor lt 4 numMotor t S ndi tH sas 43S S 5 SSeS SaaS ENAT sprintf buffer Motor d r n numMotor Send buffer while _limits numMotor 0 tim switch_fast if _limits numMotor lt 0 sprintf buffer No motor found on port d Skipping r n numMotor Send buffer else numMotors sprintf buffer Motor successfully config
13. ured Range limit ld r n _limits numMotor Send buffer Send Finished initialization r n if numMotors 2 only one camera Send Found one pan tilt camera Auto detecting PAN and TILT axes r n for numMotor 0 numMotor lt 4 numMotor if _limits numMotor gt 2500 sprintf buffer TILT axis is motor d r n numMotor Send buffer _tilt 0 numMotor else if _limits numMotor gt 1500 sprintf buffer PAN axis is motor d r n numMotor Send buffer _pan 0 numMotor else if numMotors 4 two cameras Send Found two pan tilt cameras Auto detecting PAN and TILT axes r n for numMotor 0 numMotor lt 4 numMotort t if _limits numMotor gt 2500 sprintf buffer TILT axis is motor d r n numMotor Send buffer _tilt numMotor 2 numMotor PAN TILT USER MANUAL else if _limits numMotor gt 1500 sprintf buffer PAN axis is motor d r n numMotor Send buffer _pan numMotor 2 numMotor else if we find 0 1 or 3 motors signal an error sprintf buffer Unrecognized configuration d motors Exiting r n numMotors Send buffer tim_suspend_task 500 bios_restart_launch FUSC 6 now start serial command protocol PrintHelp numMotors clean buffer while com_receive_byte gt 0 tim_switch_fast for i 0 do if receivedByte com_recei
14. ve_byte gt 0 restart SerCom 38400 on x if char receivedByte x bios_restart_launch FUSC 6 check for backspace else if char receivedByte b amp amp i gt 0 i accept only normal characters else if char receivedByte gt amp amp char receivedByte lt z userCommand it char receivedByte else tim_switch_fast while char receivedByte r userCommand i 0 switch userCommand 0 case P if numMotors 4 if sscanf userCommand P ld ld amp parms 0 amp parms 1 2 if parms 0 0 parms 0 1 NewMotorPosition _pan parms 0 parms 1 Send p r n else Send Invalid camera 0 or 1 r n else if sscanf userCommand P ld amp parms 0 1 sprintf buffer p ld r n mot_get_position _pan parms 0 Send buffer else Send Did not understand input r n else if sscanf userCommand P ld amp parms 0 1 NewMotorPosition _pan 0 parms 0 Send p r n PAN TILT USER MANUAL else sprintf buffer p ld r n mot_get_position _pan 0 Send buffer break case T if numMotors 4 if sscanf userCommand T ld ld amp parms 0 amp parms 1 2 if parms 0 0 parms 0 1 NewMotorPosition _tilt parms 0 parms 1 Send t r n else Send Invalid camera 0 or 1 r n else if ssca
15. y a lowercase character p or t You may either use the commands interactively or write a program to use this protocol over the serial port or the MMA port PAN TILT module P cam pos move PAN motor cam 0 or 1 center pos 0 P cam print current PAN position cam 0 or 1 T cam pos move TILT motor cam 0 or 1 center pos 0 T cam print current TILT position cam 0 or 1 x exit to SerCom 38400 baud PAN TILT USER MANUAL 6 5 Software Examples pan_tilt c Initialize and control one or two pan tilt cameras Author Modifs Skye Legon 6 2 01 slegon k team com This program will initialize one or two pan tilt cameras connected to a Kameleon one or two cameras controller board It auto detects whet and then performs a calibration routine to find the center positions and limits It then provides a simple serial protocol to command tilt axes of the camera s with a Koala robot NOTE the current compiler package does not redirect the output of F printf to the COM port but instead to the SER port However y in mode MMA only messages written to the COM port are passed 7 via MMA to the Koala To temporarily get around this this program i replaces all printf commands with a Send function that uses the COM port a p E N E E Xf define TEST_SPEED 20 define TORQUE_OFFSET 11 define TORQUE_LIMIT 25 in
Download Pdf Manuals
Related Search
Related Contents
Bibliobus - Médiathèque Départementale du Jura Sony Ericsson MD300 User's Manual Serie ZSE40A(F)/ISE40A Dakar Basket stretcher with wheels TurboMass Software User's Guide 取扱説明書 Vtech Ds6151 Dect 6 Two-Line Cordless Phone System With Digital Answering System EncSpot mode d Kraun Bluetooth Headset USER MANUAL Travel Vision R6 ® Copyright © All rights reserved.
Failed to retrieve file