Skip to content

Commit 3ad3747

Browse files
committed
Merge branch 'wide_angle_camera_12' of github.com:ignitionrobotics/sdformat into wide_angle_camera_12
2 parents 12354c7 + 61b4cdf commit 3ad3747

File tree

5 files changed

+274
-1
lines changed

5 files changed

+274
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project (sdformat12)
2727
set (SDF_PROTOCOL_VERSION 1.9)
2828

2929
set (SDF_MAJOR_VERSION 12)
30-
set (SDF_MINOR_VERSION 0)
30+
set (SDF_MINOR_VERSION 1)
3131
set (SDF_PATCH_VERSION 0)
3232

3333
set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION})

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## libsdformat 12.X
22

3+
### libsdformat 12.1.0 (2021-11-09)
4+
5+
1. Support accessing mutable sensor types.
6+
* [Pull request #737](https://github.com/ignitionrobotics/sdformat/pull/737)
7+
38
### libsdformat 12.0.0 (2021-09-30)
49

510
1. Make exception for plugins when checking for name uniqueness

include/sdf/Sensor.hh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ namespace sdf
256256
/// \sa SensorType Type() const
257257
public: const Magnetometer *MagnetometerSensor() const;
258258

259+
/// \brief Get a mutable magnetometer sensor, or nullptr if this sensor type
260+
/// is not a Magnetometer.
261+
/// \return Pointer to the Magnetometer sensor, or nullptr if this
262+
/// Sensor is not a Magnetometer.
263+
/// \sa SensorType Type() const
264+
public: Magnetometer *MagnetometerSensor();
265+
259266
/// \brief Set the magnetometer sensor.
260267
/// \param[in] _mag The magnetometer sensor.
261268
public: void SetMagnetometerSensor(const Magnetometer &_mag);
@@ -267,6 +274,13 @@ namespace sdf
267274
/// \sa SensorType Type() const
268275
public: const Altimeter *AltimeterSensor() const;
269276

277+
/// \brief Get a mutable altimeter sensor, or nullptr if this sensor type
278+
/// is not an Altimeter.
279+
/// \return Pointer to the Altimeter sensor, or nullptr if this
280+
/// Sensor is not a Altimeter.
281+
/// \sa SensorType Type() const
282+
public: Altimeter *AltimeterSensor();
283+
270284
/// \brief Set the altimeter sensor.
271285
/// \param[in] _alt The altimeter sensor.
272286
public: void SetAltimeterSensor(const Altimeter &_alt);
@@ -278,6 +292,13 @@ namespace sdf
278292
/// \sa SensorType Type() const
279293
public: const AirPressure *AirPressureSensor() const;
280294

295+
/// \brief Get a mutable air pressure sensor, or nullptr if this sensor type
296+
/// is not an AirPressure sensor.
297+
/// \return Pointer to the AirPressure sensor, or nullptr if this
298+
/// Sensor is not a AirPressure sensor.
299+
/// \sa SensorType Type() const
300+
public: AirPressure *AirPressureSensor();
301+
281302
/// \brief Set the air pressure sensor.
282303
/// \param[in] _air The air pressure sensor.
283304
public: void SetAirPressureSensor(const AirPressure &_air);
@@ -293,6 +314,13 @@ namespace sdf
293314
/// \sa SensorType Type() const
294315
public: const Camera *CameraSensor() const;
295316

317+
/// \brief Get a mutable camera sensor, or nullptr if the
318+
/// sensor does not contain a camera sensor.
319+
/// \return Pointer to the sensor's camera, or nullptr if the sensor
320+
/// is not a camera.
321+
/// \sa SensorType Type() const
322+
public: Camera *CameraSensor();
323+
296324
/// \brief Set the NAVSAT sensor.
297325
/// \param[in] _navsat The NAVSAT sensor.
298326
public: void SetNavSatSensor(const NavSat &_navsat);
@@ -304,6 +332,13 @@ namespace sdf
304332
/// \sa SensorType Type() const
305333
public: const NavSat *NavSatSensor() const;
306334

335+
/// \brief Get a mutable NAVSAT sensor, or nullptr if the sensor
336+
/// does not contain an NAVSAT sensor.
337+
/// \return Pointer to the sensor's NAVSAT, or nullptr if the sensor
338+
/// is not an NAVSAT.
339+
/// \sa SensorType Type() const
340+
public: NavSat *NavSatSensor();
341+
307342
/// \brief Set the force torque sensor.
308343
/// \param[in] _ft The force torque sensor.
309344
public: void SetForceTorqueSensor(const ForceTorque &_ft);
@@ -315,6 +350,13 @@ namespace sdf
315350
/// \sa SensorType Type() const
316351
public: const ForceTorque *ForceTorqueSensor() const;
317352

353+
/// \brief Get a mutable force torque sensor, or nullptr if the sensor
354+
/// does not contain a force torque sensor.
355+
/// \return Pointer to the force torque sensor, or nullptr if the sensor
356+
/// is not a force torque sensor.
357+
/// \sa SensorType Type() const
358+
public: ForceTorque *ForceTorqueSensor();
359+
318360
/// \brief Set the IMU sensor.
319361
/// \param[in] _imu The IMU sensor.
320362
public: void SetImuSensor(const Imu &_imu);
@@ -326,13 +368,27 @@ namespace sdf
326368
/// \sa SensorType Type() const
327369
public: const Imu *ImuSensor() const;
328370

371+
/// \brief Get a mutable IMU sensor, or nullptr if the sensor
372+
/// does not contain an IMU sensor.
373+
/// \return Pointer to the sensor's IMU, or nullptr if the sensor
374+
/// is not an IMU.
375+
/// \sa SensorType Type() const
376+
public: Imu *ImuSensor();
377+
329378
/// \brief Get the lidar sensor, or nullptr if this sensor type is not a
330379
/// Lidar.
331380
/// \return Pointer to the Lidar sensor, or nullptr if this Sensor is not a
332381
/// Lidar.
333382
/// \sa SensorType Type() const
334383
public: const Lidar *LidarSensor() const;
335384

385+
/// \brief Get a mutable lidar sensor, or nullptr if this sensor type is
386+
/// not a Lidar.
387+
/// \return Pointer to the Lidar sensor, or nullptr if this Sensor is not a
388+
/// Lidar.
389+
/// \sa SensorType Type() const
390+
public: Lidar *LidarSensor();
391+
336392
/// \brief Set the lidar sensor.
337393
/// \param[in] _lidar The lidar sensor.
338394
public: void SetLidarSensor(const Lidar &_lidar);

src/Sensor.cc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ const Magnetometer *Sensor::MagnetometerSensor() const
521521
return optionalToPointer(this->dataPtr->magnetometer);
522522
}
523523

524+
/////////////////////////////////////////////////
525+
Magnetometer *Sensor::MagnetometerSensor()
526+
{
527+
return optionalToPointer(this->dataPtr->magnetometer);
528+
}
529+
524530
/////////////////////////////////////////////////
525531
void Sensor::SetMagnetometerSensor(const Magnetometer &_mag)
526532
{
@@ -533,6 +539,12 @@ const Altimeter *Sensor::AltimeterSensor() const
533539
return optionalToPointer(this->dataPtr->altimeter);
534540
}
535541

542+
/////////////////////////////////////////////////
543+
Altimeter *Sensor::AltimeterSensor()
544+
{
545+
return optionalToPointer(this->dataPtr->altimeter);
546+
}
547+
536548
/////////////////////////////////////////////////
537549
void Sensor::SetAltimeterSensor(const Altimeter &_alt)
538550
{
@@ -545,6 +557,12 @@ const AirPressure *Sensor::AirPressureSensor() const
545557
return optionalToPointer(this->dataPtr->airPressure);
546558
}
547559

560+
/////////////////////////////////////////////////
561+
AirPressure *Sensor::AirPressureSensor()
562+
{
563+
return optionalToPointer(this->dataPtr->airPressure);
564+
}
565+
548566
/////////////////////////////////////////////////
549567
void Sensor::SetAirPressureSensor(const AirPressure &_air)
550568
{
@@ -557,6 +575,12 @@ const Lidar *Sensor::LidarSensor() const
557575
return optionalToPointer(this->dataPtr->lidar);
558576
}
559577

578+
/////////////////////////////////////////////////
579+
Lidar *Sensor::LidarSensor()
580+
{
581+
return optionalToPointer(this->dataPtr->lidar);
582+
}
583+
560584
/////////////////////////////////////////////////
561585
void Sensor::SetLidarSensor(const Lidar &_lidar)
562586
{
@@ -596,6 +620,12 @@ const Camera *Sensor::CameraSensor() const
596620
return optionalToPointer(this->dataPtr->camera);
597621
}
598622

623+
/////////////////////////////////////////////////
624+
Camera *Sensor::CameraSensor()
625+
{
626+
return optionalToPointer(this->dataPtr->camera);
627+
}
628+
599629
/////////////////////////////////////////////////
600630
void Sensor::SetForceTorqueSensor(const ForceTorque &_ft)
601631
{
@@ -608,6 +638,12 @@ const ForceTorque *Sensor::ForceTorqueSensor() const
608638
return optionalToPointer(this->dataPtr->forceTorque);
609639
}
610640

641+
/////////////////////////////////////////////////
642+
ForceTorque *Sensor::ForceTorqueSensor()
643+
{
644+
return optionalToPointer(this->dataPtr->forceTorque);
645+
}
646+
611647
/////////////////////////////////////////////////
612648
void Sensor::SetNavSatSensor(const NavSat &_gps)
613649
{
@@ -620,6 +656,12 @@ const NavSat *Sensor::NavSatSensor() const
620656
return optionalToPointer(this->dataPtr->navSat);
621657
}
622658

659+
/////////////////////////////////////////////////
660+
NavSat *Sensor::NavSatSensor()
661+
{
662+
return optionalToPointer(this->dataPtr->navSat);
663+
}
664+
623665
/////////////////////////////////////////////////
624666
void Sensor::SetImuSensor(const Imu &_imu)
625667
{
@@ -631,3 +673,9 @@ const Imu *Sensor::ImuSensor() const
631673
{
632674
return optionalToPointer(this->dataPtr->imu);
633675
}
676+
677+
/////////////////////////////////////////////////
678+
Imu *Sensor::ImuSensor()
679+
{
680+
return optionalToPointer(this->dataPtr->imu);
681+
}

0 commit comments

Comments
 (0)