mc_rtc
2.16.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
{ static_assert(
CheckReturnType<GetT, mc_rbdyn::Robot>::value
,
"Robot element must return an mc_rbdyn::Robot"
); }
34
35
static
constexpr
size_t
write_size
() {
return
Element::write_size
() + 3; }
36
37
void
write
(
mc_rtc::MessagePackBuilder
& builder)
38
{
39
const
mc_rbdyn::Robot
& robot = get_fn_();
40
Element::write
(builder);
41
builder.
write
(robot.
module
().
parameters
());
42
builder.
write
(robot.
mbc
().
q
);
43
builder.
write
(robot.
posW
());
44
}
45
46
private
:
47
GetT get_fn_;
48
};
49
50
}
// namespace details
51
53
template
<
typename
GetT>
54
auto
Robot
(
const
std::string & name, GetT get_fn)
55
{
return
details::RobotImpl
(name, get_fn); }
56
57
}
// 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:54
mc_rbdyn::RobotModule::parameters
const std::vector< std::string > & parameters() const
Definition:
RobotModule.h:726
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:83
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:35
mc_rtc::gui::details::RobotImpl::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition:
Robot.h:37
rbd::MultiBodyConfig::q
std::vector< std::vector< double > > q
traits.h
types.h
include
mc_rtc
gui
Robot.h
Generated by
1.9.1