Skip to content

Commit 7d75c5a

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents e408139 + d482c1d commit 7d75c5a

File tree

193 files changed

+2262
-1575
lines changed

Some content is hidden

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

193 files changed

+2262
-1575
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Checks: '-*,
1111
modernize-loop-convert,
1212
modernize-make-shared,
1313
modernize-make-unique,
14+
modernize-avoid-bind,
1415
misc-unused-parameters,
1516
readability-named-parameter,
1617
readability-redundant-smartptr-get,

.docker/ci/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ RUN \
2828
clang clang-format-12 clang-tidy clang-tools \
2929
ccache && \
3030
#
31-
# Fetch all dependencies from moveit2.repos
32-
# As of 5/2/2022, permissions need to be set explicitly.
33-
# See https://github.com/actions/checkout/issues/760.
34-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/geometric_shapes && \
35-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/moveit_resources && \
36-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/srdfdom && \
31+
# Globally disable git security
32+
# https://github.blog/2022-04-12-git-security-vulnerability-announced
33+
git config --global --add safe.directory "*" && \
3734
#
35+
# Fetch all dependencies from moveit2.repos
3836
vcs import src < src/moveit2/moveit2.repos && \
3937
if [ -r src/moveit2/moveit2_${ROS_DISTRO}.repos ] ; then vcs import src < src/moveit2/moveit2_${ROS_DISTRO}.repos ; fi && \
4038
#

.docker/source/Dockerfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ COPY . src/moveit2
1919
RUN --mount=type=cache,target=/root/.ccache/ \
2020
# Enable ccache
2121
PATH=/usr/lib/ccache:$PATH && \
22-
#
23-
# Fetch all dependencies from moveit2.repos
24-
# As of 5/2/2022, permissions need to be set explicitly.
25-
# See https://github.com/actions/checkout/issues/760.
26-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/geometric_shapes && \
27-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/moveit_resources && \
28-
git config --global --add safe.directory /home/runner/work/moveit2/moveit2/.work/upstream_ws/src/srdfdom && \
29-
#
22+
# Fetch required upstream sources for building
3023
vcs import src < src/moveit2/moveit2.repos && \
3124
if [ -r src/moveit2/moveit2_${ROS_DISTRO}.repos ] ; then vcs import src < src/moveit2/moveit2_${ROS_DISTRO}.repos ; fi && \
3225
#

MIGRATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ API changes in MoveIt releases
3939
- In case you start RViz in a namespace, the default topic for the trajectory visualization display now uses the relative instead of the absolute namespace (i.e. `<ns>/move_group/display_planned_path` instead of `/move_group/display_planned_path`).
4040
- `RobotState::attachBody()` now takes a unique_ptr instead of an owning raw pointer.
4141
- Moved the class `MoveItErrorCode` from both `moveit_ros_planning` and `moveit_ros_planning_interface` to `moveit_core`. The class now is in namespace `moveit::core`, access via `moveit::planning_interface` or `moveit_cpp::PlanningComponent` is deprecated.
42+
- End-effector markers in rviz are shown only if the eef's parent group is active _and_ the parent link is part of that group. Before, these conditions were _OR_-connected.
43+
You might need to define additional end-effectors.
4244

4345
## ROS Melodic
4446

moveit_commander/src/moveit_commander/move_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def go(self, joints=None, wait=True):
603603
elif joints is not None:
604604
try:
605605
self.set_joint_value_target(self.get_remembered_joint_values()[joints])
606-
except TypeError:
606+
except (KeyError, TypeError):
607607
self.set_joint_value_target(joints)
608608
if wait:
609609
return self._g.move()

moveit_commander/test/python_moveit_commander.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,21 @@
4343
import os
4444

4545
from moveit_msgs.msg import RobotState
46+
from sensor_msgs.msg import JointState
4647

4748
from moveit_commander import RobotCommander, PlanningSceneInterface
4849

4950

5051
class PythonMoveitCommanderTest(unittest.TestCase):
5152
PLANNING_GROUP = "manipulator"
53+
JOINT_NAMES = [
54+
"joint_1",
55+
"joint_2",
56+
"joint_3",
57+
"joint_4",
58+
"joint_5",
59+
"joint_6",
60+
]
5261

5362
@classmethod
5463
def setUpClass(self):
@@ -67,14 +76,7 @@ def test_enforce_bounds_empty_state(self):
6776
def test_enforce_bounds(self):
6877
in_msg = RobotState()
6978
in_msg.joint_state.header.frame_id = "base_link"
70-
in_msg.joint_state.name = [
71-
"joint_1",
72-
"joint_2",
73-
"joint_3",
74-
"joint_4",
75-
"joint_5",
76-
"joint_6",
77-
]
79+
in_msg.joint_state.name = self.JOINT_NAMES
7880
in_msg.joint_state.position = [0] * 6
7981
in_msg.joint_state.position[0] = 1000
8082

@@ -87,14 +89,7 @@ def test_get_current_state(self):
8789
expected_state = RobotState()
8890
expected_state.joint_state.header.frame_id = "base_link"
8991
expected_state.multi_dof_joint_state.header.frame_id = "base_link"
90-
expected_state.joint_state.name = [
91-
"joint_1",
92-
"joint_2",
93-
"joint_3",
94-
"joint_4",
95-
"joint_5",
96-
"joint_6",
97-
]
92+
expected_state.joint_state.name = self.JOINT_NAMES
9893
expected_state.joint_state.position = [0] * 6
9994
self.assertEqual(self.group.get_current_state(), expected_state)
10095

@@ -141,6 +136,25 @@ def test_validation(self):
141136
self.assertTrue(success3)
142137
self.assertTrue(self.group.execute(plan3))
143138

139+
def test_gogogo(self):
140+
current_joints = np.asarray(self.group.get_current_joint_values())
141+
142+
self.group.set_joint_value_target(current_joints)
143+
self.assertTrue(self.group.go(True))
144+
145+
self.assertTrue(self.group.go(current_joints))
146+
self.assertTrue(self.group.go(list(current_joints)))
147+
self.assertTrue(self.group.go(tuple(current_joints)))
148+
self.assertTrue(
149+
self.group.go(JointState(name=self.JOINT_NAMES, position=current_joints))
150+
)
151+
152+
self.group.remember_joint_values("current")
153+
self.assertTrue(self.group.go("current"))
154+
155+
current_pose = self.group.get_current_pose()
156+
self.assertTrue(self.group.go(current_pose))
157+
144158
def test_planning_scene_interface(self):
145159
planning_scene = PlanningSceneInterface()
146160

moveit_configs_utils/moveit_configs_utils/moveit_configs_builder.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,13 @@ class MoveItConfigsBuilder(ParameterBuilder):
240240
__config_dir_path = Path("config")
241241

242242
# Look-up for robot_name_moveit_config package
243-
def __init__(self, robot_name: str, robot_description="robot_description"):
244-
super().__init__(robot_name + "_moveit_config")
243+
def __init__(
244+
self,
245+
robot_name: str,
246+
robot_description="robot_description",
247+
package_name: Optional[str] = None,
248+
):
249+
super().__init__(package_name or (robot_name + "_moveit_config"))
245250
self.__moveit_configs.package_path = self._package_path
246251
self.__robot_name = robot_name
247252
setup_assistant_file = self._package_path / ".setup_assistant"
@@ -479,7 +484,7 @@ def planning_pipelines(
479484
# Special rule to add ompl planner_configs
480485
if "ompl" in self.__moveit_configs.planning_pipelines:
481486
ompl_config = self.__moveit_configs.planning_pipelines["ompl"]
482-
if "planner_configs" not in ompl_config.get("move_group", {}):
487+
if "planner_configs" not in ompl_config:
483488
ompl_config.update(load_yaml(default_folder / "ompl_defaults.yaml"))
484489

485490
return self

moveit_core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ if(BUILD_TESTING)
230230

231231
# These don't pass yet, disable them for now
232232
set(ament_cmake_copyright_FOUND TRUE)
233-
set(ament_cmake_cppcheck_FOUND TRUE)
234233
set(ament_cmake_cpplint_FOUND TRUE)
235234
set(ament_cmake_flake8_FOUND TRUE)
236235
set(ament_cmake_uncrustify_FOUND TRUE)

moveit_core/collision_detection/src/collision_matrix.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ bool AllowedCollisionMatrix::getAllowedCollision(const std::string& name1, const
295295
else if (!found1 && found2)
296296
fn = fn2;
297297
else if (found1 && found2)
298-
fn = std::bind(&andDecideContact, fn1, fn2, std::placeholders::_1);
298+
fn = [fn1, fn2](Contact& contact) { return andDecideContact(fn1, fn2, contact); };
299299
else
300300
return false;
301301
}
@@ -344,10 +344,14 @@ void AllowedCollisionMatrix::getAllEntryNames(std::vector<std::string>& names) c
344344
{
345345
names.clear();
346346
for (const auto& entry : entries_)
347-
if (!names.empty() && names.back() == entry.first)
348-
continue;
349-
else
350-
names.push_back(entry.first);
347+
names.push_back(entry.first);
348+
349+
for (const auto& item : default_entries_)
350+
{
351+
auto it = std::lower_bound(names.begin(), names.end(), item.first);
352+
if (it != names.end() && *it != item.first)
353+
names.insert(it, item.first);
354+
}
351355
}
352356

353357
void AllowedCollisionMatrix::getMessage(moveit_msgs::msg::AllowedCollisionMatrix& msg) const
@@ -358,7 +362,6 @@ void AllowedCollisionMatrix::getMessage(moveit_msgs::msg::AllowedCollisionMatrix
358362
msg.default_entry_values.clear();
359363

360364
getAllEntryNames(msg.entry_names);
361-
std::sort(msg.entry_names.begin(), msg.entry_names.end());
362365

363366
msg.entry_values.resize(msg.entry_names.size());
364367
for (std::size_t i = 0; i < msg.entry_names.size(); ++i)
@@ -389,7 +392,6 @@ void AllowedCollisionMatrix::print(std::ostream& out) const
389392
{
390393
std::vector<std::string> names;
391394
getAllEntryNames(names);
392-
std::sort(names.begin(), names.end());
393395

394396
std::size_t spacing = 4;
395397
for (auto& name : names)

moveit_core/collision_detection/src/collision_octomap_filter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,8 @@ bool sampleCloud(const octomap::point3d_list& cloud, const double& spacing, cons
247247
double a = 0, b = 0, c = 0, r2 = 0, r4 = 0, r6 = 0, a1 = 0, b1 = 0, c1 = 0, a2 = 0, b2 = 0, c2 = 0;
248248
bool wyvill = true;
249249

250-
octomap::point3d_list::const_iterator it;
251-
for (it = cloud.begin(); it != cloud.end(); ++it)
250+
for (const octomath::Vector3& v : cloud)
252251
{
253-
octomath::Vector3 v = (*it);
254-
255252
if (wyvill)
256253
{
257254
r2 = r * r;

moveit_core/collision_detection/src/world_diff.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ WorldDiff::WorldDiff()
5353
WorldDiff::WorldDiff(const WorldPtr& world) : world_(world)
5454
{
5555
observer_handle_ =
56-
world->addObserver(std::bind(&WorldDiff::notify, this, std::placeholders::_1, std::placeholders::_2));
56+
world->addObserver([this](const World::ObjectConstPtr& object, World::Action action) { notify(object, action); });
5757
}
5858

5959
WorldDiff::WorldDiff(WorldDiff& other)
@@ -64,8 +64,8 @@ WorldDiff::WorldDiff(WorldDiff& other)
6464
changes_ = other.changes_;
6565

6666
WorldWeakPtr(world).swap(world_);
67-
observer_handle_ =
68-
world->addObserver(std::bind(&WorldDiff::notify, this, std::placeholders::_1, std::placeholders::_2));
67+
observer_handle_ = world->addObserver(
68+
[this](const World::ObjectConstPtr& object, World::Action action) { notify(object, action); });
6969
}
7070
}
7171

@@ -90,7 +90,7 @@ void WorldDiff::reset(const WorldPtr& world)
9090

9191
WorldWeakPtr(world).swap(world_);
9292
observer_handle_ =
93-
world->addObserver(std::bind(&WorldDiff::notify, this, std::placeholders::_1, std::placeholders::_2));
93+
world->addObserver([this](const World::ObjectConstPtr& object, World::Action action) { notify(object, action); });
9494
}
9595

9696
void WorldDiff::setWorld(const WorldPtr& world)
@@ -105,7 +105,7 @@ void WorldDiff::setWorld(const WorldPtr& world)
105105
WorldWeakPtr(world).swap(world_);
106106

107107
observer_handle_ =
108-
world->addObserver(std::bind(&WorldDiff::notify, this, std::placeholders::_1, std::placeholders::_2));
108+
world->addObserver([this](const World::ObjectConstPtr& object, World::Action action) { notify(object, action); });
109109
world->notifyObserverAllObjects(observer_handle_, World::CREATE | World::ADD_SHAPE);
110110
}
111111

moveit_core/collision_detection/test/test_world.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ struct TestAction
222222
};
223223

224224
/* notification callback */
225-
static void TrackChangesNotify(TestAction* ta, const collision_detection::World::ObjectConstPtr& obj,
225+
static void TrackChangesNotify(TestAction& ta, const collision_detection::World::ObjectConstPtr& obj,
226226
collision_detection::World::Action action)
227227
{
228-
ta->obj_ = *obj;
229-
ta->action_ = action;
230-
ta->cnt_++;
228+
ta.obj_ = *obj;
229+
ta.action_ = action;
230+
ta.cnt_++;
231231
}
232232

233233
TEST(World, TrackChanges)
@@ -236,7 +236,10 @@ TEST(World, TrackChanges)
236236

237237
TestAction ta;
238238
collision_detection::World::ObserverHandle observer_ta;
239-
observer_ta = world.addObserver(std::bind(TrackChangesNotify, &ta, std::placeholders::_1, std::placeholders::_2));
239+
observer_ta = world.addObserver(
240+
[&ta](const collision_detection::World::ObjectConstPtr& object, collision_detection::World::Action action) {
241+
return TrackChangesNotify(ta, object, action);
242+
});
240243

241244
// Create some shapes
242245
shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);
@@ -267,7 +270,10 @@ TEST(World, TrackChanges)
267270

268271
TestAction ta2;
269272
collision_detection::World::ObserverHandle observer_ta2;
270-
observer_ta2 = world.addObserver(std::bind(TrackChangesNotify, &ta2, std::placeholders::_1, std::placeholders::_2));
273+
observer_ta2 = world.addObserver(
274+
[&ta2](const collision_detection::World::ObjectConstPtr& object, collision_detection::World::Action action) {
275+
return TrackChangesNotify(ta2, object, action);
276+
});
271277

272278
world.addToObject("obj2", cyl, Eigen::Isometry3d::Identity());
273279

@@ -305,7 +311,10 @@ TEST(World, TrackChanges)
305311

306312
TestAction ta3;
307313
collision_detection::World::ObserverHandle observer_ta3;
308-
observer_ta3 = world.addObserver(std::bind(TrackChangesNotify, &ta3, std::placeholders::_1, std::placeholders::_2));
314+
observer_ta3 = world.addObserver(
315+
[&ta3](const collision_detection::World::ObjectConstPtr& object, collision_detection::World::Action action) {
316+
return TrackChangesNotify(ta3, object, action);
317+
});
309318

310319
bool rm_good = world.removeShapeFromObject("obj2", cyl);
311320
EXPECT_TRUE(rm_good);
@@ -371,7 +380,10 @@ TEST(World, ObjectPoseAndSubframes)
371380

372381
TestAction ta;
373382
collision_detection::World::ObserverHandle observer_ta;
374-
observer_ta = world.addObserver(std::bind(TrackChangesNotify, &ta, std::placeholders::_1, std::placeholders::_2));
383+
observer_ta = world.addObserver(
384+
[&ta](const collision_detection::World::ObjectConstPtr& object, collision_detection::World::Action action) {
385+
return TrackChangesNotify(ta, object, action);
386+
});
375387

376388
// Create shapes
377389
shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);

moveit_core/collision_detection_bullet/src/collision_env_bullet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CollisionEnvBullet::CollisionEnvBullet(const moveit::core::RobotModelConstPtr& m
5252
{
5353
// request notifications about changes to new world
5454
observer_handle_ = getWorld()->addObserver(
55-
std::bind(&CollisionEnvBullet::notifyObjectChange, this, std::placeholders::_1, std::placeholders::_2));
55+
[this](const World::ObjectConstPtr& object, World::Action action) { notifyObjectChange(object, action); });
5656

5757
for (const std::pair<const std::string, urdf::LinkSharedPtr>& link : robot_model_->getURDF()->links_)
5858
{
@@ -66,7 +66,7 @@ CollisionEnvBullet::CollisionEnvBullet(const moveit::core::RobotModelConstPtr& m
6666
{
6767
// request notifications about changes to new world
6868
observer_handle_ = getWorld()->addObserver(
69-
std::bind(&CollisionEnvBullet::notifyObjectChange, this, std::placeholders::_1, std::placeholders::_2));
69+
[this](const World::ObjectConstPtr& object, World::Action action) { notifyObjectChange(object, action); });
7070

7171
for (const std::pair<const std::string, urdf::LinkSharedPtr>& link : robot_model_->getURDF()->links_)
7272
{
@@ -81,7 +81,7 @@ CollisionEnvBullet::CollisionEnvBullet(const CollisionEnvBullet& other, const Wo
8181
{
8282
// request notifications about changes to new world
8383
observer_handle_ = getWorld()->addObserver(
84-
std::bind(&CollisionEnvBullet::notifyObjectChange, this, std::placeholders::_1, std::placeholders::_2));
84+
[this](const World::ObjectConstPtr& object, World::Action action) { notifyObjectChange(object, action); });
8585

8686
for (const std::pair<const std::string, urdf::LinkSharedPtr>& link : other.robot_model_->getURDF()->links_)
8787
{
@@ -305,7 +305,7 @@ void CollisionEnvBullet::setWorld(const WorldPtr& world)
305305

306306
// request notifications about changes to new world
307307
observer_handle_ = getWorld()->addObserver(
308-
std::bind(&CollisionEnvBullet::notifyObjectChange, this, std::placeholders::_1, std::placeholders::_2));
308+
[this](const World::ObjectConstPtr& object, World::Action action) { notifyObjectChange(object, action); });
309309

310310
// get notifications any objects already in the new world
311311
getWorld()->notifyObserverAllObjects(observer_handle_, World::CREATE);

0 commit comments

Comments
 (0)