11 void jsonVectorToEigenVectorImpl(
const rapidjson::Value& json, Eigen::Vector3d& v)
13 v = Eigen::Vector3d(json[
"X"].GetDouble(), json[
"Y"].GetDouble(), json[
"Z"].GetDouble());
16 void jsonPlaneToPoseMsgImpl(
const rapidjson::Value& json, geometry_msgs::Pose& p)
18 Eigen::Vector3d o, x_axis, y_axis, z_axis;
20 if(json.HasMember(
"OriginX") && json.HasMember(
"OriginY") && json.HasMember(
"OriginZ"))
22 o = Eigen::Vector3d(json[
"OriginX"].GetDouble(), json[
"OriginY"].GetDouble(), json[
"OriginZ"].GetDouble());
27 jsonVectorToEigenVectorImpl(json[
"Origin"], o);
30 jsonVectorToEigenVectorImpl(json[
"XAxis"], x_axis);
31 jsonVectorToEigenVectorImpl(json[
"YAxis"], y_axis);
32 jsonVectorToEigenVectorImpl(json[
"ZAxis"], z_axis);
44 if(j_vector.HasMember(
"X") && j_vector.HasMember(
"Y") && j_vector.HasMember(
"Z"))
46 if(j_vector[
"X"].IsDouble() && j_vector[
"Y"].IsDouble() && j_vector[
"Z"].IsDouble())
57 bool has_valid_origin =
false;
58 bool has_valid_axes =
false;
60 if(j_plane.HasMember(
"OriginX") && j_plane.HasMember(
"OriginY") && j_plane.HasMember(
"OriginZ"))
62 if(j_plane[
"OriginX"].IsDouble() && j_plane[
"OriginY"].IsDouble() && j_plane[
"OriginZ"].IsDouble())
64 has_valid_origin =
true;
69 if(j_plane.HasMember(
"Origin"))
73 has_valid_origin =
true;
78 if(j_plane.HasMember(
"XAxis") && j_plane.HasMember(
"YAxis") && j_plane.HasMember(
"ZAxis"))
85 return has_valid_origin && has_valid_axes;
91 jsonVectorToEigenVectorImpl(json, v);
97 jsonPlaneToPoseMsgImpl(json, p);
102 assert(json.HasMember(
"pick_grasp_plane"));
103 assert(json.HasMember(
"pick_grasp_approach_plane"));
104 assert(json.HasMember(
"pick_grasp_retreat_plane"));
106 assert(json.HasMember(
"place_grasp_plane"));
107 assert(json.HasMember(
"place_grasp_approach_plane"));
108 assert(json.HasMember(
"place_grasp_retreat_plane"));
118 jsonPlaneToPoseMsgImpl(json[
"pick_grasp_plane"], g.pick_grasp_pose);
119 jsonPlaneToPoseMsgImpl(json[
"pick_grasp_approach_plane"], g.pick_grasp_approach_pose);
120 jsonPlaneToPoseMsgImpl(json[
"pick_grasp_retreat_plane"], g.pick_grasp_retreat_pose);
122 jsonPlaneToPoseMsgImpl(json[
"place_grasp_plane"], g.place_grasp_pose);
123 jsonPlaneToPoseMsgImpl(json[
"place_grasp_approach_plane"], g.place_grasp_approach_pose);
124 jsonPlaneToPoseMsgImpl(json[
"place_grasp_retreat_plane"], g.place_grasp_retreat_pose);
bool isValidJsonGHPlane(const rapidjson::Value &j_plane)
void jsonToGraspFrameFabMsg(const rapidjson::Value &json, choreo_msgs::Grasp &g)
void jsonPlaneToPoseMsg(const rapidjson::Value &json, geometry_msgs::Pose &p)
bool isValidJsonGHVector(const rapidjson::Value &j_vector)
void planeToPoseMsg(const Eigen::Vector3d &origin, const Eigen::Vector3d &x_axis, const Eigen::Vector3d &y_axis, const Eigen::Vector3d &z_axis, geometry_msgs::Pose &p)
void jsonVectorToEigenVector(const rapidjson::Value &json, Eigen::Vector3d &v)