I’ve updated my RobotC Segway drivers to version 0.97. For the full change log, see the driver file itself. The latest driver will always be at this link.
In normal language, what has changed? Nothing most of you should worry about. If you replace your old “segway-driver-lv.h” with the new one in this file, you shouldn’t notice any differences. Why bother then, you might ask. Well, the new version is a little more flexible if you want to customize the balancing behavior.
- You can now stretch the loop time to any desired length by changing the value of “dt”.
It is measured in seconds, so 0.010 (default) would be 10 miliseconds. Because everything else in the code compensates for this time interval, you can now change it without worrying about changing other constants. Changing “dt” to a higher value gives the user control task more time to run. This means that your rubik’s cube solving Segway will now be a little faster. There’s no such thing as free lunch, though, so there’s a limit to what you can do. The more you increase “dt”, the slower the robot will respond to disturbances. However, the new default 10 ms as opposed to 5 ms is still fine.The real reason for me to make this change is because of the NXT-G version which really needed this. By running slower loops, this gives me enough time to read I2C gyro sensors, like the dIMU from Dexter Industries. - gn_dth_dt, gn_th, gn_y, gn_dy_dt, kp, ki, kd and mean_reading are now global variables. This means that you can dynamically change them from the main control task. This makes it possible to modify the control constants and get immediate results. I used this to allow a PC application to tune the constants, but you could also use a device like the Mindsensors Numpad to manually enter values.
Anything you’d like to see added to this driver?
I’d really like to see the rubiks cube solving Segway……;-)
Thanks for the update!
Do you have a description (tutorial) on how the “segway-driver-lv.h” goes through the steps to calculate the control? Your thought process would be easier to understand than flowcharting the code.