Fix invisible-arrow and stale-direction bugs in ImuAccVisual#226
Conversation
…ccVisual
Bugs fixed in this commit:
* Invisible acceleration arrow for raw-IMU publishers that don't
estimate orientation (issues CCNYRoboticsLab#86, CCNYRoboticsLab#219 likely root cause).
* "Derotate Acceleration" checkbox didn't visibly change the arrow
until a new message arrived.
Signed-off-by: kristkis <kisyuk.kristina@gmail.com> , Aliensense
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
|
LGTM! One small correction of the issue description here. It says:
This is not 100% correct. #90 never included I just had to leave this comment here because I was confused by it and it took me way too long to figure out what's going on. Maybe my future self will thank me if I ever come back to this PR. Apart from that: Yes, targeting A backport PR to |
|
Merged, thanks! |
Summary
Fix two related bugs in
ImuAccVisualthat together made the acceleration arrow appear broken for raw-IMU publishers:Invisible arrow when the publisher doesn't estimate orientation.
setMessage()was doingdirection_ = orientation * direction_usingmsg->orientationverbatim, with no check on whether the orientation is actually valid. Publishers that follow REP-145 for "orientation not estimated" either leave the quaternion at the default(0, 0, 0, 0)or setorientation_covariance[0] = -1.0. Multiplying a vector by a zero quaternion silently produces(0, 0, 0)→ arrow length zero → invisible. No log, no warning.setDerotated()copy-paste bug. The setter was updating colour instead of direction (lifted fromsetAlpha/setColor), so toggling the "Derotate Acceleration" rviz property did nothing visible until the next message arrived.Fix
checkQuaternionValidity()mirroring the one already used inImuOrientationVisual(introduced in [rviz_imu_plugin] print ros_warn and give unit quaternion to ogre to … #90 onmelodicbut never forward-ported to the ROS 2 branches).setMessage()so we can recomputedirection_later from the same data.updateDirection()and call it from bothsetMessage()andsetDerotated().WARNon first invalid orientation +INFOon recovery, matching the orientation-visual pattern so behaviour is consistent across the two classes.Related issues / PRs
(0,0,0,0)quaternion. Fixed by [rviz_imu_plugin] print ros_warn and give unit quaternion to ogre to … #90 forimu_orientation_visual.cpponmelodiconly. This PR mirrors the same fix forimu_acc_visual.cppon the ROS 2 branches.orientation_covariance[0] = -1.0). Likely root-caused and resolved by this PR.Backport
Targeting
rolling. Happy to open backport PRs forjazzy,humble, andironif maintainers prefer, or I can update this PR to target a different branch.Co-authored with Claude (Anthropic) during a debugging session on a separate micro-ROS project that surfaced this bug.