Skip to content

Commit

Permalink
Add support for centidegree unit conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyan committed Mar 20, 2024
1 parent bc16ced commit b2be11e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )

# Define here the needed parameters
set (OPENRAVE_VERSION_MAJOR 0)
set (OPENRAVE_VERSION_MINOR 141)
set (OPENRAVE_VERSION_PATCH 1)
set (OPENRAVE_VERSION_MINOR 142)
set (OPENRAVE_VERSION_PATCH 0)
set (OPENRAVE_VERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}.${OPENRAVE_VERSION_PATCH})
set (OPENRAVE_SOVERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR})
message(STATUS "Compiling OpenRAVE Version ${OPENRAVE_VERSION}, soversion=${OPENRAVE_SOVERSION}")
Expand Down
5 changes: 5 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
ChangeLog
#########

Version 0.142.0
===============

* Add centidegree unit definition.

Version 0.141.1
===============

Expand Down
6 changes: 5 additions & 1 deletion include/openrave/units.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ OPENRAVE_API TimeUnit GetTimeUnitFromString(const std::string& pTimeUnit, TimeUn
enum AngleUnit : int8_t
{
AU_Radian = 0,
AU_Degree = 1
AU_Degree = 1,
AU_Centidegree = 2,
};

OPENRAVE_API const char* GetAngleUnitString(AngleUnit unit);
Expand Down Expand Up @@ -387,6 +388,9 @@ constexpr inline T GetAngleUnitStandardValue(const AngleUnit unit)
if( unit == OpenRAVE::AU_Degree ) {
return T(57.29577951308232);
}
if( unit == OpenRAVE::AU_Centidegree ) {
return T(5729.577951308232);
}

throw OPENRAVE_EXCEPTION_FORMAT("Unsupported angle unit '%s'", GetAngleUnitString(unit), ORE_LengthUnitInvalid);
return T{};
Expand Down
4 changes: 4 additions & 0 deletions src/libopenrave/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const char* GetAngleUnitString(AngleUnit unit)
switch(unit) {
case AU_Radian: return "rad";
case AU_Degree: return "deg";
case AU_Centidegree: return "cdeg";
}
return "(unknown)";
}
Expand All @@ -180,6 +181,9 @@ AngleUnit GetAngleUnitFromString(const char* pAngleUnit, AngleUnit defaultAngleU
if( strcmp(pAngleUnit, "deg") == 0 ) {
return AU_Degree;
}
if( strcmp(pAngleUnit, "cdeg") == 0 ) {
return AU_Centidegree;
}
throw OpenRAVEException(str(boost::format("Do not support AngleUnit '%s'")%pAngleUnit), ORE_AngleUnitInvalid);
}

Expand Down

0 comments on commit b2be11e

Please sign in to comment.