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 }
nodelet::V_string
std::vector< std::string > V_string
nodelet::M_string
std::map< std::string, std::string > M_string
loader.h
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
nodelet::Loader
nodelet::Loader::load
bool load(const std::string &name, const std::string &type, const M_string &remappings, const V_string &my_argv)
ros::names::getRemappings
const ROSCPP_DECL M_string & getRemappings()
remap
ROSCPP_DECL std::string remap(const std::string &name)
ROS_FATAL
#define ROS_FATAL(...)
ros::this_node::getName
const ROSCPP_DECL std::string & getName()
main
int main(int argc, char *argv[])
Definition: visual_servo_node.cpp:50
ros::spin
ROSCPP_DECL void spin()
ROS_INFO
#define ROS_INFO(...)
nodelet::Loader::listLoadedNodelets
std::vector< std::string > listLoadedNodelets()
ros::init_options::NoSigintHandler
NoSigintHandler


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais, Alexander Oliva
autogenerated on Wed Mar 2 2022 01:13:33