13 #include <mrpt/math/TPoint2D.h> 14 #include <mrpt/math/TPose3D.h> 15 #include <mrpt/poses/CPose2D.h> 16 #include <mrpt/poses/CPose3DInterpolator.h> 19 #include <shared_mutex> 37 using Ptr = std::shared_ptr<Simulable>;
43 virtual void simul_pre_timestep(
const TSimulContext& context);
50 virtual void simul_post_timestep(
const TSimulContext& context);
55 virtual void apply_force(
56 const mrpt::math::TVector2D& force,
57 const mrpt::math::TPoint2D& applyPoint = mrpt::math::TPoint2D(0, 0));
62 mrpt::math::TTwist2D getVelocityLocal()
const;
66 mrpt::math::TPose3D getPose()
const;
69 mrpt::math::TPose3D getPoseNoLock()
const;
71 mrpt::math::TTwist2D getTwist()
const;
77 mrpt::math::TVector3D getLinearAcceleration()
const;
81 void setPose(
const mrpt::math::TPose3D& p)
const;
83 void setTwist(
const mrpt::math::TTwist2D& dq)
const;
86 mrpt::poses::CPose2D getCPose2D()
const;
89 mrpt::poses::CPose3D getCPose3D()
const;
92 const std::string&
getName()
const {
return name_; }
95 void setName(
const std::string& s) { name_ = s; }
127 b2Body* b2dBody_ =
nullptr;
135 World* simulable_parent_ =
nullptr;
138 mutable std::shared_mutex q_mtx_;
141 mrpt::math::TPose3D q_ = mrpt::math::TPose3D::Identity();
144 mrpt::math::TTwist2D dq_{0, 0, 0};
147 mrpt::math::TVector3D ddq_lin_{0, 0, 0};
149 mrpt::math::TPose3D former_q_;
153 mrpt::math::TPose3D initial_q_ = mrpt::math::TPose3D::Identity();
155 std::optional<mrpt::poses::CPose3DInterpolator> anim_keyframes_path_;
160 bool isInCollision_ =
false;
164 bool hadCollisionFlag_ =
false;
167 std::string publishPoseTopic_;
169 std::string publishRelativePoseTopic_;
170 std::vector<std::string> publishRelativePoseOfOtherObjects_;
172 double publishPosePeriod_ = 100e-3;
173 double publishPoseLastTime_ = 0;
std::shared_ptr< Simulable > Ptr
const b2Body * b2d_body() const
virtual void freeOpenGLResources()
bool hadCollision() const
A rigid body. These are created via b2World::CreateBody.
ParseSimulableParams()=default
const World * getSimulableWorldObject() const
void setName(const std::string &s)
const std::string & getName() const
void resetCollisionFlag()
bool isInCollision() const
World * getSimulableWorldObject()
virtual VisualObject * meAsVisualObject()