SYMPTOM: When robot turns right, /odom pose orientation turns left.
(And vice versa.) However, the odom->base_link transform is correct.
CAUSE: Encoder odometry entry point update_publish(enc_left,enc_right)
is invoked with update_publish(enc1, enc2). But this is backwards. As
per cmd_vel_callback, motor 1 is the right-hand side motor and motor 2
the left-hand side.
Why does the odom->base_link transform look OK? An earlier change
added a negative sign in front of the published transform angle. This
only masked the error without fixing the underlying cause, resulting in
reversed /odom data and leaving variables like self.last_enc_right
holding the wrong values.
FIX: Reverse the parameters when calling update_publish so they are
correct. And now that the underlying problem is addressed, the negative
sign must be removed from the angle when publishing transform.
SYMPTOM: When robot turns right, /odom pose orientation turns left. (And vice versa.) However, the odom->base_link transform is correct.
CAUSE: Encoder odometry entry point update_publish(enc_left,enc_right) is invoked with update_publish(enc1, enc2). But this is backwards. As per cmd_vel_callback, motor 1 is the right-hand side motor and motor 2 the left-hand side.
Why does the odom->base_link transform look OK? An earlier change added a negative sign in front of the published transform angle. This only masked the error without fixing the underlying cause, resulting in reversed /odom data and leaving variables like self.last_enc_right holding the wrong values.
FIX: Reverse the parameters when calling update_publish so they are correct. And now that the underlying problem is addressed, the negative sign must be removed from the angle when publishing transform.