Class CActionCollection
Defined in File CActionCollection.h
Inheritance Relationships
Base Type
public mrpt::serialization::CSerializable
Class Documentation
-
class CActionCollection : public mrpt::serialization::CSerializable
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.
Public Types
-
using iterator = std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::iterator
You can use CActionCollection::begin to get a iterator to the first element.
-
using const_iterator = std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::const_iterator
You can use CActionCollection::begin to get a iterator to the first element.
Public Functions
-
CActionCollection() = default
ctor
-
inline 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" }
-
inline iterator begin()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline 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" }
-
inline 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.
- Throws:
std::exception – On index out of bounds.
-
template<typename T>
inline T::Ptr 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:
By default (ith=0), the first one is returned.CActionRobotMovement2D::Ptr obs = acts->getActionByClass<CActionRobotMovement2D>();
-
void insertPtr(const CAction::Ptr &action)
Add a new object to the list (no deep copy).
Note
(New in MRPT 2.3.1)
-
size_t size() const
Returns the actions count in the collection.
-
CActionRobotMovement2D::Ptr 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::Ptr getMovementEstimationByType(CActionRobotMovement2D::TEstimationMethod method)
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.
- Returns:
true on success,false on no odometry found.
-
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.
- Returns:
true on success,false on no odometry found.
-
void eraseByIndex(size_t index)
Remove an action from the list by its index.
- Throws:
std::exception – On index out of bounds.
-
using iterator = std::deque<mrpt::containers::deepcopy_poly_ptr<CAction::Ptr>>::iterator