Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compass to simulator #201

Merged
merged 4 commits into from
Apr 20, 2016
Merged

Conversation

cgmc
Copy link
Contributor

@cgmc cgmc commented Apr 20, 2016

To compensate for angle mirroring, the compass heading is returned as the physicalAngle value less 90 modulo 360.

The physical angle is also subject to error, when enabled.

Adjusted the value of angleSlip, to balance the effect of the degree of error on the heading and on the distance travelled.

Accounted for the implementation in C++ of the modulo function as a division remainder operation.

References #193, #164.

cgmc added 4 commits April 16, 2016 22:33
Note: Because a heading of 0 degrees in the simulator is actually due
West, the compass heading is returned as the physicalAngle value less 90
modulo 360.

The physical angle is also subject to error, when enabled (since, on the
physical robot, it would be the wheels slipping and rotating the robot
that would cause a move to go awry).

uniqueID has been made actually unique (at least per run-time).

References #193.
uniqueID is actually managed by the Edison; the simulator should just
return the value given in the command.
Due to the nature of rounding and integers, at the old value of
angleSlip, it would require a degree of error above 33 percent to cause
the robot to stray 1 degree off course. However, that degree of error
would mean that the robot would only travel 66 percent of the distance,
which is disproportionate.
At the new value, it will only require a degree of error of 5 percent to
cause the same amount of drift, which is more reasonable.

Also, I don't know why that cast to float was there, but it's redundant.
In C++, the % operator, which is normally the modulo operator, is
actually implemented as a division remainder function, which is subtly
different.
In mathematics, both functions would return the same thing, i.e. the
remainder of the division of two numbers. However, while the remainder
in modular arithmetic is always (taken as) positive, the remainder in
division can be negative if either the dividend or divisor is negative.

Since there is currently no scenario in which physicalAngle should
naturally become negative, the solution chosen has been to add 270
degrees to physicalAngle, instead of subtracting 90 degrees (due to the
rotation of the simulator).
@cgmc cgmc added this to the Sprint #7 milestone Apr 20, 2016
@cgmc cgmc self-assigned this Apr 20, 2016
@cgmc cgmc force-pushed the feature/simulatorCompass#193 branch from 533c92a to f7dbe3e Compare April 20, 2016 12:57
@cgmc cgmc merged commit f7dbe3e into feature/Simulator#164 Apr 20, 2016
@cgmc cgmc removed the in progress label Apr 20, 2016
@cgmc cgmc deleted the feature/simulatorCompass#193 branch April 20, 2016 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant