Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 85fe1a0

Browse files
committed
minor changes
print/SD lines added to DT and PIDTurn SD layout saved encoders set to not inverted in RobotMap so inversion is not retained over builds
1 parent 294c82b commit 85fe1a0

File tree

4 files changed

+231
-41
lines changed

4 files changed

+231
-41
lines changed

CompSD.xml

Lines changed: 216 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,65 @@
11
<xml version="1.0">
22
<dashboard>
3-
<widget field="Has Cube" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
4-
<location x="0" y="132"/>
3+
<widget field="DT is Inverted" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
4+
<location x="11" y="110"/>
5+
<width>118</width>
6+
<height>59</height>
7+
</widget>
8+
<widget field="Has Cube" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
9+
<location x="697" y="463"/>
10+
<width>96</width>
11+
<height>30</height>
12+
</widget>
13+
<widget field="Arcade Drive" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
14+
<location x="7" y="60"/>
15+
<width>113</width>
16+
<height>44</height>
17+
</widget>
18+
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
19+
<location x="783" y="0"/>
20+
<width>571</width>
21+
<height>448</height>
22+
<property name="Camera Choice" value="USB Camera 1"/>
23+
</static-widget>
24+
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
25+
<location x="191" y="7"/>
26+
<width>586</width>
27+
<height>438</height>
28+
<property name="Degrees Rotation" value="180"/>
29+
<property name="Camera Choice" value=""/>
30+
</static-widget>
31+
<widget field="Move PID Error" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
32+
<location x="173" y="661"/>
33+
</widget>
34+
<widget field="Move PID Result" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
35+
<location x="173" y="640"/>
36+
</widget>
37+
<widget field="Turn PID Error" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
38+
<location x="178" y="619"/>
39+
</widget>
40+
<widget field="Turn PID Result" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
41+
<location x="0" y="661"/>
42+
</widget>
43+
<widget field="Move PID Output" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
44+
<location x="0" y="640"/>
45+
</widget>
46+
<widget field="Left Solenoid Open" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
47+
<location x="0" y="619"/>
48+
</widget>
49+
<widget field="Angle" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
50+
<location x="333" y="503"/>
51+
</widget>
52+
<widget field="Right PID Controller" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
53+
<location x="153" y="462"/>
54+
</widget>
55+
<widget field="Left PID Controller" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
56+
<location x="0" y="462"/>
557
</widget>
658
<widget field="Intake Current Right" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
7-
<location x="0" y="111"/>
59+
<location x="431" y="526"/>
860
</widget>
961
<widget field="Intake Current Left" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
10-
<location x="0" y="90"/>
62+
<location x="435" y="504"/>
1163
</widget>
1264
<widget field="Left Current draw" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
1365
<location x="482" y="581"/>
@@ -25,22 +77,10 @@
2577
<location x="493" y="601"/>
2678
</widget>
2779
<widget field="High Gear" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
28-
<location x="79" y="11"/>
29-
<width>93</width>
30-
<height>78</height>
80+
<location x="6" y="175"/>
81+
<width>105</width>
82+
<height>53</height>
3183
</widget>
32-
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
33-
<location x="783" y="1"/>
34-
<width>586</width>
35-
<height>430</height>
36-
<property name="Camera Choice" value="USB Camera 1"/>
37-
</static-widget>
38-
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
39-
<location x="148" y="2"/>
40-
<width>630</width>
41-
<height>459</height>
42-
<property name="Camera Choice" value=""/>
43-
</static-widget>
4484
<widget field="LR" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
4585
<location x="31" y="2"/>
4686
</widget>
@@ -56,27 +96,164 @@
5696
<widget field="RL" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
5797
<location x="13" y="30"/>
5898
</widget>
99+
<widget field="Turn PID" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
100+
<location x="1216" y="484"/>
101+
</widget>
102+
<widget field="PIDController[2]" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
103+
<location x="705" y="516"/>
104+
</widget>
105+
<widget field="Move PID" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
106+
<location x="360" y="529"/>
107+
</widget>
108+
<widget field="Auto Delay" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
109+
<location x="450" y="469"/>
110+
</widget>
111+
<widget field="Turn PID Output" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
112+
<location x="208" y="542"/>
113+
</widget>
114+
<widget field="VPID Right kP" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
115+
<location x="25" y="1"/>
116+
</widget>
117+
<widget field="VPID Right kI" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
118+
<location x="337" y="485"/>
119+
</widget>
120+
<widget field="VPID Left kP" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
121+
<location x="28" y="19"/>
122+
</widget>
123+
<widget field="VPID Left kI" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
124+
<location x="14" y="31"/>
125+
</widget>
126+
<widget field="VPID kF" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
127+
<location x="24" y="25"/>
128+
</widget>
59129
</dashboard>
60130
<live-window>
131+
<widget field="Drivetrain" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
132+
<location x="7" y="6"/>
133+
</widget>
134+
<widget field="ClimberAssist" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
135+
<location x="21" y="22"/>
136+
</widget>
137+
<widget field="IntakeEject" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
138+
<location x="18" y="28"/>
139+
</widget>
140+
<widget field="Lift" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
141+
<widget field="PIDController" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
142+
<location x="6" y="16"/>
143+
<height>156</height>
144+
<width>293</width>
145+
</widget>
146+
<widget field="Encoder" type="Quadrature Encoder" class="edu.wpi.first.smartdashboard.livewindow.elements.EncoderDisplay">
147+
<location x="6" y="172"/>
148+
<height>98</height>
149+
<width>293</width>
150+
</widget>
151+
<widget field="CIM Motor" type="Speed Controller" class="edu.wpi.first.smartdashboard.livewindow.elements.SpeedController">
152+
<location x="6" y="270"/>
153+
<height>46</height>
154+
<width>293</width>
155+
</widget>
156+
<location x="24" y="18"/>
157+
<width>305</width>
158+
<height>323</height>
159+
</widget>
160+
<widget field="Climber" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
161+
<location x="5" y="16"/>
162+
</widget>
163+
<widget field="Ungrouped" type="LW Subsystem" class="edu.wpi.first.smartdashboard.livewindow.elements.LWSubsystem">
164+
<widget field="Encoder[1]" type="Quadrature Encoder" class="edu.wpi.first.smartdashboard.livewindow.elements.EncoderDisplay">
165+
<location x="6" y="16"/>
166+
<height>98</height>
167+
<width>326</width>
168+
</widget>
169+
<widget field="DoubleSolenoid[0,2]" type="Double Solenoid" class="edu.wpi.first.smartdashboard.livewindow.elements.RelayController">
170+
<location x="6" y="114"/>
171+
<height>20</height>
172+
<width>326</width>
173+
</widget>
174+
<widget field="DigitalInput[0]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
175+
<location x="6" y="134"/>
176+
<height>20</height>
177+
<width>326</width>
178+
</widget>
179+
<widget field="PowerDistributionPanel[0]" type="PowerDistributionPanel" class="edu.wpi.first.smartdashboard.livewindow.elements.PowerDistributionPanel">
180+
<location x="6" y="154"/>
181+
<height>195</height>
182+
<width>326</width>
183+
</widget>
184+
<widget field="VictorSP[8]" type="Speed Controller" class="edu.wpi.first.smartdashboard.livewindow.elements.SpeedController">
185+
<location x="6" y="349"/>
186+
<height>46</height>
187+
<width>326</width>
188+
</widget>
189+
<widget field="Encoder[4]" type="Quadrature Encoder" class="edu.wpi.first.smartdashboard.livewindow.elements.EncoderDisplay">
190+
<location x="6" y="395"/>
191+
<height>98</height>
192+
<width>326</width>
193+
</widget>
194+
<widget field="VictorSP[9]" type="Speed Controller" class="edu.wpi.first.smartdashboard.livewindow.elements.SpeedController">
195+
<location x="6" y="493"/>
196+
<height>46</height>
197+
<width>326</width>
198+
</widget>
199+
<widget field="DigitalInput[3]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
200+
<location x="6" y="539"/>
201+
<height>20</height>
202+
<width>326</width>
203+
</widget>
204+
<widget field="DigitalInput[5]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
205+
<location x="6" y="559"/>
206+
<height>20</height>
207+
<width>326</width>
208+
</widget>
209+
<widget field="DigitalInput[4]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
210+
<location x="6" y="579"/>
211+
<height>20</height>
212+
<width>326</width>
213+
</widget>
214+
<widget field="Talon SRX [6]" type="Speed Controller" class="edu.wpi.first.smartdashboard.livewindow.elements.SpeedController">
215+
<location x="6" y="599"/>
216+
<height>46</height>
217+
<width>326</width>
218+
</widget>
219+
<widget field="Encoder[3]" type="Quadrature Encoder" class="edu.wpi.first.smartdashboard.livewindow.elements.EncoderDisplay">
220+
<location x="6" y="645"/>
221+
<height>98</height>
222+
<width>326</width>
223+
</widget>
224+
<widget field="DoubleSolenoid[0,4]" type="Double Solenoid" class="edu.wpi.first.smartdashboard.livewindow.elements.RelayController">
225+
<location x="6" y="743"/>
226+
<height>20</height>
227+
<width>326</width>
228+
</widget>
229+
<widget field="DigitalInput[1]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
230+
<location x="6" y="763"/>
231+
<height>20</height>
232+
<width>326</width>
233+
</widget>
234+
<widget field="Encoder[2]" type="Quadrature Encoder" class="edu.wpi.first.smartdashboard.livewindow.elements.EncoderDisplay">
235+
<location x="6" y="783"/>
236+
<height>98</height>
237+
<width>326</width>
238+
</widget>
239+
<widget field="Victor SPX [5]" type="Speed Controller" class="edu.wpi.first.smartdashboard.livewindow.elements.SpeedController">
240+
<location x="6" y="881"/>
241+
<height>46</height>
242+
<width>326</width>
243+
</widget>
244+
<widget field="DoubleSolenoid[0,0]" type="Double Solenoid" class="edu.wpi.first.smartdashboard.livewindow.elements.RelayController">
245+
<location x="6" y="927"/>
246+
<height>20</height>
247+
<width>326</width>
248+
</widget>
249+
<widget field="DigitalInput[2]" type="Digital Input" class="edu.wpi.first.smartdashboard.livewindow.elements.DigitalInputDisplay">
250+
<location x="6" y="947"/>
251+
<height>20</height>
252+
<width>326</width>
253+
</widget>
254+
<location x="6" y="24"/>
255+
<width>338</width>
256+
<height>974</height>
257+
</widget>
61258
</live-window>
62-
<hidden field="Right PID Controller"/>
63-
<hidden field="VPID Right kI"/>
64-
<hidden field="VPID Left kI"/>
65-
<hidden field="Turn PID Error"/>
66-
<hidden field="Auto Delay"/>
67-
<hidden field="PIDController[2]"/>
68-
<hidden field="Move PID Error"/>
69-
<hidden field="Turn PID"/>
70-
<hidden field="Left PID Controller"/>
71-
<hidden field="Left Solenoid Open"/>
72-
<hidden field="Angle"/>
73-
<hidden field="Turn PID Result"/>
74-
<hidden field="Move PID"/>
75-
<hidden field="VPID kF"/>
76-
<hidden field="Move PID Output"/>
77-
<hidden field="PIDController[1]"/>
78-
<hidden field="VPID Right kP"/>
79-
<hidden field="VPID Left kP"/>
80-
<hidden field="Turn PID Output"/>
81-
<hidden field="Move PID Result"/>
82259
</xml>

Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ public RobotMap() {
178178
rightEncRate.setDistancePerPulse(Robot.getConst("DPP", DIST_PER_PULSE_RATIO));
179179
rightEncRate.setReverseDirection(true);
180180

181+
leftEncDist.setReverseDirection(false);
182+
rightEncDist.setReverseDirection(false);
183+
181184
dtRightMaster = new WPI_TalonSRX(getPort("RightTalonSRXMaster", 4));
182185
configSRX(dtRightMaster);
183186
dtRightSlave = new WPI_VictorSPX(getPort("RightVictorSPXSlave", 3));

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class PIDTurn extends Command implements PIDOutput {
3030
private boolean absoluteRotation;
3131
private boolean hasInitialized = false;
3232

33+
private double setpoint;
34+
3335
/**
3436
* Constructs this command with a new PIDController. Sets all of the
3537
* controller's PID constants based on SD prefs. Sets the controller's PIDSource
@@ -203,6 +205,8 @@ protected void initialize() {
203205
System.out.println("set point = " + newSetPoint);
204206
turnController.setSetpoint(newSetPoint);
205207

208+
setpoint = newSetPoint;
209+
206210
turnController.enable();
207211
System.out.println("initialize finished");
208212
// tim.start();
@@ -218,6 +222,7 @@ protected void initialize() {
218222
protected void execute() {
219223
System.out.println("execute");
220224
System.out.println("Angle: " + dt.getAHRSAngle());
225+
System.out.println("Targ: " + setpoint);
221226
// if (tim.get() > lastTime + Robot.getConst("Update Time", 1)) {
222227
// SmartDashboard.putNumber("Angle", dt.getAHRSAngle());
223228
// lastTime = tim.get();
@@ -234,7 +239,11 @@ protected void execute() {
234239
@Override
235240
protected boolean isFinished() {
236241
// System.out.println("isFinished");
237-
return (turnController.onTarget() && Math.abs(dt.getGyroRate()) < 1);
242+
double gyroRate = Math.abs(dt.getGyroRate());
243+
System.out.println("Rate: " + gyroRate);
244+
boolean done = turnController.onTarget();
245+
System.out.println("On targ: " + done);
246+
return (done && gyroRate < 1);
238247
// return turnController.onTarget()
239248
// && Math.abs(dt.getLeftEncRate()) <= Robot.getConst("Maximum Velocity When
240249
// Stop", 1)

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public void reverseDT() {
105105
isInverted = !isInverted;
106106
leftEncDist.setReverseDirection(isInverted);
107107
rightEncDist.setReverseDirection(isInverted);
108+
SmartDashboard.putBoolean("DT is Inverted", isInverted);
108109
}
109110

110111
@Override
@@ -284,7 +285,7 @@ public void arcadeDrive(double speed, double turn) {
284285
turn *= Robot.getConst("Turn Slow Ratio", 0.5);
285286
}
286287
}
287-
robotDrive.arcadeDrive(inverted * speed, inverted * turn, Robot.getBool("Square Drive Values", false));
288+
robotDrive.arcadeDrive(inverted * speed, turn, Robot.getBool("Square Drive Values", false));
288289
}
289290

290291
/**

0 commit comments

Comments
 (0)