Skip to content

Commit 4fe136c

Browse files
committed
fixed findbugs issues
1 parent 08406c9 commit 4fe136c

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

real_time/surface_src/java_src/Alice/src/main/java/com/roboclub/robobuggy/nodes/planners/WayPointFollowerPlanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class WayPointFollowerPlanner extends PathPlannerNode {
2222
private GpsMeasurement target;
2323

2424
// we only want to look at the next 10 waypoints as possible candidates
25-
private final int wayPointLOOKAHEADMAX = 50;
25+
private static final int WAY_POINT_LOOKAHEAD_MAX = 50;
2626

2727
/**
2828
* @param wayPoints the list of waypoints to follow
@@ -50,7 +50,7 @@ private int getClosestIndex(ArrayList<GpsMeasurement> wayPoints, GPSPoseMessage
5050
double min = Double.MAX_VALUE; //note that the brakes will definitely deploy at this
5151

5252
int closestIndex = lastClosestIndex;
53-
for (int i = lastClosestIndex; i < (lastClosestIndex + wayPointLOOKAHEADMAX) && i < wayPoints.size(); i++) {
53+
for (int i = lastClosestIndex; i < (lastClosestIndex + WAY_POINT_LOOKAHEAD_MAX) && i < wayPoints.size(); i++) {
5454
GPSPoseMessage gpsPoseMessage = wayPoints.get(i).toGpsPoseMessage(0);
5555
double d = GPSPoseMessage.getDistance(currentLocation, gpsPoseMessage);
5656
if (d < min) {

real_time/surface_src/java_src/Alice/src/main/java/com/roboclub/robobuggy/robots/ControllerTesterRobot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static ControllerTesterRobot getInstance() {
3838
private ControllerTesterRobot() {
3939
super();
4040

41-
ArrayList<GpsMeasurement> wayPoints = null;
41+
ArrayList<GpsMeasurement> wayPoints = new ArrayList<>();
4242
try {
4343
wayPoints = WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
4444
nodeList.add(new WayPointFollowerPlanner(wayPoints));

real_time/surface_src/java_src/Alice/src/main/java/com/roboclub/robobuggy/simulation/ControllerTester.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public class ControllerTester extends PeriodicNode {
3535
private Matrix x;
3636
private double commandedSteeringAngle = 0;
3737
private Publisher simulatedPosePub;
38-
private Publisher gpspub;
3938
private int simCounter;
40-
private double targetHeading = INITIAL_HEADING_RAD;
4139

4240
/**
4341
* Create a new {@link PeriodicNode} decorator
@@ -63,7 +61,7 @@ public ControllerTester(String name, LocTuple initialPosition) {
6361
}));
6462

6563
simulatedPosePub = new Publisher(NodeChannel.POSE.getMsgPath());
66-
gpspub = new Publisher(NodeChannel.GPS.getMsgPath());
64+
new Publisher(NodeChannel.GPS.getMsgPath());
6765
}
6866

6967
@Override

real_time/surface_src/java_src/Alice/src/main/java/com/roboclub/robobuggy/simulation/FullSimRunner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class FullSimRunner extends BuggyBaseNode {
4444
private Publisher gpsPub;
4545
private Publisher encPub;
4646
private Publisher steerPub;
47-
private Subscriber steerSub;
4847

4948
private RobobuggyKFLocalizer localizer;
5049
private WayPointFollowerPlanner controller;
@@ -84,7 +83,7 @@ public FullSimRunner(String name, LocTuple initialPos) {
8483
gpsPub = new Publisher(NodeChannel.GPS.getMsgPath());
8584
encPub = new Publisher(NodeChannel.ENCODER.getMsgPath());
8685
steerPub = new Publisher(NodeChannel.STEERING.getMsgPath());
87-
steerSub = new Subscriber("Full Sim Toolbox", NodeChannel.DRIVE_CTRL.getMsgPath(), (topicName, m) -> {
86+
new Subscriber("Full Sim Toolbox", NodeChannel.DRIVE_CTRL.getMsgPath(), (topicName, m) -> {
8887
updateMotionModel(((DriveControlMessage) m).getAngleDouble());
8988
steerPub.publish(new SteeringMeasurement(Math.toDegrees(((DriveControlMessage) m).getAngleDouble())));
9089
});

real_time/surface_src/java_src/Alice/src/main/java/com/roboclub/robobuggy/simulation/PlayBackUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public static Message parseSensorLog(JsonObject sensorDataJson, Gson translator,
137137
break;
138138
case DriveControlMessage.VERSION_ID:
139139
transmitMessage = translator.fromJson(sensorDataJson, DriveControlMessage.class);
140+
getPrivateInstance().driveCtrlPub.publish(transmitMessage);
140141
break;
141142
case EncoderMeasurement.VERSION_ID:
142143
transmitMessage = translator.fromJson(sensorDataJson, EncoderMeasurement.class);

0 commit comments

Comments
 (0)