You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an early attempt to define a set of C++ robotic constructs to
encourage code reuse and interoperability among the various
open-source robotic projects.
These can be implemented in the form of the C++20 concepts TS
More specifically concepts can be used to define and enforce specific
behavior (e.g., methods to be present in a class) for all the
classical robotic constructs that need to be implemented in any new
project. As an example these may include:
Pose (2D, 3D, etc.)
Graph
PointXD / Landmark
SensorMeasurement
PointCloud
...
Having these constructs in place will allow to define a standard among
the different implementations; one will know what to expect from a
Point instance regardless if they deal with an MRPT CPoint2D, a
JDERobot CPoint3D a custom implementation of theirs or anything else
that could abide to that concept. It will also help to reason about
and benchmark the various implementations.
An example boilerplate code for e.g., a pose would be the following
(does not compile):
// forces every pose object to implement specific methods
template<typename T>
concept bool PoseAble = requires(T a){
{ a.isPDF() } -> bool;
{ a.dims() } -> std::size_t;
{ a.translation() } -> VectorisAble&;
{ a.rotation() } -> RotationMatAble&;
// ...
};
void compose(const PoseAble& p1, const PoseAble& p2)
{
// compose the two poses by calling methods that should
// be present since they implement the `PoseAble`
// concept
}
int main(int argc, char *argv[])
{
PoseAble& p1 = mrpt::poses::CPose2D(1.0, 2.0, M_PI/4.0);
PoseAble& p2 = mrpt::poses::CPose2D(2.0, 3.0, 0.0);
compose(p1, p2);
return 0;
}
P.S. The latest update is that concepts are to be included in C++20
version. There is also a concepts implementation in gcc6 and can be
used by compiling with -fconcepts -std=c++1z
Links
TS Document
Concepts - cppreference
Minimal concepts example
Next actions
To get this going I can create a separate repo and then transfer
ownership to the MRPT org. There we can also discuss the specification
and format of the concepts to be implemented in separate github issues
(issue per concept).
How does this all sound to you?
Any ideas for the name? how about robot-concepts?
This is an early attempt to define a set of C++ robotic constructs to
encourage code reuse and interoperability among the various
open-source robotic projects.
These can be implemented in the form of the C++20 concepts TS
More specifically concepts can be used to define and enforce specific
behavior (e.g., methods to be present in a class) for all the
classical robotic constructs that need to be implemented in any new
project. As an example these may include:
Having these constructs in place will allow to define a standard among
the different implementations; one will know what to expect from a
Point instance regardless if they deal with an MRPT CPoint2D, a
JDERobot CPoint3D a custom implementation of theirs or anything else
that could abide to that concept. It will also help to reason about
and benchmark the various implementations.
An example boilerplate code for e.g., a pose would be the following
(does not compile):
P.S. The latest update is that concepts are to be included in C++20
version. There is also a concepts implementation in gcc6 and can be
used by compiling with -fconcepts -std=c++1z
Links
TS Document
Concepts - cppreference
Minimal concepts example
Next actions
To get this going I can create a separate repo and then transfer
ownership to the MRPT org. There we can also discuss the specification
and format of the concepts to be implemented in separate github issues
(issue per concept).
How does this all sound to you?
Any ideas for the name? how about robot-concepts?
@jolting, @jlblancoc, @EduFdez,
Adding @eperdices, @okanasik from JDERobot and @rcintas from the Robocomp projects
The text was updated successfully, but these errors were encountered: