crossing_detector_wrapper_py.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 # Wrapper class for CrossingDetector, meant to be used directly.
00003 #
00004 # Before creating an instance of CrossingDetector, roscpp must be
00005 # initialized. This can be achieved for example with
00006 # from moveit_ros_planning_interface._moveit_roscpp_initializer \
00007 #   import roscpp_init
00008 # roscpp_init('node_name', [])
00009 
00010 import rospy
00011 
00012 from lama_msgs.msg import Crossing
00013 from lama_msgs.msg import Frontier
00014 from lama_msgs.msg import PlaceProfile
00015 
00016 from crossing_detector_wrapper_cpp import CrossingDetectorWrapper
00017 from wrapper import WrapperPy
00018 
00019 
00020 class CrossingDetector(WrapperPy):
00021     def __init__(self, frontier_width, max_frontier_angle=0.785):
00022         self._detector = CrossingDetectorWrapper(frontier_width,
00023                                                  max_frontier_angle)
00024 
00025     def crossingDescriptor(self, profile, normalize=False):
00026         """Return a Crossing message from analysis of a PlaceProfile
00027 
00028         Return a lama_msgs/Crossing message from analysis of a
00029         lama_msgs/PlaceProfile.
00030 
00031         Parameters
00032         ----------
00033         - profile: a lama_msgs/PlaceProfile message
00034         - normalize: true if the PlaceProfile should be normalized in a first
00035             step.
00036         """
00037         if not isinstance(profile, PlaceProfile):
00038             err = 'Argument 1 is not a lama_msgs/PlaceProfile instance'
00039             rospy.logerr(err)
00040             rospy.ROSException(err)
00041         str_profile = self._to_cpp(profile)
00042         str_crossing = self._detector.crossingDescriptor(str_profile, normalize)
00043         return self._from_cpp(str_crossing, Crossing)
00044 
00045     def frontiers(self, profile, normalize=False):
00046         """Return a list of Frontier messages from analysis of a PlaceProfile
00047 
00048         Return a list of lama_msgs/Frontier messages from analysis of a
00049         lama_msgs/PlaceProfile.
00050 
00051         Parameters
00052         ----------
00053         - profile: a lama_msgs/PlaceProfile message
00054         - normalize: true if the PlaceProfile should be normalized in a first
00055             step.
00056         """
00057         if not isinstance(profile, PlaceProfile):
00058             err = 'Argument 1 is not a lama_msgs/PlaceProfile instance'
00059             rospy.logerr(err)
00060             rospy.ROSException(err)
00061         str_profile = self._to_cpp(profile)
00062         str_frontiers = self._detector.frontiers(str_profile, normalize)
00063         frontiers = []
00064         for str_frontier in str_frontiers:
00065             frontiers.append(self._from_cpp(str_frontier, Frontier))
00066         return frontiers


crossing_detector
Author(s): Gaël Ecorchard , Karel Košnar , Vojtěch Vonásek
autogenerated on Thu Jun 6 2019 22:02:06