Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs: match main-branch documentation #951

Open
wants to merge 1 commit into
base: humble
Choose a base branch
from
Open
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
43 changes: 26 additions & 17 deletions doc/tutorials/visualizing_in_rviz/visualizing_in_rviz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,42 @@ To test that this all worked, open a terminal in the workspace directory (rememb
2 Create a ROS executor and spin the node on a thread
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Before we can initialize MoveItVisualTools, we need to have a executor spinning on our ROS node.
This is necessary because of how MoveItVisualTools interacts with ROS services and topics.
Before we can initialize MoveItVisualTools, we need to have a executor spinning on our ROS node. This is necessary because of how MoveItVisualTools interacts with ROS services and topics. First, add the threading library to your includes at the top.

.. code-block:: C++

#include <thread> // <---- add this to the set of includes at the top

...
By creating and naming loggers, we are able to keep our program logs organized.

// Create a ROS logger
auto const logger = rclcpp::get_logger("hello_moveit");
.. code-block:: C++

// We spin up a SingleThreadedExecutor so MoveItVisualTools interact with ROS
rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(node);
auto spinner = std::thread([&executor]() { executor.spin(); });
// Create a ROS logger
auto const logger = rclcpp::get_logger("hello_moveit");

// Create the MoveIt MoveGroup Interface
...
Next, add your executor before creating the MoveIt MoveGroup Interface.

.. code-block:: C++

// Spin up a SingleThreadedExecutor for MoveItVisualTools to interact with ROS
rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(node);
auto spinner = std::thread([&executor]() { executor.spin(); });

// Create the MoveIt MoveGroup Interface

...

Finally, make sure to join the thread before exiting.

.. code-block:: C++

// Shutdown ROS
rclcpp::shutdown(); // <--- This will cause the spin function in the thread to return
spinner.join(); // <--- Join the thread before exiting
return 0;
}
// Shutdown ROS
rclcpp::shutdown(); // <--- This will cause the spin function in the thread to return
spinner.join(); // <--- Join the thread before exiting
return 0;

After each one of these changes, you should rebuild your workspace to make sure you don't have any syntax errors.
After making these changes, rebuild your workspace to make sure you dont have any syntax errors.
Copy link
Contributor

Choose a reason for hiding this comment

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

the ' character changed, please make sure you use the regular one instead of the backtick.:

  don't  # yes
  don`t  # no


3 Create and Initialize MoveItVisualTools
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down