mc_rtc
2.14.0
Robot.h
Go to the documentation of this file.
1
/*
2
* Copyright 2015-2020 CNRS-UM LIRMM, CNRS-AIST JRL
3
*/
4
5
#pragma once
6
7
#include <
mc_rtc/gui/details/traits.h
>
8
#include <
mc_rtc/gui/elements.h
>
9
#include <
mc_rtc/gui/types.h
>
10
11
#include <
mc_rbdyn/Robot.h
>
12
13
namespace
mc_rtc::gui
14
{
15
16
namespace
details
17
{
18
27
template
<
typename
GetT>
28
struct
RobotImpl
:
public
Element
29
{
30
static
constexpr
auto
type
=
Elements::Robot
;
31
32
RobotImpl
(
const
std::string &
name
, GetT get_fn) :
Element
(
name
), get_fn_(get_fn)
33
{
34
static_assert(
CheckReturnType<GetT, mc_rbdyn::Robot>::value
,
"Robot element must return an mc_rbdyn::Robot"
);
35
}
36
37
static
constexpr
size_t
write_size
() {
return
Element::write_size
() + 3; }
38
39
void
write
(
mc_rtc::MessagePackBuilder
& builder)
40
{
41
const
mc_rbdyn::Robot
& robot = get_fn_();
42
Element::write
(builder);
43
builder.
write
(robot.
module
().
parameters
());
44
builder.
write
(robot.
mbc
().
q
);
45
builder.
write
(robot.
posW
());
46
}
47
48
private
:
49
GetT get_fn_;
50
};
51
52
}
// namespace details
53
55
template
<
typename
GetT>
56
auto
Robot
(
const
std::string & name, GetT get_fn)
57
{
58
return
details::RobotImpl
(name, get_fn);
59
}
60
61
}
// namespace mc_rtc::gui
elements.h
Robot.h
mc_rtc::gui
Definition:
Observer.h:16
mc_rtc::gui::Elements::Robot
@ Robot
mc_rtc::gui::Robot
auto Robot(const std::string &name, GetT get_fn)
Definition:
Robot.h:56
mc_rbdyn::RobotModule::parameters
const std::vector< std::string > & parameters() const
Definition:
RobotModule.h:731
mc_rbdyn::Robot
Definition:
Robot.h:63
mc_rbdyn::Robot::mbc
rbd::MultiBodyConfig & mbc()
mc_rbdyn::Robot::module
const RobotModule & module() const
mc_rbdyn::Robot::posW
const sva::PTransformd & posW() const
mc_rtc::MessagePackBuilder
Definition:
MessagePackBuilder.h:87
mc_rtc::MessagePackBuilder::write
void write()
mc_rtc::gui::Element
Definition:
elements.h:59
mc_rtc::gui::Element::name
const std::string & name() const
Definition:
elements.h:61
mc_rtc::gui::Element::write
void write(mc_rtc::MessagePackBuilder &)
Definition:
elements.h:83
mc_rtc::gui::Element::write_size
static constexpr size_t write_size()
Definition:
elements.h:76
mc_rtc::gui::details::CheckReturnType
Definition:
traits.h:87
mc_rtc::gui::details::RobotImpl
Definition:
Robot.h:29
mc_rtc::gui::details::RobotImpl::type
static constexpr auto type
Definition:
Robot.h:30
mc_rtc::gui::details::RobotImpl::RobotImpl
RobotImpl(const std::string &name, GetT get_fn)
Definition:
Robot.h:32
mc_rtc::gui::details::RobotImpl::write_size
static constexpr size_t write_size()
Definition:
Robot.h:37
mc_rtc::gui::details::RobotImpl::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition:
Robot.h:39
rbd::MultiBodyConfig::q
std::vector< std::vector< double > > q
traits.h
types.h
include
mc_rtc
gui
Robot.h
Generated by
1.9.1