This repo focus on the program in the embedded system(STM32F429VI) on the wheelchair.
The objective of the project is to allow the wheelchair user climbing up and down a curb with maximum height of 20.0 cm safely.
-
STM32CubeIDE > 1.7.0
All OSes: click here for installation instructions
STM32CubeIDE is used to generated the overall code and structure. In Project Manager/Code Generator, select "Generate peripheral initialization ..."
Tips: Add the code in between the section
/* USER CODE BEGIN XX */
and/* USER CODE END XX */
- Do note that the code is not generated through CubeMX but refer to the code generated by it.
- If wish to use the auto-code generation feature from CubeMX, it is advised to generate a new code from CubeMX and copy the code from this repo.
- Also, the
/Document/cubeMX_report.pdf
is just providing a reference. For example, the interrupt priority in the report does not consider the interrupt priority level after FreeRTOS is used.
Hardware | Peripheral Used |
---|---|
Joystick (AD7606) | SPI1 |
Climbing motor (BD25L) | Rear: TIM8 CH4 Back: TIM1 CH2 |
Climbing motor encoder | CAN1 |
MPU6050 | I2C1 |
Hub Motor (X2_6010S) | RS485/UART3 |
Base motor (Sabertooth) | TIM3 (Right)CH1 (Left)CH2 |
Driving Encoder | RS485/UART4 |
Curb detector | UART1 |
- The operating used is FreeRTOS with round-robin as scheduling policy.
- The code organization is as follow:
main.c
consists of function callback, variable definition and freeRTOS handler such asTaskHandler_t
,QueueHandle_t
, etc.freertos.c
consists of task function definition with the function declaration inmain.h
peripheral.h/.c
andstm32f4xx_hal_msp.h/.c
consist of low level peripheral initialization code.
In normal operation mode, the wheelchair could be used as usual by controlled through joystick input.
To start climbing mode, user required to push the button to initiate sequence of action while the action could not be stopped in the middle of the process.
The climbing action can be briefly explained as following step:
- Both climbing wheel landed on the ground
- climbing process would be determined as
CLIMB_UP
orCLIMB_DOWN
depends on which leg touches ground first - The wheelchair will start lifting itself up to appropriate height according to the curb height calculated from the encoder input
- During lifting process, the wheelchair will maintain its position and make sure it would be lifted straight up by controlling the hub motor
- Then, the wheelchair will start moving forward by distance of the wheelchair length to make sure both its wheel has passed the curb before retracting the leg
- Last, both leg will be retract to its initial position and mark the end of the climbing process.
Refer to script/README.md
Docking feature require to work with curb detection algorithm developed by Kuan Yuee. The algorithm will generate 4 action which is
- Turn angle
- Move forward distance
- Turn angle (to face the curb the right way)
- Move forward (to close the gap between wheelchair and curb)
The 4 action must generate in the mentioned sequence in order for the wheelchair to perform dead reckoning to reach the desired goal with correct pose. Otherwise, the docking may fail and may cause danger to the user. In order to use docking mode, USB is required to connect the PC to STM32. When action is received, USB interrupt will be triggered and activate Task_Docking.