Skip to content

Commit c79e54c

Browse files
johnwasonLevi Armstrong
andauthored
Updates to upstream changes (#15)
* Update to latest Tesseract with boost serialization * fixup * fixup * Update Python to upstream changes * Fix numpy typecode error on Windows in eigen.i Co-authored-by: Levi Armstrong <levi.armstrong@swri.org>
1 parent 26589b5 commit c79e54c

20 files changed

+126
-82
lines changed

.github/workflows/windows_noetic_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ jobs:
3737
3838
rosdep install -q --from-paths . --ignore-src -y
3939
40-
catkin_make_isolated --install --force-cmake --only-pkg-with-deps tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON
40+
catkin_make_isolated --install --use-nmake --force-cmake --only-pkg-with-deps tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON
4141
call "D:\a\tesseract_python\tesseract_python\install_isolated\setup.bat"
42-
catkin_make_isolated --install --force-cmake --pkg tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DTESSERACT_ENABLE_TESTING=ON -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON
42+
catkin_make_isolated --install --use-nmake --force-cmake --pkg tesseract_python --cmake-args -DCMAKE_BUILD_TYPE=Release -DTESSERACT_ENABLE_TESTING=ON -DINSTALL_OMPL=ON -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF -DINSTALL_FCL=ON -DINSTALL_BULLET=ON

tesseract_python/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ find_package(tesseract_geometry REQUIRED)
2929
find_package(tesseract_visualization REQUIRED)
3030
find_package(tesseract_collision REQUIRED)
3131
find_package(tesseract_urdf REQUIRED)
32+
find_package(tesseract_srdf REQUIRED)
3233
find_package(tesseract_kinematics REQUIRED)
3334
find_package(tesseract_environment REQUIRED)
3435
find_package(tesseract_scene_graph REQUIRED)
@@ -51,6 +52,7 @@ include_directories(
5152
${tesseract_kinematics_INCLUDE_DIRS}
5253
${tesseract_urdf_INCLUDE_DIRS}
5354
${tesseract_scene_graph_INCLUDE_DIRS}
55+
${tesseract_srdf_INCLUDE_DIRS}
5456
${tesseract_environment_INCLUDE_DIRS}
5557
${tesseract_command_language_INCLUDE_DIRS}
5658
${tesseract_time_parameterization_INCLUDE_DIRS}
@@ -110,6 +112,7 @@ tesseract_python_module(tesseract_collision_python SWIG_SRCS swig/tesseract_coll
110112
tesseract_python_module(tesseract_collision_bullet_python SWIG_SRCS swig/tesseract_collision_bullet_python.i PACKAGE tesseract_collision_bullet LIBS tesseract::tesseract_collision_bullet )
111113
tesseract_python_module(tesseract_collision_fcl_python SWIG_SRCS swig/tesseract_collision_fcl_python.i PACKAGE tesseract_collision_fcl LIBS tesseract::tesseract_collision_fcl )
112114
tesseract_python_module(tesseract_scene_graph_python SWIG_SRCS swig/tesseract_scene_graph_python.i PACKAGE tesseract_scene_graph LIBS tesseract::tesseract_scene_graph )
115+
tesseract_python_module(tesseract_srdf_python SWIG_SRCS swig/tesseract_srdf_python.i PACKAGE tesseract_srdf LIBS tesseract::tesseract_srdf )
113116
tesseract_python_module(tesseract_urdf_python SWIG_SRCS swig/tesseract_urdf_python.i PACKAGE tesseract_urdf LIBS tesseract::tesseract_urdf )
114117
tesseract_python_module(tesseract_kinematics_python SWIG_SRCS swig/tesseract_kinematics_python.i PACKAGE tesseract_kinematics LIBS tesseract::tesseract_kinematics_core )
115118
tesseract_python_module(tesseract_kinematics_kdl_python SWIG_SRCS swig/tesseract_kinematics_kdl_python.i PACKAGE tesseract_kinematics_kdl LIBS tesseract::tesseract_kinematics_kdl )
@@ -179,7 +182,7 @@ if(TESSERACT_ENABLE_TESTING)
179182
_tesseract_motion_planners_python _tesseract_motion_planners_simple_python
180183
_tesseract_motion_planners_trajopt_python _tesseract_motion_planners_ompl_python
181184
_tesseract_motion_planners_descartes_python _tesseract_time_parameterization_python
182-
_tesseract_visualization_python)
185+
_tesseract_visualization_python _tesseract_srdf_python)
183186
endif()
184187

185188
add_test (NAME python-tests

tesseract_python/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<depend>tesseract_visualization</depend>
2020
<depend>tesseract_collision</depend>
2121
<depend>tesseract_urdf</depend>
22+
<depend>tesseract_srdf</depend>
2223
<depend>tesseract_kinematics</depend>
2324
<depend>tesseract_scene_graph</depend>
2425
<depend>tesseract_environment</depend>

tesseract_python/swig/eigen.i

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ John Wason:
6666
template <typename T> int NumPyType() {return -1;};
6767

6868
template<> int NumPyType<double>() {return NPY_DOUBLE;};
69+
// TODO: Is there a cleaner way to deal with the weird type code on Windows?
70+
#ifndef _WIN32
6971
template<> int NumPyType<int>() {return NPY_INT;};
72+
#else
73+
template<> int NumPyType<int>() {return NPY_LONG;};
74+
#endif
75+
7076

7177
template <class Derived>
7278
bool ConvertFromNumpyToEigenMatrix(Eigen::MatrixBase<Derived>* out, PyObject* in)
@@ -82,7 +88,8 @@ John Wason:
8288
// Check data type
8389
else if (array_type(in) != NumPyType<typename Derived::Scalar>())
8490
{
85-
PyErr_SetString(PyExc_ValueError, "Type mismatch between NumPy and Eigen objects.");
91+
PyErr_Format(PyExc_ValueError, "Type mismatch between NumPy and Eigen objects: got code %d, expected %d", array_type(in),
92+
NumPyType<typename Derived::Scalar>());
8693
return false;
8794
}
8895
// Check dimensions
@@ -153,7 +160,8 @@ John Wason:
153160
// Check data type
154161
else if (array_type(out) != NumPyType<typename Derived::Scalar>())
155162
{
156-
PyErr_SetString(PyExc_ValueError, "Type mismatch between NumPy and Eigen objects.");
163+
PyErr_Format(PyExc_ValueError, "Type mismatch between NumPy and Eigen objects: got code %d, expected %d", array_type(in),
164+
NumPyType<typename Derived::Scalar>());
157165
return false;
158166
}
159167
// Check dimensions

tesseract_python/swig/tesseract_command_language_python.i

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
// tesseract_command_language
3939
#include <tesseract_command_language/core/waypoint.h>
4040
#include <tesseract_command_language/core/instruction.h>
41+
#include <tesseract_command_language/core/serialization.h>
4142
#include <tesseract_command_language/command_language.h>
42-
#include <tesseract_command_language/serialize.h>
43-
#include <tesseract_command_language/deserialize.h>
4443

4544
#include <tesseract_command_language/profile_dictionary.h>
4645

@@ -71,14 +70,20 @@
7170
%enddef
7271

7372
%define %tesseract_command_language_add_waypoint_type(TYPE)
74-
%template(cast_##TYPE) tesseract_planning::Waypoint::cast<tesseract_planning::TYPE>;
75-
%template(cast_const_##TYPE) tesseract_planning::Waypoint::cast_const<tesseract_planning::TYPE>;
73+
%rename(as_ ## TYPE) as;
74+
%template(as_ ## TYPE) tesseract_planning::Waypoint::as<tesseract_planning::TYPE>;
75+
%rename(as_const_ ## TYPE) as;
76+
%template(as_const_ ## TYPE) tesseract_planning::Waypoint::as<const tesseract_planning::TYPE>;
77+
%rename("%s") as;
7678
%tesseract_erasure_ctor(Waypoint,TYPE);
7779
%enddef
7880

7981
%define %tesseract_command_language_add_instruction_type(TYPE)
80-
%template(cast_##TYPE) tesseract_planning::Instruction::cast<tesseract_planning::TYPE>;
81-
%template(cast_const_##TYPE) tesseract_planning::Instruction::cast_const<tesseract_planning::TYPE>;
82+
%rename(as_ ## TYPE) as;
83+
%template(as_ ## TYPE) tesseract_planning::Instruction::as<tesseract_planning::TYPE>;
84+
%rename(as_const_ ## TYPE) as;
85+
%template(as_const_ ## TYPE) tesseract_planning::Instruction::as<const tesseract_planning::TYPE>;
86+
%rename("%s") as;
8287
%tesseract_erasure_ctor(Instruction,TYPE);
8388
%enddef
8489

@@ -90,9 +95,8 @@
9095
%include "tesseract_command_language_python_profile_dictionary_functions.h"
9196
%include "tesseract_command_language/core/waypoint.h"
9297
%include "tesseract_command_language/core/instruction.h"
98+
%include "tesseract_command_language/core/serialization.h"
9399
%include "tesseract_command_language/command_language.h"
94-
%include "tesseract_command_language/serialize.h"
95-
%include "tesseract_command_language/deserialize.h"
96100
%include "tesseract_command_language/utils/filter_functions.h"
97101
%include "tesseract_command_language/utils/utils.h"
98102
%include "tesseract_command_language/utils/get_instruction_utils.h"

tesseract_python/swig/tesseract_environment_python.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
%import "tesseract_kinematics_python.i"
3434
%import "tesseract_collision_python.i"
35+
%import "tesseract_srdf_python.i"
3536

3637
%{
3738

@@ -72,22 +73,21 @@
7273
%include "tesseract_environment/core/commands/add_link_command.h"
7374
%include "tesseract_environment/core/commands/add_kinematics_information_command.h"
7475
%include "tesseract_environment/core/commands/add_scene_graph_command.h"
75-
%include "tesseract_environment/core/commands/change_default_contact_margin_command.h"
7676
%include "tesseract_environment/core/commands/change_joint_acceleration_limits_command.h"
7777
%include "tesseract_environment/core/commands/change_joint_origin_command.h"
7878
%include "tesseract_environment/core/commands/change_joint_position_limits_command.h"
7979
%include "tesseract_environment/core/commands/change_joint_velocity_limits_command.h"
8080
%include "tesseract_environment/core/commands/change_link_collision_enabled_command.h"
8181
%include "tesseract_environment/core/commands/change_link_origin_command.h"
8282
%include "tesseract_environment/core/commands/change_link_visibility_command.h"
83-
%include "tesseract_environment/core/commands/change_pair_contact_margin_command.h"
8483
%include "tesseract_environment/core/commands/move_joint_command.h"
8584
%include "tesseract_environment/core/commands/move_link_command.h"
8685
%include "tesseract_environment/core/commands/remove_allowed_collision_command.h"
8786
%include "tesseract_environment/core/commands/remove_allowed_collision_link_command.h"
8887
%include "tesseract_environment/core/commands/remove_joint_command.h"
8988
%include "tesseract_environment/core/commands/remove_link_command.h"
9089
%include "tesseract_environment/core/commands/replace_joint_command.h"
90+
%include "tesseract_environment/core/commands/change_collision_margins_command.h"
9191

9292
%include "tesseract_environment/core/manipulator_manager.h"
9393
%include "tesseract_environment/core/state_solver.h"

tesseract_python/swig/tesseract_kinematics_python.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
//%import "tesseract_common_python.i"
3434
//%import "tesseract_geometry_python.i"
3535
%import "tesseract_scene_graph_python.i"
36+
%import "tesseract_srdf_python.i"
3637

3738
%{
3839

@@ -45,6 +46,7 @@
4546
#include <tesseract_common/status_code.h>
4647
#include <tesseract_geometry/geometries.h>
4748
#include <tesseract_scene_graph/resource_locator.h>
49+
#include <tesseract_srdf/kinematics_information.h>
4850

4951
// tesseract_kinematics
5052
#include <tesseract_kinematics/core/forward_kinematics.h>

tesseract_python/swig/tesseract_scene_graph_python.i

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535

3636
%{
3737

38+
#include <tesseract_common/status_code.h>
39+
#include <tesseract_scene_graph/resource_locator.h>
40+
3841
#include <boost/graph/adjacency_list.hpp>
3942
#include <boost/graph/directed_graph.hpp>
4043
#include <boost/graph/properties.hpp>
4144
#include <boost/graph/depth_first_search.hpp>
4245
#include <boost/graph/breadth_first_search.hpp>
4346

44-
#include <tesseract_common/status_code.h>
4547
#include <tesseract_geometry/geometries.h>
4648

4749
// tesseract_scene_graph
@@ -50,9 +52,6 @@
5052
#include <tesseract_scene_graph/allowed_collision_matrix.h>
5153
#include <tesseract_scene_graph/graph.h>
5254
#include <tesseract_scene_graph/resource_locator.h>
53-
#include <tesseract_scene_graph/kinematics_information.h>
54-
#include <tesseract_scene_graph/srdf_model.h>
55-
#include <tesseract_scene_graph/utils.h>
5655

5756
#include "tesseract_scene_graph_python_std_functions.h"
5857

@@ -71,6 +70,4 @@
7170
%include "tesseract_scene_graph/allowed_collision_matrix.h"
7271
%include "tesseract_scene_graph/graph.h"
7372
%include "tesseract_scene_graph/resource_locator.h"
74-
%include "tesseract_scene_graph/kinematics_information.h"
75-
%include "tesseract_scene_graph/srdf_model.h"
76-
%include "tesseract_scene_graph/utils.h"
73+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* @file tesseract_srdf_python.i
3+
* @brief The tesseract_scene_graph_python SWIG master file.
4+
*
5+
* @author John Wason
6+
* @date December 8, 2020
7+
* @version TODO
8+
* @bug No known bugs
9+
*
10+
* @copyright Copyright (c) 2020, Wason Technology, LLC
11+
*
12+
* @par License
13+
* Software License Agreement (Apache License)
14+
* @par
15+
* Licensed under the Apache License, Version 2.0 (the "License");
16+
* you may not use this file except in compliance with the License.
17+
* You may obtain a copy of the License at
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
* @par
20+
* Unless required by applicable law or agreed to in writing, software
21+
* distributed under the License is distributed on an "AS IS" BASIS,
22+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
* See the License for the specific language governing permissions and
24+
* limitations under the License.
25+
*/
26+
27+
%module(directors="1", package="tesseract.tesseract_srdf") tesseract_srdf_python
28+
29+
#pragma SWIG nowarn=473
30+
31+
%include "tesseract_swig_include.i"
32+
33+
%import "tesseract_scene_graph_python.i"
34+
35+
%{
36+
37+
#include <tesseract_common/status_code.h>
38+
#include <tesseract_scene_graph/resource_locator.h>
39+
40+
#include <tesseract_scene_graph/allowed_collision_matrix.h>
41+
#include <tesseract_common/collision_margin_data.h>
42+
#include <tesseract_geometry/geometries.h>
43+
44+
// tesseract_srdf
45+
#include <tesseract_srdf/kinematics_information.h>
46+
#include <tesseract_srdf/srdf_model.h>
47+
#include <tesseract_srdf/utils.h>
48+
49+
%}
50+
51+
// tesseract_srdf
52+
#define TESSERACT_SRDF_PUBLIC
53+
%include "tesseract_srdf/kinematics_information.h"
54+
%include "tesseract_srdf/srdf_model.h"
55+
%include "tesseract_srdf/utils.h"

tesseract_python/swig/tesseract_urdf_python.i

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,20 @@
3535

3636
%{
3737

38+
#include <tesseract_common/status_code.h>
39+
#include <tesseract_scene_graph/resource_locator.h>
40+
3841
#include <boost/graph/adjacency_list.hpp>
3942
#include <boost/graph/directed_graph.hpp>
4043
#include <boost/graph/properties.hpp>
4144
#include <boost/graph/depth_first_search.hpp>
4245
#include <boost/graph/breadth_first_search.hpp>
4346

44-
#include <tesseract_common/status_code.h>
4547
#include <tesseract_geometry/geometries.h>
4648

4749
// tesseract_urdf
4850
#include <tesseract_urdf/urdf_parser.h>
4951

5052
%}
5153

52-
%ignore parse(Eigen::Isometry3d& origin,const tinyxml2::XMLElement* xml_element,const int /*version*/);
53-
54-
%include "tesseract_urdf/origin.h"
55-
%include "tesseract_urdf/sphere.h"
56-
%include "tesseract_urdf/box.h"
57-
%include "tesseract_urdf/cylinder.h"
58-
%include "tesseract_urdf/cone.h"
59-
%include "tesseract_urdf/capsule.h"
60-
%include "tesseract_urdf/mesh.h"
61-
%include "tesseract_urdf/convex_mesh.h"
62-
%include "tesseract_urdf/sdf_mesh.h"
63-
%include "tesseract_urdf/octomap.h"
64-
%include "tesseract_urdf/calibration.h"
65-
%include "tesseract_urdf/dynamics.h"
66-
%include "tesseract_urdf/geometry.h"
67-
%include "tesseract_urdf/inertial.h"
68-
%include "tesseract_urdf/joint.h"
69-
%include "tesseract_urdf/limits.h"
70-
%include "tesseract_urdf/material.h"
71-
%include "tesseract_urdf/mimic.h"
72-
%include "tesseract_urdf/octree.h"
73-
%include "tesseract_urdf/point_cloud.h"
74-
%include "tesseract_urdf/safety_controller.h"
75-
%include "tesseract_urdf/collision.h"
76-
%include "tesseract_urdf/visual.h"
77-
%include "tesseract_urdf/link.h"
7854
%include "tesseract_urdf/urdf_parser.h"
79-
80-
81-
%rename("%s") parse;
82-
83-

0 commit comments

Comments
 (0)