Skip to content

[nav2_rviz_plugins] want to make a new 'cancel button' in nav2 panel region #1068

@hyunseok-yang

Description

@hyunseok-yang

Bug report

It is not a bug.

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • dashing
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

I tried to make a new button as a 'navigation cancellation' on panel side.
Creating a Qt GUI button on a panel was easy but it's hard to implement action cancellation when I set the goal from external method not a inside of rviz2.

external method means......
I just call nav2 goal via ros2cli

ros2 action send_goal /NavigateToPose nav2_msgs/action/NavigateToPose "pose: {header: {frame_id: map}, pose: {position: {x: 6.0, y: 2.0, z: 0.0}, orientation:{x: 0.0, y: 0.0, z: 0, w: 1.0000000}}}"

Waiting for an action server to become available...
Sending goal:
pose:
header:
stamp:
sec: 0
nanosec: 0
frame_id: map
pose:
position:
x: 6.0
y: 2.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0

Goal accepted with ID: cfa77d4f903747e5b2104315bc0a2840

Result:
result:
structure_needs_at_least_one_member: 0

void
Nav2Panel::onCancelButtonPressed()
{
  auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
  if (rclcpp::spin_until_future_complete(client_node_, future_cancel) !=
      rclcpp::executor::FutureReturnCode::SUCCESS)
  {
    RCLCPP_ERROR(client_node_->get_logger(), "Failed to cancel goal");
    return;
  }
 }

I don't know how to get goal_handle without async_send_goal() function.

Expected behavior

It can easily cancel the navigation(path following?) in rviz panel wherever set the goal.

Actual behavior

navigation stop through cancel button in rviz panel

Additional information


Feature request

Feature description

Implementation considerations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions