Skip to content

Add Feature: Dreamview remote controller for carla#174

Open
cfs4819 wants to merge 4 commits intoguardstrikelab:masterfrom
cfs4819:dreamview-dev
Open

Add Feature: Dreamview remote controller for carla#174
cfs4819 wants to merge 4 commits intoguardstrikelab:masterfrom
cfs4819:dreamview-dev

Conversation

@cfs4819
Copy link
Contributor

@cfs4819 cfs4819 commented Dec 28, 2023

Description

Referring to LGSVL's dreamview, built a dreamview for carla_bridge.

Dreamview-remote can help :

  • Setting destination by set_destination_tranform()
  • Enabling/Disabling modules
  • Selecting HDMaps in Dreamview
  • Selecting vehicle models in Dreamview
  • Getting modules' status
  • .etc

For example, we can select a destination by

# set host and port 
host = 'localhost'
port = 2000

# connect
carla_client = carla.Client(host, port)
carla_world = carla_client.get_world()
carla_map = carla_world.get_map()

# find ego_vehicle 
ego_vehicle = None
all_vehicles = self.carla_world.get_actors().filter("*vehicle.*")
for vehicle in all_vehicles:
    if vehicle.attributes["role_name"] == "ego_vehicle":
        ego_vehicle = vehicle
        break

# get a avaliabel destination transform
dest_transform = random.choice(carla_map.get_spawn_points())

# connect dreamview
from carla_bridge.dreamview_carla import dreamview
dv = dreamview.Connection(
                    ego_vehicle,
                    ip=dreamview_ip,
                    port=str(dreamview_port))

# setup modules and pub destination
modules = [
            'Transform',  # ok
            'Routing',
            'Prediction',  # ok
            'Planning',  # ok
            'Control',
            'Storytelling'  # ok
] 
dv.enable_apollo(dest_transform, modules)

Then we can notice vehicle driving.

Issue reference

Please reference the issue this PR will close: #90 #44

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Reference document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant