Comments (8)
When I modify scenarios.py as you said, but random npcs are not generated on the map, can you provide an example for me to learn from?
Are you using the latest version in this repository instead of Pypi version? If so, you can try this script:
from macad_gym.envs import MultiCarlaEnv
configs = {
"scenarios": {
"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,
"num_vehicles": 20, # The number of npc vehicles
"num_pedestrians": 0,
},
"env": {
"server_map": "/Game/Carla/Maps/Town03",
"render": True,
"render_x_res": 800,
"render_y_res": 600,
"x_res": 168,
"y_res": 168,
"framestack": 1,
"discrete_actions": True,
"squash_action_logits": False,
"verbose": False,
"use_depth_camera": False,
"send_measurements": False,
"enable_planner": True,
"spectator_loc": [140, 68, 9],
"sync_server": True,
"fixed_delta_seconds": 0.05,
},
"actors": {
"car1": {
"type": "vehicle_4W",
"enable_planner": True,
"convert_images_to_video": False,
"early_terminate_on_collision": True,
"reward_function": "corl2017",
"scenarios": "SSUI3C_TOWN3_CAR1",
"manual_control": False,
"auto_control": False,
"camera_type": "rgb",
"collision_sensor": "on",
"lane_sensor": "on",
"log_images": False,
"log_measurements": False,
"render": True,
"x_res": 168,
"y_res": 168,
"use_depth_camera": False,
"send_measurements": False,
},
"car2": {
"type": "vehicle_4W",
"enable_planner": True,
"convert_images_to_video": False,
"early_terminate_on_collision": True,
"reward_function": "corl2017",
"scenarios": "SSUI3C_TOWN3_CAR2",
"manual_control": False,
"auto_control": False,
"camera_type": "rgb",
"collision_sensor": "on",
"lane_sensor": "on",
"log_images": False,
"log_measurements": False,
"render": True,
"x_res": 168,
"y_res": 168,
"use_depth_camera": False,
"send_measurements": False,
},
"car3": {
"type": "vehicle_4W",
"enable_planner": True,
"convert_images_to_video": False,
"early_terminate_on_collision": True,
"reward_function": "corl2017",
"scenarios": "SSUI3C_TOWN3_CAR3",
"manual_control": False,
"auto_control": False,
"camera_type": "rgb",
"collision_sensor": "on",
"lane_sensor": "on",
"log_images": False,
"log_measurements": False,
"render": True,
"x_res": 168,
"y_res": 168,
"use_depth_camera": False,
"send_measurements": False,
},
},
}
if __name__ == "__main__":
env = MultiCarlaEnv(configs)
for ep in range(2):
obs = env.reset()
total_reward_dict = {}
action_dict = {}
env_config = configs["env"]
actor_configs = configs["actors"]
for actor_id in actor_configs.keys():
total_reward_dict[actor_id] = 0
if env._discrete_actions:
action_dict[actor_id] = 4 # Brake
else:
action_dict[actor_id] = [0, 0] # test values
i = 0
done = {"__all__": False}
while not done["__all__"]:
# while i < 20: # TEST
i += 1
obs, reward, done, info = env.step(action_dict)
# action_dict = get_next_actions(info, env.discrete_actions)
for actor_id in total_reward_dict.keys():
total_reward_dict[actor_id] += reward[actor_id]
print(":{}\n\t".join(["Step#", "rew", "ep_rew",
"done{}"]).format(i, reward,
total_reward_dict, done))
Remember the spawn point is at random, you might not easily see those npc if you set a relateively small number of them.
from macad-gym.
I think this is a deprecated env, you should use HomoNcomIndePOIntrxMASS3CTWN3
instead. You can also manually add "scenarios" in the USI3C_CONFIGS
, that is:
USI3C_CONFIGS = {
"scenarios": "SSUI3C_TOWN3",
# Keep the rest untouched
}
from macad-gym.
thanks,I have found the error, but in fact the generated vehicle position is not at the observation point. I will use HomoNcomIndePOIntrxMASS3CTWN3 instead. Is there any way to increase the simulated traffic flow of vehicles driven by intersection rules?
from macad-gym.
Is there any way to increase the simulated traffic flow of vehicles driven by intersection rules?
Macad-Gym only support spawning npcs at random places. To do so, you have to copy the definition of scenario and change the number of num_vehicles
and num_pedestrains
. Unfortunately, you can't spawn npcs right at the intersection area for now.
# Scenario definition from SSUI3C_TOWN3
env_config = {
"scenarios": {
"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,
"num_vehicles": 0, # Change this to spawn npc vehicles at random place, they are controlled by autopilot
"num_pedestrians": 0,
}
# keep "env" and "actors" config untouched
}
from macad-gym.
When I modify scenarios.py as you said, but random npcs are not generated on the map, can you provide an example for me to learn from?
from macad-gym.
Thanks,I solved this problem.
I tried your open source code of marllib on macad, but the environment of macad cannot be registered successfully on marllib,I tried to solve it but failed
from macad-gym.
I tried your open source code of marllib on macad, but the environment of macad cannot be registered successfully on marllib,I tried to solve it but failed
This is not related to the current issue. If the problem has been solved, please close this one and start a new issue in that repo.
from macad-gym.
THA====
from macad-gym.
Related Issues (20)
- 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? HOT 1
- 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
- PathTracker generate wrong route HOT 2
- 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 HOT 1
- 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
- 'NoneType' object has no attribute 'pid'
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.