View Single Post
  #3   Spotlight this post!  
Unread 27-03-2012, 14:06
Butter's Butter's is offline
Registered User
AKA: Joe Kent
FRC #0522 (Robo Wizards)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Staten Island, New York
Posts: 21
Butter's is an unknown quantity at this point
Re: Adjust individual motor speed

Quote:
Originally Posted by virtuald View Post
Create an object, call Set() on it.

Code:
// some global somewhere... 
Jaguar my_motor(2);

.. 

// in your main loop
my_motor.Set( 1.0 );  // full speed in one direction
my_motor.Set( -1.0 ); // full speed in another direction
However, I suspect that is not what you're asking. If you want to control the motor using some external input, then the easiest thing is just pass the value retrieved from a joystick.

Code:
// some global somewhere
Joystick stick;

... 

// in your main loop
my_motor.Set( stick.GetY() );

Thank you so much! I actually needed the first one. Our robot has a slight curve so I wanted to make one robot have a little more power than the other (Not joystick based).

I'll go test out a few different values and tell you if it works out!

EDIT: The first method you gave us would move the robot, the second would just control it. Could I maybe make a function that would automatically (Time based) use the .Set method? It would only turn on if your driving with that stick.

Code:
public void fixCurve(bool x){
while(x == true){
wait(2.0);
rightmotor.Set(whateverTheNumberWouldBe);
}
(X is made true when the robot drives and false when they stop)

EDIT: My function would work but we need a formula to determine the speed so this itself doesn't cause a curve..... FUN!

Last edited by Butter's : 27-03-2012 at 14:28.
Reply With Quote