2323#include < flexiv\rdk\gripper.hpp>
2424#include < flexiv\rdk\file_io.hpp>
2525#include < flexiv\rdk\device.hpp>
26+ #include < flexiv\rdk\maintenance.hpp>
27+ #include < flexiv\rdk\safety.hpp>
28+ #include < flexiv\rdk\model.hpp>
2629#include " json.hpp"
2730using json = nlohmann::json;
2831using namespace flexiv ::rdk;
@@ -55,11 +58,7 @@ struct WRobotState {
5558 double tau_des[kSerialJointDoF ];
5659 double tau_dot[kSerialJointDoF ];
5760 double tau_ext[kSerialJointDoF ];
58- double q_e[kMaxExtAxes ];
59- double dq_e[kMaxExtAxes ];
60- double tau_e[kMaxExtAxes ];
6161 double tcp_pose[kPoseSize ];
62- double tcp_pose_des[kPoseSize ];
6362 double tcp_vel[kCartDoF ];
6463 double flange_pose[kPoseSize ];
6564 double ft_sensor_raw[kCartDoF ];
@@ -87,10 +86,27 @@ struct WToolParams {
8786 double TcpLocation[kPoseSize ];
8887};
8988
89+ struct WGripperParams {
90+ char name[256 ];
91+ double min_width;
92+ double max_width;
93+ double min_vel;
94+ double max_vel;
95+ double min_force;
96+ double max_force;
97+ };
98+
9099struct WGripperStates {
91100 double width;
92101 double force;
93- double max_width;
102+ int is_moving;
103+ };
104+
105+ struct WSafetyLimits {
106+ double q_min[kSerialJointDoF ];
107+ double q_max[kSerialJointDoF ];
108+ double dq_max_normal[kSerialJointDoF ];
109+ double dq_max_reduced[kSerialJointDoF ];
94110};
95111
96112void CopyExceptionMsg (const std::exception& e, FlexivError* error) {
@@ -112,14 +128,35 @@ void CopyMsgSrc2Dst(const char* src, char* dst, size_t dstSize) {
112128}
113129
114130namespace flexiv ::rdk {
131+ NLOHMANN_JSON_SERIALIZE_ENUM (RobotEvent::Level, {
132+ { RobotEvent::Level::UNKNOWN, " UNKNOWN" },
133+ { RobotEvent::Level::INFO, " INFO" },
134+ { RobotEvent::Level::WARNING, " WARNING" },
135+ { RobotEvent::Level::ERROR, " ERROR" },
136+ { RobotEvent::Level::CRITICAL, " CRITICAL" },
137+ })
138+
139+ inline void to_json (json& j, const RobotEvent& event) {
140+ using namespace std ::chrono;
141+ j = json{
142+ {" Level" , event.level },
143+ {" ID" , event.id },
144+ {" Description" , event.description },
145+ {" Consequence" , event.consequences },
146+ {" ProbableCause" , event.probable_causes },
147+ {" RecommendedActions" , event.recommended_actions },
148+ {" Timestamp" , duration_cast<milliseconds>(event.timestamp .time_since_epoch ()).count ()}
149+ };
150+ }
151+
115152 inline void from_json (const json& j, JPos& pos) {
116- j.at (" q " ).get_to (pos.q );
153+ j.at (" q_m " ).get_to (pos.q_m );
117154 j.at (" q_e" ).get_to (pos.q_e );
118155 }
119156
120157 inline void to_json (json& j, const JPos& pos) {
121158 j = json{
122- {" q " , pos.q },
159+ {" q_m " , pos.q_m },
123160 {" q_e" , pos.q_e }
124161 };
125162 }
@@ -128,7 +165,7 @@ namespace flexiv::rdk {
128165 j.at (" position" ).get_to (coord.position );
129166 j.at (" orientation" ).get_to (coord.orientation );
130167 j.at (" ref_frame" ).get_to (coord.ref_frame );
131- j.at (" ref_q " ).get_to (coord.ref_q );
168+ j.at (" ref_q_m " ).get_to (coord.ref_q_m );
132169 j.at (" ref_q_e" ).get_to (coord.ref_q_e );
133170 }
134171
@@ -137,7 +174,7 @@ namespace flexiv::rdk {
137174 {" position" , coord.position },
138175 {" orientation" , coord.orientation },
139176 {" ref_frame" , coord.ref_frame },
140- {" ref_q " , coord.ref_q },
177+ {" ref_q_m " , coord.ref_q_m },
141178 {" ref_q_e" , coord.ref_q_e }
142179 };
143180 }
0 commit comments