Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install clang-format-14
run: sudo apt-get install clang-format-14
- name: Install clang-format-18
run: sudo apt-get install clang-format-18
- uses: pre-commit/action@v3.0.1
id: precommit
- name: Upload pre-commit changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
type: string
required: true
description: 'ROS distribution codename:'
default: noetic
default: humble

permissions:
contents: read # to fetch code (actions/checkout)
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 26.3.1
rev: 26.5.1
hooks:
- id: black
args: ["--line-length", "100"]
Expand All @@ -39,7 +39,7 @@ repos:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: clang-format-14
entry: clang-format-18
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ["-fallback-style=none", "-i"]
1 change: 1 addition & 0 deletions core/include/moveit/task_constructor/stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "utils.h"
#include <moveit/macros/class_forward.hpp>
#include <moveit/task_constructor/storage.h>
#include <string_view>
#include <vector>
#include <list>

Expand Down
10 changes: 4 additions & 6 deletions core/src/cost_terms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ Clearance::Clearance(bool with_world, bool cumulative, std::string group_propert
, distance_to_cost{ [](double d) { return 1.0 / (d + 1e-5); } } {}

double Clearance::operator()(const SubTrajectory& s, std::string& comment) const {
static const std::string PREFIX{ "Clearance: " };

collision_detection::DistanceRequest request;
request.type =
cumulative ? collision_detection::DistanceRequestType::SINGLE : collision_detection::DistanceRequestType::GLOBAL;
Expand Down Expand Up @@ -298,7 +296,7 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
} };

auto collision_comment = [=](const auto& distance) {
return fmt::format(PREFIX + "allegedly valid solution collides between '{}' and '{}'", distance.link_names[0],
return fmt::format("Clearance: allegedly valid solution collides between '{}' and '{}'", distance.link_names[0],
distance.link_names[1]);
};

Expand All @@ -313,10 +311,10 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
}
distance = distance_data.distance;
if (!cumulative)
comment = fmt::format(PREFIX + "distance {} between '{}' and '{}'", distance, distance_data.link_names[0],
comment = fmt::format("Clearance: distance {} between '{}' and '{}'", distance, distance_data.link_names[0],
distance_data.link_names[1]);
else
comment = fmt::format(PREFIX + "cumulative distance {}", distance);
comment = fmt::format("Clearance: cumulative distance {}", distance);
} else { // check trajectory
for (size_t i = 0; i < s.trajectory()->getWayPointCount(); ++i) {
auto distance_data = check_distance(state, s.trajectory()->getWayPoint(i));
Expand All @@ -327,7 +325,7 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
distance += distance_data.distance;
}
distance /= s.trajectory()->getWayPointCount();
comment = fmt::format(PREFIX + "average{} distance: {}", (cumulative ? " cumulative" : ""), distance);
comment = fmt::format("Clearance: average{} distance: {}", (cumulative ? " cumulative" : ""), distance);
}

return distance_to_cost(distance);
Expand Down
33 changes: 18 additions & 15 deletions core/src/stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Stage::Stage(StagePrivate* impl) : pimpl_(impl) {
assert(impl);
auto& p = properties();
p.declare<double>("timeout", "timeout per run (s)");
p.declare<std::string>("marker_ns", name(), "marker namespace");
p.declare<std::string_view>("marker_ns", name(), "marker namespace");
p.declare<TrajectoryExecutionInfo>("trajectory_execution_info", TrajectoryExecutionInfo(),
"settings used when executing the trajectory");

Expand Down Expand Up @@ -909,33 +909,34 @@ bool Connecting::compatible(const InterfaceState& from_state, const InterfaceSta
const planning_scene::PlanningSceneConstPtr& from = from_state.scene();
const planning_scene::PlanningSceneConstPtr& to = to_state.scene();

auto false_with_debug = [](auto... args) {
RCLCPP_DEBUG_STREAM(rclcpp::get_logger("Connecting"), fmt::format(args...));
auto false_with_debug = [](auto args...) {
RCLCPP_DEBUG_STREAM(rclcpp::get_logger("Connecting"), args);
return false;
};

if (from->getWorld()->size() != to->getWorld()->size())
return false_with_debug("{}: different number of collision objects", name());
if (from->getWorld()->size() != to->getWorld()->size()) {
return false_with_debug("{}: different number of collision objects", name().c_str());
}

// both scenes should have the same set of collision objects, at the same location
for (const auto& from_object_pair : *from->getWorld()) {
const std::string& from_object_name = from_object_pair.first;
const collision_detection::World::ObjectPtr& from_object = from_object_pair.second;
const collision_detection::World::ObjectConstPtr& to_object = to->getWorld()->getObject(from_object_name);
if (!to_object)
return false_with_debug("{}: object missing: {}", name(), from_object_name);
return false_with_debug("{}: object missing: {}", name().c_str(), from_object_name.c_str());

if (!(from_object->pose_.matrix() - to_object->pose_.matrix()).isZero(1e-4))
return false_with_debug("{}: different object pose: {}", name(), from_object_name);
return false_with_debug("{}: different object pose: {}", name().c_str(), from_object_name.c_str());

if (from_object->shape_poses_.size() != to_object->shape_poses_.size())
return false_with_debug("{}: different object shapes: {}", name(), from_object_name);
return false_with_debug("{}: different object shapes: {}", name().c_str(), from_object_name.c_str());

for (auto from_it = from_object->shape_poses_.cbegin(), from_end = from_object->shape_poses_.cend(),
to_it = to_object->shape_poses_.cbegin();
from_it != from_end; ++from_it, ++to_it)
if (!(from_it->matrix() - to_it->matrix()).isZero(1e-4))
return false_with_debug("{}: different shape pose: {}", name(), from_object_name);
return false_with_debug("{}: different shape pose: {}", name().c_str(), from_object_name.c_str());
}

// Also test for attached objects which have a different storage
Expand All @@ -944,31 +945,33 @@ bool Connecting::compatible(const InterfaceState& from_state, const InterfaceSta
from->getCurrentState().getAttachedBodies(from_attached);
to->getCurrentState().getAttachedBodies(to_attached);
if (from_attached.size() != to_attached.size())
return false_with_debug("{}: different number of objects", name());
return false_with_debug("{}: different number of objects", name().c_str());

for (const moveit::core::AttachedBody* from_object : from_attached) {
auto it = std::find_if(to_attached.cbegin(), to_attached.cend(),
[from_object](const moveit::core::AttachedBody* object) {
return object->getName() == from_object->getName();
});
if (it == to_attached.cend())
return false_with_debug("{}: object missing: {}", name(), from_object->getName());
return false_with_debug("{}: object missing: {}", name().c_str(), from_object->getName().c_str());

const moveit::core::AttachedBody* to_object = *it;
if (from_object->getAttachedLink() != to_object->getAttachedLink())
return false_with_debug("{}: different attach links: {} attached to {} vs. {}", //
name(), from_object->getName(), //
from_object->getAttachedLink()->getName(), to_object->getAttachedLink()->getName());
name().c_str(), from_object->getName().c_str(), //
from_object->getAttachedLink()->getName().c_str(),
to_object->getAttachedLink()->getName().c_str());

if (from_object->getShapes().size() != to_object->getShapes().size())
return false_with_debug("{}: different object shapes: {}", name(), from_object->getName());
return false_with_debug("{}: different object shapes: {}", name().c_str(), from_object->getName().c_str());

auto from_it = from_object->getShapePosesInLinkFrame().cbegin();
auto from_end = from_object->getShapePosesInLinkFrame().cend();
auto to_it = to_object->getShapePosesInLinkFrame().cbegin();
for (; from_it != from_end; ++from_it, ++to_it)
if (!(from_it->matrix() - to_it->matrix()).isZero(1e-4))
return false_with_debug("{}: different pose of attached object shape: {}", name(), from_object->getName());
return false_with_debug("{}: different pose of attached object shape: {}", name().c_str(),
from_object->getName().c_str());
}
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions core/test/test_move_relative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ TEST_F(PandaMoveRelativeCartesian, cartesianRotateAttachedIKFrame) {
TEST_F(PandaMoveRelativeJoint, jointOutsideBound) {
// move joint inside limit
auto initial_jpos = scene->getCurrentState().getJointPositions("panda_joint7");
move->setDirection([initial_jpos] {
return std::map<std::string, double>{ { "panda_joint7", 2.0 - *initial_jpos } };
move->setDirection(
[initial_jpos] { return std::map<std::string, double>{ { "panda_joint7", 2.0 - *initial_jpos } };
}());
EXPECT_TRUE(this->t.plan()) << "Plan should succeed, joint inside limit";

this->t.reset();

// move joint outside limit: 2.8973
move->setDirection([initial_jpos] {
return std::map<std::string, double>{ { "panda_joint7", 3.0 - *initial_jpos } };
move->setDirection(
[initial_jpos] { return std::map<std::string, double>{ { "panda_joint7", 3.0 - *initial_jpos } };
}());

EXPECT_FALSE(this->t.plan()) << "Plan should fail, joint outside limit";
Expand Down
23 changes: 7 additions & 16 deletions rviz_marker_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ find_package(ament_cmake REQUIRED)
find_package(moveit_common REQUIRED)
moveit_package()

set(THIS_PACKAGE_INCLUDE_DEPENDS
rclcpp
tf2_eigen
urdfdom_headers
geometry_msgs
std_msgs
visualization_msgs
)
find_package(urdfdom_headers REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(tf2_eigen REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)

foreach(dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${dependency} REQUIRED)
Expand All @@ -26,14 +23,8 @@ add_library(${PROJECT_NAME} SHARED
src/marker_creation.cpp
)

target_link_libraries(${PROJECT_NAME} PUBLIC
rclcpp::rclcpp
${tf2_eigen_TARGETS}
${urdfdom_headers_TARGETS}
${geometry_msgs_TARGETS}
${std_msgs_TARGETS}
${visualization_msgs_TARGETS}
)
target_link_libraries(${PROJECT_NAME}
Eigen3::Eigen tf2_eigen::tf2_eigen tf2_geometry_msgs::tf2_geometry_msgs urdfdom_headers::urdfdom_headers ${visualization_msgs_TARGETS})
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down
29 changes: 17 additions & 12 deletions visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.16)
project(moveit_task_constructor_visualization)
# Qt Stuff
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

find_package(ament_cmake REQUIRED)
find_package(fmt REQUIRED)
Expand All @@ -18,12 +21,13 @@ find_package(rviz_ogre_vendor REQUIRED)
# definition needed for boost/math/constants/constants.hpp included by Ogre to compile
add_definitions(-DBOOST_MATH_DISABLE_FLOAT128)

# Qt Stuff
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()


function(qt_wrap_cpp out)
qt_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()


set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
Expand All @@ -41,12 +45,13 @@ install(DIRECTORY icons DESTINATION share)
pluginlib_export_plugin_description_file(rviz_common motion_planning_tasks_rviz_plugin_description.xml)

ament_export_include_directories(include)
ament_export_libraries(motion_planning_tasks_utils
motion_planning_tasks_properties
motion_planning_tasks_rviz_plugin
moveit_task_visualization_tools
)
ament_export_dependencies(ament_cmake)





ament_export_dependencies(Core5Compat)
#ament_export_dependencies(ament_cmake)
ament_export_dependencies(Boost)
ament_export_dependencies(moveit_core)
ament_export_dependencies(moveit_ros_visualization)
Expand Down
15 changes: 8 additions & 7 deletions visualization/motion_planning_tasks/properties/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ find_package(yaml REQUIRED)

add_library(${MOVEIT_LIB_NAME} SHARED ${SOURCES})

target_link_libraries(${MOVEIT_LIB_NAME}
${QT_LIBRARIES} yaml
)
target_link_libraries(motion_planning_tasks_properties PUBLIC
moveit_task_constructor_core::moveit_task_constructor_core
moveit_task_constructor_core::moveit_task_constructor_core_stage_plugins
moveit_task_constructor_core::moveit_task_constructor_core_stages
rviz_common::rviz_common
)

target_include_directories(${MOVEIT_LIB_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PRIVATE ${YAML_INCLUDE_DIRS}
)
target_link_libraries(${MOVEIT_LIB_NAME}
${moveit_task_constructor_core_TARGETS}
${rviz_common_TARGETS}
)


install(TARGETS ${MOVEIT_LIB_NAME}
EXPORT export_${MOVEIT_LIB_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ QVariant RemoteSolutionModel::data(const QModelIndex& index, int role) const {
return item.creation_rank;
case 1:
if (std::isinf(item.cost))
return tr(u8"∞");
return tr("∞");
if (std::isnan(item.cost))
return QVariant();
return QLocale().toString(item.cost, 'f', 4);
Expand Down
4 changes: 2 additions & 2 deletions visualization/motion_planning_tasks/src/task_list_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ QVariant TaskListModel::horizontalHeader(int column, int role) {
case 0:
return tr("name");
case 1:
return tr(u8"✓");
return tr("✓"); // ✓
case 2:
return tr(u8"✗");
return tr("✗"); // ✗
case 3:
return tr("time");
}
Expand Down
7 changes: 5 additions & 2 deletions visualization/motion_planning_tasks/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(MOVEIT_LIB_NAME motion_planning_tasks_utils)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
set(SOURCES
flat_merge_proxy_model.cpp
tree_merge_proxy_model.cpp
Expand All @@ -8,7 +9,9 @@ set(SOURCES
add_library(${MOVEIT_LIB_NAME} SHARED ${SOURCES})

target_link_libraries(${MOVEIT_LIB_NAME}
${QT_LIBRARIES}
rclcpp::rclcpp
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Core
)
target_include_directories(${MOVEIT_LIB_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
Expand Down
Loading
Loading