Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also publish lts_status as part of emulation_nav #285

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cob_hardware_emulation/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
<exec_depend>actionlib</exec_depend>
<exec_depend>actionlib_msgs</exec_depend>
<exec_depend>control_msgs</exec_depend>
<exec_depend>ipa_navigation_msgs</exec_depend>
<exec_depend>move_base_msgs</exec_depend>
<exec_depend>nav_msgs</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>std_srvs</exec_depend>
<exec_depend>tf_conversions</exec_depend>
<exec_depend>tf2_ros</exec_depend>
Expand Down
18 changes: 16 additions & 2 deletions cob_hardware_emulation/scripts/emulation_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import Transform, TransformStamped, PoseStamped
from geometry_msgs.msg import PoseWithCovarianceStamped, Quaternion
from ipa_navigation_msgs.msg import LTSNGStatus
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseResult
from std_msgs.msg import Header

class EmulationNav(object):
def __init__(self, odom_frame):
Expand All @@ -20,6 +22,7 @@ def __init__(self, odom_frame):
# - /initialpose [geometry_msgs/PoseWithCovarianceStamped]
# - publishers:
# - tf (map --> odom_frame)
# - /lts_ng/lts_status
# - actions:
# - move_base [move_base_msgs/MoveBaseAction] (optional)

Expand Down Expand Up @@ -50,6 +53,7 @@ def __init__(self, odom_frame):
quat = tf.transformations.quaternion_from_euler(0, 0, initialpose[2])
self._odom_transform.rotation = Quaternion(*quat)

self._lts_status_pub = rospy.Publisher("/lts_ng/lts_status", LTSNGStatus, queue_size=1)
rospy.Subscriber("/initialpose", PoseWithCovarianceStamped, self.initalpose_callback, queue_size=1)
rospy.Timer(rospy.Duration(0.04), self.timer_cb)

Expand Down Expand Up @@ -102,16 +106,26 @@ def initalpose_callback(self, msg):
return

def timer_cb(self, event):
header = Header()
header.stamp = rospy.Time.now()
header.frame_id = "map"

# publish lts_status
lts_status = LTSNGStatus()
lts_status.header = header
lts_status.state = LTSNGStatus.STATE_TRACKING
# TODO: only setting minimal required message fields for now - to be extended later

# publish tf
# pub odom_frame --> map
t_loc = TransformStamped()
t_loc.header.stamp = rospy.Time.now()
t_loc.header.frame_id = "map"
t_loc.header = header
t_loc.child_frame_id = self._odom_frame
t_loc.transform = self._odom_transform

transforms = [t_loc]

self._lts_status_pub.publish(lts_status)
self._transform_broadcaster.sendTransform(transforms)

def move_base_cb(self, goal):
Expand Down