rt_state.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017, 2018 Simon Rasmussen (refactor)
3  *
4  * Copyright 2015, 2016 Thomas Timm Andersen (original version)
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <inttypes.h>
22 #include <cstddef>
25 #include "ur_modern_driver/types.h"
26 
27 class URRTPacketConsumer;
28 
29 class RTPacket
30 {
31 public:
32  virtual bool parseWith(BinParser& bp) = 0;
33  virtual bool consumeWith(URRTPacketConsumer& consumer) = 0;
34 };
35 
36 class RTShared
37 {
38 protected:
39  void parse_shared1(BinParser& bp);
40  void parse_shared2(BinParser& bp);
41 
42 public:
43  double time;
44  std::array<double, 6> q_target;
45  std::array<double, 6> qd_target;
46  std::array<double, 6> qdd_target;
47  std::array<double, 6> i_target;
48  std::array<double, 6> m_target;
49  std::array<double, 6> q_actual;
50  std::array<double, 6> qd_actual;
51  std::array<double, 6> i_actual;
52 
53  // gap here depending on version
54 
55  std::array<double, 6> tcp_force;
56 
57  // does not contain "_actual" postfix in V1_X but
58  // they're the same fields so share anyway
61 
62  // gap here depending on version
63 
64  uint64_t digital_inputs;
65  std::array<double, 6> motor_temperatures;
67  double robot_mode;
68 
69  static const size_t SIZE =
70  sizeof(double) * 3 + sizeof(double[6]) * 10 + sizeof(cartesian_coord_t) * 2 + sizeof(uint64_t);
71 };
72 
73 class RTState_V1_6__7 : public RTShared, public RTPacket
74 {
75 public:
76  bool parseWith(BinParser& bp);
77  virtual bool consumeWith(URRTPacketConsumer& consumer);
78 
80 
81  static const size_t SIZE = RTShared::SIZE + sizeof(double3_t);
82 
83  static_assert(RTState_V1_6__7::SIZE == 632, "RTState_V1_6__7 has mismatched size!");
84 };
85 
87 {
88 public:
89  bool parseWith(BinParser& bp);
90  virtual bool consumeWith(URRTPacketConsumer& consumer);
91 
92  std::array<double, 6> joint_modes;
93 
94  static const size_t SIZE = RTState_V1_6__7::SIZE + sizeof(double[6]);
95 
96  static_assert(RTState_V1_8::SIZE == 680, "RTState_V1_8 has mismatched size!");
97 };
98 
99 class RTState_V3_0__1 : public RTShared, public RTPacket
100 {
101 public:
102  bool parseWith(BinParser& bp);
103  virtual bool consumeWith(URRTPacketConsumer& consumer);
104 
105  std::array<double, 6> i_control;
108 
109  std::array<double, 6> joint_modes;
110  double safety_mode;
114  double v_main;
115  double v_robot;
116  double i_robot;
117  std::array<double, 6> v_actual;
118 
119  static const size_t SIZE =
120  RTShared::SIZE + sizeof(double[6]) * 3 + sizeof(double3_t) + sizeof(cartesian_coord_t) * 2 + sizeof(double) * 6;
121 
122  static_assert(RTState_V3_0__1::SIZE == 920, "RTState_V3_0__1 has mismatched size!");
123 };
124 
126 {
127 public:
128  bool parseWith(BinParser& bp);
129  virtual bool consumeWith(URRTPacketConsumer& consumer);
130 
131  uint64_t digital_outputs;
133 
134  static const size_t SIZE = RTState_V3_0__1::SIZE + sizeof(uint64_t) + sizeof(double);
135 
136  static_assert(RTState_V3_2__3::SIZE == 936, "RTState_V3_2__3 has mismatched size!");
137 };
uint64_t digital_inputs
Definition: rt_state.h:64
double i_robot
Definition: rt_state.h:116
std::array< double, 6 > joint_modes
Definition: rt_state.h:92
std::array< double, 6 > qdd_target
Definition: rt_state.h:46
std::array< double, 6 > i_actual
Definition: rt_state.h:51
cartesian_coord_t tool_vector_target
Definition: rt_state.h:106
std::array< double, 6 > motor_temperatures
Definition: rt_state.h:65
cartesian_coord_t tcp_speed_actual
Definition: rt_state.h:60
double v_robot
Definition: rt_state.h:115
double linear_momentum_norm
Definition: rt_state.h:113
double safety_mode
Definition: rt_state.h:110
std::array< double, 6 > qd_actual
Definition: rt_state.h:50
std::array< double, 6 > qd_target
Definition: rt_state.h:45
std::array< double, 6 > joint_modes
Definition: rt_state.h:109
double3_t tool_accelerometer_values
Definition: rt_state.h:111
virtual bool consumeWith(URRTPacketConsumer &consumer)=0
std::array< double, 6 > tcp_force
Definition: rt_state.h:55
double robot_mode
Definition: rt_state.h:67
double program_state
Definition: rt_state.h:132
std::array< double, 6 > q_actual
Definition: rt_state.h:49
double speed_scaling
Definition: rt_state.h:112
static const size_t SIZE
Definition: rt_state.h:119
double v_main
Definition: rt_state.h:114
std::array< double, 6 > m_target
Definition: rt_state.h:48
cartesian_coord_t tool_vector_actual
Definition: rt_state.h:59
virtual bool parseWith(BinParser &bp)=0
std::array< double, 6 > i_control
Definition: rt_state.h:105
std::array< double, 6 > v_actual
Definition: rt_state.h:117
static const size_t SIZE
Definition: rt_state.h:69
uint64_t digital_outputs
Definition: rt_state.h:131
double time
Definition: rt_state.h:43
cartesian_coord_t tcp_speed_target
Definition: rt_state.h:107
static const size_t SIZE
Definition: rt_state.h:94
double controller_time
Definition: rt_state.h:66
double3_t tool_accelerometer_values
Definition: rt_state.h:79
static const size_t SIZE
Definition: rt_state.h:134
static const size_t SIZE
Definition: rt_state.h:81
std::array< double, 6 > q_target
Definition: rt_state.h:44
std::array< double, 6 > i_target
Definition: rt_state.h:47


ur_modern_driver
Author(s): Thomas Timm Andersen, Simon Rasmussen
autogenerated on Fri Jun 26 2020 03:37:00