class mrpt::obs::CActionCollection
Overview
Declares a class for storing a collection of robot actions.
It is used in mrpt::obs::CRawlog, for logs storage and particle filter based simulations.
See also:
#include <mrpt/obs/CActionCollection.h> class CActionCollection: public mrpt::serialization::CSerializable { public: // typedefs typedef std::shared_ptr<mrpt::obs ::CActionCollection> Ptr; typedef std::shared_ptr<const mrpt::obs ::CActionCollection> ConstPtr; typedef std::unique_ptr<mrpt::obs ::CActionCollection> UniquePtr; typedef std::unique_ptr<const mrpt::obs ::CActionCollection> ConstUniquePtr; typedef std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::iterator iterator; typedef std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::const_iterator const_iterator; // fields static constexpr const char* className = "mrpt::obs" "::" "CActionCollection"; // construction CActionCollection(); CActionCollection(CAction& a); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; const_iterator begin() const; iterator begin(); const_iterator end() const; iterator end(); iterator erase(const iterator& it); void clear(); CAction::Ptr get(size_t index); CAction::ConstPtr get(size_t index) const; template <typename T> T::ConstPtr getActionByClass(size_t ith = 0) const; template <typename T> T::Ptr getActionByClass(size_t ith = 0); void insert(const CAction& action); void insertPtr(const CAction::Ptr& action); size_t size() const; CActionRobotMovement2D::ConstPtr getBestMovementEstimation() const; CActionRobotMovement2D::Ptr getBestMovementEstimation(); CActionRobotMovement2D::ConstPtr getMovementEstimationByType(CActionRobotMovement2D::TEstimationMethod method) const; CActionRobotMovement2D::Ptr getMovementEstimationByType(CActionRobotMovement2D::TEstimationMethod method); bool getFirstMovementEstimationMean(mrpt::poses::CPose3D& out_pose_increment) const; std::optional<mrpt::poses::CPose3D> getFirstMovementEstimationMean() const; bool getFirstMovementEstimation(mrpt::poses::CPose3DPDFGaussian& out_pose_increment) const; std::optional<mrpt::poses::CPose3DPDFGaussian> getFirstMovementEstimation() const; void eraseByIndex(size_t index); };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
Typedefs
typedef std::shared_ptr<mrpt::obs ::CActionCollection> Ptr
A type for the associated smart pointer.
typedef std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::iterator iterator
You can use CActionCollection::begin to get a iterator to the first element.
typedef std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::const_iterator const_iterator
You can use CActionCollection::begin to get a iterator to the first element.
Construction
CActionCollection()
ctor
CActionCollection(CAction& a)
Constructor from a single action.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
const_iterator begin() const
Returns a iterator to the first action: this is an example of usage:
CActionCollection acts; ... for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it) { (*it)->... // (*it) is a "CAction::Ptr" }
iterator begin()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator end() const
Returns a iterator pointing to the end of the list: this is an example of usage:
CActionCollection acts; ... for (CActionCollection::iterator it=acts.begin();it!=acts.end();++it) { (*it)->... // (*it) is a "CAction::Ptr" }
iterator end()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
iterator erase(const iterator& it)
Removes the given action in the list, and return an iterator to the next element (or this-> end() if it was the last one).
void clear()
Erase all actions from the list.
CAction::Ptr get(size_t index)
Access the i’th action.DO NOT MODIFY the returned object, make a copy of ir with “CSerializable::duplicate” if desired.
First element is 0.
Parameters:
std::exception |
On index out of bounds. |
template <typename T> T::ConstPtr getActionByClass(size_t ith = 0) const
Access to the i’th action of a given class, or a nullptr smart pointer if there is no action of that class in the list.
Example:
CActionRobotMovement2D::Ptr obs = acts->getActionByClass<CActionRobotMovement2D>();
By default (ith=0), the first one is returned.
void insert(const CAction& action)
Add a new object to the list, making a deep copy.
void insertPtr(const CAction::Ptr& action)
Add a new object to the list (no deep copy).
(New in MRPT 2.3.1)
size_t size() const
Returns the actions count in the collection.
CActionRobotMovement2D::ConstPtr getBestMovementEstimation() const
Returns the best pose increment estimator in the collection, based on the determinant of its pose change covariance matrix.
Returns:
The estimation, or nullptr if none is available.
CActionRobotMovement2D::ConstPtr getMovementEstimationByType(CActionRobotMovement2D::TEstimationMethod method) const
Returns the pose increment estimator in the collection having the specified type.
Returns:
The estimation, or nullptr if none is available.
bool getFirstMovementEstimationMean(mrpt::poses::CPose3D& out_pose_increment) const
Look for the first 2D or 3D “odometry” found in this collection of actions, and return the “mean” increment of the robot according to it.
Deprecated Use getFirstMovementEstimationMean() returning optional instead.
Returns:
true on success,false on no odometry found.
std::optional<mrpt::poses::CPose3D> getFirstMovementEstimationMean() const
Returns the mean pose increment from the first odometry action found, or std::nullopt if none exists.
bool getFirstMovementEstimation(mrpt::poses::CPose3DPDFGaussian& out_pose_increment) const
Look for the first 2D or 3D “odometry” found in this collection of actions, and return the “mean” increment of the robot and its covariance according to it.
Deprecated Use getFirstMovementEstimation() returning optional instead.
Returns:
true on success,false on no odometry found.
std::optional<mrpt::poses::CPose3DPDFGaussian> getFirstMovementEstimation() const
Returns the pose PDF increment from the first odometry action found, or std::nullopt if none exists.
void eraseByIndex(size_t index)
Remove an action from the list by its index.
Parameters:
std::exception |
On index out of bounds. |