Package Summary

Tags No category tags.
Version 0.20.3
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version humble
Last Updated 2023-01-10
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Audrow Nash
  • Michael Jeronimo

Authors

  • Jacob Perron
  • Mabel Zhang
README
No README found. No README in repository either.
CHANGELOG

Changelog for package action_tutorials_cpp

0.20.3 (2023-01-10)

0.20.2 (2022-05-10)

0.20.1 (2022-04-08)

0.20.0 (2022-03-01)

0.19.0 (2022-01-14)

0.18.0 (2021-12-17)

  • Update maintainers to Audrow Nash and Michael Jeronimo (#543)
  • Contributors: Audrow Nash

0.17.0 (2021-10-18)

0.16.0 (2021-08-11)

0.15.0 (2021-05-14)

0.14.2 (2021-04-26)

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

0.13.0 (2021-03-25)

0.12.1 (2021-03-18)

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Michael Jeronimo

0.10.1 (2020-09-21)

  • Update goal response callback signature (#463)
  • Contributors: Jacob Perron

0.10.0 (2020-06-17)

0.9.3 (2020-06-01)

0.9.2 (2020-05-26)

0.9.1 (2020-05-12)

0.9.0 (2020-04-30)

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

Package Summary

Tags No category tags.
Version 0.27.1
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version iron
Last Updated 2023-05-19
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Aditya Pande
  • Audrow Nash
  • Michael Jeronimo

Authors

  • Jacob Perron
  • Mabel Zhang

Action Server

In the constructor for FibonacciActionServer, an action server is created with callbacks that are called when a goal is received, when the goal is cancelled, and when the goal is accepted:

this->action_server_ = rclcpp_action::create_server<Fibonacci>(
  ...
  "fibonacci",
  std::bind(&FibonacciActionServer::handle_goal, this, _1, _2),
  std::bind(&FibonacciActionServer::handle_cancel, this, _1),
  std::bind(&FibonacciActionServer::handle_accepted, this, _1));

The handle_goal callback is called whenever a goal is sent to the action server by an action client. In the example code, the goal is accepted as long as the order is less than or equal to 46, otherwise it is rejected. This is to prevent potential integer overflow:

if (goal->order > 46) {
  return rclcpp_action::GoalResponse::REJECT;
}
return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE;

The handle_cancelled callback is called whenever an action client requests to cancel the goal being executed. In this case, the goal cancel request is always accepted.

The handle_accepted callback is called following the action server's acceptance of a goal. In this example, a thread is started to execute the goal:

std::thread{std::bind(&FibonacciActionServer::execute, this, _1), goal_handle}.detach();

The execution thread calculates the Fibonacci sequence up to order and publishes partial sequences as feedback as each item is added to the sequence.

A rclcpp::Rate object is used to sleep between the calculation of each item in order to represent a long-running task.

When execution is complete, the full sequence is returned to the action client. If the goal is cancelled during execution, no result is returned, however the caller may have received partial sequences as feedback up until cancelling.

Action Client

In the constructor for FibonacciActionClient, and action client for the fibonacci action is created:

this->client_ptr_ = rclcpp_action::create_client<Fibonacci>(
      ...
      "fibonacci");

A goal of type Fibonacci is created with order 10. The goal is sent asynchronously with callbacks registered for the goal response, the feedback, and the goal result:

auto send_goal_options = rclcpp_action::Client<Fibonacci>::SendGoalOptions();
send_goal_options.goal_response_callback =
  std::bind(&FibonacciActionClient::goal_response_callback, this, _1);
send_goal_options.feedback_callback =
  std::bind(&FibonacciActionClient::feedback_callback, this, _1, _2);
send_goal_options.result_callback =
  std::bind(&FibonacciActionClient::result_callback, this, _1);
this->client_ptr_->async_send_goal(goal_msg, send_goal_options);

There are three types of callback functions:

  • The goal_response_callback is called when the action server accepts or rejects the goal.
  • The feedback_callback is called whenever the action server sends goal execution feedback.
  • The goal_result_callback is called when the action server is finished executing the goal and returns the result of the goal which is the full or partial Fibonacci sequence.
CHANGELOG

Changelog for package action_tutorials_cpp

0.27.1 (2023-05-11)

0.27.0 (2023-04-13)

  • Change all ROS2 -> ROS 2. (#610)
  • Contributors: Chris Lalancette

0.26.0 (2023-04-11)

0.25.0 (2023-03-01)

0.24.1 (2023-02-24)

0.24.0 (2023-02-14)

  • Update the demos to C++17. (#594)
  • Add README\'s for action_tutorials. (#576)
  • [rolling] Update maintainers - 2022-11-07 (#589)
  • Contributors: Audrow Nash, Chris Lalancette, kagibson

0.23.0 (2022-11-02)

0.22.0 (2022-09-13)

  • Fix two small bugs in the fibonacci C++ tutorial. (#564)
  • Contributors: Chris Lalancette

0.21.0 (2022-04-29)

0.20.1 (2022-04-08)

0.20.0 (2022-03-01)

0.19.0 (2022-01-14)

0.18.0 (2021-12-17)

  • Update maintainers to Audrow Nash and Michael Jeronimo (#543)
  • Contributors: Audrow Nash

0.17.0 (2021-10-18)

0.16.0 (2021-08-11)

0.15.0 (2021-05-14)

0.14.2 (2021-04-26)

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

0.13.0 (2021-03-25)

0.12.1 (2021-03-18)

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Michael Jeronimo

0.10.1 (2020-09-21)

  • Update goal response callback signature (#463)
  • Contributors: Jacob Perron

0.10.0 (2020-06-17)

0.9.3 (2020-06-01)

0.9.2 (2020-05-26)

0.9.1 (2020-05-12)

0.9.0 (2020-04-30)

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

Package Summary

Tags No category tags.
Version 0.33.2
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version rolling
Last Updated 2024-03-28
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Aditya Pande
  • Audrow Nash

Authors

  • Jacob Perron
  • Mabel Zhang

Action Server

In the constructor for FibonacciActionServer, an action server is created with callbacks that are called when a goal is received, when the goal is cancelled, and when the goal is accepted:

this->action_server_ = rclcpp_action::create_server<Fibonacci>(
  this,
  "fibonacci",
  handle_goal,
  handle_cancel,
  handle_accepted);

The handle_goal callback is called whenever a goal is sent to the action server by an action client. In the example code, the goal is accepted as long as the order is less than or equal to 46, otherwise it is rejected. This is to prevent potential integer overflow:

if (goal->order > 46) {
  return rclcpp_action::GoalResponse::REJECT;
}
return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE;

The handle_cancelled callback is called whenever an action client requests to cancel the goal being executed. In this case, the goal cancel request is always accepted.

The handle_accepted callback is called following the action server's acceptance of a goal. In this example, a thread is started to execute the goal:

auto execute_in_thread = [this, goal_handle](){return this->execute(goal_handle);};
std::thread{execute_in_thread}.detach();

The execution thread calculates the Fibonacci sequence up to order and publishes partial sequences as feedback as each item is added to the sequence.

A rclcpp::Rate object is used to sleep between the calculation of each item in order to represent a long-running task.

When execution is complete, the full sequence is returned to the action client. If the goal is cancelled during execution, no result is returned, however the caller may have received partial sequences as feedback up until cancelling.

Action Client

In the constructor for FibonacciActionClient, and action client for the fibonacci action is created:

this->client_ptr_ = rclcpp_action::create_client<Fibonacci>(
      ...
      "fibonacci");

A goal of type Fibonacci is created with order 10. The goal is sent asynchronously with callbacks registered for the goal response, the feedback, and the goal result:

auto send_goal_options = rclcpp_action::Client<Fibonacci>::SendGoalOptions();
send_goal_options.goal_response_callback = [this](
  const GoalHandleFibonacci::SharedPtr & goal_handle)
{...};
send_goal_options.feedback_callback = [this](
  GoalHandleFibonacci::SharedPtr,
  const std::shared_ptr<const Fibonacci::Feedback> feedback)
{...};
send_goal_options.result_callback = [this](
  const GoalHandleFibonacci::WrappedResult & result)
{...};
this->client_ptr_->async_send_goal(goal_msg, send_goal_options);

There are three types of callback functions:

  • The goal_response_callback is called when the action server accepts or rejects the goal.
  • The feedback_callback is called whenever the action server sends goal execution feedback.
  • The goal_result_callback is called when the action server is finished executing the goal and returns the result of the goal which is the full or partial Fibonacci sequence.
CHANGELOG

Changelog for package action_tutorials_cpp

0.33.2 (2024-03-28)

  • Update maintainer list in package.xml files (#665)
  • Contributors: Michael Jeronimo

0.33.1 (2024-02-07)

0.33.0 (2024-01-24)

  • Fix format-security warning with clang. (#663)
  • Migrate std::bind calls to lambda expressions (#659)
  • Contributors: Chris Lalancette, Felipe Gomes de Melo

0.32.1 (2023-12-26)

0.32.0 (2023-11-06)

0.31.1 (2023-09-07)

0.31.0 (2023-08-21)

0.30.1 (2023-07-11)

0.30.0 (2023-06-12)

0.29.0 (2023-06-07)

0.28.1 (2023-05-11)

0.28.0 (2023-04-27)

0.27.0 (2023-04-13)

  • Change all ROS2 -> ROS 2. (#610)
  • Contributors: Chris Lalancette

0.26.0 (2023-04-11)

0.25.0 (2023-03-01)

0.24.1 (2023-02-24)

0.24.0 (2023-02-14)

  • Update the demos to C++17. (#594)
  • Add README\'s for action_tutorials. (#576)
  • [rolling] Update maintainers - 2022-11-07 (#589)
  • Contributors: Audrow Nash, Chris Lalancette, kagibson

0.23.0 (2022-11-02)

0.22.0 (2022-09-13)

  • Fix two small bugs in the fibonacci C++ tutorial. (#564)
  • Contributors: Chris Lalancette

0.21.0 (2022-04-29)

0.20.1 (2022-04-08)

0.20.0 (2022-03-01)

0.19.0 (2022-01-14)

0.18.0 (2021-12-17)

  • Update maintainers to Audrow Nash and Michael Jeronimo (#543)
  • Contributors: Audrow Nash

0.17.0 (2021-10-18)

0.16.0 (2021-08-11)

0.15.0 (2021-05-14)

0.14.2 (2021-04-26)

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

0.13.0 (2021-03-25)

0.12.1 (2021-03-18)

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Michael Jeronimo

0.10.1 (2020-09-21)

  • Update goal response callback signature (#463)
  • Contributors: Jacob Perron

0.10.0 (2020-06-17)

0.9.3 (2020-06-01)

0.9.2 (2020-05-26)

0.9.1 (2020-05-12)

0.9.0 (2020-04-30)

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

No version for distro noetic. Known supported distros are highlighted in the buttons above.
No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.

Package Summary

Tags No category tags.
Version 0.8.4
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version eloquent
Last Updated 2020-11-04
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Mabel Zhang
  • Michael Jeronimo

Authors

  • Jacob Perron
README
No README found. No README in repository either.
CHANGELOG

Changelog for package action_tutorials_cpp

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

No version for distro dashing. Known supported distros are highlighted in the buttons above.

Package Summary

Tags No category tags.
Version 0.14.4
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version galactic
Last Updated 2022-12-07
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Mabel Zhang
  • Michael Jeronimo

Authors

  • Jacob Perron
README
No README found. No README in repository either.
CHANGELOG

Changelog for package action_tutorials_cpp

0.14.4 (2022-12-06)

0.14.3 (2021-05-10)

0.14.2 (2021-04-26)

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

0.13.0 (2021-03-25)

0.12.1 (2021-03-18)

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Michael Jeronimo

0.10.1 (2020-09-21)

  • Update goal response callback signature (#463)
  • Contributors: Jacob Perron

0.10.0 (2020-06-17)

0.9.3 (2020-06-01)

0.9.2 (2020-05-26)

0.9.1 (2020-05-12)

0.9.0 (2020-04-30)

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

Package Summary

Tags No category tags.
Version 0.9.4
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/demos.git
VCS Type git
VCS Version foxy
Last Updated 2022-07-25
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

C++ action tutorial cpp code

Additional Links

No additional links.

Maintainers

  • Mabel Zhang
  • Michael Jeronimo

Authors

  • Jacob Perron
README
No README found. No README in repository either.
CHANGELOG

Changelog for package action_tutorials_cpp

0.9.4 (2022-07-25)

  • Update maintainer list for Foxy (#471)
  • Contributors: Michael Jeronimo

0.9.3 (2020-06-01)

0.9.2 (2020-05-26)

0.9.1 (2020-05-12)

0.9.0 (2020-04-30)

0.8.4 (2019-11-19)

  • Return without sending goal if exiting (#415)
  • Contributors: Shane Loretz

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

0.8.1 (2019-10-23)

0.8.0 (2019-09-26)

  • Add action tutorials in C++ (#378)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

0.7.2 (2019-05-08)

0.7.1 (2019-04-26)

0.7.0 (2019-04-14)

0.6.2 (2019-01-15)

0.6.1 (2018-12-12)

0.6.0 (2018-12-07)

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

0.4.0 (2017-12-08)

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged action_tutorials_cpp at Robotics Stack Exchange

No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.