Skip to content

Commit 0c0e31c

Browse files
authored
Canged code to convert compass readings into a bearing (cyberbotics#6568)
Changed example code to convert compass readings into a bearing since it produced an angle using the x-axis as north rather than the y-axis as explained in the description above it.
1 parent 6540d4d commit 0c0e31c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/reference/compass.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Now if the [Compass](#compass) node is in *upright* position, meaning that its z
179179
double get_bearing_in_degrees() {
180180
const double *north = wb_compass_get_values(tag);
181181
double rad = atan2(north[1], north[0]);
182-
double bearing = (rad - 1.5708) / M_PI * 180.0;
182+
double bearing = (rad / M_PI) * 180.0;
183183
if (bearing < 0.0)
184184
bearing = bearing + 360.0;
185185
return bearing;

0 commit comments

Comments
 (0)