Comments (2)
Ok, so using BasicAgent
in Carla 0.9.13's PythonAPI, I've successfully generated correct route. It can be seen as below:
There is something need to be addressed:
- This bug seems hard to reproduce the exact same behavior, but it generally exists. I've tried to run the same scenario under Ubuntu 22.04, it turns out the
car1
's route is correct butcar2
andcar3
remain incorrect. - I think copying a specific version of PythonAPI isn't a good idea, this part of API is rapidly changing. Since each distribution contains a version of
BasicAgent
, why don't we just wrap around this class?
I'll leave the test code below, for reproducibility:
import carla
import random
import time
from agents.navigation.basic_agent import BasicAgent
from agents.tools.misc import draw_waypoints
scenario = {
"map": "Town03",
"actors": {
"car1": {
"start": [170.5, 80, 0.4],
"end": [144, 59, 0]
},
"car2": {
"start": [188, 59, 0.4],
"end": [167, 75.7, 0.13],
},
"car3": {
"start": [147.6, 62.6, 0.4],
"end": [191.2, 62.7, 0],
}
},
"weather_distribution": [0],
"max_steps": 500,
"spectator_location": [140, 68, 9],
}
class PathTracker:
'''Path tracker for the agent to follow the path
'''
def __init__(self, origin, destination, actor):
self.agent = BasicAgent(actor)
self.agent.set_destination(
carla.Location(x=destination[0],
y=destination[1], z=destination[2]),
carla.Location(x=origin[0], y=origin[1], z=origin[2])
)
def get_path(self):
return self.agent._local_planner.get_plan()
def create_scenario(client, scenario):
world = client.load_world(scenario["map"])
map = world.get_map()
vehicle_blueprints = world.get_blueprint_library().filter('vehicle.*')
actors = {}
for actor_id in scenario["actors"]:
bp = random.choice(vehicle_blueprints)
start_loc = carla.Location(x=scenario["actors"][actor_id]["start"][0],
y=scenario["actors"][actor_id]["start"][1],
z=scenario["actors"][actor_id]["start"][2])
spawn_point = carla.Transform(
start_loc,
map.get_waypoint(
start_loc, project_to_road=True).transform.rotation
)
actors[actor_id] = world.spawn_actor(bp, spawn_point)
if scenario.get("spectator_location", None) is not None:
spectator_transform = carla.Transform(
carla.Location(x=scenario["spectator_location"][0],
y=scenario["spectator_location"][1],
z=scenario["spectator_location"][2]),
carla.Rotation(pitch=-90)
)
world.get_spectator().set_transform(spectator_transform)
return actors
if __name__ == "__main__":
client = carla.Client("localhost", 2000)
client.set_timeout(10)
actors = create_scenario(client, scenario)
path_trackers = [PathTracker(scenario["actors"][actor_id]["start"],
scenario["actors"][actor_id]["end"], actors[actor_id]) for actor_id in scenario["actors"]]
while True:
for path_tracker in path_trackers:
path = path_tracker.get_path()
draw_waypoints(client.get_world(), [p[0] for p in path], 1.0)
time.sleep(0.1)
from macad-gym.
Hi,
Good to see your investigation with details.
- Thanks for the test code to reproduce the issues you described! I'll take a look.
- Yes, the carla/PythonAPI module is directly from CARLA) as stated in the README. When MACAD-Gym package was developed, that module was included in code instead of importing because we didn't publish CARLA python wheels for versions 0.9.6 to 0.9.11 as you can see on the package registry here: https://pypi.org/project/carla/#history. The reason for using the specific API version was to ensure the results in the MACAG-Gym paper is reproducible.
Recently, MACAD-Gym started adding support for CARLA 0.9.13 and later. It is a good idea to update the Traffic Manager APIs to the latest versions. From your #82 PR description, it sounds like you also tried the autopilot and path tracking with CARLA v0.9.13
and found it to be unusable because the autopilot chooses destinations/path at random especially at the intersections. We need to use a deterministic planner to ensure that every agent in a specific Multi-Agent RL environment behaves as expected and is reproducible (deterministic env). Any randomness in the behaviour should be driven by a random seed to make the RL problem tractable and reproducible.
I'll take a look into the path tracking issue you raised and update when I have one.
from macad-gym.
Related Issues (20)
- Unable to use RL algorithms with continuous action space HOT 5
- Increasing number of steps per episode/ iteration HOT 3
- Multiprocess pickle Problem HOT 3
- How to set the spectator on the agent HOT 1
- Does macad-gym support multi-agent algos training? HOT 2
- Also stuck in env.reset() in example HOT 3
- How to create communicating environment?
- How to visualize the learning environment? HOT 2
- Support the library HOT 3
- `multi_view_render` will pop new display window on each frame with latest version of Pygame HOT 6
- The latest pull request is incomplete HOT 3
- gym version will affect the usage of ray[rllib] HOT 2
- when I use urban_signal_intersection_3c env ,happen error,please help me HOT 8
- How to customize a learning environment? HOT 2
- How do we port an existing multi-agent leanring algorithm such as IDDPG, IPPO? HOT 4
- Communication Mechanism
- v0.1.3 carla serve can't get connection HOT 1
- Implement of IMPALA Agent Examples HOT 2
- No support for other sensors? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from macad-gym.