Home
ylämummo heilahtaa
Contents
1. SD TRAIN SD Arguments Mapping These are the characters used to represent integer values in the range 1 to 31 for command or status arguments 8 40h Minimum argument value 1 Maximum argument value 31 41h Zero argument value 0 20h Read more status arguments erm Communication Examples These are some examples of actual command and status strings exchanged with the VRbot module by host programs and the expected program flow with pseudo code sequences The pseudo instruction SEND transmits the specified character to the module while RECEIVE waits for a reply character a timeout is not explicitly handled for simple commands but should be always implemented if possible Also the and ERROR routines are not explicitly defined since they are host and programming language dependent but appropriate code should be written to handle both conditions Lines beginning with a sharp character are comments Please note that in a real programming language it would be best to define some constants for the command and status characters as well as for mapping numeric arguments that would be used throughout the program to minimize the chance of repetition errors and clarify the meaning of the code See the header file protocol h for sample definitions that can be used in a C language environment Here below all the characters sen
2. Buttons in A port CHAIR 0 BED 1 DOWN 1 HOME 2 UP 2 RIGHT 3 LEFT 4 AUTO 5 MANUAL 6 TI GHT LOOSE 7 pa E port GREY WIRE 3 efine AT HOME 6 Button on the oli mex board efine ONBOARDBUTTON 5 Port A buttons define BUTTON PINA PINA define BUTTON PORTA PORTA define BUTTON DDRA DDRA Port E button define BUTTON P define BUTTON PI define BUTTON D Available st define STATE N define STATE L define STATE_R define STATE MANUAL 3 define STATE_AUTO 4 define STATE TI GHTENED 5 define STATE TIGHTENING 6 define STATE LOOSENING 7 define STATE HOME 8 define STATE BED 9 define STATE CHAIR 10 define STATE AT HOME 11 define STATE NOT READY 12 define STATE INIT DRIVE GUN define STATE MANUAL TIGHTENING 14 define LOOSENI NG 15 define STATE PUSH LEFT 16 NI d Li d RTE PORTE NE PINE R define STATE PUSH RIGHT 17 define STATE MOVING LEFT 18 define STATE MOVING RIGHT 19 83 define NEXT STATE NONE 0 HOME 1 BED 2 CHAIR 3 MANUAL 4 AUTO 5 NOT READY 6 STATE STATE STATE STATE STATE STATE define NEXT define NEXT define NEXT define NEXT define NEXT define NEXT ght use in combination with is strai sem gt 2 Definit define ST define MO define MO define PU define PU DD 1
3. _none goto auto goto goto goto goto goto goto goto goto goto goto aL 4 4 4 4 42 4 1 OO OO OO CO CO CO CO CO CO CO cO E Y 5 65 Y 5 5 4 ES RR A ST SS SSS STDS SD 55 S559 559 5 5 5 55 84 statemachine c 1 This file contains all the subroutines managing the large state machine of the system state machine int state function is called by an interrupt configured in interrupts c at a frequency of 1KHz approxi mately t is the main and most important function in the whole system checks the state of the system inputs and outputs and manages all the user s instructions and system movement include lt avr io h gt include statemachi h include leds h 1 util delay h gt include global h 1 slidepotentiometer h 0 1 motor 1 accelerometer h 1 rprintf h 1 interrupts h 1 uart2 h 1 voicerecon h 1 h Voice Recognition order from the main routine extern unsigned char VRorder Last state of the buttons 0 if button is down uint8
4. portCHAR lis SetScale enum scale scale trg uint8 t conf conf2 conf lis read reg REG2 ADDR MSK if conf pdFALSE debug SET SCALE could not get the busin return pdFALSE else I Modify only the deci mation factor bits in the control register switch scale trg case 62 conf2 conf 0x7F 0XXX XXXX break case G6 conf2 conf 0x80 1 XXXX break default conf2 conf lis write reg 2 ADDR MSK conf2 return pdTRUE port CHAR Spam das das trg uint8 t conf conf2 conf lis read reg CTRL REG2 ADDR MSK if conf pdFALSE 1 debug SET SCALE could not get the bus n return pdFALSE else Modify only the deci mation factor bits in the control register switch das case BITS 12 Rj conf2 conf amp OxFE XXXX XXX0 break case BITS 16 Lj conf2 conf 0x01 XXXX XXX1 break default conf2 conf lis_write_reg CTRL_REG2_ADDR_MSK conf2 return pdTRUE uintl6 t lis read x void 1 unsigned char recvdata 2 122 unsigned char senddata READ_WO_AUTO_INCREMENT_MSK OUTX L ADDR MSK I mode addr i2c send byte LIS ADDR senddata i2c rece ve LI S ADDR 2 recvdata lli2c transfer LI S 1 amp senddata 2 recvdata return recvdata 0 recvdata 1 4 uint16 t lis read y void unsigned char recvdata 2 unsigned char senddata READ W
5. Sendi nstruction unsigned char instruction unsigned char response int data bi instruction Command byte sent to the device through the serial port i data Byte read from the serial port buffer 1 if nothing is read from the serial port response Valid response from the device This function sends instruction to the device and then waits for a response from it M e char Sendi nstruction unsigned char instruction unsigned char response us ata uartlSendByte instruction p data 1 data b data uartlGetByte response data return response 109 motor h ifndef MOTOR define MOTOR void tighten void loosen void stop tightening motor void init fendi f motor c 1 n this file the control routines for using the tightening motor are defined The motor is connected to pins 4 5 and 6 of B port of the microcontroller Pin 4 Motor power PWM could be used here Pin 5 Motor direction 1 Tighten 0 Loosen Pin 6 Motor enable 1 lt avr io h gt 1 util h 1 motor include global h include leds h Ti mer 2 Register TCCR2A Force output FOC2A 1 Fast PWM mode WGM21 0 3 Setting the COM2A1 0 bits to two will produce a non inverted PWM 8khz 522 CS21 CS20 0 1 0 cIKT2S 8 From prescaler COM2A1 0 Width Modulation is not in use in this version 0
6. initialization unsigned char buf buf Byte read fromthe serial port This function opens the COM port 0 to establish communication through the serial port and configures some features of the VRbot modul e m initialization unsigned char buf int response i 0 Opening COM port 0 and establishing the parameters of the serial port communication as 8 bit data 1 bit stop no parity 9600bd no flow control printf Opening COM 0 OpenComport 0 9600 printf Initializing device n Waking up device from low power saving mode 76 while buf OK Sendinstruction WAKE buf if i 25 2 Failed to initialize device n reak i Ask firmware ID It has to be 0 Sendinstr UE EL ONY Ask 1D buf if buf UM RROR Cannot read device 10 Send ack and read status expecting D 0 Sendinstruction ACK buf if buf 100 printf ERROR Device 10 doesn t else printf Device identified n Set language for Speaker Independent instructions English SendByte 0 LANGUAGE SET Sendinstruction ENGLISH buf if buf OK AM Vut Could not set default language for built in instructions English in else printf Language set English n Set timeout 5 seconds SendByte 0 SET TI MEOUT Sendi nstruction FIVE SECONDS buf if buf OK printf ERROR Timeout not set n printf Timeout set 5
7. Port A BUTTONS init etus 1 Buttons on terminal bl DDRA 0x00 Data 1 INPUT PORTA OxFF llactivate the pull up resistor for buttons as well The voice recognition routine is executed here the remaining control of the system is done by the interrupt driven but 8l MOTOR initialization b E f ORT MOTOR DI RE motor direction 0 RT MOTOR_ENAB To ialization ata direction OUTPUT EDS are grounded 0 means off itialization initialization F llactivate the pull up resistor for buttons n of the PCB buttons and LED irection for led see AT90CAN128 datasheet page 66 DI RECTI ON STATUSLED PORT STATUSLED nitialization TCCRIA TCCR1B TCCRIC 2 MED Pulse Width Modulation is not being used in this version izing both UARTs intf function pr ndByte po 05 lization of the potentiometer interrupts and accelerometer ntiometer rrupt Initialization of the states in statemachi next state 0 goto init dri ve 82 statemachine h ifndef STATEMACHI NE define STATEMACHI NE Buttons in I BLACK wire 1 define BUTTON I GRAY WIRE 1 define BUTTON define BUTTON I BLUE WIRE 1 define BUTTON define BUTTON I YELLOW WI RE define I RED WI RE BUTTON RED WI RE define YELLOW wire 2 define BUTTON I GREEN WIRE 27 define BUTTON
8. In reply to Any character after power on or sleep mode 65 s 73h Recognised SI word or Training similar to SI word In reply to CMD_RECOG_SI CMD_RECOG_SD CMD_TRAIN_SD A 1 reply to CMD_GROUP_SD 78h Provide firmware identification Version identifier 0 In reply to CMD_ID te 65h Signal recognition error 000000000000 recognition error a a a values that form 8 bit error code 80h NOTA otherwise see FluentChip error codes In reply to CMD_RECOG_SI CMD SD TRAIN SD 7 76h Invalid command or argument In reply to Any invalid command or argument In reply to 51 SD TRAIN SD 1 69h Interrupted recognition In reply to BREAK while in training or recognition 66 64h Provide command data Training information 0 7 training count 8 SD SV conflict 16 SI conflict Conflicting command position 0 31 Length of label 0 31 4 n of label ASCII characters from A to In reply to CMD_DUMP_SD 6Fh OK or no errors status In reply to CMD_BREAK CMD_DELAY CMD_BAUDRATE CMD_TIMEOUT CMD_KNOB CMD_LEVEL CMD_LANGUAGE CMD_SLEEP CMD_GROUP_SD CMD_UNGROUP_SD CMD_ERASE_SD CMD_NAME_SD CMD_RESETALL r 72h Recognised SD SV command or Training similar to SD SV command Command position 0 31 In reply to
9. bre else t button down por tE AT HOME drive send command CODE STOP at home break Check VR commands VRorder ris VR MOVE LEFT drive send command CODE STOP goto moving left break d VR MOVE drive send nd CODE STOP goto movi ng right brea VR_STOP drive send command CODE STOP goto auto 94 break case VR_TIGHTEN drive send command CODE STOP goto tight break m VR GO TO CHAIR drive send command CODE STOP goto chai r break case VR GO TO BED drive send command CODE STOP goto O brea else drive send command CODE STOP goto auto break break Auto instruction Go to bed The support will move to the defined bed position it will stop if another valid instruction buttons or VR commands is given case STATE BED if previous state STATE HOME directfon MOVING RIGHT else if previous sta Le STATE CHAIR directi onzMOV NG LEFT else directionzSTATI C if is straight direction Position absolute rive write param32 CODE MODE TYPE CODE CPA Sets command position 3520548 rive write param32 CODE CPOS 3520548 Sets position mode 3 rive write param32 CODE MODE n Keep position and speed refer rive write param32 CODE MODE TYPE cope TUMI Start motion rive send command CODE if button down portA BUTTON LOOSE drive send co
10. i TCCR2A FOC2A Force output compare match pwm mode R2A WGM21 R2A WGM20 mun 790 n inverted mode only when the motor 15 running i TCCR2A 2 1 t power max OxFF MOTOR DI ON MOTOR DI RECTI ON motor power Set Instead of Set Instead of Ti ghteni ng full power Loosening full power 111 led is on e Oli mex board ORT PORTE DDRE define STAT define STAT define STAT Fendif R Status led U U U ODIA gt leds c Functions used to manage the LEDs n the control pad j include lt avr io h gt include util h include a2d h include 2cconf h include 1 2 1 1153102 dri ver h 1 slidepotentiometer h 1 accelerometer h 1 interrupts h 1 leds h 1 global h void led on uint8 t led SbI LED led void led off uint8 t led cbF LED_PORT l ed uint8 t led is on uint8 t led return LED_PORT 1 lt lt led 112 interrupts h ifndef SUSPENSION define SUSPENSION H Initialize interrupt void init interrupt Start Timer void ti mer run Reset timer void timer start Return value of timer uintl6 t ti me fendi f Interrupts c In this file a syst
11. It communicates with the device using the serial port The program asks the user to say the trigger word instruction f the word is not recognized will print the error and if the user 75 does not speak within 5 seconds will print timeout If the word is recognized it will ask for an of the commands If any of the commands is recognized it wil DO it if not it would be the same as for the trigger word Either way it will start again asking for the give it the trigger word The only way of ending t the program is to il command close In that case it close itself us mai n voi d char info int i response int closez0 unsi gned char buf initialization buf printf VnSTARTI RECOGNI TI ON n while close 1 printf Trigger Word SendByte 0 START RECON Sendi nstructi on TRI GGER RECON buf if buf RECON_ OK printf ACCEPTED Instruction SendByte 0 START RECON Sendinstruction ORDER RECON buf if buf RECON OK Sendi nstruction ACK buf 1 nstructi on buf else if buf TIMEOUT rintf Timeout n else printf Recognition failed n else if buf TIMEOUT printf Timeout n else printf Recognition failed n Closing COM port 0 to avoid conflicts with other programs that want to use it printf nClosing port 0 CloseComport 0 printf CLOSED n printf Exiting program n return 0
12. NEXT STATE AUTO goto auto break if next state NEXT STATE NOT READY goto not ready break break break case STATE TI GHTENED if VRorder VR_GO_HOME button_down_portA BUTTON_HOME 88 auto or manual state 1 next_state NEXT_STATE_HOME goto loose break if VRorderzzVR GO TO BED button down portA BUTTON BED amp amp auto or manual state 1 next state NEXT STATE BED goto loose break if VRorderzzVR GO TO CHAI R button down portA BUTTON CHAIR amp amp auto or manual state 1 99 next_state n loose reak NEXT STATE CHAIR if button down UP amp amp auto_or_manual state 2 goto manual tight if VRorderzzVR TI GHTEN amp amp auto or manual state 1 next state NEXT STATE AUTO goto loose break if button down portA BUTTON TIGHT LOOSE 1 if auto or manual state 1 next state NEXT STATE AUTO T loose brea else if auto or manual sta i 2 next state NEXT STATE MANUAL goto 005 break break Loose the suppo rt while the Manual Loosening button is pressed case STATE MANUAL L90 t pole SENI NG ST if fs stralght STATI C amp amp button down portA BUTTON UP oosen else goto_manual stop_ tight ening motor break Tighten the support pole while the Manual Tightening button is pressed and the pole is not stea
13. in the US 1 2 Socially Assistive Robotics Throughout the world the elder population as well as people with disabilities have expressed preference to live as independently as possible in their communities They often need technological supports to carry out their everyday living objectives Governments around the world cannot afford to satisfy all of these needs nor supply those services at this moment or in the short term This is where automation engineering has to take its part acting as a social service Socially Assistive Robotics SAR is a response to these problems SAR are defined as 1 Information used in the writing of paragraphs 1 1 and 1 2 has been extracted from The Engineering Handbook of Smart Technology for Aging Disability and Independence Helal Mokhtari and Abdulrazak 2008 2 Definitions used in 1 2 paragraph have been obtained from Defining Socially Assistive Robotics David Feil Seifer and Maja J Mataric Interaction Laboratory University of Southern California In proceedings of the 2005 IEEE 9th International Conference on Rehabilitation Robotics June 28 July 1 2005 Chicago IL USA 13 the intersection of Assistive Robotics AR robots that assist people with physical disabilities through physical interaction and Socially Interactive Robotics SIR robots whose main task is some form of social or human robot interaction SAR share with AR the goal to provide assistance to human users
14. return 0 Prepares the CAN message objects for reception param none return 0 in t canrxconfig void 1 Prepares a CAN message object for reception Qparam cs pointer to the structure for message object information Qparam id standard 11 bit id of the message to be received param command driver cO that defines type of reception Qparam pointer to the buffer where received data can be stored param len number of bytes to be received param ing interrupt on reception 1zyes return 0 int CANconfi gRX st cmd t cs uintl16 t id can cmd t command uint8 t buffer uint8 t len uint8 t irq CANconfigRX amp ask cmd MCUREPLY ID CMD DATA MASKED ask data 2 0 return 0 1 Prepares a CAN message for sending and gives the command to CAN driver Blocks until the transfer is completed Frees the used MOB Qparam id standard 11 bit id of the CAN message 126 data pointer to the array of data to be send len number of bytes to be send max 8 eturn 0 int CANSendMessage ui nt16 t id uint8 t data uint8 t len uint8 t irq st cmd t cs cs cmd CMD TX DATA cs id std Td cs dic len cs pt_ data data cs ctrl ide 0 Cs PI ger m can cmd amp cs if cs handle lt 8 sbi CANIE2 cs handle irq enable interrupt for the MOb else sbi CANI El cs handle 8 irq Wait until the transfer is com
15. C programming example This sample code has been used to test the VRbot module in a serial programming PC environment It uses two GPL files rs 232 c and rs 232 h developed by Teunis van Beelen This program was compiled executed and tested with Embarcadero RAD Studio 2010 Trial Version under Windows Vista environment Header file voicerecon h The following definit Further details of the Appendix C of t define START RECOGNITION d define TRIGGER A define INSTRUCTION B define MOVE LEFT define MOVE RIGHT define STOP C define TIGHTEN D define GO HOME E define GO TO BED F define GO TO CHAIR G define CLOSE H define define START RECON d define TRIGGER RECON A define ORDER RECON B define TIMEOUT t define RECON OK r define ASK ID x define IDO A define WAKE b define LANGUAGE SET define ENGLISH TA define OK o define FIVE SECONDS F define SET TI MEOUT o help to work with the VRBot module environment VRbot commands and responses can be found in proj ns he is Declaration of the functions used void initialization unsigned char bu void Sendinstruction unsigned char int Getinstruction unsigned char buf Source file voicerecon c struction unsigned char buf on h 1 Voi ceRec 1 15 232 This program has been created as a test of the VRbot module under a PC environment
16. TYPE CODE 3 Keep position and speed reference ive write param32 CODE MODE TYPE CODE TUMI Start motion ive send command CODE UPD if button down portA BUTTON TIGHT LOOSE drive send command CODE STOP goto tight break else if button down portA BUTTON drive send command CODE STOP goto home else if button down BUTTON BED drive send command CODE STOP goto bed if button down portA BUTTON MANUAL drive send command CODE STOP goto manual break if drive read param32 ASK APOS drive read param32 ASK_CPOS ri Sets position mode 3 r r r goto tight Check VR commands tch VRorder DE VR MOVE LEFT drive RU goto moving break F wi mu am VR MOVE GHT drive send nd CODE STOP goto moving right brea VR_STOP drive_send_command CODE_STOP goto_auto break case VR_TIGHTEN drive send command CODE STOP goto tight break DN VR GO HOME drive send command CODE STOP goto home break case VR 60 TO BED 97 drive send command CODE STOP goto 5 2 brea else drive send command CODE STOP goto auto break break case STATE AT HOME if drive read param32 ASK APOS drive read param32 ASK 5 Wait until actual speed 0 while drive read param32 ASK ASPD 0 Reset faults drive send comma
17. but as SIR this assistance is through social interaction In SAR the robot s goal is to develop close and effective interaction with the human user for the purpose of giving assistance and achieve measurable progress convalescence rehabilitation learning etc The defining characteristics of the SAR are the following Reliability Security and Safety The most important factors when a robot is used by a person errors are not allowed because it could result in injuries User interface Non complex accessible and personalized user interfaces are required Mechanical and Ergonomic Infrastructure It has to be easy to install in another place Hardware and Software Real time operating systems algorithms and software architectures should be enhanced to perform a suitable control of the mechanical structure On top of all of these characteristics users acceptance of SAR robots and devices is the most important factor of all They have to be easy to use non intrusive and feel as part of the environment This project is under the field of SAR There are a lot of possible developments in this field and technological advances and researches will lead the way for more 1 3 Getting up assistive technology and automation One of the problems usually elderly people have is the difficulty of getting up when they are sat or laid down This project is the first one centered in solving this problem assisting elderly people in getting up
18. error happens every time the code is loaded and it seems an error related to the I2C communication protocol or the LIS3LVO2 driver used in the system this driver is a custom driver The error is automatically solved if the system is shut down and then turned on again The program does not always execute the whi e 1 loop in the mai n function at the first time It is a strange error as in mai n the motors as well as the state machine interrupt are initialized The system then starts its usual operation but as the voice recognition subroutine is done in the whi e 1 loop inside mai n voice recognition does not work It is even stranger that during its normal operation suddenly the system enters in the loop and voice recognition starts This is done at random sometimes starting after a few seconds and sometimes after a minute or two The system was also tested without interrupts thus no state machine and at a different frequency of the interrupts to see if this error was related to an overwhelmed microcontroller but the same malfunctioning still happened This error does not happen if the code is loaded and the system not restarted but this creates a conflict with the error of the accelerometer values previously commented 46 7 Conclusions and future work Conclusions As the final tests show many improvements have been successfully implemented However some other improvements are needed for a proper operation of th
19. from chairs beds etc The project was already started as part of the Master s Thesis work of Teemu Kuusisto student of the Automation and Systems Department at Helsinki University of Technology At the beginning of this project a prototype was already designed and constructed but the managing and controlling software was unfinished The main purpose in this project is to improve the original prototype fixing any possible error in the original software and adding some basic functionalities After the work of this project has been done the prototype should be a step closer from being a standalone product that with further developments especially in the design phase could be actually used in a real environment 14 2 Description of the existing prototype support pole In this Final Project improvements to an unfinished prototype of climb support are made The prototype was created by Teemu Kuusisto in his Master s Thesis project Prior to starting working with the improvements it was necessary to study how this prototype is constructed and how it works 2 1 Support pole prototype overview The prototype is basically a pole with a handle that moves on a ceiling along a fixed path and it s able to lengthen and shorten itself at a given point tightening or loosening between the floor and the ceiling While fixed it can be used as a robust support that helps to get up At this point the movement on the ceiling is done using a long s
20. its basic structure Below there is a detailed list of ideas for system improvement separated in two groups those improvements that will be made in this project and those which will not Code changes and improvements Make the accelerometer work properly Basic collision detection Manual control of the tightening Voice recognition Basic servo control Improved movement on the ceiling Distributed computing Ability to rotate Improved servo control Robotic Servo arm 4 1 Improvements to be done in this project Code changes and improvements Writing such a long code without any flaw it s quite a difficult task Usually there is always plenty of room for improvements and debugging usually detected by those who didn t write the code the first time Thus at the same time I work in the other improvements some code changes will be made and some structures and algorithms will be simplified trying to maintain the compatibility with the rest of the system Make the accelerometer work properly This is the main error of the prototype the accelerometer doesn t seem to work during the initial tests This problem has to be solved in this project so the support does not try to tighten or move when it is leaned in any direction as it can be dangerous for the support 23 itself Basic collision detection As it is now the support moves when an instruction is given but it will continue to move even if an obstacle is in its way This o
21. ne ne ne ne ne ne ne ne ne ne ne ne ne ne ne ne ne ne can controller 10 Number for Operation codes ASKOPCODE ASKLONGOP CODE CODE RESET CODE ENDI NI T CODE AXI SON CODE CACC CODE CSPD CODE CPOS CODE UPD CODE STOP CODE CODE FAULTRESET CODE MC CODE SAP CODE MODE TYPE CODE CPA CODE CPR CODETTUMO CODE TUMI CODE SP1 CODE PP3 CODE PP Cn gt C O gt lt gt lt gt lt gt lt gt lt gt lt gt lt gt lt gt lt x gt lt gt lt nooo TR TC rm 4 4 4 RO 4 1 gt gt c ro c5 CORR CO 1 1 1 1 1 C C5 C5 c5 c gt lt gt lt gt lt gt lt gt lt gt lt lt gt OO CO CO O O NU O O C C5 C5 C5 c5 Re OOOO 0x0000199A ASK_POSERR Memory addresses of variables Structure for asking data from motion controller MCUI D r e a command acceleration command speed command position update immediately 2 2 motion W r m 5 al dd faults otion is completed ets actual value d mode type position to the command eep position peed mode 1 osition mode 3 osition mode 1 and speed reference gt acceleration 0 1 of acceleration value of acceleration sk actual
22. onds n printf Device initial ized n Sendi nstruction unsigned char instruction unsigned char buf instruction Command byte sent to the device through the serial port buf Byte read from the serial port buffer This function sends an instruction to the device and then waits for a response from it void Sendinstruction unsigned char instruction unsigned char buf nt response 0 endByte 0 instruction hile response 1 i S response Pol Comport 0 buf 1 Getinstruction unsigned char buf buf Byte read from the serial port buffer This function gets the byte read from the device and translates the response to a more friendly language Always returns zero save if the instruction close is given 77 that case it will return one and the main routine wil int Getl nstruction unsigned char buf int close 0 switch buf case MOVE LEFT LEFT mt reak case MOVE RI GHT eee Al n 5 reak case STOP BELLE reak case TI GHTEN case GO HOME B ewm HOME reak case GO TO BED pino eem TO BEDI n reak case GO TO CHAIR 7 TO CHAIR1n reak case CLOSE close 1 break default return close end 78 Appendix E Final code of the system program In this appendix the code used for the system program is included The table below shows the files of the program along with a general descrip
23. pressed STATE MANUAL LOOSENING does the opposite moving the support up loosening then while the button manual loosening is pressed These states are quite similar to the manual states STATE LEFT and STATE RIGHT which move the support leftwards and rightwards while the proper button is pressed It is needed also to read the values of the sliding potentiometer when manually 30 tightening as it is implemented in the state in which the support tightens automatically STATE TIGHTENING to prevent malfunctions and accidents There is no need for adding a limit when going up as if the upper limit is reached the motor just stops It is important to notice though that at this point of the project the manual control of the tightening was implemented only for test purposes and also to start working and getting familiar with the system s code It worked but the accelerometer still did not It was possible then to tighten the support even if it was not straight This problem was solved in the next section 5 1 3 Tests with the accelerometer Basic functionali In the testing phase it was clear that the accelerometer was not working well The pole could be moved violently in any direction but that did not affect any of the actions of it After examining the code and doing some tests printing the values of the accelerometer x y and z axis the cause of the error came out it was not working due to the loose values given in the func
24. t button stateA uint8 t button stateE uint8 t buttons changedA uint8 t buttons changedE static int previous state 0 int direction 0 Defines the moving way of the shaft motor uint8 t tightening time 0 uint8 t loosening time 0 Auto state 1 Manual state 2 uint8 t auto or manual statez0 Returns the nonzero if specified button is pressed uint8 t button down portA uint8 t button return BUTTON PINA 1 lt lt button uint8 t button down E uint8 t button return BUTTON PINE 1 lt lt button Below are defined all the functions that make transitions between states and control the LEDs in the control pad E eases Go to NONE state uint8_ pe ese none on LED_ READY I ed on LED AET ON State STATE NONE 85 uint8_ uint8_ uint8_ return 0 Go to AUTO state t goto auto auto or manual state 1 rprintf AUTO r n led on LED READY led off LED ACTI ON state STATE AUTO return 0 Go to MANUAL t goto manual auto or manual s rprintf MANUAL led on LED READY led off LED ACTIO state STATE MAN return 0 5 t r 6 2 Go to RIGHT state oto right EM Nri E LED bor Go to LOOSENI NG state t goto loose timer start rprintf LOOSENI NG r n led_on LED_ACTI ON 86 led off LED READY sta
25. they are prepared for working with the Robonova series robots but they are not enough for this system SD commands are on the other hand commands that have to be taught to the module and they are then not language dependent The SD commands are used in this project Both SI and SD commands are divided in two categories trigger words and commands Trigger words are used to prepare the module for receiving a command They are not needed but they are useful to avoid recognition of words when the user does not want to The common use of trigger words is to have the module waiting for recognize a trigger word and then if it is recognized start the recognition of the commands Trigger words have also different recognition rules the module is not as restrictive with these words as it is with commands When managing the instructions and commands with VRbot GUI the instructions are divided in wordsets Wordset 0 is reserved for trigger words while wordsets 1 to 15 are reserved for commands The following instructions have been taught to the module note that the word in capital letters is the word that has been taught to the module Wordset 0 INSTRUCTION This is the trigger word If a user wants the module to recognize any of the commands below first he will have to say this word Instruction and then any of the commands It is important to notice that due to the limitations of the module a pause of about 2 seconds is n
26. voice recognition feature As UARTO is being used for programming debugging and supervising the system VRbot module will be connected to the UART1 of AT90CAN128 as show in the figure DJBOBBBODBSSBOD de 2 10 5 7 VRbot PCB Connection diagram After all the connections have been made microcontroller has to be prepared to read its UART1 on demand so it has to be configured in a similar way as UARTO is This can be easily done in the source code file main c It is recommended to export the code made in section 5 2 6 and test it in the microcontroller environment Of course libraries and functions used previously of the files S232 c and rs232 h have to be substituted by those regarding the serial port connections in the microcontroller vart c uart h uart2 c and uart2 h 43 5 2 8 Implementation of voice recognition instructions in the program code In the previous section it was achieved getting the VRbot module working with the support pole microcontroller So finally voice recognition capabilities can be added to the system To separate the manual control from the automatic control voice recognition will only be implemented in auto mode and will work together with the buttons in this mode The code is similar to the code of the PC example in section 5 2 6 and the algorithm used will be the following 1 Initialize VRbot when the climb support program is turned on 2 In the main routine give the proper command
27. 3 axis accelerometer used to measure the leaning of the support The three axis values given are 12 bit integers thus being between 0 and 4095 The communication standard between the accelerometer and the microcontroller is I2C protocol More information can be found in its datasheet 3 Sliding Potentiometer Microcontroller Motor Controller PCB CANbus Communication PS bm 1 2 3 Zoom of the upper back of the support pole 17 2 2 5 Sliding potentiometer The support can extend and contract itself being able of getting fixed between the floor and the ceiling along its path When the support extends itself to get tight it has to be sure it reaches a tight value enough to safely support the people leaning on it This is where the sliding potentiometer takes its part by continuously measuring its resistance linear with the position of the support When this value surpasses a certain limit established experimentally by testing the motor will stop and the support will be tightened enough As the values given by the sliding potentiometer are analog it is needed a conditioning and amplifying circuit as well as an A D converter to be able to read them with the microcontroller through one of its I O digital ports Tightening Motor Left Right Motor Battery Microcontroller PCB Accelerometer Serial Port Communication CANbus Communication 2 4 Zoom of the upper front of the support pole 2 2 6 Contro
28. 5 12 BY ES LJ enum filter_ mode FILTER ENABLED FILTER DISABLED typedef struct _accel data uint8 t xh xl yh yl zh zl accel data 117 Buffer size for storing accelerometers data in a buffer lla structure define XYZ BUF SIZE 10 6 bytes plus the end of packet Error codes define LIS OK 0 define LIS ERROR BUS BUSY 1 define pdFALSE 0 define pdTRUE 1 ll I Function declarations ITportCHAR lis bus select void l void lis bus unselect voi d uint8 t lis perror void portCHAR lis init void uint8 t lis read reg uint8 t addr portCHAR lis write reg uint8 t addr uint8 t regval portCHAR lis power up void portCHAR lis power down void port CHAR lis SetFilterDataSelection enum filter mode enum hpc hpc target portCHAR lis SetScale enum scale scale trg portCHAR lis SetDataAlignmentSelection enum das das trg portCHAR lis SetDecFactor enum data rate samples drs uintl16 t lis read x voi d uint16 t lis read y voi d uintl16 t lis read z voi d uint16 t lis read xyz b uint8 t buf XYZ BUF SIZE endif LIS3LVO2DRI VER 118 1 63 02 ariver c 1 Accelerometer driver written by Antti Liesj rvi 2 include lis3lv02_driver h include i2c h include rprintf h Initializes the accelerometer n case of problems with the initialization the function sets the lis errno variable with the corresponding error code return pdTRUE co
29. Carlos III de Madrid for allowing me to live the Erasmus experience discovering a country and culture both new to me finishing my studies abroad in a great university and meeting so many unforgettable people in the process Finland and the Finns for receiving me with arms wide open and being such a great country and people it is a pity that I could not stay here for longer But I am sure I will come back someday one way or another Promise Index Terms and acronyms List of figures 1 Introduction 2 Description of the existing prototype support pole 2 1 Prototype overview 2 2 Hardware description 2 2 1 Structure of the pole and the test bed 2 2 2 Motors 2 2 3 Atmel AT90CAN128 microcontroller 2 2 4 LIS3L02 accelerometer 2 2 5 Sliding potentiometer 2 2 6 Control pad 2 2 7 Battery and power supply 3 Initial tests with the support pole 3 1 Manual mode 3 2 Auto mode 3 3 Manual and auto mode 4 Ideas for system improvement 4 1 Improvements to be done in this project 4 2 Other improvements 5 Implementation of improvements 5 1 Optimization and improvements of the original code 5 1 1 Preparing the original code 5 1 1 1 Rename files 5 1 1 2 Delete redundant code 5 1 1 3 Tightening in auto mode 5 1 2 Manual control of the tightening 5 1 3 Tests with the accelerometer Basic functionality 5 1 4 Improvements for the accelerometer Collision detection 5 1 5 Furth
30. ED F define VR GO TO CHAIR G define VR define VR START RECON d define VR TRI GGER RECON define VR ORDER RECON B define VR TI MEOUT t define VR RECON OK r define VR ASK ID x define VR I DO define VR WAKE b define VR LANGUAGE SET define VR ENGLISH TA tions help to work with the VRBot module environment he VRbot commands and responses can be found in is project Ur define VR OK define VR THREE SECONDS F define VR SET TIMEOUT o define VR SET RECOG LEVEL v define VR SD EASY B unsigned char voicerecognition void int VRinitialization voi d Sendi nstruction unsigned char instruction unsigned char response int data void nstruction unsigned char response endif VOICERECON H 106 voicerecon c All t i 1 1 unsigned in re st rp ua re rp if Initia VRini he subroutines managing VRbot module are here voicerecon h yart2 h rprintf h char response char voicerecognition voi d t dataz0 sponse 0 atic int initOK Run initialization subroutine until the device is initialized properly ile init OK 22 initOKsVRinitialization Asking for the trigger word Wordset 4 in VRbot rintf Trigger Word rt lSendBytel VR START RECON sponse Sendinstruction VR TRIGGER 1 respo
31. F clear mob errors 129 while can_cmd Gask_cmd D break else ret Ri t ask data 7 ret lt lt 8 ret 1 t ask data 6 ret lt lt 8 ret ui nt8 t ask data 5 ret lt lt 8 ret uint8 t ask data 4 1 rprintful6 ret ACCEPTED return ret uint8 t drive send command ui nt 16 t code uint8 t ret 0 uint8 t message 2 POSERR 0 121 2A 20 00 00 set position error 0 message 0 ui nt8 t code message 1 uint8 t code gt gt 8 ret CANSendMessage MCASK 10 message 2 0 return ret void drive init drive send command CODE RESET delay ms 500 drive send command CODE ENDI NI T delay ms 500 drive send command CODE AXI SON 130 config h ifndef CO define CO define CAN BAUDRATE 250 CAN baudrate baud Used in CAN initialization macros to calculate baudrate define FOSC 16000 Motor Controller ID define MCID 1 Microcontroller ID define MCUID 2 endi f util h ifndef U define U define c define s endi f 131
32. Found Id AVRBOOT type 5 Information about the download progress ne verifying avrdude 17108 bytes of flash verified avrdude done Thank you Resetting the microcontroller After loading the code the program will start working but until the initialization errors 29 listed in 6 3 are fixed it is needed to turn off and on the device to restart not just reset the system by pressing the PCB button Supervising the support pole To supervise the operation of the program in the console through the serial port introduce the following code in the console user screen dev ttyUSBI HELLO Initializing device I NIT DRIVE INIT DRIVE OK NOT TI GHTENED GOI NG HOME AT HOME AUTO 56 Appendix Makefile of the system program This makefile was originally developed by Teemu Kuusisto being modified accordingly with the renaming of the files as well as the new added files Makefile for the support pole project General Flags PROJECT main MCU at90can128 TARGET main elf avr gcc Favr gcc FCPU 16000000 Options common to compile li nk a assembly rules COMMON mmcu MCU DF_CPU FCPU nd UL HA E options common for all C compilation units CFLAGS ee f 5 gdwarf 2 std gnu99 Os funsigned c
33. N TEKNILLINEN KORKEAKOULU TEKNISKA HOGSKOLAN HELSINKI UNIVERSITY OF TECHNOLOGY Jorge Latorre de la Calle Assistive Robotics and Getting Up Support pole TYO KUULUU OPISKELIJOIDEN MIDE TEKNOLOGIAPROJEKTIIN YLAMUMMO HEILAHTAA A Final Project in Industrial Engineering Espoo December 2009 Supervisor Panu Harmo MSc Abstract of the Final Project Author Jorge Latorre de la Calle Title Assistive Robotics and Getting Up Support pole Helsinki University of Technology Department Automation and Systems Technology Professorship AS 84 Automation Technology Date December 2009 Place Espoo This work is part of Ylamummo Heilahtaa Mide Technology Project for Students Supervisor Master of Science Panu Harmo This project works on the prototype of support pole originally developed by the student Teemu Kuusisto in his Master s Thesis The prototype consists in a pole with a handle that moves along a rail located on the ceiling of the test bed This support can extend and contract itself tightening and loosening between the floor and the ceiling When the pole is fully tightened it can be used as a support that helps people to get up from chairs beds etc A control pad allows the user to control the movement and tightening of the support Improvements are made in the original system code Software errors are fixed and several functionalities are added such as collision detection and servo control Finally a
34. O AUTO NCREMENT MSK OUTY L ADDR MSK mode addr i2c send byte LIS ADDR senddata i2c 115 ADDR 2 recvdata lli2c transfer LI S 1 amp senddata 2 recvdata return recvdata 0 recvdata 1 4 uintl6 t lis read z void unsigned char recvdata 2 unsigned char senddata READ WO AUTO I NCREMENT MSK OUTZ L ADDR MSK I mode addr i2c send byte LIS ADDR senddata i2c recelve LIS ADDR 2 recvdata lli2c transfer LI S 1 amp senddata 2 recvdata return recvdata 0 recvdata 1 4 The same than lis read xyz but puts the results in a buffer ready to be sent uintl6 t lis read b uint8 t buf XYZ_BUF_SIZE i2c send byte LI S ADDR READ WO AUTO INCREMENT MSK OUTX L ADDR MSK mode addr 2c receive LI S ADDR 6 buf return pdTRUE 123 canproto h i f ndef def i ne _CANPROTO_H_ CANPROTOH7 include config h 1 ude include Flags ine CANBUFFER SIZE the data buffer where received CAN messages are stored ide 1 def i def i 1 def def i defi def i def i def def def def i def i def i def i def i def i def i def i def i def i def i def i def i def i def i def i ize of fi Si Message MC CAN mes ne ne ne ne ne ne ne ne ne ne ne ne ne ne ne
35. THEN OK ELSE ERROR set command label to ARDUINO 2009 SEND g SEND SD SEND A SEND M name length 12 characters SEND A SEND R SEND D SEND OU SEND I SEND N SEND O SEND f encode each digit with a prefix followed by the digit mapped to upper case letters SEND TAT SEND SENDA TSI SEND SEND TEN SEND A SEND SEND J IF RECEIVE o THEN OK ELSE ERROR 70 5 Training an SD command repeat the whole training procedure twice for best results train command 0 in group 3 SEND t SEND D SEND A wait for reply default timeout is 3s wait for max 1s more then abort result RECEIVE IF RECEIVE o THEN training successful OK ELSE IF result r THEN training saved but spoken command is similar to another SD command read which one SEND command RECEIVE A may notify user and erase training or keep it ELSE IF result s THEN training saved but spoken command is similar to another SI command always trigger may skip reading SEND command RECEIVE A may notify user and erase training or keep it ELSE IF result t THEN timed out no word spoken or heard ELSE IF result e THEN error code ack and read which one SEND error RECEIVE A 16 SEND error error RECEIVE A perform actions according to error ELSE invalid request or reply ERROR END IF 71 6 Read
36. UID lt lt 4 message 3 ui nt8 t 0x00 message 4 ui nt8 t address message 5 uint8 t address 8 ret CANSendMessage MCASK 10 message 6 0 Wait until the transfer is completed and release mob while 1 1 uint8 t status can get status amp ask cmd if status CAN STATUS COMPLETED while can cmd amp ask cmd CAN ACCEPTED break else if status CAN STATUS ERROR CANSTMOB CANSTMOB OXOF clear mob errors while can cmd amp ask cmd ACCEPTED break else ret ask data 5 ret lt lt 8 ret ask _datal4 1 rprintful6 ret return ret Ask for parameters of drive 1 from specified drive memory address Returns the read value TODO Doesn t handle CAN errors correctl y _t drive read param32 uint16 t address int32_t ret uint8 t message 6 POSERR 121 04 BO 20 00 2A 02 162 04 08 2A 02 FF FF ask position error message 0 ui nt8 t ASKLONGOPCODE message 1 uint8 t ASKLONGOP CODE 8 message 2 uint8 t MCUID lt lt 4 message 3 ui nt8 t 0x00 message 4 ui nt8 t addres message 5 uint8 t addre a gt gt 8 ret CANSendMessage MCASK 10 message 6 0 Wait until the transfer is completed and release mob uint8 t status can_get_status amp ask_cmd if status CAN STATUS COMPLETED while can cmd amp ask cmd CAN CMD ACCEPTED tus CAN STATUS ERROR CANSTMOB 0x0
37. and Independence Helal Mokhtari and Abdulrazak 2008 Defining Socially Assistive Robotics David Feil Seifer and Maja J Mataric Interaction Laboratory University of Southern California In proceedings of the 2005 IEEE 9th International Conference on Rehabilitation Robotics June 28 July 1 2005 Chicago IL USA http cres usc edu pubdb html files upload 442 pdf 09 01 2010 Technosoft web page http www technosoftmotion com index php 09 01 2010 Technosoft PIM3605 Information datasheet and user s guide http www technosoftmotion com products OEM PROD PIM3605 htm 09 01 2010 Atmel web page http www atmel com 09 01 2010 Atmel AT90CAN128 Information and datasheet http www atmel com dyn Products product_card asp part_id 3388 09 01 2010 153102 datasheet http www chipdocs com datasheets datasheet pdf SGSThomson Microelectronics LIS3L02 html 09 01 2010 Ceilbot project http autsys tkk fi en Ceilbot 09 01 2010 VeeaR web page http vee ar com 09 01 2010 VRbot information and datasheet http www veear eu Products VRbot aspx 09 01 2010 VRbot GUI Download http www veear eu LinkClick aspx fileticket KZULbeOgvCM 3d amp tabid 220 amp mid 626 09 01 2010 VRbot User s Guide Download http www veear eu LinkClick aspx fileticket VowGK1u9rRc 3d amp tabid 220 amp mid 620 09 01 2010 51 13 14 15 16 17 18 19 20 21 VRbot pr
38. arch around the Internet and getting more detailed information about various competitive products asking store managers it was chosen the VRbot recognition module from VeeaR http www vee ar com 35 5 2 2 VRbot overview VRbot is a small simple and inexpensive voice recognition module designed to work in robots specially with Robonova series It can communicate with other devices using a UART Key features e 26 built in speaker independent SI commands for ready to run basic controls currently supports US English German Italian and Japanese e Supports up to 32 user defined Speaker Dependent SD triggers or commands as well as Voice Passwords SD commands are language independent e Easy to use and free simple Graphical User Interface to program Voice Commands e The module can be used with any host with an UART interface powered at 3 3V 5V e Serial protocol to access and program the module through the host board operating from 9600bps to 115000bps Hardware included in the package eVRbot PCB eMicrophone eCables for the serial connection 5 3 VRbot package items 36 5 2 3 Connecting VRbot to a PC To start the testing of VRbot module it has to be connected to a PC first As it is specifically designed for being used with Robonova robot series and they are not used in this project a generic external RS 232 board with a DB9 connector has to be used to connect the module to a PC A 5 Volt DC p
39. ce code file 5232 The functions used from the source code 5232 are int OpenComport nt comport number int baudrate Opens the COM port comport number baudrate is expressed in baud per second i e 115200 Returns 1 in case of an error int Poll Comport nt comport number unsigned char buf int size Gets characters from the serial port comport number if any buf is a pointer to a buffer and size the size of the buffer in bytes int SendByte int comport number unsigned char byte Sends a byte via the serial port comport number Returns 1 in case of an error void CloseComport nt comport number Closes the serial port comport number With only these 4 functions the serial port can be programmed In the created program a simulation of the normal operation of the support pole will be made The module will be continuously trying to recognize the trigger word with a timeout of 5 seconds if it is recognized the module will ask then for any of the commands taught previously The program will print on screen everything the module does asking for trigger words orders recognized errors but in a more user friendly way not with simple characters This program example is included in appendix D and as an attachment 11 42 5 2 7 Connecting VRbot and configure the system to work together The serial port has been programmed and the module works so it is time to connect VRbot to the climb support to add the
40. ct they will all be put to 0 As we don t use a decoder yet we connect the C53 bus line to the Chip Select input of the accelerometer As this input is active low the number 7 selects puts to 0 the CS3 signa only and therefore enables the accelerometer This 15 a temporary trick unti we put a decoder for the CS bus lines define LIS BUS ID 7 define LIS BUS ID 8 define LIS ADDR 0x3a define portCHAR unsigned char ing defines are byte bit masks to select read write operations address autoi ncrement dresses of certain registers They should both be placed in the nu is the data ne WHO AM ADDR MSK 0 0 ne CTRL REGI ADDR MSK 0x2 define CTRL REG2 ADDR MSK 0x2 define CTRL REG3 ADDR MSK 0x2 define HP FILTER RESET 0 define OUTX L MSK 0 define OUTX ADDR MSK 0 define OUTY L MSK 0x define OUTY ADDR MSK n X 0x 0 1 2 23 define 0072717 ADDR define OUTZ H ADDR MSK define READ WO AUTO INCREMENT 0x80 define READ AND AUTO NCREMENT MSK OxCOU define WRITE WO AUTO INCREMENT MSK 0x00 define WRITE AND AUTO NCREMENT MSK 0x40 define DATA RATE 40HZ MSK 0x0 define DATA RATE 160HZ 0 define DATA RATE 640HZ MSK 0x define DATA RATE 2560HZ MSK 0 enum data rate U HZ 40 HZ 160 HZ 640 HZ 2560 y 0 4 8 X enum hpc 5 HPC 1024 2048 HPC 4096 enum scale 62 56 enum nbits BITS 12 BITS 2 enum das 8 7
41. ction However this function though implemented in the code did not work properly The support could be leaned in any direction but it still moved and tightened even if forcefully shook Another flaw present in the prototype was that its movement was not symmetrical The speed in which it tightened loosened and moved left right was not the same and sometimes when the support loosened it did not reach the original position it had before being longer then It seemed to be more a flaw of the motor motor controller than of the programming and control of the prototype though It is also needed to mention the implemented initialization routine When turning on the device no orders were accepted until the support was loosened and in the home position This routine was tested many times and it worked correctly 22 3 3 Flowchart of the initialization routine in the prototype 4 Ideas for system improvement The prototype structure is fully functional but there is a lot of room for further improvements which in fact have to be added if it has to meet its targets requirements That is there is still a lot of work needed before it can be of any actual use for elderly and disabled people Many of these improvements however are not under the range of this project The improvements and work in this project are done with the hardware already in use with the chance of adding new modules to the original prototype model but not modifying
42. d to support and connect electrically the electronic components of an electronic device ROM Read Only Memory Non volatile memory of an electronic device in which the programs and operating systems are stored RS 232 Interface standard for serial data communications in electronic devices SAR Socially Assistive Robotics Intersection between Assistive Robotics AR and Socially Interactive Robotics SIR SI R Socially Interactive Robotics Robots whose main task is some form of social or human robot interaction UART Universal Asynchronous Receiver Transmitter Device in a computer or module that transforms serial data to parallel and vice versa 10 List of figures 1 1 Population over 65 years old 2 1 Climb support prototype 2 2 Schematic of the prototype s hardware and communications 2 3 Zoom of the upper back of the support pole 2 4 Zoom of the upper front of the support pole 2 5 Control pad Front view 2 6 Control pad Side view 2 7 Control pad Side view II 2 8 Power supply pins Recharging Home position 2 9 Power supply pins Not recharging 3 1 Flowchart of the manual mode in the prototype 3 2 Flowchart of the auto mode in the prototype 3 3 Flowchart of the initialization routine in the prototype 4 1 Alternative structure for the support pole 4 2 Ability to rotate and servo arm in the support pole 5 1 Flowchart of the manual mode 5 2 Flowchart of th
43. difference is that state transitions do not have to pass through the waiting state necessarily See figure 5 2 the states can be activated using both the control pad or voice recognition save MOVING LEFT and MOVING RIGHT which can only be activated by voice recognition The linear bus communication scheme between the states on the left shows that the system can go from 27 one of these states of the bus to another without passing through the waiting state As in the manual mode state diagram green colored states represent those implemented this project 5 1 Flowchart of the manual mode 5 2 Flowchart of the auto mode 28 5 1 Optimization and improvements of the original code Prior to start adding any new hardware to the prototype many improvements in the original code are made These changes are described in this section and are also listed in chronological order The later an improvement is listed the later was implemented in the prototype NOTE The program managing everything in the support is mainly an interrupt driven state machine being programmed the state machine in files statemachine c and statemachine h and the interrupts in files nterrupts c and interrupts h This state machine function has defined states for each and every of the actions the support can make That is why many times in this section references to this state machine and its states are made 5 1 1 Preparing the original c
44. dy case STATE MANUAL TI GHTENI NG if 15 1 g ht STATI C amp amp button down portA BUTTON DOWN if is d 1 t Buc eee 1 s_steady goto tightened stop ghtening motor break else goto manual Stop tightening motor break the pole is leaned to the left move it case STATE PUSH LEFT if is straight PUSHI NG LEFT amp G drive read param32 ASK APOS lt Set speed mode 1 drive write param32 CODE MODE TYPE CODE SP1 Set command speed to the LEFT drive write paramf CODE CSPD 60 Start motion 100 drive send command CODE UPD else Button is not pressed anymore the support is no straight or jt has reached the end STOP the ceiling motor drive send command CODE STOP M manual reak break LIP E 5 rt is leaned to the right move it t _RI GHT traight PUSHING_RIGHT 6 8 drive_ read param32 ASK APOS gt he su case STATE P if Ci ppo USH 5 5 6250000 Set speed mode 1 drive write param32 CODE MODE TYPE CODE 5 1 Set command speed to the RIGHT drive write paramf CODE CSPD 60 Start motion drive send command CODE UPD else Button is not pressed anymore the support is no straight or it has reached the end STOP the ceiling motor drive send command CODE STOP goto manual break break return 0 101 2 uint16 t y uintl16 t accelerom
45. e auto mode 5 3 VRbot package items 5 4 Pin diagram of the VRbot module 5 5 External RS 232 board 5 6 VRbot External RS 232 board connection diagram 5 7 VRbot Microcontroller PCB connection diagram A 1 Location of the reset and loader buttons in the microcontroller PCB 11 12 1 Introduction 1 1 Our future Before any further explanation about the project it is needed to take a look at the estimates of the future world s population The following table shows the population over 65 years old by regions figure 1 1 North Africa Near East Sub Saharan Africa Europe North America Latin America Caribbean Oceania 1 1 Population over 65 years old US Census Bureau 2000 As shown in figure 1 1 the group of people over 65 years old in the world will almost double in only 30 years The oldest population 85 years old is the most rapidly growing segment both in Europe and North America While this is indeed a good sign direct consequence of the improving of living standards will also create a social problem that has to be managed There is a strong correlation between elders disability and age at least 62 of elders 85 have difficulty with one or more core activities for daily living Approximately 10 of people age 65 have cognitive impairments that impair functional abilities The number of people with disability is estimated around 13 in Europe and around 15
46. e prototype at this stage of development Replace the tightening loosening motor This motor does not work properly and it is not safe for the support pole to use it The problem cannot be fixed either In addition this motor is quite noisy and this creates a conflict with the voice recognition as well as not being user friendly The noise problem is also present in the other motor as well Sound feedback in voice recognition As it is now a PC is needed for monitoring the operation for voice recognition The user does not know if the trigger word or any other command is recognized or not if a PC is not being used unless both recognitions are successful and the result visible This of course is not acceptable out of the development environment Consider an improved recognition system or the implementation of an easy to use built in teach function in the system The device has a big failure rate recognizing other users commands This problem is encountered only using SD commands not SI so maybe in the future with a firmware update the behavior of VRbot module will improve If this does not happen maybe using a more complex module will be the better solution Fix initialization errors commented in 6 3 They are not acceptable out of the development environment Future work The prototype is still at an early stage of development There is a lot of work to be done in further improvements as well as enhancing already im
47. eeded between commands 38 Wordset 1 Command 0 LEFT When this order is given the support should move leftwards only stopping when the system receives another order or reaches the end of the track Command 1 RIGHT As LEFT but going rightwards Command 2 GO HOME Same function as button Home in the control pad Command 3 GO TO BED Same function as button Bed in the control pad Command 4 GO CHAIR Same function as button Chair in the control pad Command 5 TIGHTEN Same function as button Tighten in the control pad Command 6 STOP Order needed to stop the device when moving as actions will be carried out until finished if no other command is recognized After teaching these instructions they can be checked with the program to verify a correct recognition of the command words It is time then to supervise the module operation The commands used for working with the device are English commands but wordsets 2 and 3 have been used for Spanish and Finnish commands These wordsets have also been tested The commands taught to the module are then Wordset 1 Wordset 2 Wordset 3 o Left Vasemmalle Izquierda 1 Right Oikealle Derecha 2 Go home Kotiin A casa Go bed S nkyyn A la cama 4 Goto chair Puolille A la silla 5 Tighten Kiristys Tensar 6 Stop Seis Para Along this project only wordset 1 has been used for development However it is really simple to use wordsets 2 and 3 as well A lang
48. electronic devices To get it installed using Ubuntu OS the following code has to be introduced in the console administrator privileges are required user sudo apt get install avrdude Eclipse C C IDE Eclipse IDE is a powerful GPL development tool for programmers able to manage and debug large projects quite easily The program can be downloaded from its official web page http www eclipse org cdt AVR Eclipse Plug In To recognize the libraries and instructions used by AVR using Eclipse it is needed to get the AVR Eclipse plug in Detailed instructions on how to get the plug in are in the web 53 2 Bootloader The microcontroller and its PCB have a built in bootloader With this bootloader and having all the software tools listed above any code can be loaded on the microcontroller To achieve this these are the steps to be done Compile the program with make Though the program has been written with Eclipse compiling it has to be done from the console A quite complex makefile has to be written and then to compile the program introduce make in the console When executed information about the memory usage of the device will appear See below user user pc climbsupportpole make Compiling information errors warnings etc AVR Memory Usage Device at90can128 am 17236 bytes 13 2 Full t data bootloader ta 397 bytes 9 7 Full data bss noi
49. em interruption is configured to call state machi ne at 1KHz frequency E include avr io h gt 1 lt avr interrupt h gt 1 motor h 1 statemachi ne h 1 leds h include slidepotentiometer h tinclude accelerometer h 1 util h 1 interrupts h fi ncl ude ME 1 global h uint8 t scaler uintl6 t interrupt counter volatiTe uint8 t sec counter volatile uint8 t sec max volatile uint8 t ti mer ms volatile uint32 t timer void ti mer run timer ms if timer ms gt 10 void ti mer start timer ms 0 timer 0 uintl6 t time return timer Control Register TCCROA bits 1024 pP oa C501 500 10 1 mode WGM0 1 1 113 TIMSKO Interrupt bit TOIEO s void init interrupt 0 is used as interrupt source at 16kHz frequency TIMSKO 0 TCCROA 0 sbi TI MSK0 TOI EO Sbi TCCR0A CSO2 sbi TCCROA CS00 sec counter 0 interrupt_counter 0 scaler 0 1 interrupt frequency 16KHz SR TI MERO OVF vect timer run E scaler 16 Calling state machine function at 1ms intervals state machi ne scaler 0 scaler 114 slidepotentiometer h ifndef SLIDEPOTENTI OMETER H define SLI DEPOTENTI OMETER void init potentiometer voi d int is steady voi d v
50. em s response 10 There are three possible responses t timeout word was spoken before the timeout e error error during recognition or confusing results r command recognized the words said fit within the patterns of one of the commands in wordset 1 11 If answer was t or e start again from step 6 If answer was r press space bar 12 The device will answer the number of the command recognized from the specified wordset If it recognized properly GO HOME command answer should be C command 2 from the wordset Built in instructions can also be tested by pressing i instead of d in step 6 The language for these instructions by default is English The whole module can be configured taught and tested by this procedure 41 5 2 6 Programming with VRbot to use it in a PC environment At this point it has already been tested and observed how VRbot works and communicates using the serial port A working program in C C has to be made to test the module with an application The main issue here is the programming of the serial port Open source libraries and functions to use in Linux and Windows with the same source code were found and downloaded from the web page http www teuniz net RS 232 10 Two are the files needed and used in this project to connect program and test VRbot using the serial port with a PC s232 c and rs232 h The header file rs232 4 contains all the definitions needed by the sour
51. ening Loosening motor rprintf function for Atmel AVR series Sliding potentiometer State machine of the system program System timer function libraries UART driver for Atmel AVR series UART driver for Atmel AVR series Standard useful definitions Programmer P S amp JL P S P S P S T K Atm el Atm el JA T K P S P S P S T K The code uses C source files c and header files h The majority of files are source files with attached header files this is noted as in the table as c h 79 Programmers A L Antti Liesj rvi Alvar Aalto University student Automation amp Systems department Atmel Atmel CAN files with copyright J A Johannes Aalto Alvar Aalto University student Automation amp Systems department J L Jorge Latorre University Carlos Ill of Madrid Exchange student at Alvar Aalto University Automation amp Systems Department Writer of this project T K Teemu Kuusisto Alvar Aalto University student Automation amp Systems Department Original developer of the support pole P S Pascal Stang Atmel files under GNU Public License List of printed files File name Page main c 83 statemachine h 86 statemachine c 89 accelerometer h 110 accelerometer c 111 voicerecon h 115 voicerecon c 116 motor h 120 motor c 120 leds h 122 leds c 122 interrupts h 123 interrupts c 123 slidepotentiometer h 125 slidepotentiometer c 125 lis3lvO2driver h 127
52. er switch state case 0 min x MIN X max x MAX X break case 1 min x MIN X LEFT max x MAX X LEFT break case 2 min x MIN X RIGHT max x MAX X RIGHT break case 3 min x MIN X PUSH LEFT max x MAX X PUSH LEFT 104 break case 4 min_x MIN_X_PUSH_RIGHT max x MAX X PUSH RI GHT break Determining the state of the support Pushed left has to be separated because of the nature of its X axis values if state 3 if acceleration x gt min x acceleration x lt max x 88 acceleration y gt MIN Y acceleration y lt MAX 66 acceleration z gt MIN Z acceleration z lt 2 1 return 1 else return 0 else if acceleration x gt min x amp amp acceleration x lt max x 66 acceleration y gt MIN Y acceleration y lt MAX 66 acceleration z gt MIN Z acceleration z lt 2 1 return 1 else return 0 Save accelerometer values in memory void tellAcceleration uintl6 t x uintl16 t y uintl6_t z x acceleration x y acceleration y 7 acceleration 105 voicerecon h ifndef VOlCERECON_H_ define VOICERECON HT The following defini Further details of t the Appendix C of th define VR START RECOGNITION d define VR MOVE LEFT A define VR MOVE RIGHT define VR STOP C define VR TI GHTEN D define VR GO HOME define VR GO TO B
53. er improvements with the accelerometer Servo pushing control 5 2 Voice recognition 5 2 1 Choosing a the voice recognition module 5 2 2 VRbot overview 5 2 3 Connecting VRbot to a PC 5 2 4 Training and testing the module with VRbot GUI 5 2 5 Testing and supervising the module with HyperTerminal 5 2 6 Programming with VRbot to use it in PC environment 5 2 7 Connecting VRbot and configure the system to work together 5 2 8 Implementation on voice recognition instructions in the program code 5 2 9 Making it work all together 6 Final tests 6 1 Testing manual amp auto mode 6 2 Testing voice recognition 6 3 Initialization problems 7 Conclusions and future work 8 DVD Attachments 9 References Appendix A Loading the code on the microcontroller Software needed and Bootloader B Makefile of the system program C VRbot serial protocol C Serial port C C programming example D Final commented code of the system program Terms and acronyms A D Analog to Digital Refers to the conversion of analog signals to digital signals AC Alternating current Electric current periodically reverses its flowing direction AR Assistive Robotics Robots that assist people with physical disabilities through physical interaction AVR The AVR is a Modified Harvard architecture 8 bit RIDC single chip microcontroller which was developed by Atmel in 1996 The AVR was one of the first microcontroller families to
54. erface compatible with 3 3 5V TTL logical levels according to the powering voltage VCC A typical connection to an MCU based host The initial configuration at power on is 9600 baud 8 bit data No parity 1 bit stop The baud rate can be changed later to operate in the range 9600 115200 baud The communication protocol only uses printable ASCII characters which can be divided in two main groups Command and status characters respectively on the TX and RX lines chosen among lower case letters Command arguments or status details again on the TX and RX lines spanning the range of capital letters Each command sent on the TX line with zero or more additional argument bytes receives an answer on the RX line in the form of a status byte followed by zero or more arguments There is a minimum delay before each byte sent out from the VRbot module to the RX line that is initially set to 20 ms and be selected later in the ranges 0 9 ms 10 90 ms 100 ms 1 s That accounts for slower or faster host systems and therefore suitable also for software based serial communication bit banging The communication is host driven and each byte of the reply to a command has to be acknowledged by the host to receive additional status data using the space character The reply is aborted if any other character is received and so there is no need to read all the bytes of a reply if not required Invalid combinations of commands or argume
55. es of the accelerometer If these values show a significant change in the y axis of the accelerometer which is parallel to the axis of the pole it will give the proper commands to the motor to move in the direction being pushed It s quite similar to the previous modification but with a change in the accelerometer threshold Two new states are created in the state machine STATE PUSH LEFT and STATE PUSH RIGHT They will only be reachable when in manual mode and the common static values of the accelerometer are surpassed As stated before if these values show a M T significant change in the y axis the state machine will go to one of these two new states These states then will Call is straight PUSHI NG LEFT or is straight PUSHI GHT which will have special accelerometer limits If the values of the accelerometer are within these limits the support will continue moving in that direction These values have been obtained by iterative testing in order to make the support to move only when pushed This new feature improves also the operation of the collision detection tasks This is because if an obstacle is met the support pole stops and then it will deter that it is being pushed by this obstacle It will then move in the opposite direction of the obstacle not totally separating from it but lessening the strain on the obstacle 34 5 2 Voice recognition Voice recognition implementation is the most complex a
56. eter h ifndef AC define AC void readA int is str void tellA d 4 a4 dx uin uin uin typedef s Taccele 102 void accTOverflow ACCELEROMETER void initAcc endi f accelerometer c In this file all the accelerometer routines are defined Leaning control collision detection and servo control include global h 1 avr i nterrupt h gt 1 ncl C ME include accelerometer h include lis3lv02_driver h include i2c h include leds h include ti mer h include rprintf h Finclude statemachine h Definition of the trigger values of the accelerometer and used to determine if the pole is straight enough for continuing its move or if it is being pushed Accelerometer values are 12 bit integers 0 4095 Static val ues define MIN X 10 define MAX X 100 define MIN Y 40 define MAX Y 100 define MIN Z 4075 define MAX Z 20 X axis values when the support pole is moving leftwards rightwards or being pushed X axis is parallel to the support rail define MIN X LEFT 10 define MAX X LEFT 100 define MIN X RIGHT 1 define MAX X RIGHT 100 define MIN X PUSH LEFT 4065 define MAX X PUSH LEFT 20 define MIN X PUSH RIGHT 80 define MAX X PUSH RIGHT 220 int min x int max X Tacceleration acceleration int iz0 Auxiliar variable used when monitoring accelerometer values using readAcceleration function Accelerome
57. f course can be dangerous so at least some kind of collision obstacle detection has to be implemented If the support encounters any obstacle preventing the movement along its path it has to stop until the obstacle is removed Manual control of the tightening Not strictly necessary for the final product but very useful during developing and testing is the addition of a manual control of the tightening that is being able to move the support up and down as the user wants It will also help to solve partially the asymmetrical movement mentioned before when tightening loosening the support Voice recognition The control pad is useful for testing purposes and quite fast for system development but it s not the ideal controlling scheme for the target users Many elderly and or disabled people won t find themselves comfortable having to control the support with a control pad Easier to use control methods should be implemented widening also the range of possible users One of these control schemes is voice recognition In my opinion adding a voice recognition module to the support will make it more user friendly since it does not require that users actually see or know where the pad is The support could be then controlled using speech recognition only Basic servo control Getting rid of the control pad and make the system easier and more forward to use is one of the main objectives of this project Along with voice recognition there is anothe
58. further instructions during the tightening or loosening of the support were ignored this operation could not be stopped When the support was fully tightened the only instruction accepted was loosening any other commands were not read 3 1 Flowchart of the manual mode in the prototype 3 2 Auto mode Buttons used Home Bed Chair and Tightening Home Bed and Chair buttons moved the support to the points given and defined by 21 the Home Bed and Chair states This movement could only be stopped if a switch to manual mode was made but not in auto mode Thus while getting to the desired position no more actions could be done These positions were defined in the program to be in the left Home middle Bed and right Chair of the rail The Tightening button was supposed to work in the same manner as in the manual mode but it did not This created the additional problem of not being able to control the system in auto mode if the support was previously tightened in the manual mode lt gt _ gt 3 2 Flowchart of the auto mode in the prototype 3 3 Auto and Manual modes Both modes worked together with the accelerometer When moving tightening or trying to the accelerometer values were read and if they were above the predefined limits the instructions were discarded and the movements were not done The purpose was that the support moves tightens only when its position is vertical that is not leaned in any dire
59. g motor The motor has been tested with a DC power supply and monitored using multimeters and an oscilloscope and it does not work well When the support pole is loosening it does not loosen completely even if the signal for it is received Many times it needs signal pulses that is loosen it a bit stop loosen another bit stop and so on It is also needed to mention that the accelerometer trigger values used for collision detection are quite tight Leaning the pole a bit can stop any instruction from being carried out successfully by the system While this is in general a good feature it has some negative effects in auto mode sometimes stopping the support while moving from one position to another i e when going from position home to position chair 6 2 Testing voice recognition Voice recognition has been implemented in this project It is needed then to determine its functionality After testing it at 2 meters range the following conclusion can be extracted Recognition is accurate there are no false recognitions This is especially 45 important for the trigger word as it is not recognized in a normal conversation Approximately 9096 recognition success when the support pole is static Recognition patterns are really tight spoken commands are not always recognized Decreased recognition success when the support pole is moving Due to the noise of both tightening loosening and leftwards rightwards mo
60. g of SD SV command Group index 0 trigger 1 15 generic 16 password 2 Command position 0 31 Expected replies STS SUCCESS n 6Eh Label SD SV command Group index 0 trigger 1 15 generic 16 password 2 Command position 0 31 Length of label 0 31 Text for label ASCII characters from A to Expected replies 515 SUCCESS 63h Request count of SD SV commands in the specified group 1 Group index 0 trigger 1 15 generic 16 password Expected replies STS COUNT p 70h Read SD SV command data label and training Group index 0 trigger 1 15 generic 16 password Command position 0 31 Expected replies STS DATA 6Dh Request bit mask of non empty groups Expected replies STS MASK 72h Reset all commands and groups uu Expected replies STS SUCCESS 64 78h Request firmware identification Expected replies STS_ID 79h Set transmit delay 2 0 10 ms 11 19 20 100 ms 20 28 200 1000 ms Status Details Replies to commands follow this format Please note that numeric arguments of status replies are mapped to upper case letters see the related section k 6Bh Mask of non empty groups 02 8 4bit values that form 32 bit mask LSB first In reply to CMD_MASK_SD Integer 0 31 In reply to CMD_COUNT_SD w 77h Wake up back from power down mode
61. har funsigned bitfields or CFLAGS Wa fpack struct fshort enu CFLAGS MD MP MT F o MF dep QF d Assembly specific flags ASMFLAGS COMMON ASMFLAGS CFLAGS ASMFLAGS x assembler with cpp Wa gdwarf2 Linker flags LDFLAGS COMMON LDFLAGS map Intel Hex file production flags HEX FLASH FLAGS R eeprom HEX EEPROM FLAGS j eeprom HEX EEPROM FLAGS set section flags eeprom alloc load HEX EEPROM FLAGS change section ma eeprom 0 no change warnings Objects that must be built in order to link OBJECTS main o statemachine o leds o interrupts o motor o s accelerometer o lis3lv02 driver o a2d o 2c o uart2 0 norinti can_lib o canproto o voicerecon o Objects e added by the user lid E 0 buf e b 20 iin dry 0 LI NKONLYOBJ ECT i Build all TARGET main hex main eep main lss size flash main hex avrdude c avr911 P COMI b 115200 p at90can128 U flash w mai n hex 37 flashlinux avrdude c avr911 P dev ttyUSBI b 115200 p at90can128 U flash main hex Compile main o main c CC INCLUDES CFLAGS c lt statemachine o statemachine c CC INCLUDES CFLAGS c lt leds o leds c CC INCLUDES CFLAGS c lt interrupts o interrupts c CC I NCLUDES CFLAGS c lt motor o motor c CC I NCLUDES CFLAGS c lt slidepotentiometer o slidep
62. he left to the right or if it s static and define the proper limits We need thati s straight function reads the movement of the system For doing this the function will read the movement as an argument given by the state machine Will be then is straight int state Being the defined state values 1 If moving left state MOVING LEFT 2 If moving right state MOVING RIGHT 0 Rest of cases state STATIC This is easy to do in manual mode as all the states will call function is straight STATIC save the states STATE LEFT and STATE RIGHT which will call thefunctioni s strai ght MOVI LEFT andis straight MOVI RIGHT 32 Auto mode is however a bit tricky As Home Bed and Chair positions are defined it is known that when pressing Home button the support will go to the left no matter what is position was so it has to call function i s strai ght MOVI NG LEFT It is also known that when pressing Chair button the support will go to the right calling function is strai ght MOVI NG RIGHT then but the movement when the support goes to the position Bed is not clear So for bed position it is needed to implement an algorithm to identify the direction of the movement For calling the correct i s strai ght movement function the state of the system is saved in an additional variable This state however is not the same as that of the state machine but a special one which saves the value
63. ied drive memory address TODO Doesn t handle CAN errors correctly uint8 t drive write param32 uint16 t address int32 t value uint8 t ret 0 uint8 t message 6 POSERR 0 121 2A 20 00 00 set position error 0 Iln each 2 byte field LSB is sent first In 4 byte field the More significant 2 bytes are sent first message 0 uint8 t address message 1 uint8 t address gt gt 8 message 2 int8 t value value gt gt 8 message 3 value value gt gt 8 message 4 ui nt8 t value value gt gt 8 oo ui nt8 t value message 4 int8 t val ue val ue z8 message 5 value u message 2 uint8_t value value gt gt 8 message 3 uint8 t value ret CANSendM cio Del MCA SK x message 6 0 return ret 1 Fixed point byte order differs from 32bit integer uint8 t drive write paramf uint16 t address int32 t value int32 t ret intl16 t value ret lt lt 16 value gt gt 16 ret 1 drive write param32 address ret return 0 Ask for parameters of drive 1 from specified drive memory address Returns the read value TODO Doesn t handle CAN errors correctly nt16_t drive_read_param uint16_t address intitle t ret uint8 t message 6 POSERR 121 04 B0 20 00 2 02 162 04 08 2A 02 FF FF ask positio message 0 message 1 _t ASKOPCODE _t ASKOPCODE gt gt 8 128 in message 2 uint8 t MC
64. ill really have sense in a fully domotic house In this kind of houses a central computer with a powerful and all purpose CPU would manage all the electronics and communications All the calculations not involving the basic movement of the support should be done out of its internal microcontroller So the voice recognition module would be better implemented and processed if it was in a central computer The same could be said about its location system which now is really simple but should be improved if the support has to move along the entire house more or less freely It would also allow some improvements like the ability to call the support if it is in another room Ability to rotate The support pole as it is now moves along the rail but it cannot rotate That is the handle is always in the same direction While not compulsory if a proper movement system in the ceiling is implemented it would be useful to add the ability of rotating the ability to rotate the support in a 360 degree arc This will really make things easier for their users and would make the use of the support pole more comfortable With the current structure this cannot be done so an improved architecture is needed See figure 4 2 Improved servo control 3 More information about the Ceilbot project can be found on http autsys tkk fi en Ceilbot 25 In this project a basic servo control will be implemented but this servo control is flawed by design It is u
65. instruction If successfully recognized it will ask then for commands in wordset 1 English commands As the recognition level for SD commands is set to hard false recognitions disappear 44 6 Final tests After all the implementations have been done some final tests are needed to see if this thesis has met its purpose in improving the original prototype Each and every of the new functions and fixes implemented in this project have been extensively tested 6 1 Testing manual amp auto mode All the improvements made in both modes over the original prototype work properly In manual mode manual control of the tightening servo control and collision detection have been implemented successfully In auto mode the tightening loosening has been implemented as well as collision detection Movements can now be stopped and modified on demand so the user does not have to wait for an instruction to be carried out successfully to give another command to the system One of the errors of the original prototype has not been solved though The movement when tightening loosening is still asymmetrical The support pole tightens correctly but when loosening it does not recover its original position Usually it stops earlier and the manual loosening has to be used instead to get it back This problem has been studied but cannot be solved in the prototype as it is just by changing the code This error is caused by a malfunction of the tightenin
66. l pad The control pad is used to give the proper binary commands to the support to make it work The commands given are read by the microcontroller which then gives the proper commands to the motor controller Each button of the control pad is connected to a pin in one of the I O digital ports of the microcontroller These are the buttons used in the control pad see figures 2 5 2 6 and 2 7 On Off switch Turn on off the device Auto Man switch Mode selector between manual and auto modes Vasen Oikea Left Right button Move left right orders in manual mode Koti Home Move to the defined position home in auto mode 18 S nky Bed Move to the defined position bed in auto mode Tuoli Chair Move to the defined position chair in auto mode Kiristys Tightening Tightening Loosening order in both manual and auto modes The control pad has also two LEDs see figure 2 6 controlled output digital signals of the microcontroller Red LED Ready LED turned on when the system is waiting for a command Yellow LED Action LED turned on when the system is performing an action 2 5 2 6 and 2 7 Control pad front and side views 2 2 7 Battery and power supply The support is energized by a 12V battery attached to the pole This battery recharges when the support is in home position This is possible thanks to two pins with 12V DC located at the end of the rail When the support is in ho
67. lics i e state_machine c Code in a different font i e is straight int state States Arguments in capital letters i e STATE MOVE RIGHT Before the depiction of the implementation of the improvements flow diagrams of the operation of the intended final support pole are shown They increase the understanding of the full system and put in context the added features In these flow diagrams states in the system are represented by rectangles while the arrows are commands that allow the transition of one state to another I nitialization routine This routine was already well implemented in the prototype The state NOT READY loosens the support pole and then moves it to the home position State NONE is a temporal state used to read the mode switch and the system will end always in AUTO or MANUAL states which then will be waiting for the proper commands See figure 3 3 Manual mode The states reachable by the manual mode can be identified from the state diagram shown in figure 5 1 As the majority of states only work while a button of the control pad is pressed or the support pole pushed they have to return to the manual wait state to be able to accept any other commands This is represented in the diagram with bidirectional arrows New states added over the original prototype are green colored while the states already implemented in the prototype are blue colored Auto mode Auto mode is similar to the manual mode The main
68. lis3lvO2driver c 130 canproto h 137 canproto c 139 global h 146 util h 146 NOTE This code has been in file commented after the final tests Any change has been made in the code after the final tests only comments Just in case any error occurs when compiling and testing this code the same code tested is included as DVD attachment 12 main c define MAIN_C l mai n the devices attached to it routine initializes all the 1 0 of the microcontroller function statemachine c file include lt avr io h gt 1 lt avr interrupt include lt util delay h gt 1 util h include motor h 1 statemachine h 1 leds h 1 ncl interrupts h include i2c h include 1153102 driver h include slidepotentiometer h i nclude a2d h 1 accelerometer h include 2 h 1 rprintf h 1 h 1 voicerecon h void unsigned char VRorder volatile uint8 t canstate volatile uint8 t state volatile uint8 t next state 110 of the MI CROController define CANID 2 int main void CAN initialization caninit Digital I O initialization init 1 while 1 Starting voice recognition subroutine VRorderzvoicerecognition return 0 void init void llStart Ti me timer start
69. m32 ASK 05 gt 1000 VRorderzzVR 5 1 drive send command CODE STOP goto auto break else The support is leane drive send command CODE 92 goto auto break break case STATE MOVI RI NR instruction mode is select it reaches the i is straight M Mo The support will only s n a top if different VR or AUTO inst MANUAL ns u e ction or 0 V d boun VING_ Set speed mode 1 rive write param32 CODE MODE TYPE CODE SP1 Set command speed to the RIGHT rive write paramf CODE CSPD 60 Start motion rive send command CODE UPD heck if home bed or chair is p ed or manual mode button down port A BUTTON MANUAL drive send command CODE STOP goto none break else if button down portA BUTTON HOMEJ VRorderzzVR GO Start to move the ceiling motor to position HOME drive send command CODE STOP goto home js EMEN button down port AC BUTTON we ee ae oa G0_TO_BED Start to move the ceiling motor to position BED drive send command CODE STOP goto 280008 rn e if button down port A BUTTON ve ae VRorderzzVR GO TO CHAIR Start to move the ceiling motor to position CHAIR drive send command CODE STOP JUS chairt bre else Ts VRorder VR_MOVE_LEFT drive send command CODE STOP goto moving left break If VR or manually order to start tightening stop the mot
70. me position it contacts those pins see figures and It s very important then to leave always the support in home position to avoid an eventual battery discharge 2 8 Recharging Home position 2 9 Not recharging 19 20 3 Initial tests with the support pole After studying the basics of the prototype s architecture and hardware the first tests were made to see it working The purpose of these first tests with the prototype was to determine its basic functionalities capabilities limitations and design errors Before doing this it was necessary to study carefully and understand the prototype s code 5 As it has been seen in the control pad the prototype can switch between two main modes Auto mode and Manual mode These modes determine the actions and buttons used in the prototype 3 1 Manual mode Buttons used Left Right and Tightening Left and right buttons consequently moved the support leftwards and rightwards along the rail at a fixed speed while pressed The tightening button had two uses When the support was not tightened it gave the proper orders to the motor controller to lengthen the support until it was fully tightened and steady The support knew when it was fully tightened by reading the digital values of the sliding potentiometer electric resistance given by the A D converter attached to it If already fully tightened pressing the button got the support back to its initial position Any
71. mmand from stopping recognition that will continue until timeout or other recognition results Expected replies STS SUCCESS STS INTERR 5 73h to the specified power down mode Sleep mode 0 8 0 wake on received character only wake on whistle or received character 2 wake on loud sound or received character 3 5 wake on double clap with varying sensitivity or received character 6 8 wake on triple clap with varying sensitivity or received character Expected replies STS SUCCESS 62 reu Timeout 1 default 0 infinite 1 31 seconds Expected replies STS SUCCESS 1 69h Activate SI recognition from specified wordset Wordset index 0 3 Expected replies STS SIMILAR STS TIMEOUT STS ERROR t 74h Train specified SD SV command 1 Group index 0 7 trigger 1 15 generic 16 password Command position 0 31 Expected replies STS SUCCESS STS RESULT STS SIMILAR STS TIMEOUT STS ERROR 67h Insert new SD SV command DT m index 0 7 trigger 1 15 generic 16 password Expected replies STS SUCCESS STS OUT OF MEM 1 75h Remove SD SV command 1 Group index 0 trigger 1 15 generic 16 password 64h Activate SD SV recognition Group index 0 trigger 1 15 generic 16 password Expected replies STS RESULT STS SIMILAR STS TIMEOUT STS ERROR 63 65h Erase trainin
72. mmand CODE STOPJ goto tight break else if button down portA BUTTON drive send command CODE STOP goto home else if button down BUTTON CHAI R drive send command CODE STOP goto chair ri d d d d d 95 if button down portA BUTTON MANUAL drive send command CODE STOP goto manual break if drive read param32 ASK APOS drive read param32 ASK_CPOS goto tight break Check VR commands oe VRorder case VR MOVE LEFT drive send command CODE STOP goto moving left break case VR MOVE RIGHT drive send command CODE STOP goto moving ri ght break VR_STOP drive send command CODE STOP goto auto break 145 VR_TIGHTEN drive send command CODE STOP goto break P VR GO HOME drive send command CODE STOP goto home break case VR_GO_TO_CHAIR drive send command CODE STOP goto chair break else drive send command CODE STOP goto auto break break Auto instructions Go to chair The support will move to the defined chair position it will stop if another valid instruction buttons or VR commands is given case STATE CHAIR previous state state if is straight MOV ING RI GHT 96 Position absolute ve_write_param32 CODE_MODE TYPE CODE_CPA Sets command position 5867580 ve write param32 CODE CPOS 5867580 ive write param32 CODE MODE
73. moving left reak else if VRorderz VR MOVE RIGHT break moving right n els button down portal BUTTON Rue LOOSE VRorder VR_TI GHTEN oto tight break break Moving left in manual mode while Left button is pressed and the movement limits not reached case STATE LEFT if is 42777 PERS set speed mode write Parum orbe MODE TYPE CODE SP1 set command speed to the LEFT y write paramf CODE CSPD 80 start motion ive send command CODE UPD button down portA BUTTON LEFT button down portE AT HOME drive read para APOS gt 1000 AS i E 0 o 4 r r if button is not presse drive send COD goto manual break nymore STOP the ceiling motor else drive send command CODE STOP goto manual break break Moving right in manual mode while Right button is pressed and the movement limits not reached case STATE RI GHT if T set speed mode dis write par am32 CODE MODE TYPE CODE 5 1 set command speed to the RIGHT drive write paramf CODE CSPD 60 IIstart motion drive send command CODE UPD if button_ RIGHT drive read param32 ASK_APOS 6250000 LET GR is not drive send command DE manual brea more STOP the ceiling motor P else drive send command CODE STOP goto manual 9 break break VR instr
74. nd CODE FAULTRESET Set actual position 0 drive write param32 CODE SAP 0 Update drive send command CODE goto auto break else drive send command CODE FAULTRESET goto auto break break hten the support pole until it is steady and go to state TI GHTENED operation cannot be stopped TATE TI GHTENI NG if fs strai ght STATI C tighten ti ghteni ng time ti me loosening time tightening time 5 if button down portA BUTTON LOOSE lis strai ght STATI C if auto or manual state 1 next State NEXT STATE AUTO stop tightening motor goto loose break else if auto or manual state 2 next state NEXT STATE MANUAL stop tightening motor goto loose break if is steady goto ti ghtened Stop tightening_ motor break 98 else drive send command CODE STOP goto auto break break Loosen the support pole a fixed time 5 seconds more than the tightening time case STATE LOOSENI NG oosen ti me rprintf TI ME d r n loosening ti me if loosening time 0 Stop tightening motor if next state NEXT STATE HOME goto home break if next state NEXT STATE BED goto bed break if next state NEXT STATE CHAIR goto chair break if next state NEXT STATE MANUAL goto manual break if next state
75. nd large part of all the improvements made on the original prototype In this project voice recognition will be implemented on the prototype 5 2 1 Choosing a the voice recognition module After studying the matter it was clear that the microcontroller AT90CAN128 was not capable of doing the task Voice recognition is quite demanding in terms of processing power and the chip is already overwhelmed when doing other tasks i e in A D conversion with the sliding potentiometer Thus an additional module should be added Before choosing any systems the requirements needed for our system as well as the limitations imposed by it have to be studied It has to be able to replace the control pad The system needs to recognize only a few simple commands not many more than buttons in the pad A full expensive high end voice recognition system is not needed then Something simple and cheap should work After the requirements for the operations have been defined the limitations of the system have to be considered These limitations are mainly the available connection protocols between the module and the microcontroller PCB Apart from its I O digital ports the AT90CAN128 microcontroller has 2 serial ports one of them is used while programming and debugging but the other is free and accessible Thus the connection can be made using digital inputs via the I O ports of the microcontroller or using the serial port available After doing some rese
76. ned char regval i2c send byte LIS ADDR READ WO AUTO I NCREMENT MSK addr mode addr i2c receive byte LIS_ ADDR amp regval return regval Writes a single register of the accelerometer address of the register to write param value to be written in the register return pdTRUE if success return pdFALSE if error 0 the function sets the lis errno n case of error the corresponding error code variable with portCHAR lis write reg uint8 t addr uint8 t regval unsigned char table 2 ble 0 addr WRITE WO AUTO NCREMENT MSK e 1 regval 2 send LI S ADDR 2 table return pdTRUE portCHAR lis power down void uint8 t conf Read the actual configura conf lis_read_reg CTRL_ REG ADDR MSK if conf pdFALSE debug POWER DOWN could not get the bus n return pdFALSE else 1 only the power down bits the contr register lis write reg CTRL REGI ADDR MSK conf 0x3F 0011 1111 return pdTRUE portCHAR lis power up void uint8 t conf conf lis read reg CTRL REGI ADDR MSK if conf pdFALSE debug POWER UP could not get the bus n return pdFALSE else Modify only the power down bits in the a register lis write reg CTRL REGI ADDR conf 0xC0 1100 0000 return pdTRUE portCHAR lis SetDecFactor enum data rate samples drs Data Rate Sample
77. nit The makefile of the project is included in appendix B To know how this makefile has to be written for AVRdude to recognize the code in it it is recommended to read AVRdude user s guide http www nongnu org avrdude user manual avrdude html Put the microcontroller in bootloader mode To charge the code to the microcontroller it is needed first to put it in bootloader mode There are two visible buttons in the AT90CAN128 s PCB used to do this reset button and loader button See figure A 1 To put the microcontroller in bootloader mode the following actions have to be done in strict order 1 Press and maintain pressed reset button 2 Press and maintain pressed loader button 3 Unpress the reset button 4 Unpress loader button After doing this the microcontroller will enter in bootloader mode and the code can be 54 loaded Reset Button wr 1371117 22 Loader Button A 1 Location of the reset and loader buttons in the microcontroller PCB Loading the code When the device is in bootloader mode to load the code it is needed to connect the PCB to the PC using serial connection the PCB has a DB9 connector and then introduce the following instruction in the console this code is also included in the makefile SIE avrdude c avr911 P dev ttyUSB1 b 115200 p n128 U flash mai n hex AVRdude should then answer information related to the program download Connecting to programmer
78. nse data rintf Response c response Testing purposes f the trigger word is recognized start command recognition if not print a message error or ti meout responsezzVR RECON OK sking for commands Wordset 1 in VRbot ACCEP TED Instruction uartlSendByte VR START RECON response Sendinstruction VR ORDER RECON response data rprintf Response c response Testing purposes if response VR_ RECON OK response Sendinstruction VR_ACK response data rprintf Response c n response 1 Testing purposes else if d rA TIMEOUT rprintf Timeout n else rprintf Recognition fail se if response VR TIMEOUT rprintf Timeout n else rprintf Recognition failed n turn response zation of VRbot module alization void 107 rprintf Initializing device n Waking up device from low power saving mode while response VR_OK amp amp i 101 H2 22 VR_WAKE response data i i 100 rprintf ERROR Failed to initialize deviceln ini tOK 0 i Ask firmware ID rprintf Response response response Sendi nstruction VR ASK 1D response data rprintf Response response if response VR_ASK_ID rprintf ERROR Cannot read device D n init OK 0 Send ack and read status expecting D 0 response Sendinstr
79. nts are signaled by a specific status byte that the host should be prepared to receive if the communication fails Also a reasonable timeout should be used to recover from unexpected failures If the host does not send all the required arguments of a command the command is ignored by the module without further notification and the host can start sending another command The module automatically goes to lowest power sleep mode after power on To initiate communication send any character to wake up the module 61 Command Details Format of command strings accepted by the module Please note that numeric arguments of command requests are mapped to upper case letters see the related section x 6Bh Set SI knob to specified level 1 Confidence threshold level 0 4 0 loosest more valid results 2 typical value default 4 tightest fewer valid results NOTE knob is ignored for trigger words Expected replies STS SUCCESS v 76h Set SD level 1 Strictness control setting 1 5 1 easy 2 default 5 hard A higher setting will result in more recognition errors Expected replies STS SUCCESS 1 6Ch Set SI language 1 Language 0 English 1 Italian 2 Japanese 3 German Expected replies STS SUCCESS b 62h Abort recognition in progress if any or do nothing Known issues In firmware ID 0 any other character received during recognition will prevent this co
80. ode After studying the code it was decided to start with 3 simple tasks First renaming Finnish names to English names second deleting of redundant code and third fixing the not working tightening feature of the auto mode 5 1 1 1 Rename files Many of the files had already English names as they consist of GPL source code files directly used to control and configure the system s hardware There are many others though developed by Teemu Kuusisto the prototype s designer that had Finnish names List of the renamed files tanko c main c napit c statemachine c napit h statemachine h moottori c motor c moottori h motor h ledit c leds c ledit h leds h keskeytys C interrupts c keskeytys h interrupts h liukupotentiometri c slidepotentiometer c liukupotentiometri h slidepotentiometer h summeri c Duzzer c summeri h buzzer h Makefile is also changed accordingly 29 5 1 1 2 Delete redundant code The original code was using two different files as well as their two attached respective header files for the accelerometer control As this is not necessary these files were merged into one file Files acce erometerc and kiihtyvyysanturi c merged into one accelerometer c same for header files This leads to redundant code functions with different names but same purpose so these functions are deleted and calls to these functions fixed 5 1 1 3 Tightening in auto mode This feature was missing in the original
81. of some of the previous states For example when going from home to bed this variable will save the value STATE and when going from chair to home the value will be STATE CHAIR instead So comparing the actual state STATE BED with the previous state we now the direction of the movement This state is not saved when the support is tightening so the value will be always or STATE CHAIR or STATE HOME but it will be reset if we go to the manual mode These code changes effectively improve the accelerometer routines and implements collision detection It has to be said though that due to the extreme sensitivity of the accelerometer the values change constantly even if the support is still This is why the limits established for the collision detection can t be too tight So this code detects objects when the support is leaned more than 2 3 degrees and in that case stops its movement 23 The objective now is to implement some basic servo control of the support That is if a user wants to move the support pole in a direction he she will not have to necessarily use the control pad just pushing the pole in the desired direction should work also As it is understandable this will only be implemented in manual mode As the prototype has no push detector this functionality will be based on the previous modification for obstacle detection code If the support is in manual mode and stopped it will read the valu
82. oid readPotenti ometerVal ue voi d endi f slidepotentiometer c 1 In this file all the sliding potentiometer routines are defined The slide potentiometer is attached to the string in the tightening motor and measures if it is steady enough when tightening include lt avr io h gt include 420 include inttypes h include motor h include uart2 h include rprintf h define LIMIT VALUE 980 uintl6 t result u08 potentio tick 0 void init potentiometer voi d a2d nit Initialize potentiometer a2d c int is steady voi d Read analog value from A D channel 7 Result is 10 bit integer max value is 1024 Analog to Digital conversion is Slow and this call blocks unti the value is ready This shouldn t be run inside an interrupt result a2dConvertl0bit 0 if result lt LIMIT_VALUE return 1 S else return 0 void readPotentiometerValue void t a2dConvert10bit 0 inting for testing potentio tick 160000 0 rprintf POTENTI OMETER d r n result resul Pr If potentio_tick 115 116 1 63 02 driver h ifndef LIS3LVO2DRIVER_H_ define LIS3LVO2DRIVER_H 1 lt inttypes h gt 1 Converted to use 2c bus not tested yet probably not yet working The id for the micro bus Note that in the bus select function the CS lines will be set to this number and in the bus unsele
83. or and start tightening i VRorder VR TIGHTEN button down portA BUTTON TI GHT _LOOSE drive send STi goto tight break 11 VR ordered to stop or it reaches the limits stop the ceiling motor else 1 drive read param32 ASK APOS lt 6250000 VRorder VR STOP drive send STOP goto auto break else The support is leaned don t move 93 drive send command CODE STOP Tum auto reak break Auto instruction Go home The support will move to the defined home position it will stop if another valid instruction buttons or VR commands is given case STATE HOME previous state state if is strai ght MOVI NG_LEFT Position absolute rive write param32 CODE MODE TYPE CODE_CPA Sets command position 0 rive write param32 CODE CPOS 1000 Sets position mode 3 rive write param32 CODE MODE TYPE CODE PP3 Keep position and speed reference rive write param32 CODE MODE TYPE CODE TUMI Start motion rive send command CODE UPD if button down portA BUTTON LOOSE drive send command CODE STOPJ goto tight break else if button do drive send com goto chai r else if button down p drive send command goto bed if button down portA BUTTON MANUAL drive send command CODE STOP MS manual n_portA BUTTON CHAI R an dc ODE STOP ort A BUTTON BED CODE STOP 3
84. otentiometer c CC I NCLUDES CFLAGS c lt accelerometer o accelerometer c CC I NCLUDES CFLAGS c lt lis3lv02 driver o lis3lv02 driver c CC INCLUDES CFLAGS c lt a2d o a2d c CC INCLUDES CFLAGS c lt 120 0 C 5 26 s CC INCLUDES CFLAGS c fgnu89 inline lt uart2 0 uart2 c CC INCLUDES CFLAGS c lt rprintf o rprintf c UEG FII NCLUDES CFLAGS c lt buffer o buffer c CC I NCLUDES CFLAGS c lt canproto o canproto c CC INCLUDES CFLAGS c lt can lib o can lib c TNCLUDES CFLAGS c lt can_drv o can_drv c CC INCLUDES CFLAGS c lt voicerecon 0 voicerecon c CC I NCLUDES CFLAGS c lt Li nk TARGET OBJ ECTS CC LDFLAGS OB ECTS LI NKONLYOBJ ECTS LIBDIRS LIBS o TARGET hex TARGET avr obj copy 0 ihex HEX FLASH FLAGS lt 0 56 size Cle PHONY clean TARGET avr obj copy HEX EEPROM FLAGS O ihex lt 0 exit 0 TARGET avr objdump h S lt gt 0 TARGET echo avr size C mcu MCU TARGET an target clean rm rf 0BJ ECTS cie mk di main elf dep main hex main eep main lss main map r dep 2 dev null wildcard dep 59 60 Appendix VRbot Communication Protocol Protocol and Interface Basics Communication with the VRbot module uses a standard UART int
85. otocol Download h ttp www veear eu LinkClick aspx fileticket qJhfDIDWpC8 3d amp tabid 220 amp mid 626 09 01 2010 Serial port protocol http en wikipedia org wiki Serial port 09 01 2010 HyperTerminal http www hilgraeve com htpe download html 09 01 2010 RS 232 C C Libraries http www teuniz net RS 232 09 01 2010 AVRdude http www bsdhome com avrdude 09 01 2010 Eclipse C C IDE http www eclipse or 09 01 2010 AVR Eclipse plug in http avr eclipse sourceforge net wiki index php The AVR Eclipse Plugin 09 01 2010 Embarcadero RAD Studio 2010 https downloads embarcadero com free rad studio 09 01 2010 A book on C Kelley and Pohl 1990 52 Appendix A Loading the code on the microcontroller Software needed and Bootloader This appendix is a small tutorial of how to load the code written to the microcontroller using serial port communication A 1 Software needed In order to program the microcontroller it is required to have several software packages first listed below Linux OS Eclipse C C IDE AVR Eclipse Plug In AVRdude Linux Unix OS This project has been done under Linux Ubuntu 9 04 OS but any Debian based Linux OS should serve as well It may work under other operating systems but it has not been tested AVRdude AVRdude is a GPL software package that allows machines running under Linux Windows environments to load unload the code to several
86. ower supply will be needed for both modules Detailed information can be found in its datasheet 7 5 4 Pin diagram of the VRbot module 5 5 External RS 232 board VRbot Host MCU 5 6 Connection diagram Serial port communication parameters of the module e Baud Rate 9600 default 19200 38700 57600 115200 8 Data bits No parity e 1 Stop bit No flow control As the microcontroller AT90CAN128 by default has the same parameters for the serial communication nothing has to be reconfigured or changed to interconnect them These parameters are needed when programming and testing the system with a PC though 37 5 2 4 Training and testing the module with VRbot GUI With the module connected its graphical user interface GUI has to be opened VRbot GUI downloadable from the web page of the supplier and press connect A detailed tutorial of how to teach and train commands is also downloadable 8 There are two types of words that can be recognized by the module Speaker Independent commands SI and Speaker Dependent commands SD SI commands are built in recognition patterns included within the device s firmware As the time goes by the supplier will update these patterns to add more SI commands in more languages As this project is being written there are 25 SI commands in each of these 4 languages English German Japanese and Italian However in this project these commands are not being used as
87. plemented functionalities At the moment the prototype usefulness is limited and certainly a polishing work is needed both in aesthetic and functional terms before it can possibly get out the development environment and reach the market But clearly an evolution of the support pole would be welcomed in hospitals nursing homes and private homes altogether The field of socially assistive robotics is expected to reach the mass market in the future It is important then to develop new robots and devices to compete in the market The versatility users acceptance as well as the cost of these products has to be the key of future developments 47 48 8 DVD Attachments 1 PIM3605 Intelligent Control Module datasheet 2 PIM3605 User s Guide 3 AT90CAN128 datasheet 4 LIS3L02 Accelerometer datasheet 5 Prototype s original code 6 Loading the code on the microcontroller Bootloader 7 VRbot datasheet 8 VRbot users guide 9 VRbot serial protocol 10 Serial port programming libraries 11 Serial port programming example 12 Final code used in the final tests 13 Final commented code 14 Video presentation of the support pole 15 VRbot GUI 1 1 3 16 HyperTerminal Private Edition 6 3 Also in the appendix 49 50 9 References 1 2 3 4 5 6 7 8 9 10 11 12 The Engineering Handbook of Smart Technology for Aging Disability
88. pleted and release mob while can get status amp cs CAN STATUS COMPLETED return 0 Prepares CAN message object for reception param cs pointer to the structure for message object information paramid standard 11 bit id of the message to be received param command driver command that defines type of reception param pointer to the buffer where received data can be stored len number of bytes to be received paramirq interrupt on reception 1 eturn 0 1 int CANconfigRX st cmd t cs 16 t id can cmd t command t buffer uint8 t len uint8 t irq cs cmd cs gt id e cs gt id s cs gt dic CS pt d cs gt ctrl i cs gt ctrl while can cmd cs CAN CMD ACCEPTED if cs handle 8 sbi CANIE2 cs gt handle irq Enable interrupt for the MOb els el sbi CANI El cs gt handle 8 irg return 0 Write one parameter to drive 1 into specified drive memory address TODO Doesn t handle CAN errors correctly uint8 t drive write param uint16 t address 16 t value uint8 t ret 0 uint8 t message 4 127 POSERR 0 121 2A 20 00 00 set position error 0 message 0 uint8 t address message 1 uint8 t address gt gt 8 message 2 uint8 t value message 3 uint8 t Pee 8 ret CANSendMessage MCASK 10 message 4 0 return ret Write one parameter to drive 1 into specif
89. position sk actual speed sk command position Ila Ila Ila llask position error received CAN message data 124 ee struct Function pro int caninit vo int canrxconfig int CANSendMessag to d v _Canmess types oid int CANconf i gRX AR uint8 t ui nt8 len uint t get void handle can messages dendi f drive write param drive write Rum drive write paramf drive send command drive read param ui drive read param32 ive inTt I CANPROTO H can message ui nt8 t pd D ata uint8 t can cmd en ui cmd ui 125 canproto c 2009 Johannes Aalto modi T ed CAN prototype model for using Microcontroller as a CAN master and a Slave motor controller s 1 lt avr io h gt 1 lt avr interrupt h gt 1 lt inttypes h gt 1 lt util delay h gt include canproto h 1 can drv h 1 can lib h 1 global h 1 rprintf h 1 statemachine h stati stati 15 global pointers to received messages 1 nitializes the CAN module param none return 0 n int caninit void can_init 0 Initialize CAN controller parameter has no effect on fixed baudrate CANGIE 0x3A Enable CAN interrupts receive transmit and errors canrxconfig Initialize CAN messages to be recei ved
90. prototype The states managing the tightening loosening of the support STATE TIGHTENING STATE TIGHTENED STATE LOOSENING were prepared to work both in manual and auto modes but not the states managing the auto mode STATE AUTO STATE HOME STATE BED and STATE CHAIR The solution was then to add the code to these states in a similar way it was implemented on the manual states 5 1 2 Manual control of the tightening The addition of the manual control of the tightening required more work The purpose was to give the ability to the support of moving up and down when with the appropriate commands with the control pad thus tightening and loosening manually The control pad had no free buttons to use so buttons Home and Bed will be used as if they were manual tightening and manual loosening buttons in the pad These buttons are not used in the manual mode only in the auto mode so they won t create any incompatibility error in the system The relative position of the buttons in the pad helps to remember their function The system s state machine had defined states for tightening and loosening but these states ignore any order while working More states have to be defined and programmed to implement the manual control of the tightening then Two states will be created STATE MANUAL TIGHTENING and STATE MANUAL LOOSENING In STATE MANUAL TIGHTENING the support moves down tightening while the button manual tightening is
91. r control method that is in addition quite simple to implement in its basic form Servo control If the user wants to go forward with the support it can be done by simply leaning the support in the desired direction The accelerometer will detect this the motor will be activated and then it will move the support in the desired direction 24 4 2 Other improvements out of this project work and capabilities Movement on the ceiling The basic design of the on rails ceiling movement for the prototype is functional for testing and development purposes but needs a total overhaul before it can realistically be implemented in a house It now only works in a straight line but the ability to turn and or have crossroads should be implemented to export the system to a real house environment In any case the on rails movement is limited as the support pole can t move freely that is it has to follow the rail not being able to cover the space of a whole room A more evolved system should be the way to go in the future For example using wheels both in the floor and in the ceiling at the same time which would allow the support to move in an effective 360 degree arc See figure 4 1 Investigation of a different approach around this matter robots moving on the ceiling is being done at the moment by the Automation and Systems Department in the project Ceilbot Distributed computing The prototype is now working as a stand alone model but it w
92. r is directly controlled by the microcontroller using its digital outputs More information about the motor controller can be found in its datasheet 1 and user s guide 2 Movem ent Motor I2C Protocol Tightening Motor Digital Outputs 2 2 Schematic of the prototype s hardware and communications 16 2 2 3 Atmel AT90CAN128 microcontroller The AT90CAN128 is an 8 bit general purpose microcontroller with several add ons to improve its communication and storage capabilities Extensive information of the microcontroller can be found in its datasheet 3 All of the prototype s control and calculations save those related with the movement motor are performed in it The software implemented is mainly an interrupt driven state machine that checks the inputs outputs and states of the climb support It gives the proper commands to the tightening motor and the motor controller and makes the calculations and A D conversions required for it It also communicates with all the other hardware elements of the system in many different ways and protocols See figure 2 2 CANbus for communicating with the motor controller Serial communication through one of its two UARTS for PC connection to load the code on the ROM and for supervising tasks 2C bus for communication with the accelerometer Digital I O used with the control pad and sliding potentiometer 2 2 4 1153102 accelerometer LIS3LO2 is a
93. rrect initialization return pdFALSE problems with the initialization portCHAR lis init void Initialize control registers CTRL REG1 20h PD1 1 PDO 1 device ON DF1 0 DF0zQ 40Hz data rate 15 0 Self test OFF 2 1 Enable axis Z Yenzl Enable axis Y 1 Enable axis X 1 CTRL REG2 21h 1 5 0 Scale 2g BDU 0 Block Data Update enabled BLE 0 little endian mode BOOT 0 No reboot memory content ENZX Data ready on pad DRDY 0 Disable Data Ready Generation 151 M 0 Serial mode interface to 4 wire SPI mode DAS 1 Data alignment 16 bit left justified CTRL REG3 22h ECKz0 external clock disabled HPDD 0 High pass filter for direction detection disabled HPFF 0 High pass filter for free fall disabled 5 0 Filtered data section bypassed 1 Ilres I CFS1 0 I CFS0z0 High pass filter Cut off frequency selection to 512 115 write reg CTRL REGI ADDR MSK 0xC7 lis write reg CTRL REG2 ADDR MSK 0x41 lis write reg CTRL REG3 ADDR MSK 0x00 lis errnozLI S OK return pdTRUE Reads a single register from the accelerometer param address of the register to read 119 return the value of the register read return OxFF in case of error case of error the function sets the lis errno variable with the corresponding error code uint8 t lis read reg uint8 t addr unsig
94. s uint8 t conf conf2 0 L REGI ADDR MSK R C FACTOR could not get the bus n e reg CT if con LSE SET DE r FALSE Selina A lis read f pdFA vie et pd else modify only the decimation factor bits in the control register switch drs case HZ 40 conf2 conf OxCF XX00 XXXX brea case HZ 16 con bre case HZ 6 con bre case HZ 2 con conf 8 OxCF 0x10 01 XXXX conf amp OXCF 0x20 10 XXXX conf 0x30 XX11 bre default conf2 conf lis write reg REGI ADDR MSK conf2 return pdTRUE portCHAR lis SetFilterDataSelection enum filter mode f mode enum Dp hpc PE uint8 t conf 0 conf2 0 conf lis read reg CTRL REG3 ADDR if conf pdFALSE debug SET FILTER could not get the bus n return pdFALSE else switch f e case FILTER i SABLED UM conf OxEF XXX0 XXXX case FILTER ENABLED conf2 conf 0x10 XXX1 XXXX break default conf2 conf switch o aet case HPC 51 conf2 conf2 OxFC XXXX XX00 break case HPC 1024 conf2 conf2 OxFC 0x01 XXXX XX01 T MG 8 OxFC 0x02 XXXX XX10 rea case 4096 121 conf2 conf2 0x03 XXXX XX11 break default break lis write _reg CTRL_REG3 ADDR MSK conf2 is read Tegl HP FILTER RESET MSK Reset the contents of the internal return pdTRUE
95. s to start recognition of the trigger word continuously While doing this auto mode works as usual with the control pad 3 If in AUTO mode and the trigger word is recognized the module will ask for a valid instruction then If the trigger word is not recognized go back to step 2 4 If the instruction is recognized successfully the desired action will be carried out by the robot Whether the instruction is recognized or not go back to step 2 5 2 9 Making it work all together The algorithm implemented previously in 5 2 8 is functional However a change has to be made in the voice recognition system to make work safer A flaw of the VRbot module operation when recognizing trigger words was encountered during the first tests of the complete system Voice recognition patterns for trigger words are too loose This is a problem because it causes a lot of false recognitions for trigger words That is the user says for example function but trigger word instruction is recognized instead This cannot be solved changing the code It is not possible to change the hardness of the recognition patterns for trigger words as it is for commands stored in other wordsets The solution to this problem was to teach the word instruction to the module and store it in a command wordset wordset 4 different for the one used for the other commands The program will ask for commands in wordset 4 being the only one command in the wordset the word
96. sing an accelerometer to detect if it is being pushed or not While this works it implies that the support pole has to be leaned in the direction the user wants it to move Furthermore the accelerometer used works also with the collision detection feature and it is quite tricky for the system to determine if the cause of its leaning is due to a collision or of a user pushing the pole It would be more elegant and precise the addition of hardware modules to do this task Robotic Servo arm If all the previous improvements were made a good addition that would really help disabled and elderly people would be a robotic or servo arm The climb support is created to help people to get up and move through the house but it doesn t help that much if they have to crouch get down to get something from the floor In addition doing it is usually a hard task for elderly people Attaching a robotic arm whether servo controlled or not is a design and economic decision would help people in everyday house works and situations 4 1 Alternative movement 4 2 Ability to rotate on the ceiling 26 5 Implementation of improvements In this section all the improvements and additional features listed in section 4 1 will be implemented Later on these improvements will be tested and evaluated Along this section reference to files code and states and or function arguments will be made To quickly identify them they will be written as Files in ita
97. t and received are written explicitly in order to clarify the communication protocol detailed in the previous sections 1 Recommended wake up procedure wake up or interrupt recognition or do nothing use a timeout or max repetition count DO SEND b LOOP UNTIL RECEIVE 2 Recommended setup procedure ask firmware id SEND x IF NOT RECEIVE x THEN ERROR send ack and read status expecting id 0 SEND IF RECEIVE A THEN OK ELSE ERROR set language for SI recognition Japanese SEND 1 SEND C IF RECEIVE o THEN OK ELSE ERROR set timeout 5 seconds SEND o SEND F IF RECEIVE o THEN OK ELSE ERROR 68 Recognition of a built in SI command start recognition in wordset 1 SEND i SEND B wait for reply if 5s timeout has been set wait for max 6s then abort 4 otherwise trigger recognition could never end result RECEIVE IF result s THEN successful recognition ack and read result SEND command RECEIVE A perform actions according to command ELSE IF result t THEN timed out no word spoken ELSE IF result e THEN error code ack and read which one SEND error RECEIVE A 16 SEND T error error RECEIVE A perform actions according to error ELSE invalid request or reply ERROR END IF 69 Adding a new SD command insert command 0 in group 3 SEND g SEND D SEND A IF RECEIVE o
98. tA BUTTON MANUAL reset faults ive write ramp2i CODE CACC ACC 1 update values ive send command CODE UPD goto manual break else if button down portA BUTTON AUTO reset faults drive send command CODE FAULTRESET defines drive write param32 CODE CACC ACC 01 defines speed drive write paramf CODE_CSPD 130 update values 89 drive send command CODE UPD goto auto break break Manual state Buttons used Left Right Tightening Manual Tightening and Manual Loosening It also checks accelerometer values for servo control case STATE MANUAL state state if any of the listed buttons are pressed and go to the desired own portA BUTTON LEFT eftt t n down portA BUTTON AUTO 7 down portA BUTTON UP manual loose utton down portA BUTTON DOWN manual tight OD c7700 07 7 30 s2 cR gt id e break Auto state Buttons used Home Bed Chair and Tightening t also checks voice recognition commands VRorder case STATE AUTO if button down portA BUTTON MANUAL goto none break else if button down portA BUTTON HOME VRorderzzVR GO HOME goto home break i button down porta BUTTON CHAIR VRorder VR_GO_TO_CHAIR ae chair break else if VRorder VR_MOVE_LEFT 90 goto
99. te STATE LOOSENI NG return 0 0 THE BEDV rin dies Go to CHAIR state oto chair intF GOING TO THE CHAI R r n on LED ACTI ON off LED READY e STATE CHAIR rn 0 ae aes Go to AT HOME state uint8 t at home rprintf AT HOME r on LED ACTI ON led on LED READY State STATE AT HOME return 0 n o Go to NOT READY state uint8 t goto not ready timer start led on LED ACTI led on LED READY State STATE NOT READY return 0 E Go to INIT DRIVE state uint8 t goto init drive timer start rprintf HELLO r n led on LED ACTI led on LED READY state STATE INIT DRI VE return 0 E Go to MANUAL TIGHTENING state t goto manual tight rprintF MANUAL TI GHTENING rin on LED ACTI ON led off LED READY state STATE MANUAL TI GHTENI NG return 0 RAE Go to MANUAL LOOSENING state De Go to PUSH L oto manual loose i ntF MANUAL LOOSENING1 rin TE ACTI ON of f LED READY STATE MANUAL LOOSENI NG r EFT SERVO state tj oto push left LEFT1 rin LED ACTI ON LED READY STAT E PUSH LEFT Go to PUSH RIGHT SERVO state E Go to MOVI NG RI Go to MOVING oto push right ED_ACTI ON LED_READY STATE PUSH RI GHT GHT Voice recognition onl
100. ter initialization subroutine void initAcc i2clnit lis init lis power up Read each axis values using 12C protocol uintl6 t getX return lis read x uintl6 t getY return lis read y getZ 103 return lis read z Read and save accelerometer values using 12 bus void readAcceleration voi d unsigned char buffer XYZ BUF SIZE lis read xyz b buffer acceleration x buf ffer 0 buffer 1 4 acceleration y buffer 2 buffer 3 4 acceleration z buffer 4 buffer 5 4 Printing for testing purposes only if i 10 rprintf x d t t y d t t z d r n acceleration x acceleration y acceleration z i 20 t T is straight int state state Argument given by state machine routine indicating the movement of the support pole O Static 1 Moving left 2 Moving right 3 Pushed left 4 Pushed right This function reads the accelerometer values and compares them with the defined limits for the support in its current state of movement As the movement is onl direction left or right only the value of X axis parallel to the rail has to be modified Returns 1 if the pole is straight enough Movement commands or if in manua mode is pushed Servo control Returns 0 otherwise int is straight int state readAcceleration Defining the trigger values for the acceleromet
101. tion of their purpose and programmers To compile the program the makefile included in appendix B is needed Only the files developed and written by Alvar Aalto University students for this project are printed The remaining files are general purpose generic files not developed with this project in mind that can be obtained from Atmel or are GNU Public License Files File name a2d c h accelerometer c h avrlibdefs h avrlibtypes h buffer c h buzzer c h can_drv c h can_lib c h canproto c h config h global h i2c c h i2cconf h interrupts c h leds c h lis3102 c h lis3102_driver c h main c motor c h rprintf c h slidepotentiometer c h statemachine c h timer c h uart c h uart2 c h util h Filenames Functions Devices managed Analog to digital conversion libraries Accelerometer control routines Definitions and macros for Atmel AVR series Type definitions for Atmel AVR series Buffer libraries used by the UARTs Buzzer not used CAN drivers for Atmel AT90CAN series CAN function libraries for Atmel AT90CAN series Modified CAN libraries for additional functions General system definitions Includes and definitions for Atmel AVR series 1 protocol for Atmel AVR series 1 protocol for Atmel AVR series Interrupt for the state machine subroutine LEDs of the control pad Accelerometer drivers for Atmel AVR series Modified and improved accelerometer drivers Main routine Tight
102. tion supervising them This function is straight implemented in the original code determines if the support is straight enough to be able to move or tighten If the values given by the accelerometer exceed the predefined limits ofi s strai ght any movement instruction will be ignored Thus printing the values of the 3 accelerometer axis and checking the state of is straight function along with iterative testing allowed to fix the problem After this improvement if the support is leaned a bit about 3 degrees it stops moving The values are at this point quite tight but this was done on purpose as it is designed to work together with further improvements on the accelerometer control that will be done in the following sections NOTE It is important to notice that these values obviously depend on the position and orientation of the accelerometer along the support If the accelerometer is moved somewhere else the values have to be configured again 3l 5 1 4 Improvements for the accelerometer Collision detection The accelerometer routine previously implemented is just a basic functionality but it is only truly designed for a static support that is when it receives instructions being static or it is tightening loosening When the support is moving the values of the accelerometer are not exactly the same and the tight static predefined values do not fit continuously stopping the movement It is needed then to improve is s
103. tors and the microphone being so near to them This problem can be partially solved by speaking louder Dramatically decreased recognition success when the user giving the commands is different to the user who trained the system Speaker Dependent commands those used in this project are really like that speaker dependent Voice recognition is done in auto mode but when in manual mode the system still continues recognizing commands Usually this is not a problem but if a command is recognized in manual mode and then the user switches to auto mode this command will be carried out The recognition success improves though if the language used for it is Spanish or Finnish as they are languages easier to pronounce and less prone to be affected by the original mother language of the user It cannot be ignored when testing voice recognition that the VRbot module was taught by a Spanish person and the spoken English does not sound exactly the same as the English of a Finn as were the people who helped with the test of the system 6 3 Initialization problems Along the whole project a persistent error has been detected This error was also present in the prototype The microcontroller does not always initialize well Two problems have been detected during the initialization When loading the code to the microcontroller the system automatically starts working but the values of the Y axis of the accelerometer change a lot This
104. traight function so it can identify whether the support is moving leftwards or rightwards In addition while doing this it can also be implemented collision detection The objective then is that the support moves knowing the direction in which is moving and if it encounters something in its way that prevents it to move it has to stop avoiding any damage trouble This can be done because when the support collides with an object it will still try to move leaning in the direction of its movement The accelerometer will detect this leaning and is straight function should prevent the support of moving further The following code changes will try to implement this collision detection in both manual and auto modes The values for the accelerometer when the pole is moving will be asymmetrical depending on the support moving leftwards or rightwards Some extra definitions are required as well as changes the code of the function is strai ght These changes are different in manual and auto modes The first step for doing this is reading the accelerometer values when the support moves to the left and right both in manual and auto modes These values are different when moving left or right but the same when moving in auto or manual modes With these values the new limits that will be used by is straight when the support is moving in any of the two directions can be defined Then the function has to know whether the support is moving to t
105. traight rail control commands are given by a control pad attached to the pole The prototype along with its different parts can be seen in the following figure 2 1 Ceiling Rail Power Supply Motor Battery Accelerometer Microcontroller Motor Controller Control Pad Frame of the test bed 2 1 Climb support prototype attached to the test bed 15 2 2 Hardware description In this section an overview of all the main components used for the construction of the prototype will be made in order to understand better its functioning 2 2 1 Structure of the pole and the test bed As shown in the figure 2 1 the structure is archway shaped and it is designed to support the weight of the prototype as well as to make it stable It has a rail on the top crossing the structure lengthwise in which the support is located Along this rail there are three virtual locations being the left end position home right end position chair and the middle of the rail position bed 2 2 2 Motors All the movements of the support pole are provided by the action of two DC motors One of the motors moves the support along the ceiling rail while the other shortens and lengthens the pole to fix it tighten it between the ceiling and the floor The motor moving the support leftwards rightwards along the rail is monitored and controlled by TechnoSoft s PIM3605 Intelligent Control Module using CANbus communication The tightening moto
106. uage selector could be added to the system also 39 5 2 5 Testing and supervising the module with HyperTerminal In this section how to supervise the operation of the module using a serial port connection will be explained The program used for reading and giving orders through the serial port is HyperTerminal downloadable from the web page http www hilgraeve com htpe download html To supervise the module via serial port understanding how it really works is required Documentation and examples of the protocol are included in the attachments 9 and can also be downloaded from the supplier s web page The VRbot module communicates through the serial port in quite a simple way It reads simple characters which are taken as commands and gives also simple characters in response These are some of the inputs and outputs used by the module and required for the testing I nputs Introduced in HyperTerminal console b Instruction to wake up the module from its original low power mode If the device is not waken up it won t do anything Prepare the device to start recognition of predefined orders SI or language dependent orders Prepare the device to start recognition of taught orders SD or non language dependent orders 2 Capital letters are used by the module as numbers following the rule A 0 B 1 C 2 and so on Space bar Asks the module to give a response from the previous instruction Outp
107. uction response data rprintf Response response if response VR 100 rprintf Device 1D c n response rprintf ERROR Device 10 doesn t match n initOK 0 else rprintf Device identified n oll et language for built in system instructions English R LANGUAGE SET response Sendinstruction VR ENGLI SH response data rprintf Response c n response if response VR OK rpri ntf ERROR Co instructions English in uld not set default language for built in init OK 0 else rprintf Language set English n Roo et timeout 3 seconds SET TIMEOUT response Sendinstruction VR_THREE_SECONDS response data if response VR_OK rprintf ERROR Timeout not set n init OK 0 else rprintf Ti meout set 3 seconds n Set SD recognition level to easy tI uartlSendByte VR SET RECOG LEVEL responsezSendi nstruction VR SD EASY response data rprintf Response response if response VR OK rprintf ERROR Could not set SD recognition level to easy n i ni tOKz0 else rprintf Set SD recognition level to easy n 108 if the device has been initialized properly el if initOKzz1 ini tOKz2 rprintf Device initialized n else rprintf DEVICE NOT INITI ALI ZED n rprintf Init ok d n initOK return init OK
108. uction Move left The support will only stop if MANUAL mode is selected it is given a different VR or AUTO instruction or it reaches the boundaries case STATE MOVI NG LEFT if is 1 LEFT iset speed mode 1 Te write param32 CODE MODE TYPE CODE 5 1 set command speed to the LEFT drive write paramf CODE CSPD 80 IIstart motion drive send command CODE UPD icheck if home bed or chair is pressed or manual mode if button down portA BUTTON MANUAL drive send command CODE STOP goto none break else if button down portA BUTTON HOMEJ VRorderzzVR GO start to move the ceiling motor to position HOME drive send command CODE STOP goto home js button_down por tACBUTTON G0_TO_BED 115 to move the ceiling motor to position BED drive send command CODE STOP goto 20d S e if button down port A BUTTON CHALR VRorderzzVR GO TO CHAIR l start to move the ceiling motor to position CHAIR drive send command CODE STOP JUS chairt bre else n VRorder VR MOVE RIGHT drive send command CODE STOP goto moving right break 11 VR or manually order to start tightening stop the pO motor and start tightening i VRorder VR TIGHTEN button down_portA BUTTON _LOOSE drive send STOP goto tight break 11 VR ordered to stop or it reaches the limits stop the ceiling motor else if drive read para
109. use on chip flash memory for program storage C C Widely used general purpose and procedural language programming language used widely for both operating systems and applications C being just an evolution of C CAN Controller Area Network A peripheral interface targeting automotive and Industrial applications CANbus Bus communication protocol in the Controller Area Network CAN CPU Central Processing Unit The part of a computer system which performs the core processing functions DB9 Common connector type used for RS 232 serial communications in PCs DC Direct current Electric current flowing in one direction only GUI Graphical User Interface Interface between a user and a computer system or application based on graphics instead of text GPL General Public License Widely used free software license 1 Input Output The act of moving data in and or out of a computer system or device 12C Inter Integrated Circuit Multi master serial computer bus used to attach low speed peripherals to a motherboard embedded system or cell phone I DE Integrated Development Environment also known as Integrated Design Environment or Integrated Debugging Environment is a software application that provides comprehensive facilities to computer programmers for software development OS Operative System PC Personal Computer A computer designed to be used by one individual at a time PCB Printed Circuit Board Board designe
110. used command groups request mask of groups in use SEND m IF NOT RECEIVE k THEN ERROR read mask to 32 bits variable in chunks of 4 bits each SEND masx RECEIVE A SEND mask RECEIVE A 24 mask RECEIVE A 2 mask RECEIVE A 224 7 Read how many commands in a group request command count of group 3 SEND c SEND D IF NOT RECEIVE c THEN ERROR ack and read count SEND count RECEIVE A Read a user defined command dump command 0 in group 3 SEND p SEND D SEND A IF NOT RECEIVE d THEN ERROR read command data SEND training RECEIVE A extract training count 2 for a completely trained command tr count training AND 7 extract flags for conflicts SD or SI tr flags training AND 24 read index of conflicting command same group if any SEND conflict RECEIVE A read label length SEND 1 length RECEIVE A read label text FOR i 0 TO length 1 SEND label i RECEIVE decode digits IF label i THEN SEND label i RECEIVE 0 END IF NEXT 73 Built in Command Sets In the tables below a list of all built in commands for each supported language along with group index trigger or wordset command index and language identifier to use with the communication protocol C o m Tae anion Appendix Serial port C
111. uts Read from the HyperTerminal console Waken up Instruction accepted v Instruction not valid A B Z Numbers as in inputs r Order recognized successfully e Error When the device detects an order but can t identify it properly t Timeout Output signal if in the defined timeout time 5 seconds by default no instruction is given detected Example of testing algorithm Open and configure HyperTerminal 1 Open HyperTerminal program 2 Configure the connection parameters as given in section 5 2 3 for the serial port 3 Connect the suitable COM port by default COM port 1 and open the console 40 Waking up the device 4 Wake up the program To do this introduce letter b until the module answers o indicating it is ready 5 If the module was not used with VRbot GUI previously it should answer first w so it has waken up and then o If the module was already waken up i e it was already used with VRbot GUI the answer will be o so its already waken up Test a Speaker Dependent command Example Command GO HOME 6 Press d There will not be any answer The device prepares for SD commands recognition 7 Press B the number of the wordset in which the command for recognizing is located As already explained numbers are A 0 B 1 C 2 Command GO HOME is in wordset 1 so B 8 Say the command before the default timeout expires 5b seconds 9 Wait for the syst
112. voice recognition module is implemented allowing a user to control the support pole without using the control pad Keywords Assistive devices socially assistive robotics elderly and disabled care voice recognition automation getting up Before starting with the project itself 1 would like to thank all the people that has helped me making possible for me to do it helping me guiding me or just making me laugh in the tough moments Without all of them it would have not be the same Thanks to Panu_Harmo for introducing me to the assistive robotics field allowing me to work in this project as well as guiding me through the process and of course for making my stay at TKK so much warmer Anja H nninen for helping me with all the bureaucratic affairs her advice and trying to help me to stay in Finland I really felt part of the department not only a visiting exchange student Johannes Aalto for helping me with the technical problems of the project especially during the first weeks and some sleepy moments in the last weeks too Jos Vallet for encouraging me in pursuing my goals and helping me on getting on with the Finnish way of life To all the friends that have been there at the next door at a bus distance or at the other side of the phone Skype warming me in the tougher moments and sharing my joy in the better ones Helsinki University of Technology the Automation and Systems Department and Universidad
113. y state oto moving right i ntF MOVI NG RIGHT r n ETE ACTI ON off LED READY e STATE MOVI NG RI GHT rn 0 LEFT Voice recognition only state e uint8 t goto moving left rprintf MOVING LEFT trin E t rrupt driven state machine ruling the system s a large switch loop checking the current state of the system first and checks the 1 0 state machine switch state First state of the state machine Initializes the drive controller case STATE INIT DRIVE NIT DRIVE rin pr initializing drive 88 timer run rprintf INIT DRIVE OK r n goto not ready break Loosen the support and going home case STATE NOT READY loosen wait 10 seconds while time lt 64000 ti mer run rprintf NOT in ys rprintf GOI NG HOME r n defines acc 2 write param32 CODE CACC ACC 1 II set speed mode 1 drive write param32 CODE MODE TYPE CODE SP1 set command speed to the LEFT 1 write paramf CODE CSPD 80 listart motion drive send command CODE UPD until at home while button down portE AT HOME Istop ceiling motor rive send command CODE STOP reset faults rive send command CODE FAULTRESET Iset actual position 0 rive write param32 CODE SAP 0 rprintf AT HOME rin goto none break 1 d d break Checking mo de switch and configuring the motor case STATE_NONE if button down por
Download Pdf Manuals
Related Search
Related Contents
Comprendre l`étiquetage alimentaire Electrolux CSIG 223 W User's Manual Manuel d`utilisation DZ 260, 261, 266, 267, 269 Propane Floor Burnisher Equipment with Dust Control Newport / Oriel Universal Arc Lamp Housings Manual ASUS F2A85-V F7535 User's Manual P5G41T-M LX3 - Comp-Art User Manual - Videosystems V7 Replacement Battery for selected Hewlett-Packard Notebooks Copyright © All rights reserved.
Failed to retrieve file