If you are looking for installation instructions you should read the quick start.
Here we will explain how you can use the geometric relations semantics in your application, in particular using the Orocos Kinematics and Dynamics library as a geometry library, supplemented with the semantic support.
roscreate-pkg myApplication geometric_semantics_kdl
This will automatically create a directory with name myApplication and a basic build infrastructure (see the roscreate-pkg documentation)
cd myApplication export ROS_PACKAGE_PATH=$PWD:$ROS_PACKAGE_PATH
roscd myApplication
touch myApplication.cpp
#include <Pose/Pose.h> #include <Pose/PoseCoordinatesKDL.h>
using namespace geometric_semantics; using namespace KDL;
Rotation coordinatesRotB2_B1=Rotation::EulerZYX(M_PI,0,0); Vector coordinatesPosB2_B1(2.2,0,0); KDL::Frame coordinatesFrameB2_B1(coordinatesRotB2_B1,coordinatesPosB2_B1)
Then use this KDL coordinates to create a PoseCoordinates object:
PoseCoordinates<KDL::Frame> poseCoordB2_B1(coordinatesFrameB2_B1);
Then create a Pose object using both the semantic information and the PoseCoordinates:
Pose<KDL::Frame> poseB2_B1("b2","b2","B2","b1","b1","B1","b1",poseCoordB2_B1);
Pose<KDL::Frame> poseB1_B2 = poseB2_B1.inverse()
rosbuild_add_executable(myApplication myApplication.cpp)
rosmake myApplication
and the executable will be created in the bin directory.
bin/myApplication
You will get the semantic output on your screen.
Imagine you have your own geometry library with support for geometric relation coordinate representations and calculations with these coordinate representations. You however would like to have semantic support on top of this geometry library. Probably the best thing to do in this case is to mimic our support for the Orocos Kinematics and Dynamics Library. To have a look at it do:
roscd geometric_semantics_kdl/
The possible semantic constraints are listed in the *Coordinates.h files in the geometric_semantics core library. So for instance for OrientationCoordinates we find there an enumeration of the different possible semantic constraints imposed by Orientation coordinate representations:
/** *\brief Constraints imposed by the orientation coordinate representation to the semantics */ enum Constraints{ noConstraints = 0x00, coordinateFrame_equals_referenceOrientationFrame = 0x01, // constraint that the orientation frame on the reference body has to be equal to the coordinate frame };
You should specify the constraint when writing the template specialization of the OrientationCoordinates<KDL::Rotation>:
// template specialization for KDL::Rotation template <> OrientationCoordinates<KDL::Rotation>::OrientationCoordinates(const KDL::Rotation& coordinates): data(coordinates), constraints(coordinateFrame_equals_referenceOrientationFrame){ };
The other function template specializations specify the actual coordinate calculations that have to be performed for semantic operations like inverse, changing the coordinate frame, changing the orientation frame, ... For instance, to specialize the inverse for KDL::Rotation coordinate representations:
template <> OrientationCoordinates<KDL::Rotation> OrientationCoordinates<KDL::Rotation>::inverse2Impl() const { return OrientationCoordinates<KDL::Rotation>(this->data.Inverse()); }