|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--simulator.GenericSendVRML | +--simulator.BarSendVRML
Impements the method that calculate position of robot and send the vrml scene
Field Summary | |
(package private) BoxState[] |
box
Contains a list of non collided box state position |
(package private) BoxState[] |
boxColl
Contains a list of collided with bar box state position |
(package private) double |
delta
Use to stimate new solution angle |
(package private) int |
K
number of collided box |
(package private) int |
M
Number of non collided boxs |
(package private) int |
N
Number of robots |
(package private) RobotState[] |
robot
Contains a list of robots state position |
(package private) SensorState[] |
sensor
Contains a list of sensors state position |
Fields inherited from class simulator.GenericSendVRML |
connectedUsers,
server,
state |
Constructor Summary | |
(package private) |
BarSendVRML()
|
Method Summary | |
void |
adjustBoxesPosition(BarState old,
BarState bar)
Adjust position of all boxes to reflect new bar position |
void |
adjustRobotSensor(BarState bar)
Adjust the position of sensor to be valid with the new position of the bar. |
boolean |
boxRotation(BarState oldBar,
BarState newBar,
BoxState oldBox,
BoxState newBox)
Calculates the rotation of the box that is done by the bar changing position. |
boolean |
collidedBox(BoxState box,
BarState bar)
Determine if the passed box has collided with the bar. |
int[] |
collisionDetect(BarState bar)
Detect if the bar has collided to boxes object. |
boolean |
crossProduct(Position p1,
Position p2,
Position p3,
Position p4)
Search for intersection of line (p1,p2) and (p3,p4) using the cross product algorithm |
void |
findBoxVertexes(BoxState box,
Position a1,
Position a2,
Position a3,
Position a4)
Calculates the 4 vertexes of the box using fisical dimension and orientation |
boolean |
getCollidedPoints(double m,
double q,
BarState bar,
BoxState box,
Position p1,
Position p2)
Calculates the two points solution of box corner that collided to the bar |
double |
getRelative(Position point,
BarState bar)
Get the relative position of one point respect the mass center of the bar NB the point are the external of the bar |
BarState |
interpolation(BarState oldBar,
BarState newBar,
double k)
Interpolate the position of bar using linear algorithm |
BarState |
moveBackBar(BarState oldBar,
BarState newBar,
int[] index)
Move the bar back until to the point that there's the minimum boxes that collided |
BarState |
non_linear_Newton_Raphson(BarState BS,
double eps,
double[] old1,
double[] old2,
double[] oldTeta)
Calculate the numeric solution of the non-linear equations (Fx=0, Fy=0, M=0, sensor...) using Newton-Raphson algorithm |
Position |
perpendicularPoint(Position box,
BarState bar,
double m,
double q)
Calculates the point that is perpendicular to the bar from the box center of mass |
boolean |
quickRejection(Position p1,
Position p2,
Position p3,
Position p4)
Determine if there's intersection between (p1,p2) and (p3,p4) rectangles (bounding box of original line) |
void |
runTask()
Calculate the position of all object in the simulation ambient |
void |
sendVRML()
Send the new vrml scene to all the connected clients |
Position |
shiftRadius(Position first,
double xAngle)
Calculates the position of a point in the bar that is traslated from simmetric axle becouse it is at the external of bar. |
double |
sign(double arg)
Calculate an approssimate sign of a parameter using a function that is continuos and has the first and second differential continuos (so it can be used by Newton-Rapson algorithm |
double |
sign1(double arg)
Calculate first differential of approssimate sign function in the passed parameter |
int |
signDouble(double n)
Calculate the sign of the argument |
BarState |
stimatePosition(BarState actual)
Stimate the position of the bar to make the solution found by Newton-Raphson to be calcolated fast. |
Methods inherited from class simulator.GenericSendVRML |
broadcast,
init |
Methods inherited from class java.lang.Object |
|
Field Detail |
RobotState[] robot
SensorState[] sensor
BoxState[] box
BoxState[] boxColl
int N
int M
int K
double delta
Constructor Detail |
BarSendVRML()
Method Detail |
public double sign(double arg)
arg
- the argument of functionpublic double sign1(double arg)
arg
- the argumentpublic Position perpendicularPoint(Position box, BarState bar, double m, double q)
box
- the mass center of the boxbar
- the state of barm
- the coefficient of the rect y=mx+q that represent the barq
- the coefficient of the rect y=mx+q that represent the barpublic double getRelative(Position point, BarState bar)
point
- the position of the pointbar
- the mass center of baralfa
- the angle of bar respect x axlepublic int signDouble(double n)
n
- the double argumentpublic boolean getCollidedPoints(double m, double q, BarState bar, BoxState box, Position p1, Position p2)
m
- coefficient of rect y=mx+qq
- coefficient of rect y=mx+qbar
- the state of the barbox
- the state of the boxp1
- the first solutionp2
- the second solutionpublic boolean boxRotation(BarState oldBar, BarState newBar, BoxState oldBox, BoxState newBox)
oldBar
- the old state of the barnewBar
- the new state of the baroldBox
- the old box positionnewBox
- the state of the box that will be changedpublic BarState non_linear_Newton_Raphson(BarState BS, double eps, double[] old1, double[] old2, double[] oldTeta)
BR
- the initial stimate solutioneps
- the max error we wantold1
- old2
- oldTeta
- public BarState stimatePosition(BarState actual)
actual
- actual bar state positionpublic boolean quickRejection(Position p1, Position p2, Position p3, Position p4)
p1
- first point of rectangle 1p2
- second point (opposite) of rectangle 1p3
- first point of rectangle 2p4
- second point (opposite) of rectangle 2public boolean crossProduct(Position p1, Position p2, Position p3, Position p4)
p1
- first point of first linep2
- second point of fisrt linep3
- first point of second linep4
- second point of second linepublic Position shiftRadius(Position first, double xAngle)
first
- the point to shiftxAngle
- the angle of bar respect x axlepublic int[] collisionDetect(BarState bar)
bar
- actual bar state positionpublic boolean collidedBox(BoxState box, BarState bar)
collisionDetect
methodebox
- the state of the box who search for collisionbar
- the state of the barcollisionDetect(simulator.BarState)
public void findBoxVertexes(BoxState box, Position a1, Position a2, Position a3, Position a4)
box
- the state of the boxa1
- first vertexa2
- second vertexa3
- third vertexa4
- fourth vertexpublic BarState interpolation(BarState oldBar, BarState newBar, double k)
oldBar
- first position of bar (k=0)newBar
- second position of bar (k=1)k
- the interpolator coefficient (0..1)public void adjustRobotSensor(BarState bar)
bar
- the state of barpublic BarState moveBackBar(BarState oldBar, BarState newBar, int[] index)
oldBar
- old position of barnewBar
- new position of barindex
- the index of collided boxpublic void adjustBoxesPosition(BarState old, BarState bar)
old
- the old state of barbar
- the actual state of barpublic void runTask()
public void sendVRML()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |