Skip to content

Commit

Permalink
camelcase, tests, and xml spec
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Chen <brian.chen@openrobotics.org>
  • Loading branch information
ihasdapie committed Jul 22, 2022
1 parent 539f1c6 commit baae441
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 54 deletions.
24 changes: 12 additions & 12 deletions include/sdf/Camera.hh
Original file line number Diff line number Diff line change
Expand Up @@ -472,51 +472,51 @@ namespace sdf

/// \brief Get the lens X focal length in pixels for the projection matrix.
/// \return The lens X focal length in pixels for the projection matrix.
public: double LensIntrinsicsFx_p() const;
public: double LensProjectionFx() const;

/// \brief Set the lens X focal length in pixels for the projection matrix.
/// \param[in] _fx_p The lens X focal length in pixels for the projection matrix.
public: void SetLensIntrinsicsFx_p(double _fx_p);
public: void SetLensProjectionFx(double _fx_p);

/// \brief Get the lens Y focal length in pixels for the projection matrix.
/// \return The lens Y focal length in pixels for the projection matrix.
public: double LensIntrinsicsFy_p() const;
public: double LensProjectionFy() const;

/// \brief Set the lens Y focal length in pixels for the projection matrix.
/// \param[in] _fy_p The lens Y focal length in pixels for the projection matrix.
public: void SetLensIntrinsicsFy_p(double _fy_p);
public: void SetLensProjectionFy(double _fy_p);

/// \brief Get the lens X principal point in pixels for the projection matrix.
/// \return The lens X principal point in pixels for the projection matrix.
public: double LensIntrinsicsCx_p() const;
public: double LensProjectionCx() const;

/// \brief Set the lens X principal point in pixels for the projection matrix.
/// \param[in] _cx_p The lens X principal point in pixels for the projection matrix.
public: void SetLensIntrinsicsCx_p(double _cx_p);
public: void SetLensProjectionCx(double _cx_p);

/// \brief Get the lens Y principal point in pixels for the projection matrix.
/// \return The lens Y principal point in pixels for the projection matrix.
public: double LensIntrinsicsCy_p() const;
public: double LensProjectionCy() const;

/// \brief Set the lens Y principal point in pixels for the projection matrix.
/// \param[in] _cy_p The lens Y principal point in pixels for the projection matrix.
public: void SetLensIntrinsicsCy_p(double _cy_p);
public: void SetLensProjectionCy(double _cy_p);

/// \brief Get the lens X translation in pixels for the projection matrix.
/// \return The lens X translation in pixels for the projection matrix.
public: double LensIntrinsicsTx() const;
public: double LensProjectionTx() const;

/// \brief Set the lens X translation in pixels for the projection matrix.
/// \param[in] _tx The lens X translation in pixels for the projection matrix.
public: void SetLensIntrinsicsTx(double _tx);
public: void SetLensProjectionTx(double _tx);

/// \brief Get the lens Y translation in pixels for the projection matrix.
/// \return The lens Y translation in pixels for the projection matrix.
public: double LensIntrinsicsTy() const;
public: double LensProjectionTy() const;

/// \brief Set the lens Y translation in pixels for the projection matrix.
/// \param[in] _ty The lens Y translation in pixels for the projection matrix.
public: void SetLensIntrinsicsTy(double _ty);
public: void SetLensProjectionTy(double _ty);

/// \brief Get the lens XY axis skew.
/// \return The lens XY axis skew.
Expand Down
18 changes: 18 additions & 0 deletions sdf/1.7/camera.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@
<element name="cy" type="double" default="120" required="1">
<description>Y principal point (in pixels)</description>
</element>
<element name="p_fx" type="double" default="277" required="0">
<description>X focal length for projection matrix(in pixels, overrides fx)</description>
</element>
<element name="p_fy" type="double" default="277" required="0">
<description>Y focal length for projection matrix(in pixels, overrides fy)</description>
</element>
<element name="p_cx" type="double" default="160" required="0">
<description>X principal point for projection matrix(in pixels, overrides cx)</description>
</element>
<element name="p_cy" type="double" default="120" required="0">
<description>Y principal point for projection matrix(in pixels, overrides cy)</description>
</element>
<element name="tx" type="double" default="0.0" required="0">
<description>X translation for projection matrix (in pixels)</description>
</element>
<element name="ty" type="double" default="0.0" required="0">
<description>Y translation for projection matrix (in pixels)</description>
</element>
<element name="s" type="double" default="0.0" required="1">
<description>XY axis skew</description>
</element>
Expand Down
90 changes: 48 additions & 42 deletions src/Camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,23 @@ class sdf::CameraPrivate
/// \brief lens instrinsics cy.
public: double lensIntrinsicsCy{120.0};

/// \brief lens instrinsics fx_p.
public: double lensIntrinsicsFx_p{277.0};
/// \brief lens projection fx
public: double lensProjectionFx{277.0};

/// \brief lens instrinsics fy_p.
public: double lensIntrinsicsFy_p{277.0};
/// \brief lens projection fy
public: double lensProjectionFy{277.0};

/// \brief lens instrinsics cx_p.
public: double lensIntrinsicsCx_p{160.0};
/// \brief lens projection cx
public: double lensProjectionCx{160.0};

/// \brief lens instrinsics cy_p.
public: double lensIntrinsicsCy_p{120.0};
/// \brief lens projection cy
public: double lensProjectionCy{120.0};

/// \brief lens instrinsics Tx
public: double lensIntrinsicsTx{0.0};
/// \brief lens projection tx
public: double lensProjectionTx{0.0};

/// \brief lens instrinsics Ty
public: double lensIntrinsicsTy{0.0};
/// \brief lens projection ty
public: double lensProjectionTy{0.0};

/// \brief lens instrinsics s.
public: double lensIntrinsicsS{1.0};
Expand Down Expand Up @@ -402,6 +402,18 @@ Errors Camera::Load(ElementPtr _sdf)
this->dataPtr->lensIntrinsicsCy).first;
this->dataPtr->lensIntrinsicsS = intrinsics->Get<double>("s",
this->dataPtr->lensIntrinsicsS).first;
this->dataPtr->lensProjectionFx = intrinsics->Get<double>("p_fx",
this->dataPtr->lensProjectionFx).first;
this->dataPtr->lensProjectionFy = intrinsics->Get<double>("p_fy",
this->dataPtr->lensProjectionFy).first;
this->dataPtr->lensProjectionCx = intrinsics->Get<double>("p_cx",
this->dataPtr->lensProjectionCx).first;
this->dataPtr->lensProjectionCy = intrinsics->Get<double>("p_cy",
this->dataPtr->lensProjectionCy).first;
this->dataPtr->lensProjectionTx = intrinsics->Get<double>("tx",
this->dataPtr->lensProjectionTx).first;
this->dataPtr->lensProjectionTy = intrinsics->Get<double>("ty",
this->dataPtr->lensProjectionTy).first;
}
}

Expand Down Expand Up @@ -926,81 +938,75 @@ void Camera::SetLensIntrinsicsCy(double _cy)
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsFx_p() const
double Camera::LensProjectionFx() const
{
return this->dataPtr->lensIntrinsicsFx_p;
return this->dataPtr->lensProjectionFx;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsFx_p(double _fx_p)
void Camera::SetLensProjectionFx(double _fx_p)
{
this->dataPtr->lensIntrinsicsFx_p = _fx_p;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionFx = _fx_p;
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsFy_p() const
double Camera::LensProjectionFy() const
{
return this->dataPtr->lensIntrinsicsFy_p;
return this->dataPtr->lensProjectionFy;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsFy_p(double _fy_p)
void Camera::SetLensProjectionFy(double _fy_p)
{
this->dataPtr->lensIntrinsicsFy_p = _fy_p;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionFy = _fy_p;
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsCx_p() const
double Camera::LensProjectionCx() const
{
return this->dataPtr->lensIntrinsicsCx_p;
return this->dataPtr->lensProjectionCx;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsCx_p(double _cx_p)
void Camera::SetLensProjectionCx(double _cx_p)
{
this->dataPtr->lensIntrinsicsCx_p = _cx_p;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionCx = _cx_p;
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsCy_p() const
double Camera::LensProjectionCy() const
{
return this->dataPtr->lensIntrinsicsCy_p;
return this->dataPtr->lensProjectionCy;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsCy_p(double _cy_p)
void Camera::SetLensProjectionCy(double _cy_p)
{
this->dataPtr->lensIntrinsicsCy_p = _cy_p;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionCy = _cy_p;
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsTx() const
double Camera::LensProjectionTx() const
{
return this->dataPtr->lensIntrinsicsTx;
return this->dataPtr->lensProjectionTx;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsTx(double _tx)
void Camera::SetLensProjectionTx(double _tx)
{
this->dataPtr->lensIntrinsicsTx = _tx;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionTx = _tx;
}

/////////////////////////////////////////////////
double Camera::LensIntrinsicsTy() const
double Camera::LensProjectionTy() const
{
return this->dataPtr->lensIntrinsicsTy;
return this->dataPtr->lensProjectionTy;
}

/////////////////////////////////////////////////
void Camera::SetLensIntrinsicsTy(double _ty)
void Camera::SetLensProjectionTy(double _ty)
{
this->dataPtr->lensIntrinsicsTy = _ty;
this->dataPtr->hasIntrinsics = true;
this->dataPtr->lensProjectionTy = _ty;
}

/////////////////////////////////////////////////
Expand Down

0 comments on commit baae441

Please sign in to comment.