Go to the documentation of this file.
22 Color(
double r,
double g,
double b,
double a = 1.0) : r(r), g(g), b(b), a(a) {}
23 Color(
const Eigen::Vector3d & color) : r(color.x()), g(color.y()), b(color.z()) {}
24 Color(
const Eigen::Vector4d & color) : r(color.x()), g(color.y()), b(color.z()), a(color[3]) {}
31 bool operator==(
const Color & rhs)
const {
return r == rhs.
r && g == rhs.
g && b == rhs.
b && a == rhs.
a; }
37 std::array<double, 4> data = config;
48 std::array<double, 4> color = config;
59 std::string color = config;
60 if(ColorMap.count(color)) { *
this = ColorMap.
at(color); }
63 auto msg = fmt::format(
"No color named {} ", color);
71 auto msg = std::string{
"Color is neither an array of size 4, nor a valid color string"};
110 static const std::map<std::string, Color>
ColorMap;
143 : color(color), width(width), style(style)
152 style =
LineStyle(
static_cast<typename std::underlying_type<LineStyle>::type
>(config[2]));
157 config(
"color", color);
158 config(
"width", width);
159 if(config.
has(
"style"))
161 auto s = config(
"style");
170 config.
add(
"color", color);
171 config.
add(
"width", width);
184 out.
write(
static_cast<typename std::underlying_type<LineStyle>::type
>(style));
213 head_diam = config[0];
214 head_len = config[1];
215 shaft_diam = config[2];
217 start_point_scale = config[4];
218 end_point_scale = config[5];
224 config(
"head_diam", head_diam);
225 config(
"head_len", head_len);
226 config(
"shaft_diam", shaft_diam);
227 config(
"scale", scale);
228 config(
"start_point_scale", start_point_scale);
229 config(
"end_point_scale", end_point_scale);
230 config(
"color", color);
236 conf.
add(
"head_diam", head_diam);
237 conf.
add(
"head_len", head_len);
238 conf.
add(
"shaft_diam", shaft_diam);
239 conf.
add(
"scale", scale);
240 conf.
add(
"start_point_scale", start_point_scale);
241 conf.
add(
"end_point_scale", end_point_scale);
242 conf.
add(
"color", color);
251 out.
write(head_diam);
253 out.
write(shaft_diam);
255 out.
write(start_point_scale);
256 out.
write(end_point_scale);
261 double head_diam = 0.015;
262 double head_len = 0.05;
263 double shaft_diam = 0.015;
264 double scale = 0.0015;
265 double start_point_scale = 0.0;
266 double end_point_scale = 0.0;
356 config(
"scale",
scale);
406 config(
"triangle_color", triangle_color);
407 config(
"show_triangle", show_triangle);
408 config(
"use_triangle_color", use_triangle_color);
409 config(
"edges", edge_config);
410 config(
"show_edges", show_edges);
411 config(
"fixed_edge_color", fixed_edge_color);
412 config(
"vertices", vertices_config);
413 config(
"show_vertices", show_vertices);
414 config(
"fixed_vertices_color", fixed_vertices_color);
420 conf.
add(
"triangle_color", triangle_color);
421 conf.
add(
"show_triangle", show_triangle);
422 conf.
add(
"use_triangle_color", use_triangle_color);
423 conf.
add(
"edges", edge_config);
424 conf.
add(
"show_edges", show_edges);
425 conf.
add(
"fixed_edge_color", fixed_edge_color);
426 conf.
add(
"vertices", vertices_config);
427 conf.
add(
"show_vertices", show_vertices);
428 conf.
add(
"fixed_vertices_color", fixed_vertices_color);
434 triangle_color.fromMessagePack(config[0]);
435 show_triangle = config[1];
436 use_triangle_color = config[2];
438 show_edges = config[4];
439 fixed_edge_color = config[5];
441 show_vertices = config[7];
442 fixed_vertices_color = config[8];
450 triangle_color.write(out);
451 out.
write(show_triangle);
452 out.
write(use_triangle_color);
454 edge_config.write(out);
455 out.
write(show_edges);
456 out.
write(fixed_edge_color);
458 vertices_config.write(out);
459 out.
write(show_vertices);
460 out.
write(fixed_vertices_color);
466 bool show_triangle =
true;
468 bool use_triangle_color =
false;
470 bool show_edges =
true;
472 bool fixed_edge_color =
true;
474 bool show_vertices =
true;
477 bool fixed_vertices_color =
true;
485 const Eigen::VectorXd & q,
486 const Eigen::VectorXd & alpha,
487 const Eigen::VectorXd & alphaD,
488 const Eigen::VectorXd & tau,
489 const std::vector<sva::ForceVecd> & forces,
490 const sva::PTransformd & posW)
491 : parameters(params), q(q), alpha(alpha), alphaD(alphaD), tau(tau), forces(forces), posW(posW)
Eigen::VectorXd alphaD
Definition: types.h:498
static mc_rtc::Configuration save(const mc_rtc::gui::PointConfig &point)
Definition: types.h:392
Simplify access to values hold within a JSON file.
Definition: Configuration.h:165
std::vector< sva::ForceVecd > forces
Definition: types.h:500
Definition: MessagePackBuilder.h:86
void write(mc_rtc::MessagePackBuilder &builder) const
Definition: types.h:90
void silence() const noexcept
PolyhedronConfig(const mc_rtc::Configuration &config)
Definition: types.h:402
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:44
PointConfig(const mc_rtc::Configuration &config)
Definition: types.h:345
static const Color Cyan
Definition: types.h:105
mc_rtc::Configuration saveConfig() const
Definition: types.h:78
ArrowConfig(const mc_rtc::Configuration &config)
Definition: types.h:209
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:222
LineConfig(const Color &color, double width=0.01, const LineStyle &style=LineStyle::Solid)
Definition: types.h:142
Color()
Definition: types.h:21
Eigen::VectorXd tau
Definition: types.h:499
static const Color White
Definition: types.h:100
static constexpr size_t write_size()
Definition: types.h:445
PointConfig vertices_config
Definition: types.h:473
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:347
double scale
Definition: types.h:378
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:298
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:432
void write(mc_rtc::MessagePackBuilder &out) const
Definition: types.h:369
sva::PTransformd posW
Definition: types.h:501
static const Color Red
Definition: types.h:102
mc_rtc::Configuration saveConfig() const
Definition: types.h:233
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:35
static const Color Blue
Definition: types.h:104
static const Color Gray
Definition: types.h:108
Eigen::VectorXd alpha
Definition: types.h:497
mc_rtc::Configuration saveConfig() const
Definition: types.h:167
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:292
void write(mc_rtc::MessagePackBuilder &out) const
Definition: types.h:179
static const Color Magenta
Definition: types.h:106
Color(const Eigen::Vector3d &color)
Definition: types.h:23
static mc_rtc::Configuration save(const mc_rtc::gui::PolyhedronConfig &polyhedron)
Definition: types.h:516
T at(size_t i, const T &v) const
Retrieve a given value from a JSON array.
Definition: Configuration.h:902
Color(double r, double g, double b, double a=1.0)
Definition: types.h:22
ForceConfig(const Color &color)
Definition: types.h:289
bool has(const std::string &key) const
Check if the key is part of the conf.
static mc_rtc::gui::ArrowConfig load(const mc_rtc::Configuration &config)
Definition: types.h:274
ArrowConfig()
Definition: types.h:207
static mc_rtc::gui::Color load(const mc_rtc::Configuration &config)
Definition: types.h:117
static constexpr size_t write_size()
Definition: types.h:246
LineStyle
Definition: types.h:129
double force_scale
Definition: types.h:321
static Configuration fromMessagePack(const char *data, size_t size)
Static constructor to load from MessagePack data.
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:148
Eigen::VectorXd q
Definition: types.h:496
double r
Definition: types.h:26
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:155
auto write(T &value)
Definition: traits.h:224
void start_array(size_t size)
void add(const std::string &key, bool value)
Add a bool element to the Configuration.
bool operator==(const Color &rhs) const
Definition: types.h:31
RobotMsgData(const std::vector< std::string > ¶ms, const Eigen::VectorXd &q, const Eigen::VectorXd &alpha, const Eigen::VectorXd &alphaD, const Eigen::VectorXd &tau, const std::vector< sva::ForceVecd > &forces, const sva::PTransformd &posW)
Definition: types.h:484
void write(mc_rtc::MessagePackBuilder &out) const
Definition: types.h:313
static Configuration rootArray()
Returns a Configuration with an array as root entry.
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:353
static mc_rtc::Configuration save(const mc_rtc::gui::ArrowConfig &arrow)
Definition: types.h:281
mc_rtc::Configuration saveConfig() const
Definition: types.h:417
PointConfig()
Definition: types.h:343
static const std::map< std::string, Color > ColorMap
Definition: types.h:110
static constexpr size_t write_size()
Definition: types.h:88
void fromMessagePack(const mc_rtc::Configuration &config)
Definition: types.h:211
LineConfig(const mc_rtc::Configuration &config)
Definition: types.h:146
static mc_rtc::gui::LineConfig load(const mc_rtc::Configuration &config)
Definition: types.h:193
PolyhedronConfig()
Definition: types.h:400
Exception thrown by this class when something bad occurs.
Definition: Configuration.h:223
LineConfig edge_config
Definition: types.h:469
static mc_rtc::Configuration save(const mc_rtc::gui::LineConfig &line)
Definition: types.h:200
void write(mc_rtc::MessagePackBuilder &out) const
Definition: types.h:248
LineConfig()
Definition: types.h:141
static mc_rtc::gui::PointConfig load(const mc_rtc::Configuration &config)
Definition: types.h:385
static mc_rtc::Configuration save(const mc_rtc::gui::ForceConfig &force)
Definition: types.h:336
static constexpr size_t write_size()
Definition: types.h:311
Color triangle_color
Definition: types.h:465
std::vector< std::string > parameters
Definition: types.h:495
mc_rtc::Configuration saveConfig() const
Definition: types.h:359
Color(const Eigen::Vector4d &color)
Definition: types.h:24
static constexpr size_t write_size()
Definition: types.h:367
PointConfig(const Color &color, double scale=0.02)
Definition: types.h:344
static const Color Black
Definition: types.h:101
static const Color Yellow
Definition: types.h:107
static mc_rtc::Configuration save(const mc_rtc::gui::Color &color)
Definition: types.h:124
void error(Args &&... args)
Definition: logging.h:63
Color(const mc_rtc::Configuration &config)
Definition: types.h:25
double g
Definition: types.h:27
Color color
Definition: types.h:267
static const Color LightGray
Definition: types.h:109
double b
Definition: types.h:28
Color color
Definition: types.h:377
ForceConfig(const mc_rtc::Configuration &config)
Definition: types.h:290
double a
Definition: types.h:29
mc_rtc::Configuration saveConfig() const
Definition: types.h:304
static const Color Green
Definition: types.h:103
static constexpr size_t write_size()
Definition: types.h:177
Definition: Configuration.h:55
bool operator!=(const Color &rhs) const
Definition: types.h:33
ForceConfig()
Definition: types.h:288
ArrowConfig(const Color &color)
Definition: types.h:208
static mc_rtc::gui::ForceConfig load(const mc_rtc::Configuration &config)
Definition: types.h:329
void fromConfig(const mc_rtc::Configuration &config)
Definition: types.h:404
#define MC_RTC_GUI_DLLAPI
Definition: api.h:50
static mc_rtc::gui::PolyhedronConfig load(const mc_rtc::Configuration &config)
Definition: types.h:509