怎么用代码去写一个场景,用dreamview加载出来 #15530
Replies: 4 comments 1 reply
-
You can check out projects like BehAVExplor, AV-Fuzzer that use code to specify LGSVL scenario. (There are other LGSVL-based implementations but those two are easier to run in my opinion.) I also have some projects that specify SimControl scenarios (scenoRITA, DoppelTest). I tried to implement scenoRITA in a way that (hopefully) makes it easy to specify SimControl scenario with code. There are still many deficiencies, but you should be able to specify a scenario with a static obstacle and do what you said automatically via code like this ego = EgoCar(
initial_position=PositionEstimate(lane_id="lane_27", s=35),
final_position=PositionEstimate(lane_id="lane_29", s=10),
)
obstacle = Obstacle(
id=1,
initial_position=ObstaclePosition(lane_id="lane_29", index=0),
final_position=ObstaclePosition(lane_id="lane_29", index=0),
type=ObstacleType.VEHICLE,
speed=10,
width=1.5,
length=2,
height=1.5,
motion=ObstacleMotion.STATIC,
)
scenario = Scenario(
generation_id=0,
scenario_id=0,
ego_car=ego,
obstacles=[obstacle]
)
# ......
ctn = ApolloContainer(APOLLO_ROOT, f"{PROJECT_NAME}_dev_start")
ctn.start_container(verbose=True)
ctn.start_dreamview()
print(f"Dreamview running at {ctn.dreamview_url}")
# ......
run_scenario(ctn, in_docker_path, in_docker_output, scenario_length, initial_x, initial_y, initial_heading) In DoppelTest, you can specify a scenario with multiple Apollo instances via code x = Scenario(
ad_section=ADSection(
[
ADAgent(['lane_25', 'lane_19'], 105, 40, 0),
ADAgent(['lane_25', 'lane_19'], 115, 40, 0),
ADAgent(['lane_25', 'lane_19'], 125, 40, 0),
]
),
pd_section=PDSection([]),
tc_section=TCSection.get_one()) But since I implemented DoppelTest way earlier, it lacks implementation for automatically installing Apollo and running Apollo the proper way (i.e., as a non-root user). I am happy to answer any questions if you have trouble making them work for your purpose. |
Beta Was this translation helpful? Give feedback.
-
hi,YuqiHuai,之前我跑过你的DoppelTest项目非常好用,我非常想跟您学习一下如何使用apollo来coding场景的,您之前是自己研究apollo源码吗,比如把这个值传入到某个函数里,开启容器就可以运行设置的这个场景了x = Scenario( |
Beta Was this translation helpful? Give feedback.
-
谢谢。是自己研究的代码,应该目前没有关于这些的具体教程,当时主要是看着LGSVL的代码做的这个,没用LGSVL因为LGSVL不支持多个EGO car模式下的Ground Truth Perception。Scenario那一部分都是当时自己定义的框架,这部分其实和Apollo自身的代码关系不大,就是看你想怎么定义场景,比如在scenoRITA中又换了另一种代码区定义场景。DoppelTest中和Apollo的交互主要是在这一部分,通过Apollo的CyberRT发送Routing, TrafficLightDetection,和PerceptionObstacles, 是研究了LGSVL的CyberRT Bridge然后做的。 |
Beta Was this translation helpful? Give feedback.
-
I think this issue can be discussed in discuss |
Beta Was this translation helpful? Give feedback.
-
我想生成一个场景,怎么用代码去创造出来
比如可能程序流程是这样的:①加载地图②放置egovehicle③设置车辆起始点④设置静态障碍物⑤开启一个容器运行场景
问题:有没有代码模板来生成场景,而不是在仿真平台场景编辑中手动设置
Beta Was this translation helpful? Give feedback.
All reactions