Added Java support.
This commit is contained in:
@@ -1,8 +1,24 @@
|
||||
/**
|
||||
* DeterministicSLAM implements SinglePositionSLAM using by returning the starting position instead of searching
|
||||
* on it; i.e., using odometry alone.
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.algorithms;
|
||||
|
||||
import edu.wlu.cs.levy.breezyslam.components.Position;
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# Makefile for BreezySLAM algorithms in Java
|
||||
#
|
||||
# Copyright (C) 2014 Simon D. Levy
|
||||
#
|
||||
# This code is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
BASEDIR = ../../../../../../..
|
||||
JAVADIR = $(BASEDIR)/java
|
||||
CDIR = $(BASEDIR)/c
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
/**
|
||||
* RMHCSLAM implements SinglePositionSLAM using random-mutation hill-climbing search on the starting position.
|
||||
* RMHCSLAM implements SinglePositionSLAM using random-mutation hill-climbing search on the starting position.
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.algorithms;
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
/**
|
||||
* SinglePositionSLAM is an abstract class that implements CoreSLAM using a point-cloud
|
||||
* with a single point (particle, position). Implementing classes should provide the method
|
||||
* SinglePositionSLAM is an abstract class that implements CoreSLAM using a point-cloud
|
||||
* with a single point (particle, position). Implementing classes should provide the method
|
||||
*
|
||||
* Position getNewPosition(Position start_position)
|
||||
* Position getNewPosition(Position start_position)
|
||||
*
|
||||
* to compute a new position based on searching from a starting position.
|
||||
* to compute a new position based on searching from a starting position.
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.algorithms;
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
package edu.wlu.cs.levy.breezyslam.algorithms;
|
||||
|
||||
import edu.wlu.cs.levy.breezyslam.components.Laser;
|
||||
import edu.wlu.cs.levy.breezyslam.components.Velocities;
|
||||
|
||||
public class CoreSLAM {
|
||||
|
||||
public CoreSLAM(Laser laser, int map_size_pixels, double map_size_meters)
|
||||
{
|
||||
/*
|
||||
// Set default params
|
||||
this->map_quality = DEFAULT_MAP_QUALITY;
|
||||
this->hole_width_mm = DEFAULT_HOLE_WIDTH_MM;
|
||||
|
||||
// Store laser for later
|
||||
this->laser = new Laser(laser);
|
||||
|
||||
// Initialize velocities (dxyMillimeters, dthetaDegrees, dtSeconds) for odometry
|
||||
this->velocities = new Velocities();
|
||||
|
||||
// Initialize a scan for computing distance to map, and one for updating map
|
||||
this->scan_for_mapbuild = this->scan_create(3);
|
||||
this->scan_for_distance = this->scan_create(1);
|
||||
|
||||
// Initialize the map
|
||||
this->map = new Map(map_size_pixels, map_size_meters);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public void update(int [] scan_mm, Velocities velocities)
|
||||
{
|
||||
/*
|
||||
// Build a scan for computing distance to map, and one for updating map
|
||||
this->scan_update(this->scan_for_mapbuild, scan_mm);
|
||||
this->scan_update(this->scan_for_distance, scan_mm);
|
||||
|
||||
// Update velocities
|
||||
this->velocities->update(velocities.dxy_mm,
|
||||
velocities.dtheta_degrees,
|
||||
velocities.dt_seconds);
|
||||
|
||||
// Implementing class updates map and pointcloud
|
||||
this->updateMapAndPointcloud(velocities);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public void getmap(byte [] mapbytes)
|
||||
{
|
||||
//this->map->get((char *)mapbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
Scan * CoreSLAM::scan_create(int span)
|
||||
{
|
||||
//return new Scan(this->laser, span);
|
||||
}
|
||||
|
||||
|
||||
void scan_update(Scan scan, int [] scan_mm)
|
||||
{
|
||||
//scan->update(scan_mm, this->hole_width_mm, *this->velocities);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
JAVADIR = ../../../../../..
|
||||
|
||||
ALL = CoreSLAM.class
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
CoreSLAM.class: CoreSLAM.java
|
||||
javac -classpath $(JAVADIR):. CoreSLAM.java
|
||||
|
||||
clean:
|
||||
rm -f *.class *~
|
||||
|
||||
backup:
|
||||
cp *.java bak
|
||||
cp Makefile bak
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* jnibreezyslam_algorithms.c Java Native Interface code for BreezySLAM algorithms
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http:#www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../../../../../../../c/random.h"
|
||||
#include "../jni_utils.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* Laser.java - Java code for Laser model class
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class for scanning laser rangefinder (Lidar) parameters.
|
||||
*/
|
||||
public class Laser
|
||||
{
|
||||
|
||||
@@ -10,7 +35,18 @@ public class Laser
|
||||
protected int detection_margin;
|
||||
protected double offset_mm;
|
||||
|
||||
public Laser(
|
||||
/**
|
||||
* Builds a Laser object from parameters based on the specifications for your
|
||||
* Lidar unit.
|
||||
* @param scan_size number of rays per scan
|
||||
* @param scan_rate_hz laser scan rate in Hertz
|
||||
* @param detection_angle_degrees detection angle in degrees (e.g. 240, 360)
|
||||
* @param detection_margin number of rays at edges of scan to ignore
|
||||
* @param offset_mm forward/backward offset of laser motor from robot center
|
||||
* @return a new Laser object
|
||||
*
|
||||
*/
|
||||
public Laser(
|
||||
int scan_size,
|
||||
double scan_rate_hz,
|
||||
double detection_angle_degrees,
|
||||
@@ -26,7 +62,13 @@ public class Laser
|
||||
this.offset_mm = offset_mm;
|
||||
}
|
||||
|
||||
public Laser(Laser laser)
|
||||
/**
|
||||
* Builds a Laser object by copying another Laser object.
|
||||
* Lidar unit.
|
||||
* @param laser the other Laser object
|
||||
*
|
||||
*/
|
||||
public Laser(Laser laser)
|
||||
{
|
||||
this.scan_size = laser.scan_size;
|
||||
this.scan_rate_hz = laser.scan_rate_hz;
|
||||
@@ -36,6 +78,10 @@ public class Laser
|
||||
this.offset_mm = laser.offset_mm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this Laser object.
|
||||
*/
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String format = "scan_size=%d | scan_rate=%3.3f hz | " +
|
||||
@@ -51,6 +97,10 @@ public class Laser
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the offset of the laser in mm, from the center of the robot.
|
||||
*
|
||||
*/
|
||||
public double getOffsetMm()
|
||||
{
|
||||
return this.offset_mm;
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# Makefile for BreezySLAM components in Java
|
||||
#
|
||||
# Copyright (C) 2014 Simon D. Levy
|
||||
#
|
||||
# This code is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
BASEDIR = ../../../../../../..
|
||||
JAVADIR = $(BASEDIR)/java
|
||||
CDIR = $(BASEDIR)/c
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* Map.java - Java code for Map class
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class for maps used in SLAM.
|
||||
*/
|
||||
public class Map
|
||||
{
|
||||
static
|
||||
@@ -21,8 +46,17 @@ public class Map
|
||||
|
||||
private long native_ptr;
|
||||
|
||||
/**
|
||||
* Returns a string representation of this Map object.
|
||||
*/
|
||||
public native String toString();
|
||||
|
||||
/**
|
||||
* Builds a square Map object.
|
||||
* @param size_pixels size in pixels
|
||||
* @param size_meters size in meters
|
||||
*
|
||||
*/
|
||||
public Map(int size_pixels, double size_meters)
|
||||
{
|
||||
this.init(size_pixels, size_meters);
|
||||
@@ -33,7 +67,8 @@ public class Map
|
||||
|
||||
/**
|
||||
* Puts current map values into bytearray, which should of which should be of
|
||||
* this->size map_size_pixels ^ 2.
|
||||
* this.size map_size_pixels ^ 2.
|
||||
* @param bytes byte array that gets the map values
|
||||
*/
|
||||
public native void get(byte [] bytes);
|
||||
|
||||
@@ -50,6 +85,9 @@ public class Map
|
||||
this.update(scan, position.x_mm, position.y_mm, position.theta_degrees, quality, hole_width_mm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of this map in meters.
|
||||
*/
|
||||
public double sizeMeters()
|
||||
{
|
||||
return this.size_meters;
|
||||
|
||||
@@ -1,38 +1,81 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* Position.java - Java code for Position class
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class representing the position of a robot.
|
||||
*/
|
||||
public class Position
|
||||
{
|
||||
|
||||
public double x_mm;
|
||||
public double y_mm;
|
||||
public double theta_degrees;
|
||||
|
||||
public Position(double x_mm, double y_mm, double theta_degrees)
|
||||
/**
|
||||
* Distance of robot from left edge of map, in millimeters.
|
||||
*/
|
||||
public double x_mm;
|
||||
|
||||
/**
|
||||
* Distance of robot from top edge of map, in millimeters.
|
||||
*/
|
||||
public double y_mm;
|
||||
|
||||
/**
|
||||
* Clockwise rotation of robot with respect to three o'clock (east), in degrees.
|
||||
*/
|
||||
public double theta_degrees;
|
||||
|
||||
/**
|
||||
* Constructs a new position.
|
||||
* @param x_mm X coordinate in millimeters
|
||||
* @param y_mm Y coordinate in millimeters
|
||||
* @param theta_degrees rotation angle in degrees
|
||||
*/
|
||||
public Position(double x_mm, double y_mm, double theta_degrees)
|
||||
{
|
||||
this.x_mm = x_mm;
|
||||
this.y_mm = y_mm;
|
||||
this.theta_degrees = theta_degrees;
|
||||
}
|
||||
|
||||
public Position(Position position)
|
||||
/**
|
||||
* Constructs a new Position object by copying another.
|
||||
* @param the other Positon object
|
||||
*/
|
||||
|
||||
public Position(Position position)
|
||||
{
|
||||
this.x_mm = position.x_mm;
|
||||
this.y_mm = position.y_mm;
|
||||
this.theta_degrees = position.theta_degrees;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this Position object.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
//String format = "<x = %7.0f mm y = %7.0f mm theta = %+3.3f degrees>";
|
||||
String format = "<x = %f mm y = %f mm theta = %f degrees>";
|
||||
String format = "<x = %7.0f mm y = %7.0f mm theta = %+3.3f degrees>";
|
||||
|
||||
return String.format(format, this.x_mm, this.y_mm, this.theta_degrees);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] argv)
|
||||
{
|
||||
Position position = new Position(300, 400, 120);
|
||||
System.out.println(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* Scan.java - Java code for Scan class
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class for Lidar scans.
|
||||
*/
|
||||
public class Scan
|
||||
{
|
||||
static
|
||||
@@ -20,6 +45,9 @@ public class Scan
|
||||
|
||||
public native String toString();
|
||||
|
||||
/**
|
||||
* Returns a string representation of this Scan object.
|
||||
*/
|
||||
public native void update(
|
||||
int [] lidar_mm,
|
||||
double hole_width_mm,
|
||||
@@ -27,6 +55,12 @@ public class Scan
|
||||
double velocities_dtheta_degrees);
|
||||
|
||||
|
||||
/**
|
||||
* Builds a Scan object.
|
||||
* @param laser laser parameters
|
||||
* @param span supports spanning laser scan to cover the space better.
|
||||
*
|
||||
*/
|
||||
public Scan(Laser laser, int span)
|
||||
{
|
||||
this.init(span,
|
||||
@@ -38,6 +72,11 @@ public class Scan
|
||||
laser.offset_mm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a Scan object.
|
||||
* @param laser laser parameters
|
||||
*
|
||||
*/
|
||||
public Scan(Laser laser)
|
||||
{
|
||||
this(laser, 1);
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class for the Hokuyo URG-04LX laser.
|
||||
*/
|
||||
public class URG04LX extends Laser
|
||||
{
|
||||
|
||||
public URG04LX(int detection_margin, double offset_mm)
|
||||
/**
|
||||
* Builds a URG04LX object.
|
||||
* Lidar unit.
|
||||
* @param detection_margin number of rays at edges of scan to ignore
|
||||
* @param offset_mm forward/backward offset of laser motor from robot center
|
||||
* @return a new URG04LX object
|
||||
*
|
||||
*/
|
||||
public URG04LX(int detection_margin, double offset_mm)
|
||||
{
|
||||
super(682, 10, 240, 4000, detection_margin, offset_mm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a URG04LX object with zero detection margin, offset mm.
|
||||
*/
|
||||
public URG04LX()
|
||||
{
|
||||
this(0, 0);
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* Velocities.java - Java code for Velocities class
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package edu.wlu.cs.levy.breezyslam.components;
|
||||
|
||||
/**
|
||||
* A class representing the forward and angular velocities of a robot.
|
||||
* A class representing the forward and angular velocities of a robot as determined by odometry.
|
||||
*/
|
||||
public class Velocities
|
||||
{
|
||||
@@ -41,28 +63,52 @@ public class Velocities
|
||||
this.dtheta_degrees = dtheta_degrees * velocity_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this Velocities object.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return String.format("<dxy=%7.0f mm dtheta = %+3.3f degrees dt = %f s",
|
||||
this.dxy_mm, this.dtheta_degrees, this.dt_seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the forward component of this Velocities object.
|
||||
*/
|
||||
public double getDxyMm()
|
||||
{
|
||||
return this.dxy_mm;
|
||||
}
|
||||
|
||||
public double getDthetaDegrees()
|
||||
/**
|
||||
* Returns the angular component of this Velocities object.
|
||||
*/
|
||||
public double getDthetaDegrees()
|
||||
{
|
||||
return this.dtheta_degrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time component of this Velocities object.
|
||||
*/
|
||||
public double getDtSeconds()
|
||||
{
|
||||
return this.dt_seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward component of velocity, in mm to be divided by time in seconds.
|
||||
*/
|
||||
protected double dxy_mm;
|
||||
protected double dtheta_degrees;
|
||||
protected double dt_seconds;
|
||||
|
||||
/**
|
||||
* Angular component of velocity, in mm to be divided by time in seconds.
|
||||
*/
|
||||
|
||||
protected double dtheta_degrees;
|
||||
|
||||
/**
|
||||
* Time in seconds between successive velocity measurements.
|
||||
*/
|
||||
protected double dt_seconds;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* jnibreezyslam_components.c Java Native Interface code for BreezySLAM components
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http:#www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../jni_utils.h"
|
||||
|
||||
#include "Map.h"
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
/*
|
||||
* jni_utils.h Utilities for Java Native Interface code
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this code. If not, see <http:#www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../../../../../../c/coreslam.h"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# Makefile for BreezySLAM robots in Java
|
||||
#
|
||||
# Copyright (C) 2014 Simon D. Levy
|
||||
#
|
||||
# This code is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
BASEDIR = ../../../../../../..
|
||||
JAVADIR = $(BASEDIR)/java
|
||||
JFLAGS = -Xlint
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
*
|
||||
* BreezySLAM: Simple, efficient SLAM in C++
|
||||
* BreezySLAM: Simple, efficient SLAM in Java
|
||||
*
|
||||
* WheeledRobot.java - Java class for wheeled robots
|
||||
*
|
||||
* Copyright (C) 2014 Simon D. Levy
|
||||
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
|
||||
Reference in New Issue
Block a user