summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--digital/io-hub/src/apbirthday/top.cc3
-rw-r--r--digital/io-hub/src/common-cc/move.cc2
2 files changed, 3 insertions, 2 deletions
diff --git a/digital/io-hub/src/apbirthday/top.cc b/digital/io-hub/src/apbirthday/top.cc
index 0fb37ca1..3f7bf2a5 100644
--- a/digital/io-hub/src/apbirthday/top.cc
+++ b/digital/io-hub/src/apbirthday/top.cc
@@ -47,7 +47,8 @@ top_cake_angle (const vect_t &pos)
float dx = pos.x - pg_cake_pos.x;
float dy = pos.y - pg_cake_pos.y;
float angle_rad = std::atan2 (dy, dx);
- uint16_t angle = angle_rad * ((1 << 16) / (2 * M_PI));
+ // Be careful not to lose sign during conversion.
+ int16_t angle = angle_rad * ((1 << 16) / (2 * M_PI));
return angle;
}
diff --git a/digital/io-hub/src/common-cc/move.cc b/digital/io-hub/src/common-cc/move.cc
index 75613584..5c7d3708 100644
--- a/digital/io-hub/src/common-cc/move.cc
+++ b/digital/io-hub/src/common-cc/move.cc
@@ -150,7 +150,7 @@ Move::go_or_rotate (const vect_t &dst, uint16_t angle, bool with_angle,
// Compute angle to destination, if destination is really near, angle is
// almost meaningless.
vect_t v = dst; vect_sub (&v, &robot_position.v);
- uint16_t dst_angle = 0;
+ int16_t dst_angle = 0;
int16_t diff = 0;
if (vect_dot_product (&v, &v) > eps * eps)
{