Ejemplo n.º 1
0
    def __init__(self, argv=None):
        subst_param = False
        if argv is None:
            self.topics = rospy.get_param("~topics")
            self.blocking = rospy.get_param("~blocking", False)
            self.queue_size = rospy.get_param("~queue_size", 1)
            self.update_rate = rospy.get_param("~update_rate", 1.0)
            subst_param = rospy.get_param("~subst_param", False)
        else:
            args = self.parse_args(argv)
            self.topics = args.topics
            self.blocking = args.blocking
            self.queue_size = args.queue_size
            self.update_rate = args.update_rate
            subst_param = args.subst_param
        self.subscribers = {}

        if subst_param:
            topics = []
            for t in self.topics:
                keys = REGEX.findall(t)
                splitted = REGEX.split(t)
                for i in range(len(splitted)):
                    if splitted[i] in keys:
                        splitted[i] = rospy.get_param(splitted[i])
                topics.append(str().join(splitted))
            self.topics = topics

        LoggerBase.__init__(self)
Ejemplo n.º 2
0
    def __init__(self, argv=None):
        subst_param = False
        if argv is None:
            self.topics = rospy.get_param("~topics")
            self.blocking = rospy.get_param("~blocking", False)
            self.queue_size = rospy.get_param("~queue_size", 1)
            subst_param = rospy.get_param("~subst_param", False)
        else:
            args = self.parse_args(argv)
            self.topics = args.topics
            self.blocking = args.blocking
            self.queue_size = args.queue_size
            subst_param = args.subst_param
        self.subscribers = {}

        if subst_param:
            topics = []
            for t in self.topics:
                keys = REGEX.findall(t)
                splitted = REGEX.split(t)
                for i in range(len(splitted)):
                    if splitted[i] in keys:
                        splitted[i] = rospy.get_param(splitted[i])
                topics.append(str().join(splitted))
            self.topics = topics

        LoggerBase.__init__(self)
Ejemplo n.º 3
0
    def __init__(self):
        LoggerBase.__init__(self)

        self.queue_size = rospy.get_param("~queue_size", 30)
        self.action_regex = re.compile(".*Action(Result|Goal|Feedback)$")
        self.update_rate = rospy.get_param("~update_rate", 1.0)
        self.max_rate = rospy.get_param("~max_rate", 3.0)
        self.last_inserted_time = defaultdict(rospy.Time)

        self.load_params()
Ejemplo n.º 4
0
    def __init__(self):
        LoggerBase.__init__(self)

        self.queue_size = rospy.get_param("~queue_size", 30)
        self.action_regex = re.compile(".*Action(Result|Goal|Feedback)$")
        self.update_rate = rospy.get_param("~update_rate", 1.0)
        self.max_rate = rospy.get_param("~max_rate", 3.0)
        self.last_inserted_time = defaultdict(rospy.Time)

        self.load_params()
Ejemplo n.º 5
0
    def __init__(self):
        LoggerBase.__init__(self)

        self.queue_size = rospy.get_param("~queue_size", 30)

        self.joint_tolerance = 1.0
        self.joint_states = []
        self.joint_states_inserted = [] # list of time stamp
        self.joint_sub = rospy.Subscriber('/joint_states', JointState, self.__joint_states_cb)

        self.__load_params()
Ejemplo n.º 6
0
    def __init__(self):
        LoggerBase.__init__(self)

        self.tf_buffer = tf2_ros.Buffer()
        self.tf_listener = tf2_ros.TransformListener(self.tf_buffer)

        rospy.wait_for_service("~tf2_frames")
        self.get_frames = rospy.ServiceProxy("~tf2_frames", FrameGraph)

        self.update_rate = rospy.get_param("~update_rate", 1.0)
        self.timer = rospy.Timer(rospy.Duration(self.update_rate),
                                 self.timer_callback)
Ejemplo n.º 7
0
    def __init__(self):
        LoggerBase.__init__(self)

        self.queue_size = rospy.get_param("~queue_size", 30)
        self.action_regex = re.compile(".*Action(Result|Goal|Cancel)$")
        self.joint_tolerance = 1.0
        self.joint_states = []
        self.joint_states_inserted = []  # list of time stamp
        self.joint_sub = rospy.Subscriber('/joint_states', JointState,
                                          self.__joint_states_cb)

        self.__load_params()
Ejemplo n.º 8
0
    def __init__(self):
        LoggerBase.__init__(self)
        self.map_frame = rospy.get_param('~map_frame', 'map')
        self.robot_frame = rospy.get_param('~robot_frame', 'base_footprint')
        rospy.loginfo("map->robot: %s -> %s" % (self.map_frame, self.robot_frame))

        self.tf_timeout = rospy.Duration(rospy.get_param("~tf_timeout", 1.0))
        use_tf2 = rospy.get_param("~use_tf2", True)
        self.tf_listener = TransformListener(use_tf2=use_tf2)

        self.master = rosgraph.Master("/rostopic")
        self.subscribers = []

        rospy.loginfo("%s initialized" % rospy.get_name())
Ejemplo n.º 9
0
    def __init__(self):
        LoggerBase.__init__(self)
        self.map_frame = rospy.get_param('~map_frame','map')
        self.robot_frame = rospy.get_param('~robot_frame', 'base_link')

        use_tf2 = rospy.get_param("~use_tf2", True)
        self.tf_listener = TransformListener(use_tf2=use_tf2)

        self.initialpose_pub = rospy.Publisher('/initialpose', PoseWithCovarianceStamped,
                                               queue_size=1, latch=True)
        rospy.loginfo("map->robot: %s -> %s" % (self.map_frame, self.robot_frame))

        self.current_pose = None
        self.latest_pose = None
        self.latest_stamp = rospy.Time(0)
        self._load_latest_pose()
        self.pub_latest_pose()
        self.latest_exception = None
Ejemplo n.º 10
0
    def __init__(self):
        LoggerBase.__init__(self)
        self.update_rate = rospy.get_param("~update_rate", 1.0)
        self.use_amcl = rospy.get_param("~use_amcl", True)
        self.persistent = rospy.get_param("~persistent", True)
        self.thre = rospy.get_param('~thre', 0.005)
        self.rthre = rospy.get_param('~rthre', np.deg2rad(1.0))

        if self.use_amcl:
            self.map_frame = rospy.get_param("/amcl/global_frame_id")
            self.robot_frame = rospy.get_param("/amcl/base_frame_id")
        else:
            self.map_frame = rospy.get_param('~map_frame', 'map')
            self.robot_frame = rospy.get_param('~robot_frame', 'base_link')
        if self.map_frame.startswith("/"):
            self.map_frame = self.map_frame[1:]
        if self.robot_frame.startswith("/"):
            self.robot_frame = self.robot_frame[1:]

        self.tf_listener = TransformListener(
            use_tf2=rospy.get_param("~use_tf2", True))

        self.initialpose_pub = rospy.Publisher('/initialpose',
                                               PoseWithCovarianceStamped,
                                               queue_size=1,
                                               latch=True)

        rospy.loginfo("map->robot frame: %s -> %s" %
                      (self.map_frame, self.robot_frame))

        try:
            self.latest_pose = self.load_latest_pose()
            # publish initial pose if possible
            self.publish_initial_pose(self.latest_pose)
        except Exception as e:
            rospy.logerr(e)

        if self.use_amcl:
            self.sub_amcl = rospy.Subscriber("/amcl_pose",
                                             PoseWithCovarianceStamped,
                                             self.amcl_cb,
                                             queue_size=1)