Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
67f1d3d7
Commit
67f1d3d7
authored
Jan 07, 2018
by
Sascha Niklas Schneiders
Browse files
adapted to new math grammar, missing brackets in grammar seem to cause issues
parent
c9bdbd58
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/test/resources/simulator/SteeringAngleCalculator.emam
View file @
67f1d3d7
...
...
@@ -26,9 +26,9 @@ component SteeringAngleCalculator{
//
calculate
base
steering
angle
Q
globalOrientation
=
orientation
*(
M_PI
/
180
);
if
(
globalOrientation
>
M_PI
)
{
if
(
globalOrientation
>
M_PI
)
globalOrientation
-=
2
*
M_PI
;
}
end
Q
orientedDistance
=
distance
;
...
...
@@ -41,11 +41,11 @@ component SteeringAngleCalculator{
Q
cosineAngle
=
v2
/
sqrt
(
v1
*
v1
+
v2
*
v2
);
Q
angle
=
acos
(
cosineAngle
);
if
(
v1
>
0
)
{
if
(
v1
>
0
)
orientationOfTrajectory
=
-
angle
;
}
else
{
else
orientationOfTrajectory
=
angle
;
}
end
Q
angleTrajectoryAndCarDirection
=
orientationOfTrajectory
-
globalOrientation
;
...
...
@@ -54,23 +54,21 @@ component SteeringAngleCalculator{
Q
finalAngle
=
angleTrajectoryAndCarDirection
+
angleTowardsTrajectory
;
//
correct
angle
if
(
finalAngle
>
M_PI
)
{
if
(
finalAngle
>
M_PI
)
finalAngle
-=
2
*
M_PI
;
}
elseif
(
finalAngle
<
-
M_PI
)
{
elseif
(
finalAngle
<
-
M_PI
)
finalAngle
+=
2
*
M_PI
;
}
end
newSteeringAngle
=
finalAngle
*(
180
/
M_PI
);
//
correct
angle
depending
on
car
angle
=
newSteeringAngle
;
if
angle
<
minSteeringAngle
{
if
angle
<
minSteeringAngle
angle
=
minSteeringAngle
;
}
elseif
angle
>
maxSteeringAngle
{
elseif
angle
>
maxSteeringAngle
angle
=
maxSteeringAngle
;
}
end
newSteeringAngle
=
-
angle
;
}
...
...
src/test/resources/test/BasicPortsMath.emam
View file @
67f1d3d7
...
...
@@ -5,15 +5,15 @@ component BasicPortsMath{
out
(
0
:
1
:
100
)
result
;
implementation
Math
{
if
counter
<
0
{
if
counter
<
0
result
=
0
;
}
elseif
counter
<
100
{
elseif
counter
<
100
result
=
counter
;
}
else
{
else
result
=
100
;
}
end
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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