def set_commands(self, commands, commands_source): BOVehicleSimulation.set_commands(self, commands, commands_source) if self.viz_level >= VizLevel.Sensels: self.publish_ros_commands(commands) if self.viz_level >= VizLevel.Geometry: self.publish_ros_markers() if self.vehicle_collided: # FIXME: import rospy rospy.loginfo('Restarting new episode due to collision.') self.new_episode()
def __init__(self, **params): import rospy contracts.disable_all() # XXX self.viz_level = params.get('viz_level', VizLevel.Everything) if self.viz_level > VizLevel.Nothing: from . import Marker, Image self.publisher = rospy.Publisher('~markers', Marker) self.pub_sensels_image = rospy.Publisher('~sensels_image', Image) self.pub_commands_image = rospy.Publisher('~commands_image', Image) self.first_time = True if self.viz_level >= VizLevel.State: from . import String self.pub_state = rospy.Publisher('~state', String) BOVehicleSimulation.__init__(self, **params)
def get_observations(self): timestamp, observations = BOVehicleSimulation.get_observations(self) if self.viz_level >= VizLevel.Sensels: self.publish_ros_sensels(observations) if self.viz_level >= VizLevel.State: from . import String y = self.to_yaml() s = yaml.dump(y) self.pub_state.publish(String(s)) return timestamp, observations