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

Publishes the car's name/prefix as a marker that can be visualized in rviz, so individual cars can be tracked when simulating many cars #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 19 additions & 1 deletion mushr_base/src/racecar_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sensor_msgs.msg import JointState
from std_msgs.msg import Float64
from vesc_msgs.msg import VescStateStamped

from visualization_msgs.msg import Marker
import utils


Expand Down Expand Up @@ -152,6 +152,9 @@ def __init__(self):
# Publishes joint messages
self.br = tf.TransformBroadcaster()

# Publishes vehicle prefix above vehicle in simulator as text facing camera
self.prefix_pub = rospy.Publisher("visualization_marker", Marker, queue_size=1)

# Duration param controls how often to publish default map to odom tf
# if no other nodes are publishing it
self.transformer = tf.TransformListener()
Expand Down Expand Up @@ -502,6 +505,21 @@ def timer_cb(self, event):
cur_pose.pose.orientation = utils.angle_to_quaternion(rot)
self.state_pub.publish(cur_pose)

# Publish prefix as a marker (for rviz)
prefix_marker = Marker()
prefix_marker.header.frame_id = "/map"
prefix_marker.header.stamp = now
prefix_marker.pose = cur_pose.pose
prefix_marker.type = 9
prefix_marker.text = self.TF_PREFIX
prefix_marker.pose.position.z = 0.3
prefix_marker.color.a = 1.0
prefix_marker.color.r = 244.0/255.0
prefix_marker.color.g = 214.0/255.0
prefix_marker.color.b = 118.0/255.0
prefix_marker.scale.z=0.1
self.prefix_pub.publish(prefix_marker)

"""
get_map: Get the map and map meta data
Returns: A tuple
Expand Down