osrf / vrx

Virtual RobotX (VRX) resources.
Apache License 2.0
421 stars 189 forks source link

imu orientation data in not w.r.t standard frames #675

Closed aniket11bh closed 1 year ago

aniket11bh commented 1 year ago

Issue

IMU is giving orientation data w.r.t the initial frame of reference in which it is initialised when the sim starts.

Expected behavior IMU should give data in ENU frame of reference.

To Reproduce

  1. Write a ros2 node to convert imu data present on /wamv/sensors/imu/imu/data from quaternions to rpy and prints them on console. say the node name is imu_qt2rpy_publisher
  2. Start the simulator
  3. Start the imu_qt2rpy_publisher.
  4. Observe the data in console, yaw is around 0. (degrees)
  5. Now, Try initialising the bot with a different orientation. By changing the yaw value to 0 in https://github.com/osrf/vrx/blob/main/vrx_gz/launch/competition.launch.py#L42
  6. Observe the data from imu_qt2rpy_publisher, the yaw is still 0.

This means that the IMU is not giving data in standard frame of reference. This can cause issues later on while integrating robot_localization package.

Possible fix: This can be achieved by adding following lines

            <orientation_reference_frame>
              <localization>ENU</localization>
            </orientation_reference_frame>

under the <imu> tag at wamv_imu.xacro#L33

Fix ref : https://github.com/gazebosim/gz-sim/blob/gz-sim7/test/worlds/imu_heading_deg.sdf#LL85C1-L87C43

System Configuration:

M1chaelM commented 1 year ago

@caguero Could you take a look at this?

caguero commented 1 year ago

@caguero Could you take a look at this?

Sure, I'll take a look.

M1chaelM commented 1 year ago

My understanding from discussion with @caguero is that it is normal for an IMU to report values relative to its own frame of reference. However, @j-herman points out that this IMU is supposed to be part of an integrated GPS/IMU sensor, which is a bit different. We have changed the way we are simulating this, so we should be sure to check it's consistent with the behavior of VRX classic.

crvogt commented 1 year ago

Checking with VRX classic (tag 1.6.2), I found that the IMU values are consistent with a GPS/IMU combined sensor. Running roslaunch vrx_gazebo station_keeping.launch, changing the initial WAM-V position is reflected in the /wamv/sensors/imu/imu/data topic.