-
Notifications
You must be signed in to change notification settings - Fork 0
/
RobotMap.cpp
123 lines (91 loc) · 4.73 KB
/
RobotMap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// RobotBuilder Version: 0.0.2
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// C++ from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in th future.
#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"
CANJaguar* RobotMap::articulatingJaguar = NULL;
Relay* RobotMap::compressorRelay = NULL;
Relay* RobotMap::articulatingRelay = NULL;
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
CANJaguar* RobotMap::driveCANJaguar1 = NULL;
CANJaguar* RobotMap::driveCANJaguar2 = NULL;
CANJaguar* RobotMap::driveCANJaguar3 = NULL;
CANJaguar* RobotMap::driveCANJaguar4 = NULL;
RobotDrive* RobotMap::driveRobotDrive41 = NULL;
Gyro* RobotMap::driveGyro1 = NULL;
CANJaguar* RobotMap::shooterCANJaguar1 = NULL;
DoubleSolenoid* RobotMap::shooterLoaderSolenoid = NULL;
Encoder* RobotMap::trackQuadratureEncoder1 = NULL;
AnalogChannel* RobotMap::trackAnalogForce1 = NULL;
AnalogChannel* RobotMap::trackAnalogForce2 = NULL;
Solenoid* RobotMap::trackBrakeSolenoid = NULL;
SpeedController* RobotMap::trackSpeedController1 = NULL;
SpeedController* RobotMap::trackSpeedController2 = NULL;
Solenoid* RobotMap::tippingSolenoid1 = NULL;
DigitalInput* RobotMap::pneumaticsCompressorDigitalInput1 = NULL;
DoubleSolenoid* RobotMap::articulatingArmDoubleSolenoid1 = NULL;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
void RobotMap::init()
{
articulatingJaguar = new CANJaguar(6);
compressorRelay = new Relay(1, Relay::kForwardOnly);
articulatingRelay = new Relay(2, Relay::kBothDirections);
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
LiveWindow* lw = LiveWindow::GetInstance();
driveCANJaguar1 = new CANJaguar(2);
driveCANJaguar2 = new CANJaguar(3);
driveCANJaguar3 = new CANJaguar(4);
driveCANJaguar4 = new CANJaguar(5);
driveRobotDrive41 = new RobotDrive(driveCANJaguar1, driveCANJaguar2,
driveCANJaguar3, driveCANJaguar4);
driveRobotDrive41->SetSafetyEnabled(false);
driveRobotDrive41->SetExpiration(0.1);
driveRobotDrive41->SetSensitivity(0.5);
driveRobotDrive41->SetMaxOutput(1.0);
driveRobotDrive41->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
driveRobotDrive41->SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
driveGyro1 = new Gyro(1, 1);
lw->AddSensor("Drive", "Gyro 1", driveGyro1);
driveGyro1->SetSensitivity(0.007);
shooterCANJaguar1 = new CANJaguar(7);
shooterLoaderSolenoid = new DoubleSolenoid(1, 3, 6);
trackQuadratureEncoder1 = new Encoder(1, 1, 1, 2, false, Encoder::k4X);
lw->AddSensor("Track", "Quadrature Encoder 1", trackQuadratureEncoder1);
trackQuadratureEncoder1->SetDistancePerPulse(1.0);
trackQuadratureEncoder1->SetPIDSourceParameter(Encoder::kRate);
trackQuadratureEncoder1->Start();
trackAnalogForce1 = new AnalogChannel(1, 3);
lw->AddSensor("Track", "Analog Force 1", trackAnalogForce1);
trackAnalogForce2 = new AnalogChannel(1, 4);
lw->AddSensor("Track", "Analog Force 2", trackAnalogForce2);
trackBrakeSolenoid = new Solenoid(1, 1);
lw->AddActuator("Track", "Brake Solenoid", trackBrakeSolenoid);
trackSpeedController1 = new Victor(1, 1);
lw->AddActuator("Track", "Speed Controller 1", (Victor*) trackSpeedController1);
trackSpeedController2 = new Victor(1, 2);
lw->AddActuator("Track", "Speed Controller 2", (Victor*) trackSpeedController2);
tippingSolenoid1 = new Solenoid(1, 2);
lw->AddActuator("Tipping", "Solenoid 1", tippingSolenoid1);
pneumaticsCompressorDigitalInput1 = new DigitalInput(1, 3);
lw->AddSensor("Pneumatics Compressor", "Digital Input 1", pneumaticsCompressorDigitalInput1);
articulatingArmDoubleSolenoid1 = new DoubleSolenoid(1, 8, 7);
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveCANJaguar1->ConfigEncoderCodesPerRev(360);
driveCANJaguar1->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
driveCANJaguar2->ConfigEncoderCodesPerRev(360);
driveCANJaguar2->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
driveCANJaguar3->ConfigEncoderCodesPerRev(360);
driveCANJaguar3->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
driveCANJaguar4->ConfigEncoderCodesPerRev(360);
driveCANJaguar4->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
//shooterCANJaguar1->ConfigEncoderCodesPerRev(360);
//shooterCANJaguar1->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
trackQuadratureEncoder1->SetDistancePerPulse(0.0037149147);
trackQuadratureEncoder1->SetReverseDirection(true);
}