Open aidnem opened 5 months ago
The Mermaid diagram for the state machine is complete. It can be found under doc/AutomatedTeleop.md
. The table this diagram was generated from can be found in the controls Google Drive or in CSV format under doc/AutomatedTeleop.csv
.
@linglejack06 I've noticed that the method to follow a path in the drivetrain disables alignment. Is this strictly necessary, or could we keep alignment enabled and drive to the path anyway? I'd prefer to prime and align as soon as the robot starts driving back from the source, but if it can't auto align, it would have to stop and wait before it could shoot upon arrival.
@aidnem by using the path following it defaults to their alignment, but Im pretty sure there is something in the path configuration where i can override rotation ( we could then keep the align state on ). Ill look into it tonight or tomorrow morning and add it to this PR it shouldnt take long
@aidnem I have just added the rotation target override which should work. We can test on Wednesday.
Can you test in the sim 👀
I'll be out of the house all day but I can probably try it out tonight or tomorrow afternoon. Depending on whether or not they allow me into shop on Monday we could test it in real life then as well.
I can try in sim if I have time. I also just remembered I forgot to remove the align state disabled in drive to path method so I will update that next time I get on my computer
Coaches have informed me that I am not welcome in shop and therefore testing will have to wait until next Monday (no school Wednesday) when they allow everybody back in. I'll test sim when I get the chance.
just pusehd the update with removal of the align state manual. If we keep structure how it is now, then best choice would be to set align state and target in the auto teleop command.
If we add a state machine to drive class to handle automated driving, then i could add the align state and target in that state machine. @jkleiber do you have a preference? I know you had mentioned adding the automated state machine to the drivetrain class
@linglejack06 if possible, using the Action + State framework we've been using is preferred. But if there's no reason to do Actions (i.e. any state can transition to any other state) then you can just make a mode machine where you set the drive mode in the command.
For example, you could have modes for: auto align, path follow, manual, etc
@jkleiber Here's the first test of running it in the sim. Sorry for the terrible quality, GitHub won't let me upload a video over 10MB so I had to shrink and trim it severely.
https://github.com/team401/2024-Robot-Code/assets/99768676/7722aa81-dc9d-4d5e-9361-fd5636d4873c
This shows that the state machine is at least somewhat functional (it drives where it is trying to and then transitions to 'ACQUIRE_NOTE'). Once I figure out how to use note simulation, I'll test a full cycle.
Ignoring the extreme sketchiness of how driving looks in the sim, I think it looks promising.
Also for some reason the path is on the wrong side of the field at the moment, I'll fix that as well (this was driving to shopSource
, not aiming at the actual source.
@aidnem that video looks good - if you or @linglejack06 want to take a crack at #170 it would obviously be nice to not have this crusty driving behavior in the sim
@jkleiber Yeah, the crusty sim behavior is unpleasant. Should we do something like #103 to configure constants with JSON instead? Depending on which is a higher priority I'm fine working on either.
@aidnem #186 would actually be a better first step. #103 is for JSON configurable controllers, which is useful but doesn't fix anything besides that
Oh you're right, I thought they were the same PR.
Purpose This PR adds a new command to control teleop autonomously. Closes #182.
Features A state machine with the following states:
START
DRIVE_TO_SPEAKER
.DRIVE_TO_SOURCE
.DRIVE_TO_SOURCE
ACQUIRE_NOTE
to go intake the note.ACQUIRE_NOTE
DRIVE_TO_SPEAKER
DRIVE_TO_SPEAKER
SHOOT_NOTE
. This currently only checks range to the speaker in deciding whether or not to switch to the score note state.SHOOT_NOTE
DRIVE_TO_SOURCE
.The state machine can be seen in the diagram below:
Outstanding Work
DRIVE_TO_SOURCE
to detect when a note is near and switch toACQUIRE_NOTE
.ACQUIRE_NOTE
to use note vision and/or retry logic to be able to actually intake notes by itself.