Skip to content

Commit

Permalink
modified to use with autoware
Browse files Browse the repository at this point in the history
'
  • Loading branch information
kuriatsu committed Oct 6, 2023
1 parent e9063d9 commit 8c3b7f6
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 77 deletions.
26 changes: 13 additions & 13 deletions carla_ros_bridge/src/carla_ros_bridge/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,19 @@ def main(args=None):

carla_world = carla_client.get_world()

if "town" in parameters and not parameters['passive']:
if parameters["town"].endswith(".xodr"):
carla_bridge.loginfo(
"Loading opendrive world from file '{}'".format(parameters["town"]))
with open(parameters["town"]) as od_file:
data = od_file.read()
carla_world = carla_client.generate_opendrive_world(str(data))
else:
if carla_world.get_map().name != parameters["town"]:
carla_bridge.loginfo("Loading town '{}' (previous: '{}').".format(
parameters["town"], carla_world.get_map().name))
carla_world = carla_client.load_world(parameters["town"])
carla_world.tick()
# if "town" in parameters and not parameters['passive']:
# if parameters["town"].endswith(".xodr"):
# carla_bridge.loginfo(
# "Loading opendrive world from file '{}'".format(parameters["town"]))
# with open(parameters["town"]) as od_file:
# data = od_file.read()
# carla_world = carla_client.generate_opendrive_world(str(data))
# else:
# if carla_world.get_map().name != parameters["town"]:
# carla_bridge.loginfo("Loading town '{}' (previous: '{}').".format(
# parameters["town"], carla_world.get_map().name))
# carla_world = carla_client.load_world(parameters["town"])
# carla_world.tick()

carla_bridge.initialize_bridge(carla_client.get_world(), parameters)

Expand Down
58 changes: 4 additions & 54 deletions carla_spawn_objects/config/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,65 +52,15 @@
{
"type": "sensor.lidar.ray_cast",
"id": "lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"channels": 128,
"points_per_second": 281600,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20,
"noise_stddev": 0.0
},
{
"type": "sensor.lidar.ray_cast_semantic",
"id": "semantic_lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20
},
{
"type": "sensor.other.radar",
"id": "radar_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"horizontal_fov": 30.0,
"vertical_fov": 10.0,
"points_per_second": 1500,
"range": 100.0
},
{
"type": "sensor.camera.semantic_segmentation",
"id": "semantic_segmentation_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.depth",
"id": "depth_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.dvs",
"id": "dvs_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70,
"positive_threshold": 0.3,
"negative_threshold": 0.3,
"sigma_positive_threshold": 0.0,
"sigma_negative_threshold": 0.0,
"use_log": true,
"log_eps": 0.001
},
{
"type": "sensor.other.gnss",
"id": "gnss",
Expand All @@ -136,7 +86,7 @@
"id": "lane_invasion",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 0.0}
},
{
{
"type": "sensor.pseudo.tf",
"id": "tf"
},
Expand Down
162 changes: 162 additions & 0 deletions carla_spawn_objects/config/objects.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"objects":
[
{
"type": "sensor.pseudo.traffic_lights",
"id": "traffic_lights"
},
{
"type": "sensor.pseudo.objects",
"id": "objects"
},
{
"type": "sensor.pseudo.actor_list",
"id": "actor_list"
},
{
"type": "sensor.pseudo.markers",
"id": "markers"
},
{
"type": "sensor.pseudo.opendrive_map",
"id": "map"
},
{
"type": "vehicle.tesla.model3",
"id": "ego_vehicle",
"sensors":
[
{
"type": "sensor.camera.rgb",
"id": "rgb_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"image_size_x": 800,
"image_size_y": 600,
"fov": 90.0
},
{
"type": "sensor.camera.rgb",
"id": "rgb_view",
"spawn_point": {"x": -4.5, "y": 0.0, "z": 2.8, "roll": 0.0, "pitch": 20.0, "yaw": 0.0},
"image_size_x": 800,
"image_size_y": 600,
"fov": 90.0,
"attached_objects":
[
{
"type": "actor.pseudo.control",
"id": "control"
}
]
},
{
"type": "sensor.lidar.ray_cast",
"id": "lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20,
"noise_stddev": 0.0
},
{
"type": "sensor.lidar.ray_cast_semantic",
"id": "semantic_lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20
},
{
"type": "sensor.other.radar",
"id": "radar_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"horizontal_fov": 30.0,
"vertical_fov": 10.0,
"points_per_second": 1500,
"range": 100.0
},
{
"type": "sensor.camera.semantic_segmentation",
"id": "semantic_segmentation_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.depth",
"id": "depth_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.dvs",
"id": "dvs_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70,
"positive_threshold": 0.3,
"negative_threshold": 0.3,
"sigma_positive_threshold": 0.0,
"sigma_negative_threshold": 0.0,
"use_log": true,
"log_eps": 0.001
},
{
"type": "sensor.other.gnss",
"id": "gnss",
"spawn_point": {"x": 1.0, "y": 0.0, "z": 2.0},
"noise_alt_stddev": 0.0, "noise_lat_stddev": 0.0, "noise_lon_stddev": 0.0,
"noise_alt_bias": 0.0, "noise_lat_bias": 0.0, "noise_lon_bias": 0.0
},
{
"type": "sensor.other.imu",
"id": "imu",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"noise_accel_stddev_x": 0.0, "noise_accel_stddev_y": 0.0, "noise_accel_stddev_z": 0.0,
"noise_gyro_stddev_x": 0.0, "noise_gyro_stddev_y": 0.0, "noise_gyro_stddev_z": 0.0,
"noise_gyro_bias_x": 0.0, "noise_gyro_bias_y": 0.0, "noise_gyro_bias_z": 0.0
},
{
"type": "sensor.other.collision",
"id": "collision",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 0.0}
},
{
"type": "sensor.other.lane_invasion",
"id": "lane_invasion",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 0.0}
},
{
"type": "sensor.pseudo.tf",
"id": "tf"
},
{
"type": "sensor.pseudo.objects",
"id": "objects"
},
{
"type": "sensor.pseudo.odom",
"id": "odometry"
},
{
"type": "sensor.pseudo.speedometer",
"id": "speedometer"
},
{
"type": "actor.pseudo.control",
"id": "control"
}
]
}
]
}
20 changes: 10 additions & 10 deletions carla_spawn_objects/launch/carla_example_ego_vehicle.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ def generate_launch_description():
'spawn_sensors_only': launch.substitutions.LaunchConfiguration('spawn_sensors_only')
}.items()
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'carla_spawn_objects'), 'set_initial_pose.launch.py')
),
launch_arguments={
'role_name': launch.substitutions.LaunchConfiguration('role_name'),
'control_id': launch.substitutions.LaunchConfiguration('control_id')
}.items()
)
# launch.actions.IncludeLaunchDescription(
# launch.launch_description_sources.PythonLaunchDescriptionSource(
# os.path.join(get_package_share_directory(
# 'carla_spawn_objects'), 'set_initial_pose.launch.py')
# ),
# launch_arguments={
# 'role_name': launch.substitutions.LaunchConfiguration('role_name'),
# 'control_id': launch.substitutions.LaunchConfiguration('control_id')
# }.items()
# )
])
return ld

Expand Down

0 comments on commit 8c3b7f6

Please sign in to comment.