WebCFace 2.5.2
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
robot_model.h
Go to the documentation of this file.
1#pragma once
2#include "./base.h"
4#include <vector>
5
6#ifndef MSGPACK_DEFINE_MAP
7#define MSGPACK_DEFINE_MAP(...)
8#endif
9
11namespace message {
12
13struct RobotLink {
18 std::array<double, 3> joint_origin_pos, joint_origin_rot;
19 double joint_angle = 0;
21 std::vector<double> geometry_properties;
22 int color;
23 RobotLink() = default;
24 RobotLink(const SharedString &name, const SharedString &joint_name,
25 int joint_parent, int joint_type,
26 const std::array<double, 3> &joint_origin_pos,
27 const std::array<double, 3> &joint_origin_rot, double joint_angle,
28 int geometry_type, const std::vector<double> &geometry_properties,
29 int color)
30 : name(name), joint_name(joint_name), joint_parent(joint_parent),
31 joint_type(joint_type), joint_origin_pos(joint_origin_pos),
32 joint_origin_rot(joint_origin_rot), joint_angle(joint_angle),
33 geometry_type(geometry_type),
34 geometry_properties(geometry_properties), color(color) {}
35 MSGPACK_DEFINE_MAP(MSGPACK_NVP("n", name), MSGPACK_NVP("jn", joint_name),
36 MSGPACK_NVP("jp", joint_parent),
37 MSGPACK_NVP("jt", joint_type),
38 MSGPACK_NVP("js", joint_origin_pos),
39 MSGPACK_NVP("jr", joint_origin_rot),
40 MSGPACK_NVP("ja", joint_angle),
41 MSGPACK_NVP("gt", geometry_type),
42 MSGPACK_NVP("gp", geometry_properties),
43 MSGPACK_NVP("c", color))
44};
45struct RobotModel : public MessageBase<MessageKind::robot_model> {
47 std::vector<std::shared_ptr<RobotLink>> data;
48 RobotModel() = default;
50 const std::vector<std::shared_ptr<RobotLink>> &data)
51 : field(field), data(data) {}
52 MSGPACK_DEFINE_MAP(MSGPACK_NVP("f", field), MSGPACK_NVP("d", data))
53};
54
55template <>
57 : public MessageBase<MessageKind::robot_model + MessageKind::res> {
58 unsigned int req_id = 0;
60 std::vector<std::shared_ptr<RobotLink>> data;
61 Res() = default;
62 Res(unsigned int req_id, const SharedString &sub_field,
63 const std::vector<std::shared_ptr<RobotLink>> &data)
64 : req_id(req_id), sub_field(sub_field), data(data) {}
65 MSGPACK_DEFINE_MAP(MSGPACK_NVP("i", req_id), MSGPACK_NVP("f", sub_field),
66 MSGPACK_NVP("d", data))
67};
68
69}
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:69
#define MSGPACK_DEFINE_MAP(...)
Definition canvas2d.h:10
型からkindを取得するためだけのベースクラス
Definition base.h:53
std::vector< std::shared_ptr< RobotLink > > data
Definition robot_model.h:60
SharedString sub_field
Definition robot_model.h:59
Res(unsigned int req_id, const SharedString &sub_field, const std::vector< std::shared_ptr< RobotLink > > &data)
Definition robot_model.h:62
Definition base.h:58
Definition robot_model.h:45
std::vector< std::shared_ptr< RobotLink > > data
Definition robot_model.h:47
RobotModel(const SharedString &field, const std::vector< std::shared_ptr< RobotLink > > &data)
Definition robot_model.h:49
SharedString field
Definition robot_model.h:46
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103