Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Stop Driving (http://www.chiefdelphi.com/forums/showthread.php?t=115794)

tuXguy15 05-04-2013 16:19

Stop Driving
 
Hello. My team I was running some simulations for my teams robot before we go to the regional competition and I found out an issue with our pneumatic gearbox. To resolve this I was thinking about making a button that when the driver presses and holds it will set our drive motors (jaguar1, jaguar2, jaguar4, & jaguar5) to off even if the driver is pushing forward on the joystick. Is there a way I can do this. I can't try anything because we can't take our robot out of the bag. Can i make this button override robot drive and make it stop driving when the button is pressed? Thanks!

themccannman 05-04-2013 17:02

Re: Stop Driving
 
I'm not a programmer so I'm not entirely sure what I'm talking about, but there should be a way to program your motors to brake so that when there is no driver input the motors will actively fight forces trying to turn them instead of freely spinning. I'm not sure if that would solve the issue your having but I just thought it might help.

tuXguy15 05-04-2013 17:15

Re: Stop Driving
 
Im trying to get it so that the button overrides joystick input and stops the robot and continues driving when the button is released.

Owen Makin 05-04-2013 17:18

Re: Stop Driving
 
Set a button to that allow motors to move when not pressed, but when pressed overrides all values to zero. I dont know how java works because i only know labview. but im sure its not that different.

thecakeisalie 05-04-2013 17:36

Re: Stop Driving
 
Not sure if this is what you mean, but:
Code:

if(button.get()) {
    Drivetrain.tankDrive(0,0);
}
else {
    DriveTrain.tankDrive(leftJoystick.getY(), rightJoystick.getY());
}


ekapalka 05-04-2013 18:14

Re: Stop Driving
 
How about this?
Code:

bool stopp = false;
[...]
if (!stopp)
{
    DriveTrain.tankDrive(leftJoystick.getY(), rightJoystick.getY());
}
if (button.get())
{
    stopp = true;
}

Does this help?

tuXguy15 05-04-2013 21:06

Re: Stop Driving
 
Ok thanks ill start writing out some code for it and test it at the regionals

Ginto8 06-04-2013 02:00

Re: Stop Driving
 
Quote:

Originally Posted by ekapalka (Post 1257580)
How about this?
Code:

bool stopp = false;
[...]
if (!stopp)
{
    DriveTrain.tankDrive(leftJoystick.getY(), rightJoystick.getY());
}
if (button.get())
{
    stopp = true;
}

Does this help?

This example will only work if you're using RobotDrive, have its safety feature enabled, and have the timeout set low enough. Otherwise, it'll just stop changing the motors' speeds instead of actually stopping them.

tuXguy15 06-04-2013 10:20

Re: Stop Driving
 
Is the safety feature enabled by default?

ekapalka 06-04-2013 13:51

Re: Stop Driving
 
?
Code:

bool stopp = false;
[...]
if (!stopp)
{
    DriveTrain.tankDrive(leftJoystick.getY(), rightJoystick.getY());
}
if (button.get())
{
    stopp = true;
    DriveTrain.tankDrive(0.0, 0.0);
}

Sorry. I've actually been programming in C++. This year we had a function using something like this that would take control from the driver and autonomously take control using the sensors. It was flawless (we programmed it during the final three rounds of the competition :P )


All times are GMT -5. The time now is 22:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi