Skip to content

Commit

Permalink
Merge pull request #22 from carla-simulator/fix/vehicleControl
Browse files Browse the repository at this point in the history
Send vehicle control commands only when reciving ROS input
  • Loading branch information
fabianoboril committed Jan 7, 2019
2 parents e2a3895 + 854f239 commit e69570c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/carla_ros_bridge/ego_vehicle.py
Expand Up @@ -161,8 +161,13 @@ def apply_control(self):
vehicle_control.steer = self.info.output.steer
vehicle_control.throttle = self.info.output.throttle
vehicle_control.reverse = self.info.output.reverse
# send control command out
self.carla_actor.apply_control(vehicle_control)

# send control command out, if there is a ROS control publisher
ros_control_topic = rospy.get_published_topics(namespace=self.topic_name() + "/ackermann_cmd")
ros_control_topic.extend(rospy.get_published_topics(namespace=self.topic_name() + "/vehicle_control_cmd"))
if ros_control_topic:
self.carla_actor.apply_control(vehicle_control)


def update_current_values(self):
"""
Expand Down

0 comments on commit e69570c

Please sign in to comment.