Skip to content

Commit 48e171f

Browse files
committed
use enable_orientation sdf elem
Signed-off-by: Ian Chen <[email protected]>
1 parent 09c8b35 commit 48e171f

File tree

2 files changed

+8
-29
lines changed

2 files changed

+8
-29
lines changed

src/systems/imu/Imu.cc

+7-21
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ class ignition::gazebo::systems::ImuPrivate
5858
/// \brief Ign-sensors sensor factory for creating sensors
5959
public: sensors::SensorFactory sensorFactory;
6060

61-
/// \brief True to compute and output orientation values,
62-
/// false to leave the orientation field empty in the published msg.
63-
public: bool outputOrientation = true;
64-
6561
public: Entity worldEntity = kNullEntity;
6662

6763
/// \brief Create IMU sensor
@@ -86,19 +82,6 @@ Imu::Imu() : System(), dataPtr(std::make_unique<ImuPrivate>())
8682
//////////////////////////////////////////////////
8783
Imu::~Imu() = default;
8884

89-
//////////////////////////////////////////////////
90-
void Imu::Configure(const Entity & /*_entity*/,
91-
const std::shared_ptr<const sdf::Element> &_sdf,
92-
gazebo::EntityComponentManager & /*_ecm*/,
93-
gazebo::EventManager & /*_eventMgr*/)
94-
{
95-
if (_sdf->HasElement("output_orientation"))
96-
{
97-
this->dataPtr->outputOrientation =
98-
_sdf->Get<bool>("output_orientation");
99-
}
100-
}
101-
10285
//////////////////////////////////////////////////
10386
void Imu::PreUpdate(const UpdateInfo &/*_info*/,
10487
EntityComponentManager &_ecm)
@@ -203,8 +186,12 @@ void ImuPrivate::CreateImuEntities(EntityComponentManager &_ecm)
203186
// Set topic
204187
_ecm.CreateComponent(_entity, components::SensorTopic(sensor->Topic()));
205188

206-
// Set whether to output orientation
207-
sensor->SetOrientationEnabled(this->outputOrientation);
189+
// Set whether orientation is enabled
190+
if (data.ImuSensor())
191+
{
192+
sensor->SetOrientationEnabled(
193+
data.ImuSensor()->OrientationEnabled());
194+
}
208195

209196
this->entitySensorMap.insert(
210197
std::make_pair(_entity, std::move(sensor)));
@@ -274,8 +261,7 @@ void ImuPrivate::RemoveImuEntities(
274261

275262
IGNITION_ADD_PLUGIN(Imu, System,
276263
Imu::ISystemPreUpdate,
277-
Imu::ISystemPostUpdate,
278-
Imu::ISystemConfigure
264+
Imu::ISystemPostUpdate
279265
)
280266

281267
IGNITION_ADD_PLUGIN_ALIAS(Imu, "ignition::gazebo::systems::Imu")

src/systems/imu/Imu.hh

+1-8
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,14 @@ namespace systems
4040
class Imu:
4141
public System,
4242
public ISystemPreUpdate,
43-
public ISystemPostUpdate,
44-
public ISystemConfigure
43+
public ISystemPostUpdate
4544
{
4645
/// \brief Constructor
4746
public: explicit Imu();
4847

4948
/// \brief Destructor
5049
public: ~Imu() override;
5150

52-
/// Documentation inherited
53-
public: void Configure(const Entity &_entity,
54-
const std::shared_ptr<const sdf::Element> &_sdf,
55-
EntityComponentManager &_ecm,
56-
gazebo::EventManager &_eventMgr) final;
57-
5851
/// Documentation inherited
5952
public: void PreUpdate(const UpdateInfo &_info,
6053
EntityComponentManager &_ecm) final;

0 commit comments

Comments
 (0)