12 #include <box2d/b2_body.h>
13 #include <mrpt/math/TPoint2D.h>
14 #include <mrpt/math/TPose3D.h>
15 #include <mrpt/poses/CPose2D.h>
16 #include <mrpt/poses/CPose3DInterpolator.h>
17 #include <mvsim/basic_types.h>
19 #include <shared_mutex>
32 bool init_pose_mandatory =
true;
42 using Ptr = std::shared_ptr<Simulable>;
61 const mrpt::math::TVector2D& force,
62 const mrpt::math::TPoint2D& applyPoint = mrpt::math::TPoint2D(0, 0));
64 virtual VisualObject* meAsVisualObject() {
return nullptr; }
72 [[deprecated(
"Use getRefVelocityLocal() instead")]] mrpt::math::TTwist2D
getVelocityLocal()
108 void setPose(
const mrpt::math::TPose3D& p,
bool notifyChange =
true)
const;
146 const b2Body* b2d_body()
const {
return b2dBody_; }
147 b2Body* b2d_body() {
return b2dBody_; }
149 World* getSimulableWorldObject() {
return simulable_parent_; }
150 const World* getSimulableWorldObject()
const {
return simulable_parent_; }
152 virtual void freeOpenGLResources() {}
159 [[maybe_unused]]
const mrpt::math::TPoint2D& worldXY)
const
173 b2Body* b2dBody_ =
nullptr;
181 virtual void notifySimulableSetPose([[maybe_unused]]
const mrpt::math::TPose3D& newPose)
187 World* simulable_parent_ =
nullptr;
190 mutable std::shared_mutex q_mtx_;
193 mrpt::math::TPose3D q_ = mrpt::math::TPose3D::Identity();
196 mrpt::math::TTwist2D dq_{0, 0, 0};
199 mrpt::math::TTwist2D dq_com_{0, 0, 0};
202 mrpt::math::TVector3D ddq_lin_{0, 0, 0};
204 mrpt::math::TPose3D former_q_;
205 mrpt::math::TTwist2D former_dq_{0, 0, 0};
209 mrpt::math::TPose3D initial_q_ = mrpt::math::TPose3D::Identity();
211 std::optional<mrpt::poses::CPose3DInterpolator> anim_keyframes_path_;
216 bool isInCollision_ =
false;
222 bool hadCollisionFlag_ =
false;
225 std::string publishPoseTopic_;
227 std::string publishRelativePoseTopic_;
228 std::vector<std::string> publishRelativePoseOfOtherObjects_;
230 double publishPosePeriod_ = 100e-3;
231 double publishPoseLastTime_ = 0;
Definition: JointXMLnode.h:20
Definition: Simulable.h:40
virtual void apply_force(const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0))
virtual mrpt::math::TPose3D getRelativePose() const
Definition: Simulable.h:95
mrpt::poses::CPose2D getCPose2D() const
Alternative to getPose()
void setName(const std::string &s)
Definition: Simulable.h:131
virtual void simul_pre_timestep(const TSimulContext &context)
mrpt::math::TTwist2D getRefVelocityLocal() const
virtual void setRelativePose(const mrpt::math::TPose3D &p)
Definition: Simulable.h:112
std::string name_
Definition: Simulable.h:166
mrpt::math::TPose3D getPose() const
virtual void simul_post_timestep(const TSimulContext &context)
mrpt::math::TTwist2D getRefVelocityGlobal() const
mrpt::math::TVector3D getLinearAcceleration() const
void setPose(const mrpt::math::TPose3D &p, bool notifyChange=true) const
const std::string & getName() const
Definition: Simulable.h:128
void setRefVelocityLocal(const mrpt::math::TTwist2D &dq)
mrpt::math::TTwist2D getVelocityLocal() const
Definition: Simulable.h:72
mrpt::poses::CPose3D getCPose3D() const
Alternative to getPose()
mrpt::math::TPose3D getPoseNoLock() const
No thread-safe version. Used internally only.
mrpt::math::TTwist2D getComVelocityGlobal() const
bool hadCollision() const
void resetCollisionFlag()
bool isInCollision() const
virtual std::optional< float > getElevationAt([[maybe_unused]] const mrpt::math::TPoint2D &worldXY) const
Definition: Simulable.h:158
Definition: VisualObject.h:36
Definition: Simulable.h:29
Definition: basic_types.h:58