View Single Post
  #10   Spotlight this post!  
Unread 22-07-2015, 14:29
JamesTerm's Avatar
JamesTerm JamesTerm is offline
Terminator
AKA: James Killian
FRC #3481 (Bronc Botz)
Team Role: Engineer
 
Join Date: May 2011
Rookie Year: 2010
Location: San Antonio, Texas
Posts: 298
JamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to behold
Re: Generating Position Setpoints

Quote:
Originally Posted by martinrand View Post
I'm working on a prototype for a motion controller which will accelerate a motor to a maximum velocity, coast at the maximum velocity and then commence deceleration at the correct position for the motor to stop at the target position.Where have I gone wrong?
I'm not going to solve this for you, but I do want you to take a peek at this:

d=1/2 a t^2
learn this, and love it... it is probably one of my favorite equations.

What I do is solve for time...
t=sqrt(2.0*(d/a))
If I know how much time I have left given my current velocity and given the desired acceleration rate. I can solve where on the velocity line my velocity should be at that time by the equation v=a*t; //where t is the amount of time I need to come to a complete stop of "a" as my max stopping acceleration. (I factor out mass from force to keep my numbers small). This works for both setpoint (e.g. arm position) kind of problems as well as velocity control (e.g. ball shooter).


On a side note you may find this equation too:
d=1/2at^2+vt
At one time I considered using the vt variable to do a match velocity kind of function in game development (i.e. one object tracking another moving object)... but found it easier in code to treat that as a separate problem and add the velocity back in as a separate part of the function.

(Ether you still around?)