Robot code will not deploy

I rewrote all of our team’s code from the offseason and I will not deploy to the robot.

Can someone please take a look at my code and explain what is wrong? I can’t seem to find where the problem is.

https://github.com/frcteam4189/Remade_Offseason

Thanks so much!

In your Robot class, you are initializing an OI object before you are making your subsystems. Therefore, the subsystems you are passing to your OI class are null. Try initializing your OI object after you initialize your subsystems.

Your DriveTrain object is never initialized before using it here, and therefore is null, which causes this error to be thrown in your TurnToAngle command.

Edit: beat me to it :slight_smile:

1 Like

Haha, my bad, I didn’t see that you were writing until just after I posted the reply!

1 Like

@sumig254 and @vkoutha

That seemed to fix it. Now the code will deploy but it wont let me drive.

The motor safety issue usually indicates that you have some sort of loop in one of your methods that takes too many milliseconds. The only time consuming thing I can see is your telemetry, but it shouldn’t be that long. Just to be sure, see if commenting out the ouptutTelemetry methods called from the periodic parts of Robot.java solves the issue. If not, to help the search - is this happening in teleop, or some other state?

1 Like

Commenting that out didn’t change the error message. My turn to angle method works perfectly fine so it must be something within the drivewithjoysticks command. This is in teleop

Do you ever initialize your DriveWithJoySticks command? Looking at your code, I don’t see it initialized anywhere, so it really should be giving you a null pointer exception as well. Try initializing your DriveWithJoySticks command in your robotInit method before you call driveTrain.establishDefaultCommand()

1 Like

Wow, I’m really dumb. That fixed everything. Thank you so much for your help! I really appreciate it!

1 Like

Nah, just needed a touch of help, you did most of the heavy lifting, make sure to take credit for that.

5 Likes

@GeeTwo @vkoutha @UnofficialForth @sumig254

So sorry to bother you again but I was curious if any of you could help explain why I can only run my turn to angle command once? When I run it the first time it works fine, then when I press it again only the gyro angle resets. It seems that the PID controller will not re-enable a second time.

Here is the most current code with everything working besides the turn command: https://github.com/frcteam4189/OffSeason_Project

It looks like your drive train’s telemetry method is creating a new turnToAngle command each pass. That can’t be right.

1 Like

That might be the problem, I will test then when I get a chance.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.