From fc0bff5c256a85e53b92beb015e0f67d35a51721 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 11:31:46 +0000 Subject: [PATCH 1/9] Fix headers --- .../src/planning_scene_ros_api_tutorial.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp index 92a6fe6124..9a7af3d93f 100644 --- a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp +++ b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp @@ -34,25 +34,25 @@ /* Author: Sachin Chitta, Michael Lautman */ -#include -#include +#include +#include // MoveIt -#include -#include -#include -#include -#include +#include +#include +// #include +#include +// #include #include #include #include -#include +// #include int main(int argc, char** argv) { - ros::init(argc, argv, "planning_scene_ros_api_tutorial"); + rclcpp::init(argc, argv, "planning_scene_ros_api_tutorial"); ros::AsyncSpinner spinner(1); spinner.start(); From b7cf3c2a47194cd7c0dbadbb6760e0102c92aed4 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 12:32:31 +0000 Subject: [PATCH 2/9] Port source and launch files of planning scene ROS API --- CMakeLists.txt | 2 +- doc/planning_scene_ros_api/CMakeLists.txt | 15 ++-- .../planning_scene_ros_api_tutorial.launch | 6 -- .../planning_scene_ros_api_tutorial.launch.py | 18 +++++ .../src/planning_scene_ros_api_tutorial.cpp | 73 ++++++++++--------- 5 files changed, 69 insertions(+), 45 deletions(-) delete mode 100644 doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch create mode 100644 doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bb11f1726..fc3691a84c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ include_directories(${THIS_PACKAGE_INCLUDE_DIRS}) # add_subdirectory(doc/pick_place) # add_subdirectory(doc/planning) # add_subdirectory(doc/planning_scene) -# add_subdirectory(doc/planning_scene_ros_api) +add_subdirectory(doc/planning_scene_ros_api) add_subdirectory(doc/quickstart_in_rviz) # add_subdirectory(doc/robot_model_and_robot_state) # add_subdirectory(doc/state_display) diff --git a/doc/planning_scene_ros_api/CMakeLists.txt b/doc/planning_scene_ros_api/CMakeLists.txt index 1c6c285ac9..bcaee07178 100644 --- a/doc/planning_scene_ros_api/CMakeLists.txt +++ b/doc/planning_scene_ros_api/CMakeLists.txt @@ -1,8 +1,13 @@ add_executable(planning_scene_ros_api_tutorial src/planning_scene_ros_api_tutorial.cpp) -target_link_libraries(planning_scene_ros_api_tutorial - ${catkin_LIBRARIES} ${Boost_LIBRARIES}) -install(TARGETS planning_scene_ros_api_tutorial DESTINATION - ${CATKIN_PACKAGE_BIN_DESTINATION}) +target_include_directories(planning_scene_ros_api_tutorial + PUBLIC include) +ament_target_dependencies(planning_scene_ros_api_tutorial + ${THIS_PACKAGE_INCLUDE_DEPENDS} Boost) -install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) +install(TARGETS planning_scene_ros_api_tutorial + DESTINATION lib/${PROJECT_NAME} +) +install(DIRECTORY launch + DESTINATION share/${PROJECT_NAME} +) diff --git a/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch b/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch deleted file mode 100644 index 0485754001..0000000000 --- a/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py b/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py new file mode 100644 index 0000000000..2c061cc790 --- /dev/null +++ b/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py @@ -0,0 +1,18 @@ +import os +import yaml +from launch import LaunchDescription +from launch_ros.actions import Node +from ament_index_python.packages import get_package_share_directory + + +def generate_launch_description(): + + # Planning Scene ROS API Tutorial executable + planning_scene_ros_api_tutorial = Node( + name="planning_scene_ros_api_tutorial", + package="moveit2_tutorials", + executable="planning_scene_ros_api_tutorial", + output="screen", + ) + + return LaunchDescription([planning_scene_ros_api_tutorial]) diff --git a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp index 9a7af3d93f..9c86de8b3d 100644 --- a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp +++ b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp @@ -40,30 +40,36 @@ // MoveIt #include #include -// #include +#include #include -// #include +#include #include #include #include // #include +#include + +static const rclcpp::Logger LOGGER = rclcpp::get_logger("planning_scene_ros_api_tutorial"); int main(int argc, char** argv) { - rclcpp::init(argc, argv, "planning_scene_ros_api_tutorial"); - ros::AsyncSpinner spinner(1); - spinner.start(); - - ros::NodeHandle node_handle; + rclcpp::init(argc, argv); + rclcpp::NodeOptions node_options; + node_options.automatically_declare_parameters_from_overrides(true); + auto node = rclcpp::Node::make_shared("planning_scene_ros_api_tutorial", node_options); + + rclcpp::executors::SingleThreadedExecutor executor; + executor.add_node(node); + std::thread([&executor]() { executor.spin(); }).detach(); // BEGIN_TUTORIAL // // Visualization // ^^^^^^^^^^^^^ // The package MoveItVisualTools provides many capabilities for visualizing objects, robots, // and trajectories in RViz as well as debugging tools such as step-by-step introspection of a script. - moveit_visual_tools::MoveItVisualTools visual_tools("panda_link0"); + rviz_visual_tools::RvizVisualTools visual_tools("panda_link0", "planning_scene_ros_api_tutorial", node); visual_tools.deleteAllMarkers(); // ROS API @@ -77,11 +83,11 @@ int main(int argc, char** argv) // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // We create a publisher and wait for subscribers. // Note that this topic may need to be remapped in the launch file. - ros::Publisher planning_scene_diff_publisher = node_handle.advertise("planning_scene", 1); - ros::WallDuration sleep_t(0.5); - while (planning_scene_diff_publisher.getNumSubscribers() < 1) + rclcpp::Publisher::SharedPtr planning_scene_diff_publisher = + node->create_publisher("planning_scene", 1); + while (planning_scene_diff_publisher->get_subscription_count() < 1) { - sleep_t.sleep(); + rclcpp::sleep_for(std::chrono::milliseconds(500)); } visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to start the demo"); @@ -90,7 +96,7 @@ int main(int argc, char** argv) // We will use this message to add or // subtract the object from the world // and to attach the object to the robot. - moveit_msgs::AttachedCollisionObject attached_object; + moveit_msgs::msg::AttachedCollisionObject attached_object; attached_object.link_name = "panda_hand"; /* The header must contain a valid TF frame*/ attached_object.object.header.frame_id = "panda_hand"; @@ -98,12 +104,12 @@ int main(int argc, char** argv) attached_object.object.id = "box"; /* A default pose */ - geometry_msgs::Pose pose; + geometry_msgs::msg::Pose pose; pose.position.z = 0.11; pose.orientation.w = 1.0; /* Define a box to be attached */ - shape_msgs::SolidPrimitive primitive; + shape_msgs::msg::SolidPrimitive primitive; primitive.type = primitive.BOX; primitive.dimensions.resize(3); primitive.dimensions[0] = 0.075; @@ -127,11 +133,11 @@ int main(int argc, char** argv) // the set of collision objects in the "world" part of the // planning scene. Note that we are using only the "object" // field of the attached_object message here. - ROS_INFO("Adding the object into the world at the location of the hand."); - moveit_msgs::PlanningScene planning_scene; + RCLCPP_INFO(LOGGER, "Adding the object into the world at the location of the hand."); + moveit_msgs::msg::PlanningScene planning_scene; planning_scene.world.collision_objects.push_back(attached_object.object); planning_scene.is_diff = true; - planning_scene_diff_publisher.publish(planning_scene); + planning_scene_diff_publisher->publish(planning_scene); visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); // Interlude: Synchronous vs Asynchronous updates @@ -148,13 +154,14 @@ int main(int argc, char** argv) // inserted for visualization purposes asynchronous updates do not pose a problem), // it would is perfectly justified to replace the planning_scene_diff_publisher // by the following service client: - ros::ServiceClient planning_scene_diff_client = - node_handle.serviceClient("apply_planning_scene"); - planning_scene_diff_client.waitForExistence(); + rclcpp::Client::SharedPtr planning_scene_diff_client = + node->create_client("apply_planning_scene"); + planning_scene_diff_client->wait_for_service(); // and send the diffs to the planning scene via a service call: - moveit_msgs::ApplyPlanningScene srv; - srv.request.scene = planning_scene; - planning_scene_diff_client.call(srv); + auto request = std::make_shared(); + request->scene = planning_scene; + planning_scene_diff_client->async_send_request(request); + // moveit_msgs::srv::ApplyPlanningScene srv; // Note that this does not continue until we are sure the diff has been applied. // // Attach an object to the robot @@ -169,7 +176,7 @@ int main(int argc, char** argv) // * Attaching the object to the robot /* First, define the REMOVE object message*/ - moveit_msgs::CollisionObject remove_object; + moveit_msgs::msg::CollisionObject remove_object; remove_object.id = "box"; remove_object.header.frame_id = "panda_hand"; remove_object.operation = remove_object.REMOVE; @@ -178,12 +185,12 @@ int main(int argc, char** argv) // attached objects or collisions objects by clearing those fields // first. /* Carry out the REMOVE + ATTACH operation */ - ROS_INFO("Attaching the object to the hand and removing it from the world."); + RCLCPP_INFO(LOGGER, "Attaching the object to the hand and removing it from the world."); planning_scene.world.collision_objects.clear(); planning_scene.world.collision_objects.push_back(remove_object); planning_scene.robot_state.attached_collision_objects.push_back(attached_object); planning_scene.robot_state.is_diff = true; - planning_scene_diff_publisher.publish(planning_scene); + planning_scene_diff_publisher->publish(planning_scene); visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); @@ -194,7 +201,7 @@ int main(int argc, char** argv) // * Re-introducing the object into the environment /* First, define the DETACH object message*/ - moveit_msgs::AttachedCollisionObject detach_object; + moveit_msgs::msg::AttachedCollisionObject detach_object; detach_object.object.id = "box"; detach_object.link_name = "panda_hand"; detach_object.object.operation = attached_object.object.REMOVE; @@ -203,14 +210,14 @@ int main(int argc, char** argv) // attached objects or collisions objects by clearing those fields // first. /* Carry out the DETACH + ADD operation */ - ROS_INFO("Detaching the object from the robot and returning it to the world."); + RCLCPP_INFO(LOGGER, "Detaching the object from the robot and returning it to the world."); planning_scene.robot_state.attached_collision_objects.clear(); planning_scene.robot_state.attached_collision_objects.push_back(detach_object); planning_scene.robot_state.is_diff = true; planning_scene.world.collision_objects.clear(); planning_scene.world.collision_objects.push_back(attached_object.object); planning_scene.is_diff = true; - planning_scene_diff_publisher.publish(planning_scene); + planning_scene_diff_publisher->publish(planning_scene); visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); @@ -221,15 +228,15 @@ int main(int argc, char** argv) // Note, also how we make sure that the diff message contains no other // attached objects or collisions objects by clearing those fields // first. - ROS_INFO("Removing the object from the world."); + RCLCPP_INFO(LOGGER, "Removing the object from the world."); planning_scene.robot_state.attached_collision_objects.clear(); planning_scene.world.collision_objects.clear(); planning_scene.world.collision_objects.push_back(remove_object); - planning_scene_diff_publisher.publish(planning_scene); + planning_scene_diff_publisher->publish(planning_scene); // END_TUTORIAL visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to end the demo"); - ros::shutdown(); + rclcpp::shutdown(); return 0; } From 97cd9fb865f20972c1f1674840c12ccb137ae522 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 12:51:58 +0000 Subject: [PATCH 3/9] Fix prompts and add xterm to launch --- .../planning_scene_ros_api_tutorial.launch.py | 1 + .../src/planning_scene_ros_api_tutorial.cpp | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py b/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py index 2c061cc790..3fd75ea15f 100644 --- a/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py +++ b/doc/planning_scene_ros_api/launch/planning_scene_ros_api_tutorial.launch.py @@ -12,6 +12,7 @@ def generate_launch_description(): name="planning_scene_ros_api_tutorial", package="moveit2_tutorials", executable="planning_scene_ros_api_tutorial", + prefix="xterm -e", output="screen", ) diff --git a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp index 9c86de8b3d..5366dc99ae 100644 --- a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp +++ b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp @@ -48,9 +48,17 @@ #include #include -// #include +/* #include This has not been ported to ros2 yet */ #include - +/* this is a standin for moveit_visual_tools prompt */ +#include +void prompt(const std::string& message) +{ + printf(MOVEIT_CONSOLE_COLOR_GREEN "\n%s" MOVEIT_CONSOLE_COLOR_RESET, message.c_str()); + fflush(stdout); + while (std::cin.get() != '\n' && rclcpp::ok()) + ; +} static const rclcpp::Logger LOGGER = rclcpp::get_logger("planning_scene_ros_api_tutorial"); int main(int argc, char** argv) @@ -89,7 +97,7 @@ int main(int argc, char** argv) { rclcpp::sleep_for(std::chrono::milliseconds(500)); } - visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to start the demo"); + prompt("Press 'next' in the RvizVisualToolsGui window to start the demo"); // Define the attached object message // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +146,7 @@ int main(int argc, char** argv) planning_scene.world.collision_objects.push_back(attached_object.object); planning_scene.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); // Interlude: Synchronous vs Asynchronous updates // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -192,7 +200,7 @@ int main(int argc, char** argv) planning_scene.robot_state.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); // Detach an object from the robot // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,7 +227,7 @@ int main(int argc, char** argv) planning_scene.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); // Remove the object from the collision world // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -235,7 +243,7 @@ int main(int argc, char** argv) planning_scene_diff_publisher->publish(planning_scene); // END_TUTORIAL - visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to end the demo"); + prompt("Press 'next' in the RvizVisualToolsGui window to end the demo"); rclcpp::shutdown(); return 0; From 614ddc39dfe7f3cbe4066d96609af2b46a4756ca Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 13:09:05 +0000 Subject: [PATCH 4/9] Update documentation --- .../planning_scene_ros_api_tutorial.rst | 13 ++++--------- .../src/planning_scene_ros_api_tutorial.cpp | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst index fe43bff1aa..0726b8c565 100644 --- a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst +++ b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst @@ -1,8 +1,3 @@ -:moveit1: - -.. - Once updated for MoveIt 2, remove all lines above title (including this comment and :moveit1: tag) - Planning Scene ROS API ================================== @@ -20,15 +15,15 @@ Running the code ---------------- Open two shells. In the first shell start RViz and wait for everything to finish loading: :: - roslaunch panda_moveit_config demo.launch + ros2 launch moveit2_tutorials demo.launch.py In the second shell, run the launch file for this demo: :: - roslaunch moveit_tutorials planning_scene_ros_api_tutorial.launch + ros2 launch moveit2_tutorials planning_scene_ros_api_tutorial.launch.py **Note:** This tutorial uses the **RvizVisualToolsGui** panel to step through the demo. To add this panel to RViz, follow the instructions in the `Visualization Tutorial <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html#rviz-visual-tools>`_. -After a short moment, the RViz window should appear and look similar to the one at the top of this page. To progress through each demo step either press the **Next** button in the **RvizVisualToolsGui** panel at the bottom of the screen or select **Key Tool** in the **Tools** panel at the top of the screen and then press **N** on your keyboard while RViz is focused. +After a short moment, the RViz window should appear and look similar to the one at the `Visualization Tutorial <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html#rviz-visual-tools>`_. To progress through each demo step either press the **Next** button in the **RvizVisualToolsGui** panel at the bottom of the screen or select **Key Tool** in the **Tools** panel at the top of the screen and then press **N** on your keyboard while RViz is focused. Expected Output --------------- @@ -56,4 +51,4 @@ Debugging the Planning Scene Monitor ------------------------------------ To aid in debugging detached and attached collision objects, a command-line tool will help introspect your system: :: - rosrun moveit_ros_planning moveit_print_planning_scene_info + ros2 run moveit_ros_planning moveit_print_planning_scene_info diff --git a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp index 5366dc99ae..47fc87136e 100644 --- a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp +++ b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp @@ -160,7 +160,7 @@ int main(int argc, char** argv) // // While most of this tutorial uses the latter mechanism (given the long sleeps // inserted for visualization purposes asynchronous updates do not pose a problem), - // it would is perfectly justified to replace the planning_scene_diff_publisher + // it would be perfectly justified to replace the planning_scene_diff_publisher // by the following service client: rclcpp::Client::SharedPtr planning_scene_diff_client = node->create_client("apply_planning_scene"); @@ -169,7 +169,6 @@ int main(int argc, char** argv) auto request = std::make_shared(); request->scene = planning_scene; planning_scene_diff_client->async_send_request(request); - // moveit_msgs::srv::ApplyPlanningScene srv; // Note that this does not continue until we are sure the diff has been applied. // // Attach an object to the robot From 61b2981a9b7d4402b94f3cd2396af16383ac02f6 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 14:12:27 +0000 Subject: [PATCH 5/9] Add info about xterm --- .../planning_scene_ros_api_tutorial.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst index 0726b8c565..8cfe00ceae 100644 --- a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst +++ b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst @@ -11,6 +11,11 @@ Getting Started --------------- If you haven't already done so, make sure you've completed the steps in `Getting Started <../getting_started/getting_started.html>`_. +**Note:** Because **MoveitVisualTools** has not been ported to ROS2 this tutorial has made use of xterm and a simple prompter to help the user progress through each demo step. +To install xterm please run the following command: :: + + sudo apt-get install -y xterm + Running the code ---------------- Open two shells. In the first shell start RViz and wait for everything to finish loading: :: From ba3d709103ef1b571ba478c09f5b567ded8e1a08 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Thu, 15 Apr 2021 20:39:03 +0000 Subject: [PATCH 6/9] Remove debugging info and add todo --- .../planning_scene_ros_api_tutorial.rst | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst index 8cfe00ceae..7e18c0bd46 100644 --- a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst +++ b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst @@ -48,12 +48,5 @@ The entire code can be seen :codedir:`here in the MoveIt GitHub project` on GitHub. All the code in this tutorial can be compiled and run from the moveit_tutorials package. - -Debugging the Planning Scene Monitor ------------------------------------- -To aid in debugging detached and attached collision objects, a command-line tool will help introspect your system: :: - - ros2 run moveit_ros_planning moveit_print_planning_scene_info +.. + TODO(JafarAbdi): Add the launch file section back (see https://github.com/ros-planning/moveit_tutorials/blob/master/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst#the-launch-file) From 87cdf89c63100ec6835a16d73b8b64e21c74cdf9 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Tue, 20 Apr 2021 20:39:27 +0300 Subject: [PATCH 7/9] Update doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst Co-authored-by: Marq Rasmussen --- doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst index 7e18c0bd46..f8c2133ec1 100644 --- a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst +++ b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst @@ -28,7 +28,7 @@ In the second shell, run the launch file for this demo: :: **Note:** This tutorial uses the **RvizVisualToolsGui** panel to step through the demo. To add this panel to RViz, follow the instructions in the `Visualization Tutorial <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html#rviz-visual-tools>`_. -After a short moment, the RViz window should appear and look similar to the one at the `Visualization Tutorial <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html#rviz-visual-tools>`_. To progress through each demo step either press the **Next** button in the **RvizVisualToolsGui** panel at the bottom of the screen or select **Key Tool** in the **Tools** panel at the top of the screen and then press **N** on your keyboard while RViz is focused. +After a short moment, the RViz window should appear and look similar to `Visualization Tutorial <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html#rviz-visual-tools>`_. To progress through each demo step either press the **Next** button in the **RvizVisualToolsGui** panel at the bottom of the screen or select **Key Tool** in the **Tools** panel at the top of the screen and then press **N** on your keyboard while RViz is focused. Expected Output --------------- From 59108bb7980b664b45b10c3b12d3e6f82a767b50 Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Tue, 20 Apr 2021 18:05:59 +0000 Subject: [PATCH 8/9] Remove unnecessary note. --- .../planning_scene_ros_api_tutorial.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst index f8c2133ec1..670228ab40 100644 --- a/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst +++ b/doc/planning_scene_ros_api/planning_scene_ros_api_tutorial.rst @@ -38,10 +38,6 @@ In RViz, you should be able to see the following: * Object gets detached from the robot. * Object is removed from the planning scene. -.. role:: red - -**Note:** You may see an error message reading :red:`Found empty JointState message`. This is a known bug and will be fixed soon. - The entire code --------------- The entire code can be seen :codedir:`here in the MoveIt GitHub project`. From 7c4f10917dc62d010a7384ea8c3346579cac53fd Mon Sep 17 00:00:00 2001 From: Vatan Aksoy Tezer Date: Wed, 21 Apr 2021 17:17:51 +0000 Subject: [PATCH 9/9] Fix prompts --- .../src/planning_scene_ros_api_tutorial.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp index 47fc87136e..c155859456 100644 --- a/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp +++ b/doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp @@ -52,6 +52,7 @@ #include /* this is a standin for moveit_visual_tools prompt */ #include + void prompt(const std::string& message) { printf(MOVEIT_CONSOLE_COLOR_GREEN "\n%s" MOVEIT_CONSOLE_COLOR_RESET, message.c_str()); @@ -97,7 +98,8 @@ int main(int argc, char** argv) { rclcpp::sleep_for(std::chrono::milliseconds(500)); } - prompt("Press 'next' in the RvizVisualToolsGui window to start the demo"); + prompt("Press 'Enter' to continue the demo"); + /* visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); */ // Define the attached object message // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -146,7 +148,8 @@ int main(int argc, char** argv) planning_scene.world.collision_objects.push_back(attached_object.object); planning_scene.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'Enter' to continue the demo"); + /* visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); */ // Interlude: Synchronous vs Asynchronous updates // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +202,8 @@ int main(int argc, char** argv) planning_scene.robot_state.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'Enter' to continue the demo"); + /* visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); */ // Detach an object from the robot // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -226,7 +230,8 @@ int main(int argc, char** argv) planning_scene.is_diff = true; planning_scene_diff_publisher->publish(planning_scene); - prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); + prompt("Press 'Enter' to continue the demo"); + /* visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo"); */ // Remove the object from the collision world // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -242,7 +247,8 @@ int main(int argc, char** argv) planning_scene_diff_publisher->publish(planning_scene); // END_TUTORIAL - prompt("Press 'next' in the RvizVisualToolsGui window to end the demo"); + prompt("Press 'Enter' to end the demo"); + /* visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to end the demo"); */ rclcpp::shutdown(); return 0;