Class trifinger_object_tracking::BaseCuboidModel

class BaseCuboidModel

Base class for all cuboid object models.

See Object Model for more information on the available object models.

Subclassed by trifinger_object_tracking::BaseCubeModel, trifinger_object_tracking::BaseCubeModel, trifinger_object_tracking::CubeV2ColorOrderBase, trifinger_object_tracking::CubeV2ColorOrderBase, trifinger_object_tracking::Cuboid2x2x8V2Model, trifinger_object_tracking::Cuboid2x2x8V2Model

Public Types

typedef std::shared_ptr<BaseCuboidModel> Ptr
typedef std::shared_ptr<const BaseCuboidModel> ConstPtr
typedef std::array<std::array<float, 4>, 8> CornerPositionArray
typedef std::array<CubeFace, N_FACES> CubeFaceArray
typedef std::shared_ptr<BaseCuboidModel> Ptr
typedef std::shared_ptr<const BaseCuboidModel> ConstPtr
typedef std::array<std::array<float, 4>, 8> CornerPositionArray
typedef std::array<CubeFace, N_FACES> CubeFaceArray

Public Functions

virtual std::string get_name() const = 0

Get name of the model.

virtual CornerPositionArray get_corners() const = 0

Get homogeneous coordinates (x, y, z, 1) of the cube corners.

virtual CubeFace map_color_to_face(FaceColor color) const = 0

Get the cuboid face that has the specified colour.

virtual ColorModel get_color_model() const = 0

Get the colour model that is used for this object.

inline BaseCuboidModel()
inline std::array<unsigned int, 4> get_face_corner_indices(FaceColor color) const

Maps each color to the indices of the corresponding cube corners.

virtual std::string get_name() const = 0

Get name of the model.

virtual CornerPositionArray get_corners() const = 0

Get homogeneous coordinates (x, y, z, 1) of the cube corners.

virtual CubeFace map_color_to_face(FaceColor color) const = 0

Get the cuboid face that has the specified colour.

virtual ColorModel get_color_model() const = 0

Get the colour model that is used for this object.

inline BaseCuboidModel()
inline std::array<unsigned int, 4> get_face_corner_indices(FaceColor color) const

Maps each color to the indices of the corresponding cube corners.

Public Members

std::map<std::pair<CubeFace, CubeFace>, Edge> edges

Public Static Functions

static inline std::array<FaceColor, 6> get_colors()

Get face colours. The index in the list refers to the face index.

static inline std::string get_color_name(FaceColor color)

Get name of the given colour.

static inline std::array<int, 3> get_rgb(FaceColor color)

Get RGB value of the given colour.

Note that the RGB values returned by this function are only meant for visualisation purposes and do not necessarily represent the actual shade of the colour on the given object (e.g. the value returned for red is always (255, 0, 0), independent of the object.

static inline std::array<int, 3> get_hsv(FaceColor color)

Get HSV value of the given colour.

Like get_rgb() this is only for visualisation purposes and does not attempt to match the actual colour of the real object.

static inline std::array<FaceColor, 6> get_colors()

Get face colours. The index in the list refers to the face index.

static inline std::string get_color_name(FaceColor color)

Get name of the given colour.

static inline std::array<int, 3> get_rgb(FaceColor color)

Get RGB value of the given colour.

Note that the RGB values returned by this function are only meant for visualisation purposes and do not necessarily represent the actual shade of the colour on the given object (e.g. the value returned for red is always (255, 0, 0), independent of the object.

static inline std::array<int, 3> get_hsv(FaceColor color)

Get HSV value of the given colour.

Like get_rgb() this is only for visualisation purposes and does not attempt to match the actual colour of the real object.

Public Static Attributes

static constexpr unsigned int N_FACES = 6

Number of faces of the cuboid.

static constexpr std::array<std::array<unsigned int, 4>, N_FACES> face_corner_indices = {{{0, 1, 2, 3}, {4, 5, 1, 0}, {5, 6, 2, 1}, {6, 7, 3, 2}, {7, 4, 0, 3}, {7, 6, 5, 4}}}

For each cuboid face the indices of the corresponding corners.

static constexpr float face_normal_vectors[6][3] = {{0, 0, 1}, {1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {0, 0, -1}}

Normal vectors of all cuboid faces.

struct Edge

Represents a cuboid edge, defined by its two corner points.

Public Members

unsigned int c1

Index of the first cuboid corner that belong to the edge.

unsigned int c2

Index of the second cuboid corner that belong to the edge.