-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfake_localization_node.py
More file actions
110 lines (43 loc) · 1.76 KB
/
fake_localization_node.py
File metadata and controls
110 lines (43 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
"""Prototype ROS node that publishes simplified localization data for navigation and mapping tests."""
""" Fake localization node.
ROS navigation code typically expects 'map' to be the base coordinate
frame. A functioning navigation system would figure out where the
robot is in the map and then communicate that location by publishing a
transform from 'map' to 'odom'.
This node fakes that process so that the tf tree will include a
map frame.
The same thing could be accomplished with the static_transform_publisher
tool:
http://www.ros.org/wiki/tf#static_transform_publisher
We are using a Python node instead in case we want to use it as the
starting point for a -real- localization node in the future.
More info on ROS frame standards can be found here:
REP 105: http://www.ros.org/reps/rep-0105.html#coordinate-frames
Author: Nathan Sprague
Version: 2/13/2013
"""
import rospy
import tf
import numpy as np
class Localizer(object):
""" This class may someday provide localization.
Currently it just broadcasts an identity transform from 'map' to
'odom'.
"""
def __init__(self):
""" Initialize the localizer node. """
rospy.init_node('localizer')
br = tf.TransformBroadcaster()
# Broadcast the transform at 10 HZ
while not rospy.is_shutdown():
br.sendTransform((0., 0., 0.), (0., 0. , 0. , 1.),
rospy.Time.now(),
"odom",
"map")
rospy.sleep(.1)
if __name__ == '__main__':
try:
td = Localizer()
except rospy.ROSInterruptException:
pass