2017:Programming: Difference between revisions

From 1511Wookiee
Jump to navigationJump to search
No edit summary
No edit summary
 
(27 intermediate revisions by 2 users not shown)
Line 6: Line 6:


*IO Map
*IO Map
**<s>Fully synchronize with current Wiki IO Map (Austin)</s>
**<s>Add entry for new indexer motor</s>
*Robot main
*Robot main
**<s>Autonomoose selection/setting/setup in start of Autonomous function - see last year's code (Austin)</s>
**<s>Autonomous selection will be overwritten in auto reset() call. Move Reset() calls BEFORE auto selection. (Austin)</s>
**<s>Add empty Reset() to all subsystems not already having such (Austin)</s>
**<s>Controls process() call in disabled should pass DISABLED not TELEOP (Austin)</s>
**<s>Clean up and make uniform subsystem calls to Debug, Process, Reset, etc -- Debug in all modes of operation, Process in auto+teleop, Reset at start of auto+teleop (Austin)</s>
**<s>Reorder objects and constructor calls so that subsystems are created before the controls and autonomoose objects that use them (Austin)</s>
**<s>Add process() of controls to disabled() so we can do button processing in disabled mode, too. (Austin)</s>
*Autonomoose
*Autonomoose
**<s>Add to Reset(): (Kate/Austin)</s>
**<s>Send auto choices and descriptions. Follow pattern of last year's AutoDashboardSend() function. Call this in Disabled() in thunderbot.</s>
***<s>Reset chosen auto mode to "do nothing!"</s>
**<s>DOCUMENT on wiki in VERY CLEAR AND PRECISE words, the starting location for each one (can edit/add to the strategy-provided google sheet)</s>
**<s>Add to Debug(): (Kate/Austin)</s>
***<s>currentStep</s>
***<s>Chosen auto mode</s>
**Strongly consider pulling out "common steps" to a function so you only need to fix/tune/maintain them in one place! Use arguments to handle slight variations (turn left v. turn right, for example). Red/blue boiler is one good candidate for this, probably others! (Kate/Austin)
**DOCUMENT on wiki in VERY CLEAR AND PRECISE words, the starting location for each one (can edit/add to the strategy-provided google sheet)
 
*Feedback
*Feedback
**Add camera code to send images to driver station. Make sure it doesn't kill everything if no camera is plugged in (Austin)
**Nothing right now
**Add function allowing swapping/toggling between 2 cameras (Austin)
**Import last year's 1511-modified camera server to project (Austin)
*Controls
*Controls
**<s>Remove the invert of direction of the left drive train! COORDINATE THIS WITH CHANGE TO DRIVE CLASS TO FIX ITS BROKEN INTERFACE (Austin)</s>
**<s>Fix broken switch processing - call these universally (don't check "process()" - just send the state of the button). Still keep all this disabled for now until real controls are ready</s>
**Add button to invoke camera swap in Feedback (Andrew)
**<s>Move rumble setup from main joystick function into aux function</s>
**Add button to do gyro initialization call in Drive (Andrew)
**<s>Add back in control for preheat. This should just tell the shooter to shoot. (so, if (buttonShoot || buttonPreheat) shooter->start_shoot(); else end_shoot() -- have to then handle enqueue separately for SHOOTING ONLY, not for preheat.</s>
**Add processing for broken switches AND DOCUMENT WHICH SWITCH IS WHICH ON CONTROLS WIKI. List of brokens below (Andrew)
**<s>Fix climber control. It was always going true/on. Currently forced to false because of this</s>. I think I fixed it, &nbsp;-Austin
***Shooter: Speed encoder is broken; instead sends a constant power value when shooting.
***Gear: "Spike present" sensor is not working; allow spitting out gear at any time
***Bucket: Encoder on bucket ball moving conveyor broken; just use constant power value
***Drive: Left encoder broken, right encoder broken; Only impacts autonomous
**Because physical controls may not be ready before robot, put #ifdef around all broken switch code. If code is disabled, all broken switches must be considered off (not broken) (Andrew)
**Turn on rumble of aux (or both?) xbox controllers if gear system says spike is engaged (Andrew)
**Move drive speed ramping into Drive - it does not belong in controls. In Drive, it should only be used for teleop mode. Be sure to reset to current output 0 inside Drive::Reset() (Andrew)
**Implement "swap drive" control. Right now it looks like it does nothing? (Andrew)
**Improve "aux" controls (Andrew):
***Make only ONE call (max) to Intake::Set_Direction() per call - use combination of shooting state and intake state to determine
***Make calls to new Bucket functions to control the "input bar" -- on when shooting (not preheating) OR intaking (Andrew)
*Intake
*Intake
**<s>Remove X_Is_Full() functions? We have no way to tell this with final design? (Austin)</s>
**Nothing right now
**Add encoder sensor object for future use
**<s>Add Set_Sensor_Broken(boolean) to control broken-ness of encoder (just set internal state variable; may be used in future)</s>
**Implement Reset() -- turn off motor, set direction to STOP, call Reset() on encoder (Austin)
**Debug()
***Current direction
***Last measured current draw for motor
***Current encoder count
*Shooter
*Shooter
**<s>Set talons here for coast mode - we don't want brake on these (Kate)</s>
**<s>Process() -- Sensor detection needs fixing, see commented out "broken = false". Can't just set broken absolutely. Must combine this with "Set_Broken" value to determine actual broken state.</s>
**<s>Need to add second talon (2 motors on shooter). Configure for master->slave operation. Master is the one you do all the PID control on. </s>Check Talon doc for how slave works with PID control on master (see if any more setup is required?) (Kate)
**<s>Need SetControlMode when we switch from broken back to not broken (similar to working to broken setup). Again, be sure to call Set(something) immediately since units will change!</s>
**Familiarize with PID tuning (Kate)
**<s>Remove preheat function declarations in .h to avoid confusion.</s>
**Determine realistic values for at speed tolerance (Kate)
**<s>Process() -- move sensor detection before anything else that examines "broken". (Kate)</s>
**<s>Change Shooter_Set_Broken() to take boolean argument to set as broken or not. (Kate)</s>
**<s>Remove SetControlMode() from SetBroken() -- instead do in process by detecting a change to broken state. When state is chaged, call SetControlMode() with arguments. You also need to set all other control mode related things here. Do this before calling Set() on the motor, and make sure Set() is invoked immediately after any mode change (since the units are different in the different modes!) (Kate)</s>
**<s>Implement Broken in process() such that it will Set() a constant value when shooting (again, different units for Set() in PID mode versus&nbsp;%vbus mode) (Kate)</s>
**<s>Should Start_Shoot() really clear preheat? (Kate) -probably not</s>
**<s>Add to debug: (Kate)</s>
***<s>Current shooter speed (revs per second?)</s>
***<s>Current shooter speed error (fractional revs per second or native units?)</s>
***<s>Broken state</s>
***<s>Last measured current draw for BOTH motors</s>
**<s>Implement Reset() -- turn off shoot, pre-heat states, TURN OFF MOTOR (Kate)</s>
*Gear
*Gear
**Add Set_Spike_Sensor_Broken(boolean) for broken spike present sensor. Set internal state to indicate if broken. Use (Andrew)
**<s>Remove printf's. Use Debug() and dashboard sends instead</s>
**Use the broken state to do the right things in extend (Andrew)
**<s>Remove redundant and never-running code in Is_Spike_Engaged()</s>
**When broken, the IsSpikeThere() function should always return FALSE (Andrew)
**Remove unused global variables in the .cpp (Andrew)
**Add to debug (Andrew):
***Current broken state(s)
***Current state (extended or retracted)
***<s>Remove Is_Deploy_Finished()? no longer makes sense?</s>
**Move servo values to top-of-cpp-file constants with appropriate names (Andrew)
*Drive
*Drive
**<s>DOCUMENT the drive function to say it expect + numbers for forward, - numbers for reverse! Apply invert to LEFT SIDE ONLY internally to match electrical wiring. DO THIS IN CONJUNCTION WITH CONTROLS CHANGE. It would be best to apply this inversion in one place, right before Set() to the motor, and do it universally that way for teleop and auto (Austin)</s>
**<s>Debug() -- send dashboard key "thunderdashboard_gyro". Numeric. Set to 1 until gyro is calibrated. Set to 0 after.</s>
**Change motor controllers from Jaguar objects to SpeedController ''pointers'' (Austin)
**<s>Change to constructing Spark's not Jaguar's</s>
**In constructor, construct them using Jaguars for now (temporary electrical board) with #ifdef'd out constructors for Sparks (real robot) (Austin)
**Change all uses of the motor controllers to use as a SpeedController pointer (generic, works with both!) (Austin)
**<s>Reset() should reset the drive MODE to manual/teleop drive! Auto drive carrying over to teleop would be bad! (Austin)</s>
**<s>Reset() should turn off motors, too. (Austin)</s>
**<s>Reset() should reset encoders to 0, too (Austin)</s>
**<s>Remove printf's in process(); it's being output in debug() anyway (Austin)</s>
**<s>Add is straight finished to Debug() output -- just like is turn finished that is already there (Austin)</s>
**<s>Add broken setting functions for left and right encoder. (Austin)</s>
**<s>Add broken setting values to Debug() (Austin)</s>
**<s>Change auto driving to account for broken states -- if one is broken, use only the other. If both broken, don't use either just stop and say you are NOT finished! (Kate)</s>
**Change gyro calibrate as follows: (Austin)
***Add new function to Drive(): CalibrateGyro(). Will be called by controls. Keep track of if this has been called already - if so, do nothing. If not, do the gyro.Calibrate() call.
***In our Reset()... Only call Calibrate() if not yet calibrated! Always call gyro.Reset() here (to set the angle to zero)
***Add a new Debug output called GyroCalibrated or something similar. Send true/false if gyro's calibrate function has been called already or not.
***End result here is that calibration happens under driver's pre-match instruction OR, if they forget, at the beginning of auto
*Climbing
*Climbing
**<s>Implement Reset() - set direction to STOP, servo to neutral, motors off, clear "finished" (Austin)</s>
**Nothing right now
**<s>Move overcurrent detection into top of Process(). Set "finished" internal state appropriately (this way if Is_Complete() is not being called, the current is still monitored!) (Austin)</s>
**<s>Change Is_Complete() to simply return the "finished" state maintained by Process() (Austin)</s>
**<s>Setup motorB to "follow" motorA. Only set values to motorA. (Austin)</s>
**<s>Initial value of climb_finished should be true, right? (Austin)</s>
**<s>In Climb_Direction, should we be ignoring new directions if we aren't done with old direction? (Austin)</s>
**<s>Move servo and motor values out to constants at top of .cpp (Austin)</s>
**<s>Document units of kClimbStop (Austin)</s>
**<s>In constructor, servo should be set to "neutral" mode so it does not drive any value; in Deploy, this neutral mode should be deactivated and the Set() value output to the servo (Austin)</s>
**<s>Add to Debug: (Austin)</s>
***<s>Current state/direction</s>
***<s>Last measured Motor Current draw for BOTH motors</s>
***<s>The "is finished with climb" value</s>
*Bucket
*Bucket
**Missing stuff to control "Input bar" or whatever we want to call it: (Andrew)
**<s>Add new motor controller (talon) for "indexer".</s>
***Add public function to control direction (in/out/stop) of this mechanism
**<s>Add functions to control it - needs to take an into shooter, away from shooter, and stop argument.</s>
***Add another motor controller (CANTalon)
**<s>Document in wiki - use CAN ID 13 -- Positive values (voltage) cause spin TOWARDS/into shooter, negative out.</s>
***Control it in process(). For now, use similar means to the conveyor -- constant forward/back speeds.
**<s>Modify controls to call as needed - spin into shooter only when shooting (not preheat). Spin away from shooter whenever intaking balls.</s>
**Add encoder sensor object for future use (Andrew)
**<s>Use fixed speeds for both, but allow to adjust via dashboard (ask kate how to do this)</s>
**Add Set_Sensor_Broken(boolean) to control broken-ness of sensor (just set internal state variable; may be used in future) (Andrew)
**Add Reset() (Andrew)
***Turn off motors
***Set Direction to off
***Set input bar direction off
***Reset() on sensor
**Add to Debug() (Andrew)
***Current Direction of "input bar"
***Current direction of conveyor
***Current encoder value
***Last measured current draw for each motor


== Coders: ==
== Coders: ==
Line 131: Line 45:
Intake &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Austin<br/>Shooter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; K8<br/>Bucket &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new<br/>Gear &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Chase<br/>Drive base &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;???<br/>Autonomoose &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;K8 n/or Andrew n/or Austin<br/>climbing &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Calvin<br/>Feedback system &nbsp; &nbsp; &nbsp;Ethan/Zach<br/>Controls &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Josh
Intake &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Austin<br/>Shooter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; K8<br/>Bucket &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new<br/>Gear &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Chase<br/>Drive base &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;???<br/>Autonomoose &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;K8 n/or Andrew n/or Austin<br/>climbing &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Calvin<br/>Feedback system &nbsp; &nbsp; &nbsp;Ethan/Zach<br/>Controls &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Josh


== Autonomous ==
== Autonomoose ==
 
Starting Locations:
 
Cross Baseline: Start anywhere along the wall as long as it isnt gonna crash into the airship
 
Any of the ones tht start with high boiler: Start lined up with the inner side of the robot along the outside of the tape outlining the key with one of the back corners against the wall
 
Center Gear: lined up with the center gear lift
 
Side gear: lined up where the back wall meets&nbsp;the boiler but completely flat against the back wall
 
 


'''<span style="font-family:comic sans ms,cursive;">Measurements for crossing the baseline: 95 inches</span>'''
measurements for crossing the baseline: 95 inches


== Programming Sub-pages and Links ==
== Programming Sub-pages and Links ==

Latest revision as of 17:29, 16 February 2017

General programming stuff relevant to all subsystems should be documented here.

Outstanding Tasks

Split up by subsystem - responsible veteran student in (), student(s) doing actual code, if different, in []. These are not in any particular order!

  • IO Map
    • Add entry for new indexer motor
  • Robot main
    • Autonomous selection will be overwritten in auto reset() call. Move Reset() calls BEFORE auto selection. (Austin)
    • Controls process() call in disabled should pass DISABLED not TELEOP (Austin)
  • Autonomoose
    • Send auto choices and descriptions. Follow pattern of last year's AutoDashboardSend() function. Call this in Disabled() in thunderbot.
    • DOCUMENT on wiki in VERY CLEAR AND PRECISE words, the starting location for each one (can edit/add to the strategy-provided google sheet)
  • Feedback
    • Nothing right now
  • Controls
    • Fix broken switch processing - call these universally (don't check "process()" - just send the state of the button). Still keep all this disabled for now until real controls are ready
    • Move rumble setup from main joystick function into aux function
    • Add back in control for preheat. This should just tell the shooter to shoot. (so, if (buttonShoot || buttonPreheat) shooter->start_shoot(); else end_shoot() -- have to then handle enqueue separately for SHOOTING ONLY, not for preheat.
    • Fix climber control. It was always going true/on. Currently forced to false because of this. I think I fixed it,  -Austin
  • Intake
    • Nothing right now
  • Shooter
    • Process() -- Sensor detection needs fixing, see commented out "broken = false". Can't just set broken absolutely. Must combine this with "Set_Broken" value to determine actual broken state.
    • Need SetControlMode when we switch from broken back to not broken (similar to working to broken setup). Again, be sure to call Set(something) immediately since units will change!
    • Remove preheat function declarations in .h to avoid confusion.
  • Gear
    • Remove printf's. Use Debug() and dashboard sends instead
    • Remove redundant and never-running code in Is_Spike_Engaged()
  • Drive
    • Debug() -- send dashboard key "thunderdashboard_gyro". Numeric. Set to 1 until gyro is calibrated. Set to 0 after.
    • Change to constructing Spark's not Jaguar's
  • Climbing
    • Nothing right now
  • Bucket
    • Add new motor controller (talon) for "indexer".
    • Add functions to control it - needs to take an into shooter, away from shooter, and stop argument.
    • Document in wiki - use CAN ID 13 -- Positive values (voltage) cause spin TOWARDS/into shooter, negative out.
    • Modify controls to call as needed - spin into shooter only when shooting (not preheat). Spin away from shooter whenever intaking balls.
    • Use fixed speeds for both, but allow to adjust via dashboard (ask kate how to do this)

Coders:

Intake                       Austin
Shooter                     K8
Bucket                      new
Gear                        Chase
Drive base                ???
Autonomoose            K8 n/or Andrew n/or Austin
climbing                    Calvin
Feedback system      Ethan/Zach
Controls                    Josh

Autonomoose

Starting Locations:

Cross Baseline: Start anywhere along the wall as long as it isnt gonna crash into the airship

Any of the ones tht start with high boiler: Start lined up with the inner side of the robot along the outside of the tape outlining the key with one of the back corners against the wall

Center Gear: lined up with the center gear lift

Side gear: lined up where the back wall meets the boiler but completely flat against the back wall


measurements for crossing the baseline: 95 inches

Programming Sub-pages and Links

Programming Archives