moveit2
The MoveIt Motion Planning Framework for ROS 2.
launches.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2022, Metro Robots
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Metro Robots nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: David V. Lu!! */
37 
38 namespace moveit_setup
39 {
40 namespace app
41 {
43 {
44  config_data_->registerType("launches", "moveit_setup::app::LaunchesConfig");
45  launches_config_ = config_data_->get<LaunchesConfig>("launches");
46 
47  available_launch_bundles_.push_back(
48  LaunchBundle("Robot State Publisher Launch",
49  "Launch file to publish the robot description and transforms generated by the joint states.", "rsp",
50  { "robot_state_publisher" }));
51  available_launch_bundles_.push_back(
52  LaunchBundle("RViz Launch and Config",
53  "Visualize in Rviz the robot's planning groups running with interactive "
54  "markers that allow goal states to be set.",
55  "moveit_rviz", { "rviz2", "rviz_common", "rviz_default_plugins", "moveit_ros_visualization" }));
56  available_launch_bundles_.back().addFile(
57  "config/moveit.rviz", "Configuration file for Rviz with the Motion Planning Plugin already setup.");
59  "MoveGroup Launch", "Launch file to run the main MoveIt executable that provides the MoveGroup action",
60  "move_group", { "moveit_ros_move_group" }));
61  available_launch_bundles_.push_back(LaunchBundle("Static TF Launch",
62  "Launch file to broadcast static TF for the robot's virtual joints.",
63  "static_virtual_joint_tfs", { "tf2_ros" }));
64  available_launch_bundles_.push_back(LaunchBundle("Spawn Controllers Launch",
65  "Launch file to spawn the necessary controllers",
66  "spawn_controllers", { "controller_manager" }));
67  available_launch_bundles_.push_back(LaunchBundle("Demo Launch",
68  "Launch file to run a demo of MoveGroup. Warning that it requires "
69  "the above launch files to all be generated as well.",
70  "demo"));
71 
72  available_launch_bundles_.push_back(LaunchBundle("Setup Assistant Launch",
73  "Launch file for easily re-starting the MoveIt "
74  "Setup Assistant to edit this robot's generated "
75  "configuration package.",
76  "setup_assistant", { "moveit_setup_assistant" }));
77  available_launch_bundles_.push_back(LaunchBundle("Warehouse DB Launch",
78  "Launch file for starting the warehouse with a default MongoDB.",
79  "warehouse_db", { "warehouse_ros_mongo", "moveit_ros_warehouse" }));
80 
81  for (unsigned int i = 0; i < available_launch_bundles_.size(); i++)
82  {
83  available_launch_bundles_[i].setID(i);
84 
85  // By default, we start with all the launch bundles included
87  }
88 }
89 
90 bool Launches::getState(unsigned int id) const
91 {
92  return launches_config_->isIncluded(available_launch_bundles_[id]);
93 }
94 
95 void Launches::setState(unsigned int id, bool state)
96 {
97  const LaunchBundle& bundle = available_launch_bundles_[id];
98  if (state)
99  {
100  launches_config_->include(bundle);
101  }
102  else
103  {
104  launches_config_->remove(bundle);
105  }
106 }
107 } // namespace app
108 } // namespace moveit_setup
DataWarehousePtr config_data_
Definition: setup_step.hpp:97
One launch file and any other bonus files that get bundled with it, i.e. the RViz launch file and its...
Stores which LaunchBundles are configured to be generated.
void setState(unsigned int id, bool state)
Sets whether the LaunchBundle with the given id is included (true) or not (false)
Definition: launches.cpp:95
std::shared_ptr< LaunchesConfig > launches_config_
Definition: launches.hpp:90
bool getState(unsigned int id) const
Definition: launches.cpp:90
void onInit() override
Overridable initialization method.
Definition: launches.cpp:42
std::vector< LaunchBundle > available_launch_bundles_
Definition: launches.hpp:89