DevilBotz2876 / ChargedUp2023

Code for the FRC 2023 Robotics Competition
Other
3 stars 0 forks source link

Command debug #117

Closed BrownGenius closed 1 year ago

BrownGenius commented 1 year ago

Hi team, since we are experimenting with more complex autonomous/assist routines, I added some debug/trace code so that we can see what is happening in the sequential commands. E.g. this is the output to the console when executing the AutoScore routine:

bhs.devilbotz.commands.assist.AutoScore:Start
bhs.devilbotz.commands.arm.ArmToPosition:initialize
bhs.devilbotz.commands.arm.ArmToPosition:end
bhs.devilbotz.commands.gripper.GripperOpen:initialize
bhs.devilbotz.commands.gripper.GripperOpen:end
bhs.devilbotz.commands.auto.DriveStraightPID:initialize
bhs.devilbotz.commands.auto.DriveStraightPID:end
bhs.devilbotz.commands.assist.PrepareForGroundPickup:Start
bhs.devilbotz.commands.gripper.GripperClose:initialize
bhs.devilbotz.commands.gripper.GripperClose:end
bhs.devilbotz.commands.arm.ArmDown:initialize
bhs.devilbotz.commands.arm.ArmDown:end
bhs.devilbotz.commands.gripper.GripperOpen:initialize
bhs.devilbotz.commands.gripper.GripperOpen:end
bhs.devilbotz.commands.assist.PrepareForGroundPickup:End
bhs.devilbotz.commands.auto.RotateDegrees:initialize
bhs.devilbotz.commands.auto.RotateDegrees:end
bhs.devilbotz.commands.assist.AutoScore:End

We can add more debug as needed so that we can understand what is happening in the robot. Eventually, I'd like to add a way to dynamically enable/disable the debug messages using shuffleboard.

ParkerMeyers commented 1 year ago

We can add more debug as needed so that we can understand what is happening in the robot. Eventually, I'd like to add a way to dynamically enable/disable the debug messages using shuffleboard.

you could make it so it only does that when the robot is in test mode instead of using a shuffleboard toggle @BrownGenius

BrownGenius commented 1 year ago

you could make it so it only does that when the robot is in test mode instead of using a shuffleboard toggle @BrownGenius

In Test mode, how do I select and run the autonomous routines? Do I need to create a separate autonomous command list for shuffleboard?

ParkerMeyers commented 1 year ago

you could make it so it only does that when the robot is in test mode instead of using a shuffleboard toggle @BrownGenius

In Test mode, how do I select and run the autonomous routines? Do I need to create a separate autonomous command list for shuffleboard?

I'm not sure, we'd have to explore it

BrownGenius commented 1 year ago

This is an example "DockAndEngage" output:

bhs.devilbotz.commands.auto.DockAndEngage:Start
bhs.devilbotz.commands.auto.DriveStraightToDock:initialize
bhs.devilbotz.commands.auto.DriveStraightPID:initialize
bhs.devilbotz.commands.auto.DriveStraightPID:initialize:startAngle: -97.66043090820312 distance: 2.0
bhs.devilbotz.commands.auto.DriveStraightToDock:end
bhs.devilbotz.commands.auto.DriveStraightPID:end:endAngle: -98.35904693603516 distance: 1.9049455093931287
bhs.devilbotz.commands.auto.BalancePID:initialize:startRoll: 0.0
bhs.devilbotz.commands.auto.BalancePID:end:endRoll: 0.0
bhs.devilbotz.commands.auto.RotateDegrees:initialize
bhs.devilbotz.commands.auto.RotateDegrees:initialize:startAngle: -98.98542785644531 --> -8.985427856445312
bhs.devilbotz.commands.auto.RotateDegrees:end:endAngle: -9.902073860168457
bhs.devilbotz.commands.auto.DockAndEngage:End
BrownGenius commented 1 year ago

Hi Team, we tested this code on the actual bot and was very useful to trace the various commands. Until we switch to a more standard debug logging method (e.g. Oblog), we should use this.

ParkerMeyers commented 1 year ago

Hi Team, we tested this code on the actual bot and was very useful to trace the various commands. Until we switch to a more standard debug logging method (e.g. Oblog), we should use this.

I'm not sure you understand what Oblog is, it is a shuffleboard logging utility: https://github.com/Oblarg/Oblog. Anyways, in the long run we should make our own. I've started writing some ideas, we can talk about it in the offseason!

BrownGenius commented 1 year ago

Currently, there isn't a way to enable/disable via shuffleboard, but it should be easy to add that.