|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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.
How can i reduce the speed without changing the arm itself? |
|
#2
|
|||
|
|||
|
Re: Slowing Down Motor On Java
Just divide the number you are sending to the set() function by some number greater than 1.
|
|
#3
|
||||
|
||||
|
Re: Slowing Down Motor On Java
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 |
|
#4
|
|||
|
|||
|
Re: Slowing Down Motor On Java
Are you using a Jaguar? A Victor? or a Spike?
|
|
#5
|
|||
|
|||
|
Re: Slowing Down Motor On Java
Currently i am using a victor to control the arm system.
|
|
#6
|
|||
|
|||
|
Re: Slowing Down Motor On Java
So based on what you said I am assuming you are doing something along this line
Code:
Victor a_motor = new Victor(1); a_motor.set(1); Code:
Victor a_motor = new Victor(1); a_motor.set(0.25); |
|
#7
|
|||
|
|||
|
Re: Slowing Down Motor On Java
okay yayyyy it worked so awesome.............
but now i have a situation which is causing me a headache. 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. ![]() |
|
#8
|
|||
|
|||
|
Re: Slowing Down Motor On Java
Quote:
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 |
|
#9
|
|||
|
|||
|
Re: Slowing Down Motor On Java
Thats easy
Replace # with the button numbers and motor with your victor Code:
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)
}
Gus Robotics, team228.org |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|