src
pick_place_demo.cpp
Go to the documentation of this file.
1
/*********************************************************************
2
* BSD 3-Clause License
3
*
4
* Copyright (c) 2019 PickNik 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 ARE
24
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*********************************************************************/
32
33
/* Author: Henning Kayser, Simon Goldstein
34
Desc: A demo to show MoveIt Task Constructor in action
35
*/
36
37
// ROS
38
#include <
ros/ros.h
>
39
40
// MTC pick/place demo implementation
41
#include <
moveit_task_constructor_demo/pick_place_task.h
>
42
43
constexpr
char
LOGNAME
[] =
"moveit_task_constructor_demo"
;
44
45
int
main
(
int
argc,
char
** argv) {
46
ros::init
(argc, argv,
"mtc_tutorial"
);
47
ros::NodeHandle
nh, pnh(
"~"
);
48
49
// Handle Task introspection requests from RViz & feedback during execution
50
ros::AsyncSpinner
spinner
(1);
51
spinner
.start();
52
53
moveit_task_constructor_demo::setupDemoScene
(pnh);
54
55
// Construct and run pick/place task
56
moveit_task_constructor_demo::PickPlaceTask
pick_place_task(
"pick_place_task"
, pnh);
57
if
(!pick_place_task.
init
()) {
58
ROS_INFO_NAMED
(
LOGNAME
,
"Initialization failed"
);
59
return
1;
60
}
61
62
if
(pick_place_task.
plan
()) {
63
ROS_INFO_NAMED
(
LOGNAME
,
"Planning succeded"
);
64
if
(pnh.
param
(
"execute"
,
false
)) {
65
pick_place_task.
execute
();
66
ROS_INFO_NAMED
(
LOGNAME
,
"Execution complete"
);
67
}
else
{
68
ROS_INFO_NAMED
(
LOGNAME
,
"Execution disabled"
);
69
}
70
}
else
{
71
ROS_INFO_NAMED
(
LOGNAME
,
"Planning failed"
);
72
}
73
74
// Keep introspection alive
75
ros::waitForShutdown
();
76
return
0;
77
}
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
moveit_task_constructor_demo::PickPlaceTask::init
bool init()
Definition:
pick_place_task.cpp:178
ros.h
ros::AsyncSpinner
spinner
void spinner()
main
int main(int argc, char **argv)
Definition:
pick_place_demo.cpp:45
moveit_task_constructor_demo::PickPlaceTask::execute
bool execute()
Definition:
pick_place_task.cpp:538
ROS_INFO_NAMED
#define ROS_INFO_NAMED(name,...)
moveit_task_constructor_demo::PickPlaceTask
Definition:
pick_place_task.h:99
moveit_task_constructor_demo::PickPlaceTask::plan
bool plan()
Definition:
pick_place_task.cpp:531
ros::waitForShutdown
ROSCPP_DECL void waitForShutdown()
ros::NodeHandle::param
T param(const std::string ¶m_name, const T &default_val) const
moveit_task_constructor_demo::setupDemoScene
void setupDemoScene(ros::NodeHandle &pnh)
Definition:
pick_place_task.cpp:124
pick_place_task.h
LOGNAME
constexpr char LOGNAME[]
Definition:
pick_place_demo.cpp:43
ros::NodeHandle
demo
Author(s): Robert Haschke
, Simon Goldstein
, Henning Kayser
autogenerated on Sat May 3 2025 02:40:30