Real time robot control | Cypress Semiconductor
Real time robot control
My current challenge is a real time (or as close as I can get to one) autonomous robotic controller. The PSoC should be capable of doing this but I am looking for some ideas or feedback on my approach:
I need to:
Read analog (16 ch ADC) and digital (I2C) sensors and process them
Publish sensor and motion(speed, direction etc) data on I2C bus
Receive commands from I2C bus
Control motors based on the commands. Whilst motor control is ongoing, data must still be collected from sensors - especially digital ones: Accelerometer, Magneto and others. Motor control is based on trapezoidal profiles generated using ISRs.
How do you see this best implemented?
My current implementation is based on a huge main loop and different ISR for functions. The problem is that during trapezoidal generation I can't get any data, during I2C transfers I can't get any motor control and so on.
I am thinking of fixing the execution time for each loop and force certain functions to not execute if there isn't enough time. This is similar to an RTOS so probably the most complicated solution. What would be the best way to fix the program execution time or is there another way?
Another option would be to do all the ADC sampling, trapezoidal generation and whatever else I can in hardware + DMA - I think this would work and be easier to implement?
Looking forwad to any ideas :)