![]() |
Commands Stop Everything
I'm new to Java programming and happen to be the only programmer on the team (with the internet to teach me everything I need to know). I've started to get the hang of things but every time I run a command on the bot it stops driving. I just recently added end(); to the interrupt code and do not know if that will fix it (I am not near the bot at the moment). The robot drive (mecanum) is in the main Robot.java under teleOp so I do not know if maybe I have to put it inside of a command with the requires(chassis);. Any help would be appreciated, I will upload my code upon request. I don't know if this is important but I did start with RobotBuilder as a template.
|
Re: Commands Stop Everything
Quote:
Tip: make sure to use code tags when posting code in forums. |
Re: Commands Stop Everything
Here's the command (LiftBox):
Code:
Code:
|
Re: Commands Stop Everything
Can you also post your judyelevator Subsystem?
Right now you are going to have a conflict when you try to run the command because both the command and your teleopPeriodic() method are trying to use the same motor. Code:
RobotMap.judyelevatorSpeedControllerElevtaor.set(1.0);Code:
RobotMap.judyelevatorSpeedControllerElevtaor.set(oi.joystick2.getY()); |
Re: Commands Stop Everything
Code:
// RobotBuilder Version: 1.5 |
Re: Commands Stop Everything
Also something weird, anytime I try to set RobotMap.judyelevatorSpeedControllerElevtaor to a SpeedController (to shorten the name) it compiles but when ran on the RIO it immediately crashes. Same with RobotMap.judydrivetrainjudyrobotdrive. And I am aware elevator is mispelled. I am not terribly worried about it because this is off season and only test code.
For example: Code:
SpeedController RobotMap.judyelevatorSpeedControllerElevtaor = elevator; |
Re: Commands Stop Everything
Can you post your OI class? I'm assuming that is where you are firing your command from correct?
|
Re: Commands Stop Everything
Will have to post tomorrow. Laptop is inaccessible at the moment. And as for the speed controller shortening, that was in robot.java (although I believe Iwill be taking that and putting it somewhere else as a solution). I tried referencing the OI and in some places it worked and others it gave an error. Although today I found out that custom commands (non robotbuilder) can reference the OI with Robot.OI. instead of oi. Will be trying these tomorrow.
|
Re: Commands Stop Everything
Here's the OI
Code:
// RobotBuilder Version: 1.5 |
Re: Commands Stop Everything
Ok so I separated the elevator code into its own command instead of having it in robot.java. The catch is I now have to call that command with a trigger or button to use the elevator. This solves my problem but I would like to use it without pulling my trigger. To do this would I just take the code and put it in the elevator subsystems default command? Same with drive train I assume, if I'm going to be using commands with it as well.
|
Re: Commands Stop Everything
Quote:
If you are looking for some examples you can look at out past code. 2014 2015 |
Re: Commands Stop Everything
Awesome, thanks for the help. Our robot is now exactly how we want it.
|
| All times are GMT -5. The time now is 10:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi