Hi Dave, Thanx a lot. This is exactly what I need. I will look into your links and documentation. First I have to finish the hardware, but I can do some preliminary tests.
Controlling the motor within a 1 degree accuracy won't be necessary because I indeed will use some reduction stages. -----Oorspronkelijk bericht----- Van: David Anderson [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 22 juni 2007 13:05 Aan: Jim van Gulik CC: [email protected] Onderwerp: Re: [Lejos-discussion] Precision control Hey Jim, On 6/22/07, Jim van Gulik <[EMAIL PROTECTED]> wrote: > Is there any way I can precisely control the motors when controlling > the NXT via Bluetooth, so a 360 degree rotation will exactly be 360 degrees? I don't know about NXJ precisely, but the motors all have tacho feedback that lets the OS track the position of the motors. Given that, it is possible to implement a feedback control loop to precisely control the position of the motors. For my own OS I implemented a PID control loop ( http://en.wikipedia.org/wiki/PID_controller ), which slaves the motor position to a given setpoint input. I wanted exactly the same thing as you: "when I say 360 degrees, I really do mean 360, not 354 or 376". After calibration of the loop (working out the coefficients), I could control the motor position very precisely. See http://natulte.net/pid-pi-bordel.png ; green is the setpoint; blue the motor drive output (-100 through 100); purple the actual angular position of the motor. Horizontal axis is time in milliseconds; vertical axis is angle in degrees). For your arm, I would implement the same control loop in the onboard logic of your NXT, then use bluetooth to change the setpoint input. You could also implement the control loop on your computer and just send motor outputs and tacho feedback over bluetooth, but a PID loop requires running fairly frequently (the loop that produced the above graph runs every 10ms), and is a little intolerant to lag (requires a different calibration, and probably will reach the setpoint slower). Another tip: while the motor's position feedback is supposedly precise to within 1 degree, the motor output isn't. I haven't pushed it to its limits yet, but the 90 degree rotation you can see in the graph already feels like it's getting close to the precision limits of the motor outputs. Therefore, if you want to be able to go from 0deg to 1deg, I'd recommend having more reduction stages, and adjusting the setpoints accordingly (eg. 1440deg motor rotation for 360deg of arm rotation). If you want to have precise positioning, but can stand having to configure a setpoint that is at least X degrees away from the current position, you can get away with hooking the motor up directly, the PID controller would do the rest properly. Finally, I highly recommend reading http://www.embedded.com/2000/0010/0010feat3.htm if you don't know about PID control loops. That article is very well done, with a discussion of the function and side-effects of all the stages of a PID controller, with various examples to match. Hope that helps a little, - Dave ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Lejos-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lejos-discussion
