candlewick 0.10.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
16};
17
23 inline static Float3 DEFAULT_TRIAD_SCALE = Float3::Constant(0.33333f);
24 inline static float DEFAULT_VEL_SCALE = 0.5f;
25
26 RobotDebugSystem(DebugScene &scene, const pin::Model &model,
27 const pin::Data &data)
28 : IDebugSubSystem(scene), m_robotModel(&model), m_robotData(&data) {}
29
30 entt::entity addFrameTriad(pin::FrameIndex frame_id,
31 const Float3 &scale = DEFAULT_TRIAD_SCALE);
32
33 entt::entity addFrameVelocityArrow(pin::FrameIndex frame_id,
34 float scale = DEFAULT_VEL_SCALE);
35
41 void update() override;
42
44
45 void renderDebugGui(const char *title);
46
48 this->destroyEntities();
49 this->m_robotModel = nullptr;
50 this->m_robotData = nullptr;
51 }
52
53 void reload(const pin::Model &model, const pin::Data &data) {
54 this->destroyEntities();
55 this->m_robotModel = &model;
56 this->m_robotData = &data;
57 }
58
59private:
60 pin::Model const *m_robotModel;
61 pin::Data const *m_robotData;
62};
63
64} // 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
Eigen::Vector4f Float4
Definition math_types.h:9
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
Float4 orig_color
Definition RobotDebug.h:15
pin::FrameIndex frame_id
Definition RobotDebug.h:12
void renderDebugGui(const char *title)
void reload(const pin::Model &model, const pin::Data &data)
Definition RobotDebug.h:53
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:24
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:26
~RobotDebugSystem()
Definition RobotDebug.h:47
static Float3 DEFAULT_TRIAD_SCALE
Definition RobotDebug.h:23