Log in

View Full Version : Slowing Down Motor On Java


spidey619
24-01-2011, 22:33
I am a new person to the world of java and i have stumbled on to a problem. When trying to program a prototype arm it goes to fast.::safety::

How can i reduce the speed without changing the arm itself?

jhersh
25-01-2011, 01:27
I am a new person to the world of java and i have stumbled on to a problem. When trying to program a prototype arm it goes to fast.::safety::

How can i reduce the speed without changing the arm itself?


Just divide the number you are sending to the set() function by some number greater than 1.

germansamurai16
26-01-2011, 20:22
the code looks for a magnitude value from the controller that ranges from -1 to 1. like jhersh said, divide by some number.

2 would give half speed, for the best results if 2 is too large move the number by increments of .5

drakesword
26-01-2011, 22:30
Are you using a Jaguar? A Victor? or a Spike?

spidey619
26-01-2011, 22:46
Currently i am using a victor to control the arm system.

drakesword
26-01-2011, 22:55
So based on what you said I am assuming you are doing something along this line

Victor a_motor = new Victor(1);
a_motor.set(1);

If you wanted to go slower you would want a percentage of the power so for example 25% power

Victor a_motor = new Victor(1);
a_motor.set(0.25);

spidey619
28-01-2011, 21:38
okay yayyyy it worked so awesome.............
but now i have a situation which is causing me a headache.:confused:



how can i control the motor, using the victor, going forward and reverse using different buttons on the joystick cause i need the arm to go up and down.


Thanks so much for your help people i really appreciate it. :D

drakesword
30-01-2011, 20:15
okay yayyyy it worked so awesome.............
but now i have a situation which is causing me a headache.:confused:



how can i control the motor, using the victor, going forward and reverse using different buttons on the joystick cause i need the arm to go up and down.


Thanks so much for your help people i really appreciate it. :D


Set the value to a negative number for reverse direction

e.g. set (0.5) for 50% forward and set(-0.5) for 50% reverse

ProgrammerMatt
31-01-2011, 10:49
Thats easy
Replace # with the button numbers and motor with your victor

if (joystick.getRawButton(#) == true)
{
motor.set(0.25)
}
else
{
motor.set(0.0)
}
if (joystick.getRawButton(#) == true)
{
motor.set(-0.25)
}
else
{
motor.set(0.0)
}

Programmer Matt,
Gus Robotics, team228.org