@@ -118,9 +118,6 @@ class gz::sensors::CameraSensorPrivate
118118 // / \brief Camera information message.
119119 public: msgs::CameraInfo infoMsg;
120120
121- // / \brief The frame this camera uses in its camera_info topic.
122- public: std::string opticalFrameId{" " };
123-
124121 // / \brief Topic for info message.
125122 public: std::string infoTopic{" " };
126123
@@ -511,7 +508,7 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now)
511508 *msg.mutable_header ()->mutable_stamp () = msgs::Convert (_now);
512509 auto frame = msg.mutable_header ()->add_data ();
513510 frame->set_key (" frame_id" );
514- frame->add_value (this ->dataPtr -> opticalFrameId );
511+ frame->add_value (this ->FrameId () );
515512 msg.set_data (data, this ->dataPtr ->camera ->ImageMemorySize ());
516513 }
517514
@@ -708,27 +705,9 @@ void CameraSensor::PopulateInfo(const sdf::Camera *_cameraSdf)
708705 this ->dataPtr ->infoMsg .add_rectification_matrix (0.0 );
709706 this ->dataPtr ->infoMsg .add_rectification_matrix (1.0 );
710707
711- // Note: while Gazebo interprets the camera frame to be looking towards +X,
712- // other tools, such as ROS, may interpret this frame as looking towards +Z.
713- // To make this configurable the user has the option to set an optical frame.
714- // If the user has set <optical_frame_id> in the cameraSdf use it,
715- // otherwise fall back to the sensor frame.
716- // \todo(iche033 sdf::Camera::OpticalFrameId is deprecated.
717- // Remove this if statement when gz-sensors is updated to use sdformat16
718- GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
719- if (_cameraSdf->OpticalFrameId ().empty ())
720- {
721- this ->dataPtr ->opticalFrameId = this ->FrameId ();
722- }
723- else
724- {
725- this ->dataPtr ->opticalFrameId = _cameraSdf->OpticalFrameId ();
726- }
727- GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
728-
729708 auto infoFrame = this ->dataPtr ->infoMsg .mutable_header ()->add_data ();
730709 infoFrame->set_key (" frame_id" );
731- infoFrame->add_value (this ->dataPtr -> opticalFrameId );
710+ infoFrame->add_value (this ->FrameId () );
732711
733712 this ->dataPtr ->infoMsg .set_width (width);
734713 this ->dataPtr ->infoMsg .set_height (height);
@@ -776,7 +755,7 @@ bool CameraSensor::HasInfoConnections() const
776755// ////////////////////////////////////////////////
777756const std::string& CameraSensor::OpticalFrameId () const
778757{
779- return this ->dataPtr -> opticalFrameId ;
758+ return this ->FrameId () ;
780759}
781760
782761// ////////////////////////////////////////////////
0 commit comments