robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
discrete_event.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_DISCRETE_EVENT_HPP_
2#define ROBOTOC_DISCRETE_EVENT_HPP_
3
4#include <vector>
5
8
9
10namespace robotoc {
11
17 Impact,
18 Lift,
19 None
20};
21
27public:
33 DiscreteEvent(const ContactStatus& pre_contact_status,
34 const ContactStatus& post_contact_status);
35
40
44 ~DiscreteEvent() = default;
45
49 DiscreteEvent(const DiscreteEvent&) = default;
50
55
59 DiscreteEvent(DiscreteEvent&&) noexcept = default;
60
64 DiscreteEvent& operator=(DiscreteEvent&&) noexcept = default;
65
70 bool existDiscreteEvent() const {
71 return (exist_impact_ || exist_lift_);
72 }
73
79 bool existImpact() const {
80 return exist_impact_;
81 }
82
88 bool existLift() const {
89 return exist_lift_;
90 }
91
96 const ImpactStatus& impactStatus() const {
97 return impact_status_;
98 }
99
105 return pre_contact_status_;
106 }
107
113 return post_contact_status_;
114 }
115
121 void setDiscreteEvent(const ContactStatus& pre_contact_status,
122 const ContactStatus& post_contact_status);
123
134 void setContactPlacement(const int contact_index,
135 const Eigen::Vector3d& contact_position);
136
147 void setContactPlacement(const int contact_index,
148 const Eigen::Vector3d& contact_position,
149 const Eigen::Matrix3d& contact_rotation);
150
159 const std::vector<Eigen::Vector3d>& contact_positions);
160
169 const std::vector<Eigen::Vector3d>& contact_positions,
170 const std::vector<Eigen::Matrix3d>& contact_rotations);
171
177 void setContactPlacements(const aligned_vector<SE3>& contact_placements);
178
179
185 void setFrictionCoefficient(const int contact_index,
186 const double friction_coefficient);
187
193 void setFrictionCoefficients(const std::vector<double>& friction_coefficients);
194
199 int maxNumContacts() const {
200 return max_num_contacts_;
201 }
202
208 return event_type_;
209 }
210
214 void disp(std::ostream& os) const;
215
216 friend std::ostream& operator<<(std::ostream& os,
217 const DiscreteEvent& discrete_event);
218
219private:
220 ContactStatus pre_contact_status_, post_contact_status_;
221 ImpactStatus impact_status_;
222 int max_num_contacts_;
223 DiscreteEventType event_type_;
224 bool exist_impact_, exist_lift_;
225
226};
227
228} // namespace robotoc
229
230#endif // ROBOTOC_DISCRETE_EVENT_HPP_
Contact status of robot model.
Definition: contact_status.hpp:32
Discrete event composed by impact and lift.
Definition: discrete_event.hpp:26
void setDiscreteEvent(const ContactStatus &pre_contact_status, const ContactStatus &post_contact_status)
Sets the contact status from two sequential contact status.
bool existLift() const
Returns true if lift exists in this discrete event. Returns false if not.
Definition: discrete_event.hpp:88
void setFrictionCoefficients(const std::vector< double > &friction_coefficients)
Sets the friction coefficints.
void setFrictionCoefficient(const int contact_index, const double friction_coefficient)
Gets the friction coefficint.
DiscreteEventType eventType() const
Returns the event type of this discrete event.
Definition: discrete_event.hpp:207
DiscreteEvent & operator=(const DiscreteEvent &)=default
Default copy assign operator.
DiscreteEvent(const ContactStatus &pre_contact_status, const ContactStatus &post_contact_status)
Constructs discrete event from two sequential contact status.
DiscreteEvent(const DiscreteEvent &)=default
Default copy constructor.
const ContactStatus & postContactStatus() const
Gets the contact status after this discrete event.
Definition: discrete_event.hpp:112
DiscreteEvent()
Default constructor.
void setContactPlacements(const std::vector< Eigen::Vector3d > &contact_positions, const std::vector< Eigen::Matrix3d > &contact_rotations)
Sets contact placements.
void setContactPlacement(const int contact_index, const Eigen::Vector3d &contact_position, const Eigen::Matrix3d &contact_rotation)
Sets a contact placement, that is, the position and rotation of the contact. For the point contacts,...
void setContactPlacement(const int contact_index, const Eigen::Vector3d &contact_position)
Sets a contact placement, that is, the position and rotation of the contact. The contact rotation is ...
void disp(std::ostream &os) const
Displays the discrete event onto a ostream.
~DiscreteEvent()=default
Destructor.
bool existDiscreteEvent() const
Returns true if this discrete event exists. Returns false if not.
Definition: discrete_event.hpp:70
friend std::ostream & operator<<(std::ostream &os, const DiscreteEvent &discrete_event)
DiscreteEvent(DiscreteEvent &&) noexcept=default
Default move constructor.
const ImpactStatus & impactStatus() const
Returns const reference to impact status.
Definition: discrete_event.hpp:96
const ContactStatus & preContactStatus() const
Gets the contact status before this discrete event.
Definition: discrete_event.hpp:104
int maxNumContacts() const
Returns the maximum number of the contacts.
Definition: discrete_event.hpp:199
void setContactPlacements(const aligned_vector< SE3 > &contact_placements)
Sets contact placements.
bool existImpact() const
Returns true if impact exists in this discrete event. Returns false if not.
Definition: discrete_event.hpp:79
void setContactPlacements(const std::vector< Eigen::Vector3d > &contact_positions)
Sets contact placements. The rotation of each contact is set to Eigen::Matrix3d::Identity(),...
Impact status of robot model. Wrapper of ContactStatus to treat impacts.
Definition: impact_status.hpp:21
Definition: constraint_component_base.hpp:17
DiscreteEventType
Type of the discrete events.
Definition: discrete_event.hpp:16
std::vector< T, Eigen::aligned_allocator< T > > aligned_vector
std vector with Eigen::aligned_allocator.
Definition: aligned_vector.hpp:14