Skip to content
Closed
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
8 changes: 8 additions & 0 deletions rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,14 @@ class LifecycleNode : public node_interfaces::LifecycleNodeInterface,
const State &
deactivate(LifecycleNodeInterface::CallbackReturn & cb_return_code);

RCLCPP_LIFECYCLE_PUBLIC
const State &
raise_error();

RCLCPP_LIFECYCLE_PUBLIC
const State &
raise_error(LifecycleNodeInterface::CallbackReturn & cb_return_code);

RCLCPP_LIFECYCLE_PUBLIC
const State &
shutdown();
Expand Down
22 changes: 22 additions & 0 deletions rclcpp_lifecycle/src/lifecycle_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,28 @@ LifecycleNode::deactivate(LifecycleNodeInterface::CallbackReturn & cb_return_cod
lifecycle_msgs::msg::Transition::TRANSITION_DEACTIVATE, cb_return_code);
}

const State &
LifecycleNode::raise_error()
{
if(get_current_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this needs to be checked here. it will check the current state and get the reference to rcl_lifecycle_transition_t in rcl state_machine.

return impl_->trigger_transition(
lifecycle_msgs::msg::Transition::TRANSITION_ACTIVE_ERROR);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lifecycle_msgs::msg::Transition::TRANSITION_ACTIVE_ERROR);
rcl_lifecycle_error_label);

else
return impl_->trigger_transition(
lifecycle_msgs::msg::Transition::TRANSITION_INACTIVE_ERROR);
}

const State &
LifecycleNode::raise_error(LifecycleNodeInterface::CallbackReturn & cb_return_code)
{
if(get_current_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
return impl_->trigger_transition(
lifecycle_msgs::msg::Transition::TRANSITION_ACTIVE_ERROR, cb_return_code);
else
return impl_->trigger_transition(
lifecycle_msgs::msg::Transition::TRANSITION_INACTIVE_ERROR, cb_return_code);
}

const State &
LifecycleNode::shutdown()
{
Expand Down