Skip to content

Commit a16f994

Browse files
authored
Move swig commands into tesseract_python package (#26)
* swig refactor * Remove most remaining swig commands from tesseract package * tesseract_planning swig commands * Temporarily use swig_refactor branh in rosinstall files * Use fewer rework includes * Use tesseract-robotics upstream repos * Use pre-poly refactor command language
1 parent 5458743 commit a16f994

26 files changed

+975
-28
lines changed

dependencies.rosinstall

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
- git:
77
local-name: tesseract
88
uri: https://github.com/tesseract-robotics/tesseract.git
9-
version: 3c799dccfaae524d04688f48b4fe282ecb1fed22
9+
version: 3c90ecc78dc62290628dbf5961f16705883901dc
1010
- git:
1111
local-name: tesseract_planning
12-
uri: https://github.com/tesseract-robotics/tesseract_planning.git
13-
version: 0c0983699f4afab3251daae6665bc0c9336f97f0
12+
uri: https://github.com/johnwason/tesseract_planning.git
13+
version: swig_refactor
1414
- git:
1515
local-name: trajopt
1616
uri: https://github.com/tesseract-robotics/trajopt.git

dependencies_with_ext.rosinstall

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
- git:
66
local-name: tesseract
77
uri: https://github.com/tesseract-robotics/tesseract.git
8-
version: 3c799dccfaae524d04688f48b4fe282ecb1fed22
8+
version: 3c90ecc78dc62290628dbf5961f16705883901dc
99
- git:
1010
local-name: tesseract_planning
11-
uri: https://github.com/tesseract-robotics/tesseract_planning.git
12-
version: 0c0983699f4afab3251daae6665bc0c9336f97f0
11+
uri: https://github.com/johnwason/tesseract_planning.git
12+
version: swig_refactor
1313
- git:
1414
local-name: trajopt
1515
uri: https://github.com/tesseract-robotics/trajopt.git

tesseract_python/CMakeLists.txt

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@ else()
2323
add_compile_options(/bigobj)
2424
endif()
2525

26-
find_package(tesseract_motion_planners REQUIRED)
27-
find_package(tesseract_common REQUIRED)
28-
find_package(tesseract_geometry REQUIRED)
29-
find_package(tesseract_visualization REQUIRED)
30-
find_package(tesseract_collision REQUIRED)
31-
find_package(tesseract_urdf REQUIRED)
32-
find_package(tesseract_srdf REQUIRED)
33-
find_package(tesseract_kinematics REQUIRED)
34-
find_package(tesseract_environment REQUIRED)
35-
find_package(tesseract_scene_graph REQUIRED)
36-
find_package(tesseract_command_language REQUIRED)
37-
find_package(tesseract_time_parameterization REQUIRED)
26+
# find_package(tesseract_motion_planners REQUIRED)
27+
# find_package(tesseract_common REQUIRED)
28+
# find_package(tesseract_geometry REQUIRED)
29+
# find_package(tesseract_visualization REQUIRED)
30+
# find_package(tesseract_collision REQUIRED)
31+
# find_package(tesseract_urdf REQUIRED)
32+
# find_package(tesseract_srdf REQUIRED)
33+
# find_package(tesseract_kinematics REQUIRED)
34+
# find_package(tesseract_environment REQUIRED)
35+
# find_package(tesseract_scene_graph REQUIRED)
36+
# find_package(tesseract_command_language REQUIRED)
37+
# find_package(tesseract_time_parameterization REQUIRED)
38+
# find_package(PCL REQUIRED COMPONENTS core features filters io segmentation surface)
39+
# find_package(trajopt REQUIRED)
40+
# find_package(TinyXML2 REQUIRED)
41+
# find_package(opw_kinematics REQUIRED)
42+
3843
find_package(tesseract_process_managers REQUIRED)
39-
find_package(PCL REQUIRED COMPONENTS core features filters io segmentation surface)
40-
find_package(trajopt REQUIRED)
41-
find_package(TinyXML2 REQUIRED)
42-
find_package(opw_kinematics REQUIRED)
4344

4445
if(NOT TinyXML2_INCLUDE_DIRS AND TARGET tinyxml2::tinyxml2)
4546
get_target_property(TinyXML2_INCLUDE_DIRS tinyxml2::tinyxml2 INTERFACE_INCLUDE_DIRECTORIES)
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
namespace tesseract_planning
2+
{
3+
class CartesianWaypoint
4+
{
5+
public:
6+
7+
8+
CartesianWaypoint() = default;
9+
10+
void print(const std::string& prefix = "") const;
11+
12+
/////////////////////
13+
// Eigen Container //
14+
/////////////////////
15+
16+
using ConstLinearPart = Eigen::Isometry3d::ConstLinearPart;
17+
using LinearPart = Eigen::Isometry3d::LinearPart;
18+
using ConstTranslationPart = Eigen::Isometry3d::ConstTranslationPart;
19+
using TranslationPart = Eigen::Isometry3d::TranslationPart;
20+
21+
////////////////////////
22+
// Eigen Constructors //
23+
////////////////////////
24+
25+
// This constructor allows you to construct from Eigen expressions
26+
template <typename OtherDerived>
27+
CartesianWaypoint(const Eigen::MatrixBase<OtherDerived>& other);
28+
29+
CartesianWaypoint(const Eigen::Isometry3d& other);
30+
31+
///////////////////
32+
// Eigen Methods //
33+
///////////////////
34+
35+
Eigen::Matrix3d linear() const;
36+
Eigen::Matrix3d linear();
37+
Eigen::Vector3d translation() const;
38+
Eigen::Vector3d translation();
39+
40+
41+
/** @returns true if two are approximate */
42+
inline bool isApprox(const Eigen::Isometry3d& other, double prec = 1e-12) const;
43+
44+
/////////////////////
45+
// Eigen Operators //
46+
/////////////////////
47+
48+
// This method allows you to assign Eigen expressions to MyVectorType
49+
template <typename OtherDerived>
50+
inline CartesianWaypoint& operator=(const Eigen::MatrixBase<OtherDerived>& other);
51+
52+
template <typename OtherDerived>
53+
inline CartesianWaypoint& operator*=(const Eigen::MatrixBase<OtherDerived>& other);
54+
55+
template <typename OtherDerived>
56+
inline CartesianWaypoint operator*(const Eigen::MatrixBase<OtherDerived>& other) const;
57+
58+
inline CartesianWaypoint& operator=(const Eigen::Isometry3d& other);
59+
60+
inline CartesianWaypoint& operator*=(const Eigen::Isometry3d& other);
61+
62+
inline CartesianWaypoint operator*(const Eigen::Isometry3d& other) const;
63+
64+
//////////////////////////
65+
// Implicit Conversions //
66+
//////////////////////////
67+
68+
/** @return Implicit Conversions to read-only Eigen::Isometry3d */
69+
inline operator const Eigen::Isometry3d&() const;
70+
71+
/** @return Implicit Conversions to writable Eigen::Isometry3d */
72+
inline operator Eigen::Isometry3d&();
73+
74+
//////////////////////////////////
75+
// Cartesian Waypoint Container //
76+
//////////////////////////////////
77+
78+
/** @brief The Cartesian Waypoint */
79+
Eigen::Isometry3d waypoint;
80+
/** @brief Distance below waypoint that is allowed. Should be size = 6. First 3 elements are dx, dy, dz. The last 3
81+
* elements are angle axis error allowed (Eigen::AngleAxisd.axis() * Eigen::AngleAxisd.angle()) */
82+
Eigen::VectorXd lower_tolerance;
83+
/** @brief Distance above waypoint that is allowed. Should be size = 6. First 3 elements are dx, dy, dz. The last 3
84+
* elements are angle axis error allowed (Eigen::AngleAxisd.axis() * Eigen::AngleAxisd.angle())*/
85+
Eigen::VectorXd upper_tolerance;
86+
87+
/**
88+
* @brief Waypoint seed associated with this Cartesian waypoint
89+
* @details The waypoint seed can be used for purposes like:
90+
* - providing a joint state seed to an IK solver
91+
* - providing a seed to the IK solver with modified limits using the tolerances
92+
* - providing a joint state to be used by a motion planner for interpolation to avoid performing IK
93+
*/
94+
Waypoint seed;
95+
96+
/**
97+
* @brief Returns true if waypoint has tolerances
98+
* @return True if waypoint has tolerances
99+
*/
100+
bool isToleranced() const;
101+
bool operator==(const CartesianWaypoint& rhs) const;
102+
bool operator!=(const CartesianWaypoint& rhs) const;
103+
104+
};
105+
106+
} // namespace tesseract_planning
107+
108+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
namespace tesseract_planning
2+
{
3+
enum class CompositeInstructionOrder
4+
{
5+
ORDERED, // Must go in forward
6+
UNORDERED, // Any order is allowed
7+
ORDERED_AND_REVERABLE // Can go forward or reverse the order
8+
};
9+
10+
class CompositeInstruction
11+
{
12+
public:
13+
14+
15+
CompositeInstruction(std::string profile = DEFAULT_PROFILE_KEY,
16+
CompositeInstructionOrder order = CompositeInstructionOrder::ORDERED,
17+
ManipulatorInfo manipulator_info = ManipulatorInfo());
18+
19+
CompositeInstructionOrder getOrder() const;
20+
21+
void setDescription(const std::string& description);
22+
const std::string& getDescription() const;
23+
24+
void setProfile(const std::string& profile);
25+
const std::string& getProfile() const;
26+
27+
/** @brief Dictionary of profiles that will override named profiles for a specific task*/
28+
ProfileDictionary::Ptr profile_overrides;
29+
30+
void setManipulatorInfo(ManipulatorInfo info);
31+
const ManipulatorInfo& getManipulatorInfo() const;
32+
ManipulatorInfo& getManipulatorInfo();
33+
34+
void setStartInstruction(Instruction instruction);
35+
36+
void resetStartInstruction();
37+
const Instruction& getStartInstruction() const;
38+
Instruction& getStartInstruction();
39+
bool hasStartInstruction() const;
40+
41+
void setInstructions(std::vector<tesseract_planning::Instruction> instructions);
42+
std::vector<tesseract_planning::Instruction>& getInstructions();
43+
const std::vector<tesseract_planning::Instruction>& getInstructions() const;
44+
45+
void print(const std::string& prefix = "") const;
46+
47+
bool operator==(const CompositeInstruction& rhs) const;
48+
49+
bool operator!=(const CompositeInstruction& rhs) const;
50+
51+
// C++ container support
52+
53+
/** value_type */
54+
using value_type = Instruction;
55+
/** pointer */
56+
using pointer = typename std::vector<value_type>::pointer;
57+
/** const_pointer */
58+
using const_pointer = typename std::vector<value_type>::const_pointer;
59+
/** reference */
60+
using reference = typename std::vector<value_type>::reference;
61+
/** const_reference */
62+
using const_reference = typename std::vector<value_type>::const_reference;
63+
/** size_type */
64+
using size_type = typename std::vector<value_type>::size_type;
65+
/** difference_type */
66+
using difference_type = typename std::vector<value_type>::difference_type;
67+
68+
%ignore get_allocator;
69+
%ignore resize;
70+
%ignore assign;
71+
%ignore swap;
72+
%ignore insert;
73+
%ignore CompositeInstruction();
74+
%ignore CompositeInstruction(const CompositeInstruction&);
75+
%ignore CompositeInstruction(size_type);
76+
%ignore CompositeInstruction(size_type, value_type const &);
77+
%swig_vector_methods(tesseract_planning::CompositeInstruction)
78+
%std_vector_methods(CompositeInstruction)
79+
80+
};
81+
82+
} // namespace tesseract_planning
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace tesseract_planning
2+
{
3+
class JointWaypoint
4+
{
5+
public:
6+
7+
JointWaypoint() = default;
8+
9+
void print(const std::string& prefix = "") const;
10+
11+
Eigen::VectorXd waypoint;
12+
std::vector<std::string> joint_names;
13+
/** @brief Joint distance below waypoint that is allowed. Each element should be <= 0 */
14+
Eigen::VectorXd lower_tolerance;
15+
/** @brief Joint distance above waypoint that is allowed. Each element should be >= 0 */
16+
Eigen::VectorXd upper_tolerance;
17+
18+
/**
19+
* @brief Returns true if waypoint is toleranced
20+
* @return True if waypoint is toleranced
21+
*/
22+
bool isToleranced() const;
23+
24+
bool operator==(const JointWaypoint& rhs) const;
25+
bool operator!=(const JointWaypoint& rhs) const;
26+
27+
};
28+
} // namespace tesseract_planning
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace tesseract_common
2+
{
3+
using AnyBase = tesseract_common::TypeErasureBase<TypeErasureInterface, detail_any::AnyInstance>;
4+
5+
struct Any : AnyBase
6+
{
7+
using AnyBase::AnyBase;
8+
};
9+
10+
} // namespace tesseract_common
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
namespace tesseract_common
2+
{
3+
class JointState
4+
{
5+
public:
6+
JointState() = default;
7+
JointState(std::vector<std::string> joint_names, Eigen::VectorXd position);
8+
9+
/** @brief The joint corresponding to the position vector. */
10+
std::vector<std::string> joint_names;
11+
12+
/** @brief The joint position at the waypoint */
13+
Eigen::VectorXd position;
14+
15+
/** @brief The velocity at the waypoint (optional) */
16+
Eigen::VectorXd velocity;
17+
18+
/** @brief The Acceleration at the waypoint (optional) */
19+
Eigen::VectorXd acceleration;
20+
21+
/** @brief The Effort at the waypoint (optional) */
22+
Eigen::VectorXd effort;
23+
24+
/** @brief The Time from start at the waypoint (optional) */
25+
double time{ 0 };
26+
27+
bool operator==(const JointState& other) const;
28+
29+
bool operator!=(const JointState& rhs) const;
30+
31+
};
32+
33+
} // namespace tesseract_common
34+
35+
%template(JointStates) std::vector<tesseract_common::JointState>;
36+
37+
namespace tesseract_common
38+
{
39+
/** @brief Represents a joint trajectory */
40+
class JointTrajectory
41+
{
42+
public:
43+
JointTrajectory(std::string description = "");
44+
JointTrajectory(std::vector<JointState> states, std::string description = "");
45+
46+
std::vector<JointState> states;
47+
std::string description;
48+
49+
bool operator==(const JointTrajectory& other) const;
50+
51+
bool operator!=(const JointTrajectory& rhs) const;
52+
53+
///////////////////////////
54+
// C++ container support //
55+
///////////////////////////
56+
57+
/** value_type */
58+
using value_type = JointState;
59+
/** pointer */
60+
using pointer = typename std::vector<value_type>::pointer;
61+
/** const_pointer */
62+
using const_pointer = typename std::vector<value_type>::const_pointer;
63+
/** reference */
64+
using reference = typename std::vector<value_type>::reference;
65+
/** const_reference */
66+
using const_reference = typename std::vector<value_type>::const_reference;
67+
/** size_type */
68+
using size_type = typename std::vector<value_type>::size_type;
69+
/** difference_type */
70+
using difference_type = typename std::vector<value_type>::difference_type;
71+
72+
%ignore get_allocator;
73+
%ignore resize;
74+
%ignore assign;
75+
%ignore swap;
76+
%ignore insert;
77+
%ignore JointTrajectory();
78+
%ignore JointTrajectory(const JointTrajectory&);
79+
%ignore JointTrajectory(size_type);
80+
%ignore JointTrajectory(size_type, value_type const &);
81+
%swig_vector_methods(tesseract_common::JointTrajectory)
82+
%std_vector_methods(JointTrajectory)
83+
};
84+
85+
} // namespace tesseract_common
86+

0 commit comments

Comments
 (0)