visual_servo_node.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2019 by INRIA. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact INRIA about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr/ for more information.
17  *
18  * This software was developed at:
19  * INRIA Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  * https://team.inria.fr/rainbow/fr/
24  *
25  * If you have questions regarding the use of this file, please contact
26  * INRIA at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Visual servoing node to control Parrot Bebop 2 drone.
33  *
34  * Authors:
35  * Gatien Gaumerais
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 #include <string>
41 #include <vector>
42 #include <algorithm>
43 
44 #include <ros/ros.h>
45 #include <nodelet/loader.h>
46 
47 #include <visp3/core/vpConfig.h>
48 
49 int main(int argc, char* argv[])
50 {
51 #if VISP_VERSION_INT > VP_VERSION_INT(3,2,0) // ViSP >= 3.0.0
52  ros::init(argc, argv, "bebop_vs", ros::init_options::NoSigintHandler);
53  nodelet::Loader nll;
54 
56  nodelet::V_string nargv;
57  const std::string nl_name = ros::this_node::getName();
58  nll.load(nl_name, "visp_ros_bebop2_visual_servo_nodelet", remap, nargv);
59 
60  const std::vector<std::string>& loaded_nodelets = nll.listLoadedNodelets();
61  if (std::find(loaded_nodelets.begin(),
62  loaded_nodelets.end(),
63  nl_name) == loaded_nodelets.end())
64  {
65  // Nodelet OnInit() failed
66  ROS_FATAL("Visual servo nodelet failed to load.");
67  return 1;
68  }
69 
70  // It reaches here when OnInit() succeeds
71  ROS_INFO("Visual servo nodelet loaded.");
72  ros::spin();
73 #else
74  ROS_INFO("This node needs ViSP > 3.2.0. Exit...");
75 #endif
76 
77  return 0;
78 }
#define ROS_FATAL(...)
bool load(const std::string &name, const std::string &type, const M_string &remappings, const V_string &my_argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL const std::string & getName()
std::vector< std::string > listLoadedNodelets()
ROSCPP_DECL void spin(Spinner &spinner)
ROSCPP_DECL const M_string & getRemappings()
ROSCPP_DECL std::string remap(const std::string &name)
#define ROS_INFO(...)
int main(int argc, char *argv[])
std::vector< std::string > V_string
std::map< std::string, std::string > M_string


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais
autogenerated on Tue Feb 9 2021 03:40:20