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 <algorithm>
41 #include <string>
42 #include <vector>
43 
44 #include <nodelet/loader.h>
45 #include <ros/ros.h>
46 
47 #include <visp3/core/vpConfig.h>
48 
49 int
50 main( int argc, char *argv[] )
51 {
52 #if VISP_VERSION_INT > VP_VERSION_INT( 3, 2, 0 ) // ViSP >= 3.0.0
53  ros::init( argc, argv, "bebop_vs", ros::init_options::NoSigintHandler );
54  nodelet::Loader nll;
55 
57  nodelet::V_string nargv;
58  const std::string nl_name = ros::this_node::getName();
59  nll.load( nl_name, "visp_ros_bebop2_visual_servo_nodelet", remap, nargv );
60 
61  const std::vector< std::string > &loaded_nodelets = nll.listLoadedNodelets();
62  if ( std::find( loaded_nodelets.begin(), loaded_nodelets.end(), nl_name ) == loaded_nodelets.end() )
63  {
64  // Nodelet OnInit() failed
65  ROS_FATAL( "Visual servo nodelet failed to load." );
66  return 1;
67  }
68 
69  // It reaches here when OnInit() succeeds
70  ROS_INFO( "Visual servo nodelet loaded." );
71  ros::spin();
72 #else
73  ROS_INFO( "This node needs ViSP > 3.2.0. Exit..." );
74 #endif
75 
76  return 0;
77 }
#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 const M_string & getRemappings()
ROSCPP_DECL std::string remap(const std::string &name)
#define ROS_INFO(...)
ROSCPP_DECL void spin()
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, Alexander Oliva
autogenerated on Tue Mar 1 2022 00:03:22