|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Programmer a motor with a trigger
hello, the idea im trying to do is program leftStick Get Raw Button(1) to set the drive motors on pwm1 and pwm 2 leftmotor and rightmotor to run at a speed of .2, now if i have set 0.2 and set 0.2, the left motor goes in reverse, if i do -0.2, it doesnt move at all, what is the proper way to set these two motors to the same speed by holding a trigger?
|
|
#2
|
|||
|
|||
|
Re: Programmer a motor with a trigger
First make sure that the Open Motor or Drive ref is for the right kind of motor controller. The PWM period is different and especially talking to a victor as if it is a jaguar is not a good idea.
If that isn't it, try bumping the value a bit higher. -0.2 may not be enough to move it. Greg McKaskle |
|
#3
|
||||
|
||||
|
Re: Programmer a motor with a trigger
i tried that, but here let me give you the code i tried and maybe you could find somethign thats wrong
RobotDrive* myRobot; Jaguar* leftmotor; Jaguar* rightmotor; myRobot = new RobotDrive(1, 2); leftmotor = new Jaguar(1); rightmotor = new Jaguar(2); if (!ds->GetDigitalIn(ARCADE_MODE)) { myRobot->TankDrive(leftStick, rightStick); } else { myRobot->ArcadeDrive(leftStick); } if (rightStick->GetRawButton(1)) { leftmotor->Set(-0.5); rightmotor->Set(0.5); } else { leftmotor->Set(0.0); rightmotor->Set(0.0); } that's what i have, can someone please help tell me why the left motor doesnt work when i do this. if i have both positive numbers, then the left motor goes in reverse |
|
#4
|
|||
|
|||
|
Re: Programmer a motor with a trigger
I'm not a jaguar expert. Is there a jumper that affects this?
Greg McKaskle |
|
#5
|
||||
|
||||
|
Re: Programmer a motor with a trigger
no there isnt a jumper that affects this.. does anyone else have any ideas?
Last edited by programmr : 14-02-2009 at 08:48. |
|
#6
|
||||
|
||||
|
Re: Programmer a motor with a trigger
does anyone else have any ideas as to why this doesnt work....???? PLEASE HELP! Thank You
|
|
#7
|
|||
|
|||
|
Re: Programmer a motor with a trigger
OK, I had more time to look up what I was thinking. The jaguar has jumpers that need to be installed if you are not using the limit switches. If you don't have the jumpers, I think that can result in a motor controller that will not move in one of the directions.
It seems like something to double check. Greg McKaskle |
|
#8
|
||||
|
||||
|
Re: Programmer a motor with a trigger
try this (modify as needed)
Code:
while (IsOperatorControl)
if (LeftStick.GetRawButton(1) == true)
{
roller.Set(1.0);
}
if (LeftStick.GetRawButton(1) == false)
{
roller.Set(0.0);
}
Wait(0.005);
Roller is the function to be used with the trigger No need for semaphores, and don't worry, the cRIO is so fast, you'd never notice the lag. This is part of 558's codebase. If you need more help email me: pplude@freehugalliance.com |
|
#9
|
|||
|
|||
|
Re: Programmer a motor with a trigger
I think the original question was about getting a motor to reverse using a button. I have tried using a -1 and nothing happens when button is pushed. I am using a Victor and Windriver. If someone has actually done it, how?
|
|
#10
|
||||
|
||||
|
Re: Programmer a motor with a trigger
would something along the lines of
Code:
if (LeftStick.GetRawButton(1) == true)
{
RobotDrive = RobotDrive * (-1);
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please help with some questions~new programmer | bilal1219 | Programming | 2 | 29-01-2008 11:44 |
| New Programmer working with cmu cam2 | pbrules15 | Programming | 13 | 14-07-2007 22:40 |
| NEED PROGRAMMER TO HELP WITH PROGRAMING | Reaper40 | Programming | 4 | 02-02-2007 17:31 |
| pic: The programmer needs some alone time with the robot! | Karthik1 | Extra Discussion | 7 | 23-02-2005 10:35 |
| problems with our programmer | AlphaOmega870 | Programming | 12 | 31-01-2003 08:23 |