Source code for robot
-import wpilib
+"""
+The entry point for all robot code.
+"""
+
+
+import wpilib
import constants
import swerve
import teleop
@@ -49,6 +54,13 @@ Source code for robot
[docs]class Robot(wpilib.IterativeRobot):
[docs] def robotInit(self):
+ """
+ Perform initialization on robot startup.
+
+ This function is called when the robot code starts after being powered
+ on; at this point everything within WPILib / NetworkTables / etc.
+ has been initialized.
+ """
constants.load_control_config()
self.autoPositionSelect = wpilib.SendableChooser()
@@ -68,26 +80,69 @@ Source code for robot
)
[docs] def disabledInit(self):
+ """
+ Called once whenever the robot is disabled.
+
+ This can't, and probably shouldn't, do much. It could be helpful to
+ reload robot configuration values here (from Preferences, for instance)
+ for testing purposes.
+ """
# We don't really _need_ to reload configuration in
# every init call-- it's just useful for debugging.
# (no need to restart robot code just to load new values)
self.drivetrain.load_config_values()
[docs] def disabledPeriodic(self):
+ """
+ Called periodically whenever the robot is disabled.
+
+ To be specific, this function is called whenever a new packet has been
+ received from the Driver Station.
+
+ This probably shouldn't do much other than update SmartDashboard.
+ """
pass
[docs] def autonomousInit(self):
+ """
+ Called once when entering Autonomous mode.
+ """
self.drivetrain.load_config_values()
self.auto = Autonomous(self.autoPositionSelect.getSelected())
[docs] def autonomousPeriodic(self):
+ """
+ Called periodically when in Autonomous mode.
+
+ To be specific, this function is called whenever a new packet has been
+ received from the Driver Station.
+
+ Warning:
+ This function **must not** block the robot program for more than
+ a few milliseconds at a time. Blocking will cause all sorts of
+ problems with the robot and may leave it unresponsive.
+ """
pass
[docs] def teleopInit(self):
+ """
+ Called once when entering Teleop mode.
+ """
self.drivetrain.load_config_values()
constants.load_control_config()
[docs] def teleopPeriodic(self):
+ """
+ Called periodically when in Teleop mode.
+
+ To be specific, this function is called whenever a new packet has been
+ received from the Driver Station.
+
+ Warning:
+ This function **must not** block the robot program for more than
+ a few milliseconds at a time. Blocking will cause all sorts of
+ problems with the robot and may leave it unresponsive.
+ """
# For now: basic driving
teleop.drive(self.control_stick, self.drivetrain)
self.drivetrain.update_smart_dashboard()
@@ -102,6 +157,9 @@ Source code for robot
+
2018-PowerUp
@@ -144,7 +202,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/sensors/ultrasonic.html b/docs/_modules/sensors/ultrasonic.html
index 953337a..47bf08e 100644
--- a/docs/_modules/sensors/ultrasonic.html
+++ b/docs/_modules/sensors/ultrasonic.html
@@ -63,6 +63,9 @@ Source code for sensors.ultrasonic
+
2018-PowerUp
@@ -105,7 +108,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/swerve/swerve_drive.html b/docs/_modules/swerve/swerve_drive.html
index 2d214b2..02cf320 100644
--- a/docs/_modules/swerve/swerve_drive.html
+++ b/docs/_modules/swerve/swerve_drive.html
@@ -160,6 +160,9 @@ Source code for swerve.swerve_drive
+
2018-PowerUp
@@ -202,7 +205,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/swerve/swerve_module.html b/docs/_modules/swerve/swerve_module.html
index 8537d18..eb32fa8 100644
--- a/docs/_modules/swerve/swerve_module.html
+++ b/docs/_modules/swerve/swerve_module.html
@@ -269,6 +269,9 @@ Source code for swerve.swerve_module
+
2018-PowerUp
@@ -311,7 +314,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/teleop.html b/docs/_modules/teleop.html
index 74d3731..6d3a038 100644
--- a/docs/_modules/teleop.html
+++ b/docs/_modules/teleop.html
@@ -50,6 +50,10 @@ Source code for teleop
[docs]def drive(control_stick, drivetrain):
"""
Drive the robot directly using a joystick.
+
+ This function grabs inputs from a joystick, applies axis inversion and
+ deadbanding, and from there passes the control inputs on to
+ :func:`swerve.swerve_drive.SwerveDrive.drive`.
"""
ctrl = np.array([
control_stick.getRawAxis(constants.fwdAxis),
@@ -85,6 +89,9 @@ Source code for teleop
+
2018-PowerUp
@@ -127,7 +134,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/vision/visionmaster.html b/docs/_modules/vision/visionmaster.html
index 55f6f99..f02fceb 100644
--- a/docs/_modules/vision/visionmaster.html
+++ b/docs/_modules/vision/visionmaster.html
@@ -97,6 +97,9 @@ Source code for vision.visionmaster
+
2018-PowerUp
@@ -139,7 +142,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_modules/vision/visionslave.html b/docs/_modules/vision/visionslave.html
index 0365047..90c7148 100644
--- a/docs/_modules/vision/visionslave.html
+++ b/docs/_modules/vision/visionslave.html
@@ -86,6 +86,9 @@ Source code for vision.visionslave
+
2018-PowerUp
@@ -128,7 +131,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
diff --git a/docs/_static/basic.css b/docs/_static/basic.css
index 3c7223b..6f40830 100644
--- a/docs/_static/basic.css
+++ b/docs/_static/basic.css
@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
- * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/docs/_static/doctools.js b/docs/_static/doctools.js
index 24992e6..0c15c00 100644
--- a/docs/_static/doctools.js
+++ b/docs/_static/doctools.js
@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
- * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -204,7 +204,7 @@ var Documentation = {
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
- if (document.location.hash)
+ if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
diff --git a/docs/_static/logo.png b/docs/_static/logo.png
new file mode 100644
index 0000000..9646320
Binary files /dev/null and b/docs/_static/logo.png differ
diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js
index 33fedf4..41b8336 100644
--- a/docs/_static/searchtools.js
+++ b/docs/_static/searchtools.js
@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
- * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/docs/_static/websupport.js b/docs/_static/websupport.js
index 53f6a45..79b18e3 100644
--- a/docs/_static/websupport.js
+++ b/docs/_static/websupport.js
@@ -4,7 +4,7 @@
*
* sphinx.websupport utilities for all documentation.
*
- * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/docs/autonomous.html b/docs/autonomous.html
index 9c99a3d..eb42b4e 100644
--- a/docs/autonomous.html
+++ b/docs/autonomous.html
@@ -94,6 +94,9 @@
+
2018-PowerUp
@@ -149,7 +152,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
|
diff --git a/docs/constants.html b/docs/constants.html
index a42b43a..a8b40a0 100644
--- a/docs/constants.html
+++ b/docs/constants.html
@@ -45,6 +45,72 @@
constants module¶
Contains constants relating to robot configuration; for example, Talon CAN IDs
and frame dimensions.
+Many of these attributes are loaded from NetworkTables and the SmartDashboard
+via the Robot Preferences API in WPILib.
+
+-
+
constants.fwdAxis¶
+int – The controller axis to use for forward/backward driving in
+Teleop.
+
+
+
+-
+
constants.strAxis¶
+int – The controller axis to use for left/right driving in
+Teleop.
+
+
+
+-
+
constants.rcwAxis¶
+int – The controller axis to use for rotation control in Teleop.
+
+
+
+-
+
constants.fwdInv¶
+bool – Whether or not the forward/backward control axis should be
+inverted in Teleop.
+
+
+
+-
+
constants.strInv¶
+bool – Whether or not the left/right control axis should be
+inverted in Teleop.
+
+
+
+-
+
constants.rcwInv¶
+bool – Whether or not the rotation control axis should be inverted
+in Teleop.
+
+
+
+-
+
constants.swerve_config¶
+list – A list containing configurations for each module
+within the swerve drive.
+Each tuple takes the form ('module name', steer_id, drive_id).
+See also swerve.swerve_drive.
+
+
+
+-
+
constants.chassis_length¶
+float – The distance between the left and right sides
+of the robot frame. The exact choice of units
+
+
+
+-
+
constants.chassis_width¶
+float – The distance between the front and back sides of
+the robot frame.
+
+
+
2018-PowerUp
@@ -116,7 +185,7 @@ Quick search
©2018, Dragon Robotics.
|
- Powered by Sphinx 1.6.5
+ Powered by Sphinx 1.6.6
& Alabaster 0.7.10
|
diff --git a/docs/genindex.html b/docs/genindex.html
index a97831e..db3b172 100644
--- a/docs/genindex.html
+++ b/docs/genindex.html
@@ -84,19 +84,21 @@ A
C
+
-
@@ -122,13 +124,15 @@ D
F
@@ -218,14 +222,18 @@ P
R
+
+
+