I’m releasing version 1.00 of my smart motor library, as with all software it will continue to evolve as we learn more and test further on real robots. This library is based in part on work by Chris Siegert (aka vamfun) and is an alternative to his code posted in this thread.
The code has been tested using ROBOTC 3.51, I was hoping the next version would be out by now but it’s not. The library may need an update for 3.53 when that is released.
The functionality is as follows.
- The automatic calculation of actual motor speed based on encoder value changes.
- The automatic calculation of motor current based on measured motor speed and motor control value.
- The estimation of PTC temperature in encoded motors and the cortex or power expander controlling them.
- Monitoring of PTC temperature and limiting of motor current if the maximum PTC temperature is reached.
- Monitoring and limiting of average motor current if a preset current threshold is passed.
- Slew rate control of motors by controlling acceleration and deceleration.
Complete documentation can be seen here.
An archive with the library, documentation and examples is here.
The library source (no examples or docs) is available here.
There are still some typos and grammatical errors in the docs, I’m not much of a technical writer.
There is no support for servos in this release and the old 3-wire motors have had no testing.
I have no plans for an EasyC port, accurate timing with EasyC’s existing runtime library is a PITA.