def test_marker(self): """ Tests marker """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/markers", MarkerArray, timeout=TIMEOUT) self.assertEqual(len(msg.markers), 1) # only ego vehicle exists ego_marker = msg.markers[0] self.assertEqual(ego_marker.header.frame_id, "map") self.assertNotEqual(ego_marker.id, 0) self.assertEqual(ego_marker.type, 1) self.assertNotEqual(ego_marker.pose, Pose()) self.assertNotEqual(ego_marker.scale, Vector3()) self.assertEqual(ego_marker.color.r, 0.0) self.assertEqual(ego_marker.color.g, 255.0) self.assertEqual(ego_marker.color.b, 0.0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_vehicle_info(self): """ Tests vehicle_info """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message( "/carla/ego_vehicle/vehicle_info", CarlaEgoVehicleInfo, timeout=TIMEOUT, qos_profile=QoSProfile( depth=1, durability=DurabilityPolicy.TRANSIENT_LOCAL)) self.assertNotEqual(msg.id, 0) self.assertEqual(msg.type, "vehicle.tesla.model3") self.assertEqual(msg.rolename, "ego_vehicle") self.assertEqual(len(msg.wheels), 4) self.assertNotEqual(msg.max_rpm, 0.0) self.assertNotEqual(msg.moi, 0.0) self.assertNotEqual(msg.damping_rate_full_throttle, 0.0) self.assertNotEqual(msg.damping_rate_zero_throttle_clutch_engaged, 0.0) self.assertNotEqual( msg.damping_rate_zero_throttle_clutch_disengaged, 0.0) self.assertTrue(msg.use_gear_autobox) self.assertNotEqual(msg.gear_switch_time, 0.0) self.assertNotEqual(msg.mass, 0.0) self.assertNotEqual(msg.clutch_strength, 0.0) self.assertNotEqual(msg.drag_coefficient, 0.0) self.assertNotEqual(msg.center_of_mass, Vector3()) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_clock(self): """ Tests clock """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/clock", Clock, timeout=TIMEOUT) self.assertNotEqual(Clock(), msg) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_dvs_camera_events(self): """ Tests dvs camera events """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/dvs_front/events", PointCloud2, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/dvs_front") finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_actor_list(self): """ Tests actor_list """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/actor_list", CarlaActorList, timeout=TIMEOUT) self.assertNotEqual(len(msg.actors), 0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_semantic_lidar(self): """ Tests semantic_lidar sensor node """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/semantic_lidar", PointCloud2, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/semantic_lidar") finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_objects(self): """ Tests carla objects """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/objects", ObjectArray, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "map") self.assertEqual(len(msg.objects), 1) # only ego vehicle exists finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_ego_vehicle_objects(self): """ Tests objects node for ego_vehicle """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/objects", ObjectArray, timeout=15) self.assertEqual(msg.header.frame_id, "map") self.assertEqual(len(msg.objects), 0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_vehicle_status(self, proc_output): """ Tests vehicle_status """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/vehicle_status", CarlaEgoVehicleStatus) self.assertNotEqual(msg.header, Header()) self.assertEqual(msg.header.frame_id, 'map') self.assertNotEqual(msg.orientation, Quaternion()) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_odometry(self): """ Tests Odometry """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/odometry", Odometry, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "map") self.assertEqual(msg.child_frame_id, "ego_vehicle") self.assertNotEqual(msg.pose, Pose()) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_traffic_lights_info(self): """ Tests traffic_lights """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message( "/carla/traffic_lights/info", CarlaTrafficLightInfoList, timeout=TIMEOUT, qos_profile=QoSProfile( depth=10, durability=DurabilityPolicy.TRANSIENT_LOCAL)) self.assertNotEqual(len(msg.traffic_lights), 0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_map(self): """ Tests map """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message( "/carla/map", String, timeout=TIMEOUT, qos_profile=QoSProfile( depth=10, durability=DurabilityPolicy.TRANSIENT_LOCAL)) self.assertNotEqual(len(msg.data), 0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_dvs_camera_image(self): """ Tests dvs camera images """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/dvs_front/image", Image, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/dvs_front") self.assertEqual(msg.height, 70) self.assertEqual(msg.width, 400) self.assertEqual(msg.encoding, "bgr8") finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_camera_info(self): """ Tests camera_info """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message( "/carla/ego_vehicle/rgb_front/camera_info", CameraInfo, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/rgb_front") self.assertEqual(msg.height, 600) self.assertEqual(msg.width, 800) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_imu(self): """ Tests IMU sensor node """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/imu", Imu, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/imu") self.assertNotEqual(msg.linear_acceleration, 0.0) self.assertNotEqual(msg.angular_velocity, 0.0) self.assertNotEqual(msg.orientation, 0.0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_gnss(self): """ Tests Gnss """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message("/carla/ego_vehicle/gnss", NavSatFix, timeout=TIMEOUT) self.assertEqual(msg.header.frame_id, "ego_vehicle/gnss") self.assertNotEqual(msg.latitude, 0.0) self.assertNotEqual(msg.longitude, 0.0) self.assertNotEqual(msg.altitude, 0.0) finally: if node is not None: node.destroy_node() roscomp.shutdown()
def test_world_info(self): """ Tests world_info """ try: node = None roscomp.init("test_node") node = CompatibleNode('test_node') msg = node.wait_for_message( "/carla/world_info", CarlaWorldInfo, timeout=TIMEOUT, qos_profile=QoSProfile( depth=10, durability=DurabilityPolicy.TRANSIENT_LOCAL)) self.assertNotEqual(len(msg.map_name), 0) self.assertNotEqual(len(msg.opendrive), 0) finally: if node is not None: node.destroy_node() roscomp.shutdown()