7 const std::vector<FanucGroup> extra_groups)
17 std::vector<FanucAxis> axis;
26 axis.insert(std::end(axis), std::begin(extended_axes), std::end(extended_axes));
32 groups_.insert(std::end(
groups_), std::begin(extra_groups), std::end(extra_groups));
46 return "MovementType not recognized!";
71 std::string configuration(
"");
74 configuration.append(
"F ");
76 configuration.append(
"N ");
79 configuration.append(
"D ");
81 configuration.append(
"U ");
84 configuration.append(
"B");
86 configuration.append(
"T");
96 for (
unsigned i(0); i <
groups_.size(); ++i)
101 for (
unsigned j(0); j <
groups_[i].axis_.size(); ++j)
121 if (
groups_[0].axis_.size() < 6)
127 if (
groups_[0].axis_[0].name_ !=
"X" &&
134 if (
groups_[0].axis_[1].name_ !=
"Y" &&
141 if (
groups_[0].axis_[2].name_ !=
"Z" &&
149 if (
groups_[0].axis_[3].name_ !=
"W" &&
156 if (
groups_[0].axis_[4].name_ !=
"P" &&
162 if (
groups_[0].axis_[5].name_ !=
"R" &&
215 if (group.axis_.empty())
221 if (group.user_frame_ > 9)
227 if (group.tool_frame_ == 0)
233 if (group.tool_frame_ > 9)
247 std::string line(
"");
249 const std::string p_id(std::to_string(
pose_id_));
253 std::string move_speed;
255 move_speed =
"R[" + std::to_string((
unsigned)
speed_) +
"]";
257 move_speed = std::to_string(
unsigned(speed_));
259 line = movement +
" P[" + p_id +
"] " + move_speed + speed_unit;
262 line.append(
" FINE " +
option_ +
";");
265 line.append(
" CNT" + std::to_string(
cnt_) +
" " +
option_ +
";");
275 std::string pose_block;
276 pose_block.append(
"P[" + std::to_string(
pose_id_) +
"]{\n");
277 pose_block.append(
" GP1:\n");
279 "\tUF : " + std::to_string(
groups_[0].user_frame_) +
", UT : " 280 + std::to_string(
groups_[0].tool_frame_) +
", CONFIG : '");
283 pose_block.append(
", ");
289 "\tX = " + std::to_string(
groups_[0].axis_[0].value_ * 1000.0) +
" mm, Y = " 290 + std::to_string(
groups_[0].axis_[1].value_ * 1000.0)
291 +
" mm, Z = " + std::to_string(
groups_[0].axis_[2].value_ * 1000.0) +
" mm,\n");
293 "\tW = " + std::to_string(
groups_[0].axis_[3].value_ * 180.0 / M_PI) +
" deg, P = " + std::to_string(
groups_[0].axis_[4].value_* 180.0 / M_PI)
294 +
" deg, R = " + std::to_string(
groups_[0].axis_[5].value_ * 180.0 / M_PI) +
" deg");
297 if (
groups_[0].axis_.size() > 6)
299 pose_block.append(
",\n");
301 for (
unsigned i(6); i <
groups_[0].axis_.size(); ++i)
303 double value(
groups_[0].axis_[i].value_);
305 value *= 180.0 / M_PI;
309 pose_block.append(
"\t");
310 pose_block.append(
groups_[0].axis_[i].name_ +
" = " + std::to_string(value));
313 pose_block.append(
" mm");
315 pose_block.append(
" deg");
317 if (i ==
groups_[0].axis_.size() - 1)
318 pose_block.append(
"\n");
320 pose_block.append(
",\n");
324 pose_block.append(
"\n");
329 for (
unsigned group_number(1); group_number <
groups_.size(); ++group_number)
331 unsigned axis_per_line(0);
333 pose_block.append(
" GP" + std::to_string(group_number + 1) +
":\n");
335 "\tUF : " + std::to_string(
groups_[group_number].user_frame_) +
", UT : " 336 + std::to_string(
groups_[group_number].tool_frame_) +
",\n");
338 for (
auto &axis :
groups_[group_number].axis_)
340 if (axis_per_line == 0)
341 pose_block.append(
"\t");
343 pose_block.append(
" ");
344 pose_block.append(axis.name_ +
"= ");
346 double value(axis.value_);
348 value *= 180.0 / M_PI;
352 pose_block.append(std::to_string(value));
355 pose_block.append(
" mm");
357 pose_block.append(
" deg");
359 if (&axis != &
groups_[group_number].axis_.back())
360 pose_block.append(
",");
362 if (axis_per_line == 2)
364 pose_block.append(
"\n");
371 if (axis_per_line != 0)
372 pose_block.append(
"\n");
377 pose_block.append(
"};\n");
386 const Eigen::Vector3d euler_angles(pose.linear().eulerAngles(0, 1, 2));
387 groups_[0].axis_[0].value_ = pose.translation().x();
388 groups_[0].axis_[1].value_ = pose.translation().y();
389 groups_[0].axis_[2].value_ = pose.translation().z();
392 groups_[0].axis_[3].value_ = euler_angles[0];
394 groups_[0].axis_[4].value_ = euler_angles[1];
396 groups_[0].axis_[5].value_ = euler_angles[2];
std::string movementTypeToString() const
FanucPose(const std::vector< FanucAxis > extended_axes={}, const std::vector< FanucGroup > extra_groups={})
TFSIMD_FORCE_INLINE const tfScalar & y() const
std::vector< FanucGroup > groups_
std::string configurationToString() const
std::string speedTypeToString() const
std::string getMainLineString() const
unsigned elbow_rotations_
void setRobotPose(const Eigen::Isometry3d &pose)
TFSIMD_FORCE_INLINE const tfScalar & x() const
TFSIMD_FORCE_INLINE const tfScalar & z() const
TFSIMD_FORCE_INLINE const tfScalar & w() const
std::string getPoseLinesString() const
unsigned flipnonflip_rotations_
bool hasSameGroupsAxes(const FanucPose &other) const
#define ROS_ERROR_STREAM(args)
unsigned backfront_rotations_