-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed e8a6e84 with MkDocs version: 1.5.3
- Loading branch information
1 parent
b007d21
commit 892e4d2
Showing
23 changed files
with
1,572 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" > | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="shortcut icon" href="../../img/favicon.ico" /> | ||
<title>路口微观3D 动画演示运动场景spectator.py - 交通仿真文档</title> | ||
<link rel="stylesheet" href="../../css/theme.css" /> | ||
<link rel="stylesheet" href="../../css/theme_extra.css" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" /> | ||
<link href="../../extra.css" rel="stylesheet" /> | ||
|
||
<script> | ||
// Current page data | ||
var mkdocs_page_name = "\u8def\u53e3\u5fae\u89c23D \u52a8\u753b\u6f14\u793a\u8fd0\u52a8\u573a\u666fspectator.py"; | ||
var mkdocs_page_input_path = "course\\microscopic_Intersection_demo.md"; | ||
var mkdocs_page_url = null; | ||
</script> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="../../js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script> | ||
<script>hljs.highlightAll();</script> | ||
</head> | ||
|
||
<body class="wy-body-for-nav" role="document"> | ||
|
||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search"> | ||
<a href="../.." class="icon icon-home"> 交通仿真文档 | ||
</a><div role="search"> | ||
<form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" title="Type search term here" /> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../..">主页</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | ||
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu"> | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../..">交通仿真文档</a> | ||
|
||
</nav> | ||
<div class="wy-nav-content"> | ||
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../.." class="icon icon-home" aria-label="Docs"></a></li> | ||
<li class="breadcrumb-item active">路口微观3D 动画演示运动场景spectator.py</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
<a href="https://github.com/OpenHUTB/carla_doc/edit/master/docs/course/microscopic_Intersection_demo.md" class="icon icon-github"> Edit on GitHub</a> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div class="section" itemprop="articleBody"> | ||
|
||
<h1 id="3d-spectatorpy">路口微观3D 动画演示运动场景spectator.py</h1> | ||
<h4 id="_1"><strong>介绍</strong></h4> | ||
<p>此脚本连接到CARLA仿真环境,并定期切换湖工商附近的四个预设路口视角。通过不断改变观众(Spectator)的视角,用户可以观察到不同路口的交通状况。</p> | ||
<h4 id="_2"><strong>环境要求</strong></h4> | ||
<ul> | ||
<li> | ||
<p>Python 3.6 及以上版本</p> | ||
</li> | ||
<li> | ||
<p>CARLA 仿真环境</p> | ||
</li> | ||
<li> | ||
<p>安装必要的Python库:</p> | ||
</li> | ||
</ul> | ||
<p><code>pip install carla</code></p> | ||
<h4 id="_3"><strong>运行</strong></h4> | ||
<p>此示例支持设置 <strong>spectator</strong> 视角来观察交通路口运动情形。</p> | ||
<p>以下示例通过预定义 <strong>spectator</strong> 对象视角的位置 <strong>Location</strong> 和旋转角度 <strong>pitch</strong> 来进行视角的更换</p> | ||
<pre><code>client = carla.Client('localhost', 2000) | ||
client.set_timeout(10) | ||
world = client.get_world() | ||
spectator_transform = [ | ||
carla.Transform(carla.Location(x=-323, y=-15.7, z=108), carla.Rotation(pitch=-90)), | ||
carla.Transform(carla.Location(x=-359.6, y=391.3, z=94), carla.Rotation(pitch=-90)), | ||
carla.Transform(carla.Location(x=426.2, y=-33.4, z=91.6), carla.Rotation(pitch=-90)), | ||
carla.Transform(carla.Location(x=375.1, y=-558.4, z=91.6), carla.Rotation(pitch=-90)) | ||
] | ||
spectator = world.get_spectator() | ||
spectator.set_transform(spectator_transform[0]) | ||
</code></pre> | ||
<h5 id="_4">定期切换视角</h5> | ||
<p>脚本将连接到CARLA服务器,并每5秒切换一次预设的观众视角。</p> | ||
<pre><code>start_time = time.time() | ||
state = 0 | ||
while True: | ||
elapsed_time = time.time() - start_time | ||
if elapsed_time >= 5: | ||
spectator.set_transform(spectator_transform[state]) | ||
state += 1 | ||
if state > 3: | ||
state = 0 | ||
start_time = time.time() | ||
</code></pre> | ||
<h5 id="_5">运行结果:</h5> | ||
<p><img alt="" src="../../img/traffic_course_img/1.gif" /></p> | ||
|
||
</div> | ||
</div><footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<!-- Copyright etc --> | ||
</div> | ||
|
||
</footer> | ||
|
||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
|
||
<div class="rst-versions" role="note" aria-label="Versions"> | ||
<span class="rst-current-version" data-toggle="rst-current-version"> | ||
|
||
<span> | ||
<a href="https://github.com/OpenHUTB/carla_doc" class="fa fa-github" style="color: #fcfcfc"> GitHub</a> | ||
</span> | ||
|
||
|
||
|
||
</span> | ||
</div> | ||
<script src="../../js/jquery-3.6.0.min.js"></script> | ||
<script>var base_url = "../..";</script> | ||
<script src="../../js/theme_extra.js"></script> | ||
<script src="../../js/theme.js"></script> | ||
<script src="../../extra.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | ||
<script src="../../search/main.js"></script> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.