|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimbad.sim.BaseObject
simbad.sim.Device
simbad.sim.SensorDevice
simbad.sim.PickSensor
simbad.sim.RangeSensorBelt
public class RangeSensorBelt
This class models a circular belt of range sensors : Sonar , Bumpers (future : Laser, Ir).
Sensors are arranged circularly around the robot. User can access to the measurement and hits state of each sensor individualy
or obtain an average measurement in a quadrant.
Note that the sensors are not affected by noise. however you can easily add some gaussian noise with the java.util.Random class.
Random generator = new Random(seed);
and
value = sonars.getMeasurement(0)+generator.nextGaussian()*stddev;
Implementation notes :
We use java 3D picking feature to emulate sensing.
A PickCylinderRay is used on each update to test whether there is an potential obstacle.
Each ray is then checked with a PickSegement.
Nested Class Summary | |
---|---|
private class |
RangeSensorBelt.RangeSensorBeltJPanel
A JPanel Inner class for displaying the sensor belt rays in 2d. |
Field Summary | |
---|---|
private double[] |
angles
angular position (deduced from positions infos) |
private javax.vecmath.Color3f |
color
|
private javax.vecmath.Vector3d |
cylinderDirection
|
private float |
cylinderRadius
|
private javax.vecmath.Point3d |
cylinderStart
|
private javax.vecmath.Vector3d[] |
directions
direction vector of each sensor - relative to sensor position. |
private javax.vecmath.Point3d |
end
|
static int |
FLAG_SHOW_FULL_SENSOR_RAY
|
private int |
flags
|
private boolean[] |
hits
|
private float |
maxRange
|
private double[] |
measurements
for storing results |
private int |
nbSensors
|
private boolean |
oneHasHit
|
private javax.media.j3d.PickCylinderRay |
pickCylinder
for picking |
private javax.media.j3d.PickSegment |
pickSegment
|
private javax.vecmath.Vector3d[] |
positions
position of each sensor relative to center |
private float |
radius
|
private javax.vecmath.Point3d |
start
|
private javax.media.j3d.Transform3D |
t3d
|
private javax.media.j3d.Transform3D |
t3d_2
|
private int |
type
|
static int |
TYPE_BUMPER
|
static int |
TYPE_IR
|
static int |
TYPE_LASER
|
static int |
TYPE_SONAR
|
Fields inherited from class simbad.sim.PickSensor |
---|
pickableSceneBranch |
Fields inherited from class simbad.sim.BaseObject |
---|
black, branchGroup, canBeTraversed, compilable, detachedFromSceneGraph, group, localBounds, material, rotation, rotationGroup, translation, translationGroup, white, world |
Constructor Summary | |
---|---|
RangeSensorBelt(float radius,
float minRange,
float maxRange,
int nbsensors,
int type,
int flags)
Constructs a RangeSensorBelt. |
|
RangeSensorBelt(javax.vecmath.Vector3d[] positions,
javax.vecmath.Vector3d[] directions,
int type,
int flags)
Constructs a RangeSensorBelt. |
Method Summary | |
---|---|
private void |
create3D()
|
javax.swing.JPanel |
createInspectorPanel()
Creates the panel associated to the device. |
int |
getBackLeftQuadrantHits()
Returns number of sensor hits in the back left quadrant: [PI/2,PI]. |
double |
getBackLeftQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the bacck left quadrant: [PI/2,PI]. |
int |
getBackQuadrantHits()
Returns number of sensor hits in the back quadrant: [3PI/4,5PI/4]. |
double |
getBackQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the back quadrant: [3PI/4,4*PI/4]. |
int |
getBackRightQuadrantHits()
Returns number of sensor hits in the back right quadrant: [PI,3PI/2]. |
double |
getBackRightQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the back right quadrant: [PI,3*PI/2]. |
int |
getFrontLeftQuadrantHits()
Returns number of sensor hits in the front left quadrant: [0,PI/4]. |
double |
getFrontLeftQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the front left quadrant: [0,PI/4]. |
int |
getFrontQuadrantHits()
Returns number of sensor hits in the front quadrant: [-PI/4,PI/4]. |
double |
getFrontQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the front quadrant: [-PI/4,PI/4]. |
int |
getFrontRightQuadrantHits()
Returns number of sensor hits in the front right quadrant: [3PI/2,2*PI]. |
double |
getFrontRightQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the front right quadrant: [3PI/2,2*PI]. |
int |
getLeftQuadrantHits()
Returns number of sensor hits in the left quadrant: [PI/4,PI*3/4]. |
double |
getLeftQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the left quadrant: [PI/4,PI*3/4]. |
float |
getMaxRange()
Returns the maximum sensing range in meters. |
double |
getMeasurement(int sensorNum)
Returns the last measure collected for the individual sensor. |
int |
getNumSensors()
Return the number of individual sensor in the belt. |
int |
getQuadrantHits(double minAngle,
double maxAngle)
Returns number of hits in quadrant [minAngle,maxAngle]. |
double |
getQuadrantMeasurement(double minAngle,
double maxAngle)
Returns the averaged measure of the sensors situated in quadrant [minAngle,maxAngle]. |
int |
getRightQuadrantHits()
Returns number of sensor hits in the right quadrant: [5PI/4,7PI/4]. |
double |
getRightQuadrantMeasurement()
Returns the averaged measure of the sensors situated in the right quadrant: [5*PI/4,7*PI/4]. |
double |
getSensorAngle(int sensorNum)
Returns the angle of this sensor. |
boolean |
hasHit(int sensorNum)
Returns the hit state of the sensor. |
private void |
initialize(float radius,
float maxRange,
int nbsensors,
int type,
int flags)
|
boolean |
oneHasHit()
Returns true if one of the sensors has hit. |
protected void |
update()
to be overriden |
Methods inherited from class simbad.sim.PickSensor |
---|
setPickableSceneBranch |
Methods inherited from class simbad.sim.Device |
---|
getName, getOwner, getUpdatePerSecond, reset, setName, setOwner, setUpdateOnEachFrame, setUpdatePerSecond, update |
Methods inherited from class simbad.sim.BaseObject |
---|
addChild, addChild, attach, compile, create3D, detach, getBounds, getCanBeTraversed, getGroup, getNode, getRotationTransform, getRotationTransformGroup, getTranslation, getTranslationTransform, getTranslationTransform, resetTransforms, rotateY, setBounds, setCanBeTraversed, setColor, setWorld, translateTo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int type
private float maxRange
private float radius
private int nbSensors
private double[] measurements
private boolean[] hits
private boolean oneHasHit
private double[] angles
private javax.vecmath.Vector3d[] positions
private javax.vecmath.Vector3d[] directions
private javax.media.j3d.Transform3D t3d
private javax.media.j3d.Transform3D t3d_2
private javax.vecmath.Point3d start
private javax.vecmath.Point3d end
private javax.vecmath.Color3f color
private javax.media.j3d.PickCylinderRay pickCylinder
private javax.media.j3d.PickSegment pickSegment
private javax.vecmath.Point3d cylinderStart
private float cylinderRadius
private javax.vecmath.Vector3d cylinderDirection
private int flags
public static final int TYPE_SONAR
public static final int TYPE_IR
public static final int TYPE_LASER
public static final int TYPE_BUMPER
public static final int FLAG_SHOW_FULL_SENSOR_RAY
Constructor Detail |
---|
public RangeSensorBelt(float radius, float minRange, float maxRange, int nbsensors, int type, int flags)
radius
- - the radius of the belt.minRange
- - the minimal range of each sensor ray. Not used for TYPE_BUMPER.maxRange
- - the maximal range of each sensor ray. Not used for TYPE_BUMPER.nbsensors
- - the number of sensors in the belt (typically 4,6,12,24 or 36).type
- - to specify the sensor behaviorpublic RangeSensorBelt(javax.vecmath.Vector3d[] positions, javax.vecmath.Vector3d[] directions, int type, int flags)
positions
- : the position of each sensor relative to belt center.directions
- : the sensing ray direction of each sensor relative to sensor positions.
the magnitude of the vector corresponds to the max range.Method Detail |
---|
private void initialize(float radius, float maxRange, int nbsensors, int type, int flags)
private void create3D()
protected void update()
Device
update
in class Device
public double getMeasurement(int sensorNum)
sensorNum
- num of the sensor.
public double getFrontQuadrantMeasurement()
public double getFrontLeftQuadrantMeasurement()
public double getFrontRightQuadrantMeasurement()
public double getLeftQuadrantMeasurement()
public double getBackLeftQuadrantMeasurement()
public double getBackQuadrantMeasurement()
public double getBackRightQuadrantMeasurement()
public double getRightQuadrantMeasurement()
public double getQuadrantMeasurement(double minAngle, double maxAngle)
minAngle
- in radians the right limit of the quadrant.maxAngle
- in radians the left limit of the quadrant.
public int getFrontQuadrantHits()
public int getFrontLeftQuadrantHits()
public int getFrontRightQuadrantHits()
public int getLeftQuadrantHits()
public int getBackLeftQuadrantHits()
public int getBackQuadrantHits()
public int getBackRightQuadrantHits()
public int getRightQuadrantHits()
public int getQuadrantHits(double minAngle, double maxAngle)
minAngle
- in radians the right limit of the quadrant.maxAngle
- in radians the left limit of the quadrant.
public boolean hasHit(int sensorNum)
sensorNum
- num of the sensor.
public boolean oneHasHit()
public int getNumSensors()
public double getSensorAngle(int sensorNum)
sensorNum
- - num of the sensor.
public float getMaxRange()
public javax.swing.JPanel createInspectorPanel()
Device
createInspectorPanel
in class Device
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |