![]() |
RobWorkProject
25.2.11-
|
A stable pose with 1 DoF model. More...
#include <StablePose1DModel.hpp>
Inherits RANSACModel< StablePose1DModel, rw::math::Rotation3D<> >.
Public Types | |
typedef rw::core::Ptr< StablePose1DModel > | Ptr |
Smart pointer type to this class. | |
![]() | |
typedef rw::core::Ptr< RANSACModel< StablePose1DModel, rw::math::Rotation3D<> > > | Ptr |
Smart pointer type to this class. | |
Public Member Functions | |
StablePose1DModel () | |
Constructor. | |
StablePose1DModel (const rw::math::Vector3D<> &normal, const rw::math::Vector3D<> distances) | |
Constructor. More... | |
virtual | ~StablePose1DModel () |
Destructor. | |
virtual double | fitError (const rw::math::Rotation3D<> &sample) const |
Calculates the fitting error of a sample. More... | |
virtual bool | invalid () const |
Checks whether the model is invalid. More... | |
virtual int | getMinReqData () const |
Returns the number of samples required to create the model. More... | |
virtual double | refit (const std::vector< rw::math::Rotation3D<>> &samples) |
Recalculates the model based on provided samples. More... | |
virtual bool | same (const StablePose1DModel &model, double threshold) const |
Tests whether the model is same to a threshold of another model. More... | |
rw::math::Vector3D | normal () const |
Get stable pose normal. | |
rw::math::Vector3D | d () const |
Get stable pose plane distances. | |
![]() | |
RANSACModel () | |
Constructor. | |
virtual StablePose1DModel | make (const std::vector< rw::math::Rotation3D<> > &data) const |
Creates a new model of this type using provided data. | |
virtual | ~RANSACModel () |
Destructor. | |
bool | operator< (const StablePose1DModel &model) const |
'Worse than' operator. More... | |
bool | operator> (const StablePose1DModel &model) const |
'Better than' operator. More... | |
virtual bool | belongsTo (const rw::math::Rotation3D<> &sample, double threshold) const |
Check whether a sample belongs to the model. More... | |
virtual double | refit (const std::vector< rw::math::Rotation3D<> > &data)=0 |
Recalculates the model based on provided samples. More... | |
size_t | getNumberOfInliers () const |
Get the number of inliers. | |
double | getQuality () const |
Get the model quality. More... | |
void | setQuality (double quality) |
Set the model quality. More... | |
std::vector< rw::math::Rotation3D<> > & | getData () |
Access data. | |
const std::vector< rw::math::Rotation3D<> > & | getData () const |
Access data. | |
std::vector< size_t > | getInlierIndices () const |
Get the vector of inlier indices. More... | |
Static Public Member Functions | |
static StablePose1DModel | fromAxes (const rw::math::Vector3D<> &local, const rw::math::Vector3D<> &global) |
Constructs stable pose from an axis of rotation described in the object frame of reference, and a placement of that axis in global frame of reference. More... | |
![]() | |
static std::vector< StablePose1DModel > | findModels (const std::vector< rw::math::Rotation3D<> > &data, int maxIterations, int dataRequired, double dataThreshold, double modelThreshold) |
Find models fitting a set of observations. More... | |
static StablePose1DModel | bestModel (const std::vector< StablePose1DModel > &models) |
Select the model with the largest number of inliers. More... | |
static StablePose1DModel | likelyModel (const std::vector< StablePose1DModel > &models) |
Select a model randomly, with a chance based on the number of inliers. More... | |
Protected Attributes | |
rw::math::Vector3D | _normal |
double | _dx |
double | _dy |
double | _dz |
bool | _invalid |
![]() | |
std::vector< rw::math::Rotation3D<> > | _data |
double | _quality |
std::vector< size_t > | _indices |
Friends | |
std::ostream & | operator<< (std::ostream &out, const StablePose1DModel &model) |
Streaming operator. | |
A stable pose with 1 DoF model.
Models a stable pose with 1 DoF, i.e. a set of rotations allowed for object with 1 axis of rotation possible (e.g. a box on a surface). For a case of coordinate frame rotating around single arbitrary axis, the points at the ends of x, y, and z versors fall into parallel planes on a unit sphere. A stable pose with 1 DoF freedom is represented by a normal vector for the planes, and distances Dx, Dy, and Dz to respective planes, measured from the point {0, 0, 0}. For some cases, only two planes are defined, omitting the third coordinate (NaN). If only one plane was found, the model is considered invalid.
At least 4 samples are required for this model.
|
inline |
Constructor.
normal | [in] normal for x, y and z planes |
distances | [in] Dx, Dy and Dz distances for the respective planes |
|
virtual |
Calculates the fitting error of a sample.
Fit error for the stable pose is calculated as norm2 of distances of its x, y and z versor end points to respective planes. In case the particular plane was not found (i.e. Di = NaN), distance to this plane is assumed to be 0.
Implements RANSACModel< StablePose1DModel, rw::math::Rotation3D<> >.
|
inlinestatic |
Constructs stable pose from an axis of rotation described in the object frame of reference, and a placement of that axis in global frame of reference.
local | [in] rotation axis in the body frame of reference |
global | [in] location of the axis of rotation in the world coordinate frame |
|
inlinevirtual |
Returns the number of samples required to create the model.
No model will be found, if data size is less than this amount.
StablePose1DModel requires at least 4 samples.
Implements RANSACModel< StablePose1DModel, rw::math::Rotation3D<> >.
|
virtual |
Checks whether the model is invalid.
Implements RANSACModel< StablePose1DModel, rw::math::Rotation3D<> >.
|
virtual |
Recalculates the model based on provided samples.
|
virtual |
Tests whether the model is same to a threshold of another model.
This is used to filter down (merge) similar models found in the course of RANSAC algorithm execution.
Implements RANSACModel< StablePose1DModel, rw::math::Rotation3D<> >.