Skip to content

Commit 5d2857b

Browse files
committed
Merge branches 'simplify-node-creation' and 'master' into ros2
2 parents 046309d + a0c0064 commit 5d2857b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+230
-149
lines changed

.github/workflows/prerelease.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ name: pre-release
55

66
on:
77
workflow_dispatch:
8+
inputs:
9+
ROS_DISTRO:
10+
type: string
11+
required: true
12+
description: 'ROS distribution codename:'
13+
default: noetic
814

915
permissions:
1016
contents: read # to fetch code (actions/checkout)
1117

1218
jobs:
1319
default:
14-
strategy:
15-
matrix:
16-
distro: [noetic]
17-
1820
env:
19-
# https://github.com/ros-industrial/industrial_ci/issues/666
20-
BUILDER: catkin_make_isolated
21-
ROS_DISTRO: ${{ matrix.distro }}
21+
ROS_DISTRO: ${{ inputs.ROS_DISTRO }}
2222
PRERELEASE: true
2323
BASEDIR: ${{ github.workspace }}/.work
2424

25-
name: "${{ matrix.distro }}"
25+
name: "${{ inputs.ROS_DISTRO }}"
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: "Free up disk space"

capabilities/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ find_package(moveit_common REQUIRED)
88
moveit_package()
99
find_package(moveit_core REQUIRED)
1010
find_package(moveit_ros_move_group REQUIRED)
11+
find_package(moveit_ros_planning REQUIRED)
12+
find_package(moveit_task_constructor_core REQUIRED)
1113
find_package(moveit_task_constructor_msgs REQUIRED)
1214
find_package(pluginlib REQUIRED)
1315
find_package(rclcpp_action REQUIRED)
@@ -21,6 +23,8 @@ ament_target_dependencies(${PROJECT_NAME}
2123
rclcpp_action
2224
moveit_core
2325
moveit_ros_move_group
26+
moveit_ros_planning
27+
moveit_task_constructor_core
2428
moveit_task_constructor_msgs
2529
)
2630

@@ -31,6 +35,8 @@ install(TARGETS ${PROJECT_NAME}
3135
pluginlib_export_plugin_description_file(moveit_ros_move_group capabilities_plugin_description.xml)
3236
ament_export_dependencies(moveit_core)
3337
ament_export_dependencies(moveit_ros_move_group)
38+
ament_export_dependencies(moveit_ros_planning)
39+
ament_export_dependencies(moveit_task_constructor_core)
3440
ament_export_dependencies(moveit_task_constructor_msgs)
3541
ament_export_dependencies(pluginlib)
3642
ament_export_dependencies(rclcpp_action)

core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ find_package(moveit_core REQUIRED)
1111
find_package(moveit_ros_planning REQUIRED)
1212
find_package(moveit_ros_planning_interface REQUIRED)
1313
find_package(moveit_task_constructor_msgs REQUIRED)
14+
find_package(py_binding_tools REQUIRED)
1415
find_package(rclcpp REQUIRED)
1516
find_package(rviz_marker_tools REQUIRED)
1617
find_package(tf2_eigen REQUIRED)

core/include/moveit/python/task_constructor/properties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include <pybind11/smart_holder.h>
4-
#include <moveit/python/pybind_rosmsg_typecasters.h>
4+
#include <py_binding_tools/ros_msg_typecasters.h>
55
#include <moveit/task_constructor/properties.h>
66
#include <boost/any.hpp>
77
#include <typeindex>

core/include/moveit/task_constructor/stage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ class Generator : public ComputeBase
365365

366366
virtual bool canCompute() const = 0;
367367
virtual void compute() = 0;
368+
void spawn(InterfaceState&& from, InterfaceState&& to, SubTrajectory&& trajectory);
368369
void spawn(InterfaceState&& state, SubTrajectory&& trajectory);
369370
void spawn(InterfaceState&& state, double cost) {
370371
SubTrajectory trajectory;

core/include/moveit/task_constructor/stage_p.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class StagePrivate
136136
void sendBackward(InterfaceState&& from, const InterfaceState& to, const SolutionBasePtr& solution);
137137
template <Interface::Direction>
138138
inline void send(const InterfaceState& start, InterfaceState&& end, const SolutionBasePtr& solution);
139+
void spawn(InterfaceState&& from, InterfaceState&& to, const SolutionBasePtr& solution);
139140
void spawn(InterfaceState&& state, const SolutionBasePtr& solution);
140141
void connect(const InterfaceState& from, const InterfaceState& to, const SolutionBasePtr& solution);
141142

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*********************************************************************
2+
* Software License Agreement (BSD License)
3+
*
4+
* Copyright (c) 2024, Sherbrooke University
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions
9+
* are met:
10+
*
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above
14+
* copyright notice, this list of conditions and the following
15+
* disclaimer in the documentation and/or other materials provided
16+
* with the distribution.
17+
* * Neither the name of Bielefeld University nor the names of its
18+
* contributors may be used to endorse or promote products derived
19+
* from this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
* POSSIBILITY OF SUCH DAMAGE.
33+
*********************************************************************/
34+
/* Authors: Captain Yoshi */
35+
36+
#pragma once
37+
38+
#include <moveit/task_constructor/stage.h>
39+
#include <moveit/planning_scene/planning_scene.h>
40+
41+
namespace moveit {
42+
namespace task_constructor {
43+
namespace stages {
44+
45+
/** no-op stage, which doesn't modify the interface state nor adds a trajectory.
46+
* However, it can be used to store custom stage properties,
47+
* which in turn can be queried post-planning to steer the execution.
48+
*/
49+
50+
class NoOp : public PropagatingEitherWay
51+
{
52+
public:
53+
NoOp(const std::string& name = "no-op") : PropagatingEitherWay(name){};
54+
55+
private:
56+
bool compute(const InterfaceState& state, planning_scene::PlanningScenePtr& scene, SubTrajectory& /*trajectory*/,
57+
Interface::Direction /*dir*/) override {
58+
scene = state.scene()->diff();
59+
return true;
60+
};
61+
};
62+
} // namespace stages
63+
} // namespace task_constructor
64+
} // namespace moveit

core/include/moveit/task_constructor/storage.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ class InterfaceState
9595
*/
9696
struct Priority : std::tuple<Status, unsigned int, double>
9797
{
98-
Priority(unsigned int depth, double cost, Status status = ENABLED)
99-
: std::tuple<Status, unsigned int, double>(status, depth, cost) {
100-
assert(std::isfinite(cost));
101-
}
98+
Priority(unsigned int depth, double cost, Status status)
99+
: std::tuple<Status, unsigned int, double>(status, depth, cost) {}
100+
Priority(unsigned int depth, double cost) : Priority(depth, cost, std::isfinite(cost) ? ENABLED : PRUNED) {}
102101
// Constructor copying depth and cost, but modifying its status
103102
Priority(const Priority& other, Status status) : Priority(other.depth(), other.cost(), status) {}
104103

core/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<depend>moveit_ros_planning</depend>
2020
<depend>moveit_ros_planning_interface</depend>
2121
<depend>moveit_task_constructor_msgs</depend>
22+
<depend>py_binding_tools</depend>
2223
<depend>rclcpp</depend>
2324
<depend>rviz_marker_tools</depend>
2425
<depend>tf2_eigen</depend>

core/python/bindings/src/core.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ void setForwardedProperties(Stage& self, const py::object& names) {
8686
for (auto item : names)
8787
s.emplace(item.cast<std::string>());
8888
} catch (const py::cast_error& e) {
89-
// manually translate cast_error to type error
90-
PyErr_SetString(PyExc_TypeError, e.what());
91-
throw py::error_already_set();
89+
// translate cast_error to type_error with an informative message
90+
throw py::type_error("Expecting a string or a list of strings");
9291
}
9392
self.setForwardedProperties(s);
9493
}

0 commit comments

Comments
 (0)