Skip to content

Commit 607e089

Browse files
Add constructors to WaypointPoly to support State, Joint and Cartesian Interface class
1 parent 033d653 commit 607e089

30 files changed

+314
-310
lines changed

tesseract_command_language/include/tesseract_command_language/fwd.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
namespace tesseract_planning
77
{
88
// Waypoint Poly
9+
class WaypointInterface;
10+
class CartesianWaypointInterface;
11+
class JointWaypointInterface;
12+
class StateWaypointInterface;
913
class WaypointPoly;
1014
class CartesianWaypointPoly;
1115
class JointWaypointPoly;
@@ -17,8 +21,10 @@ class JointWaypoint;
1721
class StateWaypoint;
1822

1923
// Instruction Poly
24+
class InstructionInterface;
2025
class InstructionPoly;
2126
enum class MoveInstructionType : std::uint8_t;
27+
class MoveInstructionInterface;
2228
class MoveInstructionPoly;
2329

2430
// Instructions

tesseract_command_language/include/tesseract_command_language/move_instruction.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
4040

4141
namespace tesseract_planning
4242
{
43-
class ProfileDictionary;
4443
/**
4544
* @brief The move instruction is used when defining the results of a motion planning request
4645
* @details

tesseract_command_language/include/tesseract_command_language/poly/waypoint_poly.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
4141

4242
namespace tesseract_planning
4343
{
44+
class CartesianWaypointInterface;
45+
class JointWaypointInterface;
46+
class StateWaypointInterface;
47+
4448
/**
4549
* @brief The WaypointInterface class
4650
*/
@@ -104,6 +108,9 @@ class WaypointPoly
104108
WaypointPoly& operator=(WaypointPoly&& other) noexcept = default;
105109

106110
WaypointPoly(const WaypointInterface& impl);
111+
WaypointPoly(const CartesianWaypointInterface& impl);
112+
WaypointPoly(const JointWaypointInterface& impl);
113+
WaypointPoly(const StateWaypointInterface& impl);
107114

108115
/**
109116
* @brief Set the name of the waypoint

tesseract_command_language/src/poly/waypoint_poly.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
88
#include <tesseract_command_language/poly/cartesian_waypoint_poly.h>
99
#include <tesseract_command_language/poly/joint_waypoint_poly.h>
1010
#include <tesseract_command_language/poly/state_waypoint_poly.h>
11+
#include <tesseract_command_language/cartesian_waypoint.h>
12+
#include <tesseract_command_language/joint_waypoint.h>
13+
#include <tesseract_command_language/state_waypoint.h>
1114
#include <tesseract_common/serialization.h>
1215

1316
namespace tesseract_planning
@@ -39,6 +42,12 @@ WaypointPoly& WaypointPoly::operator=(const WaypointPoly& other)
3942
}
4043

4144
WaypointPoly::WaypointPoly(const WaypointInterface& impl) : impl_(impl.clone()) {}
45+
WaypointPoly::WaypointPoly(const CartesianWaypointInterface& impl)
46+
: impl_(std::make_unique<CartesianWaypointPoly>(impl))
47+
{
48+
}
49+
WaypointPoly::WaypointPoly(const JointWaypointInterface& impl) : impl_(std::make_unique<JointWaypointPoly>(impl)) {}
50+
WaypointPoly::WaypointPoly(const StateWaypointInterface& impl) : impl_(std::make_unique<StateWaypointPoly>(impl)) {}
4251

4352
void WaypointPoly::setName(const std::string& name) { impl_->setName(name); }
4453
const std::string& WaypointPoly::getName() const { return impl_->getName(); }

tesseract_command_language/test/command_language_test_program.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ inline CompositeInstruction getTestProgram(std::string profile,
2121

2222
// Start Joint Position for the program
2323
std::vector<std::string> joint_names = { "joint_1", "joint_2", "joint_3", "joint_4", "joint_5", "joint_6" };
24-
StateWaypointPoly wp0{ StateWaypoint(joint_names, Eigen::VectorXd::Zero(6)) };
25-
JointWaypointPoly wp00{ JointWaypoint(joint_names, Eigen::VectorXd::Zero(6)) };
24+
StateWaypoint wp0{ joint_names, Eigen::VectorXd::Zero(6) };
25+
JointWaypoint wp00{ joint_names, Eigen::VectorXd::Zero(6) };
2626
MoveInstruction start_instruction(wp0, MoveInstructionType::FREESPACE, "freespace_profile");
2727
MoveInstruction end_instruction(wp00, MoveInstructionType::FREESPACE, "freespace_profile");
2828
start_instruction.setDescription("Start Instruction");
@@ -33,22 +33,22 @@ inline CompositeInstruction getTestProgram(std::string profile,
3333
seed_state.position = Eigen::VectorXd::Zero(6);
3434

3535
// Define raster poses
36-
CartesianWaypointPoly wp1 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.3, 0.8) *
37-
Eigen::Quaterniond(0, 0, -1.0, 0));
36+
CartesianWaypoint wp1(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.3, 0.8) *
37+
Eigen::Quaterniond(0, 0, -1.0, 0));
3838
wp1.setSeed(seed_state);
39-
CartesianWaypointPoly wp2 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.2, 0.8) *
40-
Eigen::Quaterniond(0, 0, -1.0, 0));
41-
CartesianWaypointPoly wp3 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.1, 0.8) *
42-
Eigen::Quaterniond(0, 0, -1.0, 0));
39+
CartesianWaypoint wp2(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.2, 0.8) *
40+
Eigen::Quaterniond(0, 0, -1.0, 0));
41+
CartesianWaypoint wp3(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -0.1, 0.8) *
42+
Eigen::Quaterniond(0, 0, -1.0, 0));
4343
wp3.setSeed(seed_state);
44-
CartesianWaypointPoly wp4 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.0, 0.8) *
45-
Eigen::Quaterniond(0, 0, -1.0, 0));
46-
CartesianWaypointPoly wp5 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.1, 0.8) *
47-
Eigen::Quaterniond(0, 0, -1.0, 0));
44+
CartesianWaypoint wp4(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.0, 0.8) *
45+
Eigen::Quaterniond(0, 0, -1.0, 0));
46+
CartesianWaypoint wp5(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.1, 0.8) *
47+
Eigen::Quaterniond(0, 0, -1.0, 0));
4848
wp5.setSeed(seed_state);
49-
CartesianWaypointPoly wp6 = CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.2, 0.8) *
50-
Eigen::Quaterniond(0, 0, -1.0, 0));
51-
JointWaypointPoly wp7 = JointWaypoint(joint_names, Eigen::VectorXd::Ones(6));
49+
CartesianWaypoint wp6(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, 0.2, 0.8) *
50+
Eigen::Quaterniond(0, 0, -1.0, 0));
51+
JointWaypoint wp7(joint_names, Eigen::VectorXd::Ones(6));
5252

5353
// Define raster move instruction
5454
MoveInstruction plan_c0(wp2, MoveInstructionType::LINEAR, "RASTER");

0 commit comments

Comments
 (0)