Skip to content

Commit

Permalink
fixed findbugs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
VivaanBahl committed May 26, 2017
1 parent 08406c9 commit 4fe136c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class WayPointFollowerPlanner extends PathPlannerNode {
private GpsMeasurement target;

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

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

int closestIndex = lastClosestIndex;
for (int i = lastClosestIndex; i < (lastClosestIndex + wayPointLOOKAHEADMAX) && i < wayPoints.size(); i++) {
for (int i = lastClosestIndex; i < (lastClosestIndex + WAY_POINT_LOOKAHEAD_MAX) && i < wayPoints.size(); i++) {
GPSPoseMessage gpsPoseMessage = wayPoints.get(i).toGpsPoseMessage(0);
double d = GPSPoseMessage.getDistance(currentLocation, gpsPoseMessage);
if (d < min) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static ControllerTesterRobot getInstance() {
private ControllerTesterRobot() {
super();

ArrayList<GpsMeasurement> wayPoints = null;
ArrayList<GpsMeasurement> wayPoints = new ArrayList<>();
try {
wayPoints = WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile());
nodeList.add(new WayPointFollowerPlanner(wayPoints));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public class ControllerTester extends PeriodicNode {
private Matrix x;
private double commandedSteeringAngle = 0;
private Publisher simulatedPosePub;
private Publisher gpspub;
private int simCounter;
private double targetHeading = INITIAL_HEADING_RAD;

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

simulatedPosePub = new Publisher(NodeChannel.POSE.getMsgPath());
gpspub = new Publisher(NodeChannel.GPS.getMsgPath());
new Publisher(NodeChannel.GPS.getMsgPath());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class FullSimRunner extends BuggyBaseNode {
private Publisher gpsPub;
private Publisher encPub;
private Publisher steerPub;
private Subscriber steerSub;

private RobobuggyKFLocalizer localizer;
private WayPointFollowerPlanner controller;
Expand Down Expand Up @@ -84,7 +83,7 @@ public FullSimRunner(String name, LocTuple initialPos) {
gpsPub = new Publisher(NodeChannel.GPS.getMsgPath());
encPub = new Publisher(NodeChannel.ENCODER.getMsgPath());
steerPub = new Publisher(NodeChannel.STEERING.getMsgPath());
steerSub = new Subscriber("Full Sim Toolbox", NodeChannel.DRIVE_CTRL.getMsgPath(), (topicName, m) -> {
new Subscriber("Full Sim Toolbox", NodeChannel.DRIVE_CTRL.getMsgPath(), (topicName, m) -> {
updateMotionModel(((DriveControlMessage) m).getAngleDouble());
steerPub.publish(new SteeringMeasurement(Math.toDegrees(((DriveControlMessage) m).getAngleDouble())));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public static Message parseSensorLog(JsonObject sensorDataJson, Gson translator,
break;
case DriveControlMessage.VERSION_ID:
transmitMessage = translator.fromJson(sensorDataJson, DriveControlMessage.class);
getPrivateInstance().driveCtrlPub.publish(transmitMessage);
break;
case EncoderMeasurement.VERSION_ID:
transmitMessage = translator.fromJson(sensorDataJson, EncoderMeasurement.class);
Expand Down

0 comments on commit 4fe136c

Please sign in to comment.