|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|
Position Control
Over the fall, I made a simple positioning system using simple Trig and geometry.
That was using the PWM open loop (On the Jaguar at least) voltage control. Now that we are allowed to use CAN, I would like to use the Position control mode. The encoders are hooked directly into the Jaguar. The simple formulas that I used are as follows: Code:
S = ((Delta Dist Rightside) + (Delta Dist Leftside)) / 2.0; X += S * cos(theta); Y += S * sin(theta); So, once I had a new estimated position, the distance and angle to the next point were calculated. The angle and distance would then go into 2 PID calculations. Each side of the drive would then be set from a simple arcade drive function Code:
double angle = MathUtils.atan2(pY-Y, pX-X); double distance = Math.sqrt(Math.pow(pY-Y,2)+Math.pow(pX-X,2)); double leftSpeed = speed + turn; double rightSpeed = speed - turn; I would like to use the Jaguar's Position control, tell it how far to turn the wheel and it goes there. One dimensional movement (forward / backward) is easy, as the distance to tell it is from the distance formula, but once it gets to rotation, I am lost. From the above equations, I derived these equations: Code:
Dist Left = sqrt((y-y1)^2 + (x-x1)^2) + (atan2(y-y1,x-x1) - theta1) Dist Right = sqrt((y-y1)^2 + (x-x1)^2) - (atan2(y-y1,x-x1) - theta1) Last edited by biojae : 04-03-2010 at 22:05. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CAN Jaguar Enable Control .vi Initial Encoder Position | TonyP | CAN | 0 | 26-02-2010 19:23 |
| CAN Position control code? | taichichuan | C/C++ | 8 | 13-02-2010 11:46 |
| Position Control using potentiometer? | biojae | CAN | 13 | 03-02-2010 20:12 |
| Antenna position | Torboticsmember | Rules/Strategy | 2 | 16-02-2008 11:18 |
| Which position is A vs. C | MattB703 | Rules/Strategy | 3 | 29-03-2006 08:56 |