Skip to content

Commit 9f7a34b

Browse files
authored
Merge pull request #279 from fmessmer/fix/emulation
reliable start
2 parents cadb97b + f2b980a commit 9f7a34b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cob_hardware_emulation/scripts/emulation_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def __init__(self, odom_frame):
2727

2828
self.odom_frame_ = odom_frame
2929

30-
rospy.Subscriber("/base/twist_controller/command", Twist, self.twist_callback, queue_size=1)
31-
self.pub_odom = rospy.Publisher("/base/odometry_controller/odometry", Odometry, queue_size=1)
32-
rospy.Service("/base/odometry_controller/reset_odometry", Trigger, self.reset_odometry)
3330
self.br = tf2_ros.TransformBroadcaster()
3431

3532
self.timestamp_last_update = rospy.Time.now()
@@ -42,6 +39,9 @@ def __init__(self, odom_frame):
4239
self.odom.child_frame_id = "base_footprint"
4340
self.odom.pose.pose.orientation.w = 1 # initialize orientation with a valid quaternion
4441

42+
self.pub_odom = rospy.Publisher("/base/odometry_controller/odometry", Odometry, queue_size=1)
43+
rospy.Subscriber("/base/twist_controller/command", Twist, self.twist_callback, queue_size=1)
44+
rospy.Service("/base/odometry_controller/reset_odometry", Trigger, self.reset_odometry)
4545
rospy.Timer(rospy.Duration(0.1), self.timer_cb)
4646

4747
rospy.loginfo("Emulation for base running")

cob_hardware_emulation/scripts/emulation_nav.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def __init__(self, odom_frame):
3434
self._listener = tf2_ros.TransformListener(self._buffer)
3535
self._transform_broadcaster = tf2_ros.TransformBroadcaster()
3636

37-
rospy.Subscriber("/initialpose", PoseWithCovarianceStamped, self.initalpose_callback, queue_size=1)
3837
initialpose = rospy.get_param("~initialpose", None)
3938
if type(initialpose) == list:
4039
rospy.loginfo("using initialpose from parameter server: %s", str(initialpose))
@@ -51,6 +50,7 @@ def __init__(self, odom_frame):
5150
quat = tf.transformations.quaternion_from_euler(0, 0, initialpose[2])
5251
self._odom_transform.rotation = Quaternion(*quat)
5352

53+
rospy.Subscriber("/initialpose", PoseWithCovarianceStamped, self.initalpose_callback, queue_size=1)
5454
rospy.Timer(rospy.Duration(0.04), self.timer_cb)
5555

5656
rospy.loginfo("Emulation for navigation running")
@@ -68,6 +68,7 @@ def __init__(self, odom_frame):
6868
else:
6969
rospy.logwarn("Emulation running without move_base due to invalid value for parameter move_base_mode: '%s'", self._move_base_mode)
7070

71+
7172
def initalpose_callback(self, msg):
7273
rospy.loginfo("Got initialpose, updating %s transformation.", self._odom_frame)
7374
try:

cob_hardware_emulation/scripts/emulation_odom_laser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ def __init__(self, odom_frame):
2323

2424
self._odom_frame = odom_frame
2525

26-
rospy.Subscriber("/base/odometry_controller/odometry", Odometry, self.odometry_callback, queue_size=1)
27-
self._odom_publisher = rospy.Publisher("/scan_odom_node/scan_odom/odometry", Odometry, queue_size=1)
28-
2926
self._transform_broadcaster = tf2_ros.TransformBroadcaster()
3027

3128
self._odom = Odometry()
3229
self._odom.header.frame_id = self._odom_frame
3330
self._odom.child_frame_id = "base_footprint"
3431
self._odom.pose.pose.orientation.w = 1 # initialize orientation with a valid quaternion
3532

33+
self._odom_publisher = rospy.Publisher("/scan_odom_node/scan_odom/odometry", Odometry, queue_size=1)
34+
rospy.Subscriber("/base/odometry_controller/odometry", Odometry, self.odometry_callback, queue_size=1)
3635
rospy.loginfo("Emulation for laser odometry running")
3736

3837
def odometry_callback(self, msg):

0 commit comments

Comments
 (0)