Skip to content

Commit 9528692

Browse files
authored
Avoid segfault and improve error warnings (#15)
1 parent 6e9fe66 commit 9528692

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

capabilities/src/execute_task_solution_capability.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include <fmt/format.h>
4747

4848
namespace {
49-
49+
const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_task_constructor_visualization.execute_task_solution");
5050
// TODO: move to moveit::core::RobotModel
5151
const moveit::core::JointModelGroup* findJointModelGroup(const moveit::core::RobotModel& model,
5252
const std::vector<std::string>& joints) {
@@ -78,8 +78,6 @@ const moveit::core::JointModelGroup* findJointModelGroup(const moveit::core::Rob
7878
}
7979
} // namespace
8080

81-
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_task_constructor_visualization.execute_task_solution");
82-
8381
namespace move_group {
8482

8583
ExecuteTaskSolutionCapability::ExecuteTaskSolutionCapability() : MoveGroupCapability("ExecuteTaskSolution") {}

core/src/container.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ Stage* ContainerBase::findChild(const std::string& name) const {
345345
else if (auto* parent = dynamic_cast<const ContainerBase*>(child.get()))
346346
return parent->findChild(name.substr(pos + 1));
347347
}
348+
RCLCPP_DEBUG_STREAM(rclcpp::get_logger("ContainerBase"), fmt::format("Child '{}' not found", name));
348349
return nullptr;
349350
}
350351

core/src/stages/compute_ik.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ void ComputeIK::compute() {
314314

315315
link = scene->getCurrentState().getRigidlyConnectedParentLinkModel(ik_pose_msg.header.frame_id);
316316

317+
if (!link) {
318+
RCLCPP_WARN_STREAM(
319+
LOGGER, fmt::format("ik frame '{}' is not rigidly connected to any link", ik_pose_msg.header.frame_id));
320+
return;
321+
}
317322
// transform target pose such that ik frame will reach there if link does
318323
target_pose = target_pose * ik_pose.inverse() * scene->getCurrentState().getFrameTransform(link->getName());
319324
}

0 commit comments

Comments
 (0)