File tree Expand file tree Collapse file tree 38 files changed +271
-95
lines changed
arcade-drive-xbox-controller
cscore-intermediate-vision
tank-drive-xbox-controller Expand file tree Collapse file tree 38 files changed +271
-95
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
7
+
1
8
import wpilib
2
9
3
10
kLEDBuffer = 60
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a demo program showing the use of the DifferentialDrive class.
4
- Runs the motors with split arcade steering and an Xbox controller.
5
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
import wpilib .drive
9
10
10
11
11
12
class MyRobot (wpilib .TimedRobot ):
13
+ """
14
+ This is a demo program showing the use of the DifferentialDrive class.
15
+ Runs the motors with split arcade steering and an Xbox controller.
16
+ """
17
+
12
18
def robotInit (self ):
13
19
"""Robot initialization function"""
14
20
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a demo program showing the use of the DifferentialDrive class.
4
- Runs the motors with arcade steering.
5
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
import wpilib .drive
9
10
10
11
11
12
class MyRobot (wpilib .TimedRobot ):
13
+ """
14
+ This is a demo program showing the use of the DifferentialDrive class.
15
+ Runs the motors with arcade steering.
16
+ """
17
+
12
18
def robotInit (self ):
13
19
"""Robot initialization function"""
14
20
Original file line number Diff line number Diff line change 3
3
# Copyright (c) FIRST and other WPILib contributors.
4
4
# Open Source Software; you can modify and/or share it under the terms of
5
5
# the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
Original file line number Diff line number Diff line change 1
- #!usr/bin/env python3
2
-
1
+ #!/ usr/bin/env python3
2
+ #
3
3
# Copyright (c) FIRST and other WPILib contributors.
4
4
# Open Source Software; you can modify and/or share it under the terms of
5
5
# the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
import commands2
Original file line number Diff line number Diff line change 1
- #!usr/bin/env python3
2
-
1
+ #!/ usr/bin/env python3
2
+ #
3
3
# Copyright (c) FIRST and other WPILib contributors.
4
4
# Open Source Software; you can modify and/or share it under the terms of
5
5
# the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
import commands2
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a sample program showing how to retrieve information from the Power
4
- Distribution Panel via CAN. The information will be displayed under variables
5
- through the SmartDashboard .
6
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project .
6
+ #
7
7
8
8
import wpilib
9
9
import wpilib .drive
10
10
11
11
12
12
class MyRobot (wpilib .TimedRobot ):
13
+ """
14
+ This is a sample program showing how to retrieve information from the Power
15
+ Distribution Panel via CAN. The information will be displayed under variables
16
+ through the SmartDashboard.
17
+ """
18
+
13
19
def robotInit (self ):
14
20
"""Robot initialization function"""
15
21
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a good foundation to build your robot code on
4
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
5
7
6
8
import wpilib
7
9
8
10
9
11
class MyRobot (wpilib .TimedRobot ):
12
+ """
13
+ This is a good foundation to build your robot code on
14
+ """
15
+
10
16
def robotInit (self ):
11
17
wpilib .CameraServer .launch ("vision.py:main" )
12
18
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a good foundation to build your robot code on
4
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
5
7
6
8
import wpilib
7
9
8
10
9
11
class MyRobot (wpilib .TimedRobot ):
12
+ """
13
+ This is a good foundation to build your robot code on
14
+ """
15
+
10
16
def robotInit (self ):
11
17
wpilib .CameraServer .launch ()
12
18
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
2
7
3
8
import wpilib
4
9
import wpilib .drive
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
7
+
1
8
import wpilib
2
9
import wpimath .controller
3
10
import wpimath .trajectory
Original file line number Diff line number Diff line change 3
3
# Copyright (c) FIRST and other WPILib contributors.
4
4
# Open Source Software; you can modify and/or share it under the terms of
5
5
# the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import math
8
9
import wpilib
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- Example file showing how to get game-data from your driver station / FMS
4
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
7
+
5
8
import wpilib
6
9
import ntcore
7
10
8
11
PNUE_MOD_TYPE = wpilib .PneumaticsModuleType .CTREPCM
9
12
10
13
11
- class GameDataRobot (wpilib .TimedRobot ):
14
+ class MyRobot (wpilib .TimedRobot ):
15
+ """
16
+ Example file showing how to get game-data from your driver station / FMS
17
+ """
18
+
12
19
def robotInit (self ):
13
20
# A way of demonstrating the difference between the game data strings
14
21
self .blue = wpilib .Solenoid (PNUE_MOD_TYPE , 0 )
@@ -35,4 +42,4 @@ def teleopPeriodic(self):
35
42
36
43
37
44
if __name__ == "__main__" :
38
- wpilib .run (GameDataRobot )
45
+ wpilib .run (MyRobot )
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
2
7
3
8
import typing
4
9
import wpilib
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
2
7
3
8
import typing
4
9
import wpilib
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a sample program demonstrating how to communicate to a light controller from the robot
4
- code using the roboRIO's I2C port.
5
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
9
10
10
11
class MyRobot (wpilib .TimedRobot ):
12
+ """
13
+ This is a sample program demonstrating how to communicate to a light controller from the robot
14
+ code using the roboRIO's I2C port.
15
+ """
16
+
11
17
PORT = wpilib .I2C .Port .kOnboard
12
18
DEVICE_ADDRESS = 4
13
19
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
2
7
3
8
import wpilib
4
9
from magicbot import MagicRobot
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a demo program showing how to use Mecanum control with the
4
- MecanumDrive class.
5
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
import wpilib .drive
9
10
10
11
11
12
class MyRobot (wpilib .TimedRobot ):
13
+ """
14
+ This is a demo program showing how to use Mecanum control with the
15
+ MecanumDrive class.
16
+ """
17
+
12
18
# Channels on the roboRIO that the motor controllers are plugged in to
13
19
kFrontLeftChannel = 2
14
20
kRearLeftChannel = 3
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This is a demo program showing how to use Mecanum control with the
4
- MecanumDrive class.
5
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
6
7
7
8
import wpilib
8
9
from wpilib .drive import MecanumDrive
9
10
10
11
11
12
class MyRobot (wpilib .TimedRobot ):
13
+ """
14
+ This is a demo program showing how to use Mecanum control with the
15
+ MecanumDrive class.
16
+ """
17
+
12
18
# Channels on the roboRIO that the motor controllers are plugged in to
13
19
frontLeftChannel = 2
14
20
rearLeftChannel = 3
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
3
- This sample program shows how to use Mechanism2d - a visual representation of arms, elevators,
4
- and other mechanisms on dashboards; driven by a node-based API.
5
-
6
- Ligaments are based on other ligaments or roots, and roots are contained in the base
7
- Mechanism2d object.
8
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
9
7
10
8
import wpilib
11
9
12
10
13
11
class MyRobot (wpilib .TimedRobot ):
12
+ """
13
+ This sample program shows how to use Mechanism2d - a visual representation of arms, elevators,
14
+ and other mechanisms on dashboards; driven by a node-based API.
15
+
16
+ Ligaments are based on other ligaments or roots, and roots are contained in the base
17
+ Mechanism2d object.
18
+ """
19
+
14
20
kMetersPerPulse = 0.01
15
21
kElevatorMinimumLength = 0.5
16
22
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
7
+
8
+ import wpilib
9
+
10
+
11
+ class MyRobot (wpilib .TimedRobot ):
12
+ """
3
13
This sample program shows how to control a motor using a joystick. In the
4
14
operator control part of the program, the joystick is read and the value
5
15
is written to the motor.
9
19
a short time in the loop to allow other threads to run. This is generally
10
20
a good idea, especially since the joystick values are only transmitted
11
21
from the Driver Station once every 20ms.
12
- """
22
+ """
13
23
14
- import wpilib
15
-
16
-
17
- class MyRobot (wpilib .TimedRobot ):
18
24
#: update every 0.005 seconds/5 milliseconds (200Hz)
19
25
kUpdatePeriod = 0.005
20
26
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) FIRST and other WPILib contributors.
4
+ # Open Source Software; you can modify and/or share it under the terms of
5
+ # the WPILib BSD license file in the root directory of this project.
6
+ #
2
7
3
8
import wpilib
4
9
import wpilib .drive
You can’t perform that action at this time.
0 commit comments