Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
René Søndergaard Nilsson
LEGO
Commits
0c6fe825
Commit
0c6fe825
authored
Jun 01, 2015
by
Lasse Brøsted Pedersen
Browse files
Merge branch 'master' of gitlab.au.dk:rene2014/lego
parents
8a82e098
9339d094
Changes
4
Hide whitespace changes
Inline
Side-by-side
Lesson11/Programs/PilotRoute/src/PilotRoute.java
View file @
0c6fe825
...
...
@@ -7,7 +7,7 @@ public class PilotRoute
private
SlaveIOStreams
PC
;
private
double
distFactor
=
0.99
;
private
double
wheelDiameterL
=
5.595
*
distFactor
,
wheelDiameterR
=
5.6
*
distFactor
,
trackWidth
=
16.27
;
private
double
travelSpeed
=
20
,
rotateSpeed
=
45
;
private
double
travelSpeed
=
5
,
rotateSpeed
=
45
;
private
NXTRegulatedMotor
left
=
Motor
.
B
;
private
NXTRegulatedMotor
right
=
Motor
.
C
;
private
LightSensor
lightsensor
=
new
LightSensor
(
SensorPort
.
S4
);
...
...
@@ -26,7 +26,7 @@ public class PilotRoute
private
void
sendMove
(
Move
move
)
{
PC
.
output
((
move
.
getMoveType
()
==
Move
.
MoveType
.
TRAVEL
?
0
:
1
));
PC
.
output
(
move
.
getDistanceTraveled
());
PC
.
output
(
move
.
getDistanceTraveled
()
*
10
);
PC
.
output
(
move
.
getAngleTurned
());
}
...
...
@@ -53,25 +53,25 @@ public class PilotRoute
while
(
!
Button
.
ENTER
.
isDown
())
Thread
.
yield
();
Sound
.
twoBeeps
();
for
(
int
i
=
0
;
i
<
30
;
i
++)
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
travel
(
5
);
sendLightValue
(
400
);
travel
(
1
);
sendLightValue
(
lightsensor
.
getLightValue
()
);
}
for
(
int
i
=
0
;
i
<
10
;
i
++)
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
travel
(
5
);
sendLightValue
(
600
);
travel
(
1
);
sendLightValue
(
lightsensor
.
getLightValue
()
);
}
for
(
int
i
=
0
;
i
<
10
;
i
++)
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
travel
(
5
);
sendLightValue
(
400
);
travel
(
1
);
sendLightValue
(
lightsensor
.
getLightValue
()
);
}
for
(
int
i
=
0
;
i
<
10
;
i
++)
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
travel
(
5
);
sendLightValue
(
600
);
travel
(
1
);
sendLightValue
(
lightsensor
.
getLightValue
()
);
}
while
(
!
Button
.
ENTER
.
isDown
())
Thread
.
yield
();
...
...
Lesson11/Programs/RobotMonitor/src/Particle.java
View file @
0c6fe825
...
...
@@ -25,7 +25,7 @@ public class Particle
private
static
Random
rand
=
new
Random
();
private
Pose
pose
;
private
float
weight
=
1
;
private
int
blackWhiteThreshold
=
500
;
private
int
blackWhiteThreshold
=
42
;
/**
* Create a particle with a specific pose
...
...
@@ -76,7 +76,7 @@ public class Particle
{
if
(
m
.
getColor
(
pose
)
==
Color
.
BLACK
)
{
if
(
lightValue
>
blackWhiteThreshold
)
if
(
lightValue
<
blackWhiteThreshold
)
weight
=
0.9f
;
else
weight
=
0.1f
;
...
...
@@ -85,7 +85,7 @@ public class Particle
{
if
(
m
.
getColor
(
pose
)
==
Color
.
WHITE
)
{
if
(
lightValue
>
blackWhiteThreshold
)
if
(
lightValue
<
blackWhiteThreshold
)
weight
=
0.1f
;
else
weight
=
0.9f
;
...
...
Lesson11/Programs/RobotMonitor/src/RobotMonitor.java
View file @
0c6fe825
...
...
@@ -92,12 +92,11 @@ public class RobotMonitor
public
void
goSimulation
()
{
for
(
int
i
=
0
;
i
<
6
0
;
i
++)
for
(
int
i
=
0
;
i
<
3
0
;
i
++)
{
motionUpdate
(
getMove
());
sensorUpdate
(
getSensorValue
());
}
}
public
static
void
main
(
String
[]
args
)
...
...
Lesson11/Videos/RobotMonitor.avi
0 → 100644
View file @
0c6fe825
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment