16 #include <mrpt/img/TColor.h> 17 #include <mrpt/math/TPolygon2D.h> 18 #include <mrpt/opengl/CSetOfLines.h> 19 #include <mrpt/opengl/CSetOfObjects.h> 20 #include <mrpt/poses/CPose2D.h> 37 using Ptr = std::shared_ptr<Block>;
53 const mrpt::math::TVector2D& force,
54 const mrpt::math::TPoint2D& applyPoint =
55 mrpt::math::TPoint2D(0, 0))
override;
127 const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
128 const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical,
129 bool childrenOnly)
override;
161 {
"mass", {
"%lf", &mass_}},
162 {
"zmin", {
"%lf", &block_z_min_}},
164 {
"ground_friction", {
"%lf", &groundFriction_}},
165 {
"lateral_friction", {
"%lf", &lateral_friction_}},
166 {
"restitution", {
"%lf", &restitution_}},
168 {
"intangible", {
"%bool", &intangible_}},
169 {
"static", {
"%bool", &isStatic_}}
194 using Ptr = std::shared_ptr<DummyInvisibleBlock>;
208 for (
auto&
s : sensors_)
s->simul_pre_timestep(context);
213 for (
auto&
s : sensors_)
s->simul_post_timestep(context);
217 [[maybe_unused]]
const mrpt::math::TVector2D& force,
218 [[maybe_unused]]
const mrpt::math::TPoint2D& applyPoint)
override 231 sensors_.push_back(sensor);
236 const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
237 const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical,
238 [[maybe_unused]]
bool childrenOnly)
override;
244 for (
auto& sensor : sensors_) sensor->registerOnServer(c);
void blockShape(const mrpt::math::TPolygon2D &p)
virtual void create_multibody_system(b2World &)
double block_z_max() const
mrpt::math::TPoint2D block_com_
In local coordinates.
std::vector< b2FrictionJoint * > friction_joints_
mrpt::opengl::CSetOfLines::Ptr gl_forces_
b2Fixture * fixture_block_
mrpt::opengl::CSetOfObjects::Ptr gl_block_
std::vector< SensorBase::Ptr > TListSensors
std::map< std::string, TParamEntry > TParameterDefinitions
void updateMaxRadiusFromPoly()
bool default_block_z_min_max() const
mrpt::img::TColor block_color_
double restitution_
Default: 0.01.
virtual float getMaxBlockRadius() const
std::vector< mrpt::math::TSegment3D > force_segments_for_rendering_
void block_z_min(double v)
virtual void apply_force(const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0)) override
static Ptr factory(World *parent, const rapidxml::xml_node< char > *xml_node)
static void register_block_class(const rapidxml::xml_node< char > *xml_node)
double lateral_friction_
Default: 0.5.
double ground_friction() const
size_t getBlockIndex() const
void mass(double newValue)
b2Body * getBox2DBlockBody()
const TParameterDefinitions params_
std::shared_ptr< Block > Ptr
virtual void simul_pre_timestep(const TSimulContext &context) override
A rigid body. These are created via b2World::CreateBody.
mrpt::math::TPolygon2D block_poly_
const mrpt::math::TPolygon2D & blockShape() const
VisualObject * meAsVisualObject() override
std::shared_ptr< SensorBase > Ptr
virtual void create_multibody_system(b2World &world)
TListSensors sensors_
Sensors aboard.
virtual double getMass() const
virtual void apply_force([[maybe_unused]] const mrpt::math::TVector2D &force, [[maybe_unused]] const mrpt::math::TPoint2D &applyPoint) override
void internal_parseGeometry(const rapidxml::xml_node< char > &xml_geom_node)
std::shared_ptr< DummyInvisibleBlock > Ptr
virtual void registerOnServer(mvsim::Client &c)
void block_color(const mrpt::img::TColor &c)
virtual void simul_post_timestep(const TSimulContext &context)
double block_z_min() const
virtual void simul_pre_timestep(const TSimulContext &context) override
void registerOnServer(mvsim::Client &c) override
virtual void simul_pre_timestep(const TSimulContext &context)
void block_z_max(double v)
virtual float getMaxBlockRadius() const
void internal_internalGuiUpdate_forces(mrpt::opengl::COpenGLScene &scene)
void setBlockIndex(size_t idx)
double groundFriction_
Default: 0.5.
virtual void simul_post_timestep(const TSimulContext &context) override
void add_sensor(const SensorBase::Ptr &sensor)
virtual double getMass() const
mrpt::math::TPoint2D getBlockCenterOfMass() const
In local coordinates.
virtual void simul_post_timestep(const TSimulContext &context) override
virtual void internalGuiUpdate(const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly) override
const mrpt::img::TColor block_color() const
std::mutex force_segments_for_rendering_cs_
void ground_friction(double newValue)