candlewick 0.9.0
A tiny cross-platform renderer based on SDL3
Loading...
Searching...
No Matches
RobotDebug.h
Go to the documentation of this file.
1#pragma once
2
3#include "Multibody.h"
5#include <pinocchio/spatial/force.hpp>
6
7namespace candlewick::multibody {
8
12 pin::FrameIndex frame_id; //< Frame at which the force applies
13 Forcef force{Forcef::Zero()}; //< Force value
14 int lifetime = 1; //< Arrow lifetime
15};
16
22 inline static Float3 DEFAULT_TRIAD_SCALE = Float3::Constant(0.33333f);
23 inline static float DEFAULT_VEL_SCALE = 0.5f;
24
25 RobotDebugSystem(DebugScene &scene, const pin::Model &model,
26 const pin::Data &data)
27 : IDebugSubSystem(scene), m_robotModel(&model), m_robotData(&data) {}
28
29 entt::entity addFrameTriad(pin::FrameIndex frame_id,
30 const Float3 &scale = DEFAULT_TRIAD_SCALE);
31
32 entt::entity addFrameVelocityArrow(pin::FrameIndex frame_id,
33 float scale = DEFAULT_VEL_SCALE);
34
40 void update() override;
41
43
45 this->destroyEntities();
46 this->m_robotModel = nullptr;
47 this->m_robotData = nullptr;
48 }
49
50 void reload(const pin::Model &model, const pin::Data &data) {
51 this->destroyEntities();
52 this->m_robotModel = &model;
53 this->m_robotData = &data;
54 }
55
56private:
57 pin::Model const *m_robotModel;
58 pin::Data const *m_robotData;
59};
60
61} // namespace candlewick::multibody
Scene for organizing debug entities and render systems.
Definition DebugScene.h:50
Support for the Pinocchio rigid-body algorithms library and the Coal collision detection library.
Definition LoadPinocchioGeometry.h:8
pin::ForceTpl< float > Forcef
Definition Multibody.h:21
Eigen::Vector3f Float3
Definition math_types.h:8
IDebugSubSystem(DebugScene &scene)
Definition DebugScene.h:36
Display an external force using an arrow. This is a transient component which has its own lifetime.
Definition RobotDebug.h:11
int lifetime
Definition RobotDebug.h:14
Forcef force
Definition RobotDebug.h:13
pin::FrameIndex frame_id
Definition RobotDebug.h:12
void reload(const pin::Model &model, const pin::Data &data)
Definition RobotDebug.h:50
entt::entity addFrameTriad(pin::FrameIndex frame_id, const Float3 &scale=DEFAULT_TRIAD_SCALE)
void update() override
Update the transform components for the debug visual entities, according to their frame placements an...
static float DEFAULT_VEL_SCALE
Definition RobotDebug.h:23
entt::entity addFrameVelocityArrow(pin::FrameIndex frame_id, float scale=DEFAULT_VEL_SCALE)
RobotDebugSystem(DebugScene &scene, const pin::Model &model, const pin::Data &data)
Definition RobotDebug.h:25
~RobotDebugSystem()
Definition RobotDebug.h:44
static Float3 DEFAULT_TRIAD_SCALE
Definition RobotDebug.h:22