Skip to content

Commit

Permalink
Measure IMU orientation with respect to world (dashing) (#1065)
Browse files Browse the repository at this point in the history
Report the IMU orientation from the sensor plugin
with respect to the world frame.
This complies with convention documented in REP 145:
https://www.ros.org/reps/rep-0145.html

In order to not break existing behavior,
users should opt-in by adding a new SDF tag.

Co-authored-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
scpeters and jacobperron authored Mar 26, 2020
1 parent 2e6459b commit 4de2cea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gazebo_plugins/src/gazebo_ros_imu_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ void GazeboRosImuSensor::Load(gazebo::sensors::SensorPtr _sensor, sdf::ElementPt
return;
}

if (_sdf->HasElement("initial_orientation_as_reference")) {
bool initial_orientation_as_reference = _sdf->Get<bool>("initial_orientation_as_reference");
RCLCPP_INFO(impl_->ros_node_->get_logger(),
"<initial_orientation_as_reference> set to: %d", initial_orientation_as_reference);
if (!initial_orientation_as_reference) {
// This complies with REP 145
impl_->sensor_->SetWorldToReferenceOrientation(ignition::math::Quaterniond::Identity);
}
}

impl_->pub_ =
impl_->ros_node_->create_publisher<sensor_msgs::msg::Imu>("~/out", rclcpp::SensorDataQoS());

Expand Down

0 comments on commit 4de2cea

Please sign in to comment.