servo_server.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2019, Los Alamos National Security, LLC
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 are met:
9  *
10  * * Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *******************************************************************************/
33 
34 /* Title : servo_server.cpp
35  * Project : moveit_servo
36  * Created : 12/31/2018
37  * Author : Andy Zelenak
38  */
39 
40 #include <moveit_servo/servo.h>
41 
42 namespace
43 {
44 constexpr char LOGNAME[] = "servo_server";
45 constexpr char ROS_THREADS = 8;
46 
47 } // namespace
48 
49 int main(int argc, char** argv)
50 {
51  ros::init(argc, argv, LOGNAME);
52  ros::AsyncSpinner spinner(ROS_THREADS);
53  spinner.start();
54 
55  ros::NodeHandle nh("~");
56 
57  // Load the planning scene monitor
58  auto planning_scene_monitor = std::make_shared<planning_scene_monitor::PlanningSceneMonitor>("robot_description");
59  if (!planning_scene_monitor->getPlanningScene())
60  {
61  ROS_ERROR_STREAM_NAMED(LOGNAME, "Error in setting up the PlanningSceneMonitor.");
62  exit(EXIT_FAILURE);
63  }
64 
65  // Start the planning scene monitor
66  planning_scene_monitor->startSceneMonitor();
67  planning_scene_monitor->startWorldGeometryMonitor(
70  false /* skip octomap monitor */);
71  planning_scene_monitor->startStateMonitor();
72 
73  // Create the servo server
75 
76  // Start the servo server (runs in the ros spinner)
77  servo.start();
78 
79  // Wait for ros to shutdown
81 
82  // Stop the servo server
83  servo.setPaused(true);
84 
85  return 0;
86 }
planning_scene_monitor
servo.h
main
int main(int argc, char **argv)
Definition: servo_server.cpp:49
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros::AsyncSpinner
moveit_servo::Servo::setPaused
void setPaused(bool paused)
Pause or unpause processing servo commands while keeping the timers alive.
Definition: servo.cpp:311
spinner
void spinner()
LOGNAME
static const char LOGNAME[]
Definition: collision_check.cpp:45
planning_scene_monitor::PlanningSceneMonitor::DEFAULT_PLANNING_SCENE_WORLD_TOPIC
static const std::string DEFAULT_PLANNING_SCENE_WORLD_TOPIC
ROS_ERROR_STREAM_NAMED
#define ROS_ERROR_STREAM_NAMED(name, args)
planning_scene_monitor::PlanningSceneMonitor::DEFAULT_COLLISION_OBJECT_TOPIC
static const std::string DEFAULT_COLLISION_OBJECT_TOPIC
ros::waitForShutdown
ROSCPP_DECL void waitForShutdown()
ros::NodeHandle
moveit_servo::Servo::start
void start()
start servo node
Definition: servo.cpp:294
moveit_servo::Servo
Definition: servo.h:90


moveit_servo
Author(s): Brian O'Neil, Andy Zelenak , Blake Anderson, Alexander Rössler , Tyler Weaver
autogenerated on Sat May 3 2025 02:27:56