![]() |
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?
|
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 |
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 |
Re: Programmer a motor with a trigger
I'm not a jaguar expert. Is there a jumper that affects this?
Greg McKaskle |
Re: Programmer a motor with a trigger
no there isnt a jumper that affects this.. does anyone else have any ideas?
|
Re: Programmer a motor with a trigger
does anyone else have any ideas as to why this doesnt work....???? PLEASE HELP! Thank You
|
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 |
Re: Programmer a motor with a trigger
try this (modify as needed)
Code:
while (IsOperatorControl)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 |
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?
|
Re: Programmer a motor with a trigger
would something along the lines of
Code:
if (LeftStick.GetRawButton(1) == true) |
| All times are GMT -5. The time now is 02:19. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi