diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 1d51a4e..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-docs/build/
-test/*.svg
-test/*.png
-test/*.pdf
-test/*.webm
-test/*.gif
-
-# auto-generated files
-docs/build/
-docs/src/tutorials
-docs/src/notebooks
-docs/src/assets
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7da473f..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Documentation: http://docs.travis-ci.com/user/languages/julia/
-language: julia
-sudo: required
-os:
- - linux
- - osx
-julia:
- - 1
-
-addons:
- apt:
- packages:
- - libgtk-3-dev
-
-notifications:
- email: false
-script:
- - git clone https://github.com/JuliaRegistries/General $(julia -e 'import Pkg; println(joinpath(Pkg.depots1(), "registries", "General"))')
- - git clone https://github.com/SISL/Registry $(julia -e 'import Pkg; println(joinpath(Pkg.depots1(), "registries", "SISL"))')
- - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- - julia --project -e 'using Pkg; Pkg.add(PackageSpec(name="JSExpr", version="0.5"))'
- - julia --project --color=yes --check-bounds=yes -e 'import Pkg; Pkg.build(); Pkg.test("AutoViz"; coverage=true)'
-after_success:
- - julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
-
-jobs:
- include:
- - stage: "Documentation"
- julia: 1
- os: linux
- script:
- - git clone https://github.com/JuliaRegistries/General $(julia -e 'import Pkg; println(joinpath(Pkg.depots1(), "registries", "General"))')
- - git clone https://github.com/SISL/Registry $(julia -e 'import Pkg; println(joinpath(Pkg.depots1(), "registries", "SISL"))')
- - julia --project=docs/ -e 'using Pkg; Pkg.add("Documenter");
- Pkg.develop(PackageSpec(path=pwd()));
- Pkg.instantiate()'
- - julia --project=docs/ docs/make.jl
- after_success: skip
diff --git a/LICENSE.md b/LICENSE.md
deleted file mode 100644
index f3f7ca1..0000000
--- a/LICENSE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-The AutoViz.jl package is licensed under the MIT "Expat" License:
-
-> Copyright (c) 2016: Tim Wheeler.
->
-> Permission is hereby granted, free of charge, to any person obtaining
-> a copy of this software and associated documentation files (the
-> "Software"), to deal in the Software without restriction, including
-> without limitation the rights to use, copy, modify, merge, publish,
-> distribute, sublicense, and/or sell copies of the Software, and to
-> permit persons to whom the Software is furnished to do so, subject to
-> the following conditions:
->
-> The above copyright notice and this permission notice shall be
-> included in all copies or substantial portions of the Software.
->
-> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Project.toml b/Project.toml
deleted file mode 100644
index 0483d70..0000000
--- a/Project.toml
+++ /dev/null
@@ -1,26 +0,0 @@
-name = "AutoViz"
-uuid = "82aa6e0c-a491-5edf-8d4b-c16b98e4ea17"
-repo = "https://github.com/sisl/AutoViz.jl.git"
-version = "0.9.0"
-
-[deps]
-AutomotiveDrivingModels = "99497e54-f3d6-53d3-a3a9-fa9315a7f1ba"
-Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
-Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
-Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
-Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
-Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
-Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
-Rsvg = "c4c386cf-5103-5370-be45-f3a111cca3b8"
-StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
-
-[compat]
-AutomotiveDrivingModels = "0.8"
-
-[extras]
-Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-Reel = "71555da5-176e-5e73-a222-aebc6c6e4f2f"
-Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
-
-[targets]
-test = ["Random", "Reel", "Test"]
diff --git a/README.md b/README.md
deleted file mode 100644
index 41e5b0f..0000000
--- a/README.md
+++ /dev/null
@@ -1,199 +0,0 @@
-# AutoViz
-
-[](https://travis-ci.org/sisl/AutoViz.jl)
-[](https://coveralls.io/r/sisl/AutoViz.jl)
-[](https://sisl.github.io/AutoViz.jl/latest)
-
-A package for rendering simple scenes primarily consisting of cars on roadways using Cairo.
-
-AutoViz is undergoing significant changes. If you are looking for the version before these changes that is designed around AutomotiveDrivingModels.jl, please checkout the v0.6.0 tag.
-
-
-
-## Installation
-
-In julia 1.1+, the preferred way is to add the SISL registry and install AutoViz as follows:
-
-```julia
-] registry add https://github.com/sisl/Registry
-] add AutoViz
-```
-
-## Usage
-
-**Warning: This part of the documentation is not up to date, the documentation website will be updated soon, the notebook tutorial is up to date with AutoViz v0.8 **
-
-AutoViz works by adding rendering instructions to a `RenderModel`,
-and finally applying those instructions to a canvas using the
-`render` function.
-
-### Basic Usage
-
-In the simplest case, a `roadway` and a `scene` of types `Roadway` and `Scene`
-respectively can be rendered via
-
-```julia
-render([roadway, scene])
-```
-
-However, the rendering interface is much more flexible than that,
-supporting custom rendering and cameras.
-
-### Renderable Objects
-
-In order for an object of type `ObjectType` to be "renderable",
-we need to provide a function with the signature
-``` julia
- add_renderable!(rendermodel::RenderModel, obj::ObjectType)
-```
-The basic example above works, because AutoViz implements the
-`add_renderable!` function for commonly used types such as
-`Roadway`, `Entity` or `Scene`.
-In general, the `render(renderables)` function can take any collection
-of renderable objects.
-AutoViz provides a series of convenient wrapper objects such as
-`FancyCar`, `FancyPedestrian`, `EntityRectangle` to make entities
-renderable.
-
-### Cameras
-
-A `Camera` object specifies what portion of the scene should be rendered.
-
-By default, `render(renderables)` uses a static camera.
-In order to use an adaptive camera, the `camera` object
-needs to be updated before rendering and passed in to the
-`render` function as a keyword argument.
-
-```julia
-update_camera!(scene, camera)
-render([roadway, scene], camera=camera)
-```
-
-### Full Example
-
-```julia
-# define roadway and vewhicle objects
-roadway = gen_straight_roadway(3, 100.0)
-lane = roadway[LaneTag(1,2)]
-def = VehicleDef(length=5., width=2.)
-ego = Entity(VehicleState(Frenet(lane, 50., 0., 0.), roadway, 5rand()), def, :ego)
-carA = Entity(VehicleState(Frenet(lane, 20., 2., -.2), roadway, 5rand()), def, :carA)
-carB = Entity(VehicleState(Frenet(lane, 40., -2., -.1), roadway, 5rand()), def, :carB)
-carC = Entity(VehicleState(Frenet(lane, 60., 0., .4), roadway, 5rand()), def, :carC)
-carD = Entity(VehicleState(Frenet(lane, 80., 3., .1), roadway, 5rand()), def, :carD)
-scene = Scene([ego, carA, carB, carC, carD])
-
-# define camera and adjust to scene
-camera = TargetFollowCamera(:ego; y=0., zoom=12.)
-update_camera!(camera, scene)
-
-# render
-renderables = [
- roadway,
- FancyCar(car=ego, color=colorant"blue"),
- FancyCar(car=carA, color=rand(RGB)),
- FancyCar(car=carB, color=rand(RGB)),
- EntityRectangle(entity=carC, color=rand(RGB)),
- EntityRectangle(entity=carD, color=rand(RGB)),
- TextOverlay(text=["AutoViz rocks!"], font_size=60, pos=VecE2(400, 100), color=colorant"green")
-]
-for veh in scene
- push!(renderables, VelocityArrow(entity=veh))
-end
-img = render(renderables, camera=camera)
-```
-
-In a jupyter notebook, an image will appear, otherwise see the [Saving images](#saving-images) section below. A short tutorial is located in [notebooks/tutorial.ipynb](notebooks/tutorial.ipynb).
-
-
-### Roadways and ArrowCars
-
-The primary basic directly renderable types are `Roadway` (now from `AutomotiveDrivingModels`; soon from `Roadways.jl`) and `ArrowCar`.
-
-`ArrowCar`s are the pink cars with arrows that are in everyone's videos. You can construct one like this:
-
-```julia
-using Colors
-using AutoViz
-
-# x, y, angle and velocity are from your simulation
-
-ArrowCar(x, y, angle; color=colorant"green", text="v: $velocity")
-```
-
-### How to make types renderable
-
-There are two ways to make renderable types.
-
-1. You can make your existing types renderable by conversion by defining `convert(::Type{Renderable}, ::MyType)` which should return a directly renderable object, e.g. an `ArrowCar`.
-2. You can make types directly renderable by defining `render!(::RenderModel, ::MyType)`. To make things easier for the compiler, you can also define `isrenderable(::Type{MyType}) = true`. If you want to allow others to convert to this type to make their types renderable by conversion, make your type a subtype of `Renderable`.
-
-## Overlays
-
-Overlays will function as in the previous version of AutoViz. They will be rendered last with `render!(rendermodel, overlay, scene)`.
-
-## Additional keyword arguments for `render()`
-
-The following additional keyword arguments will accepted by `render()`:
-
-- `canvas_width`
-- `canvas_height`
-- `rendermodel`
-- `overlays`
-- `cam` - a camera controlling the field of view as in the previous version of AutoViz
-
-## Saving images
-
-Png images can be saved with `write_to_png(render(scene), "filename.png")` or `write_to_svg(render(scene), "filename.svg")`.
- Gif animations may be created with e.g. [Reel.jl](https://github.com/shashi/Reel.jl).
-
-## `RenderModel`s
-
-The mid-level interface for this package (which is what you will use when you write `render!()` for your types or when you write an overlay) revolves around adding instructions to a `RenderModel`. Each instruction consists of a function and a tuple of arguments for the function. This is not documented in this readme, but it is fairly easy to figure out by reading `rendermodels.jl`, `overlays.jl`, and `arrowcar.jl`.
-
-## Customization
-
-AutoViz.jl has two display mode: a "fancy" mode (default) that uses the svg representations in `icons/` to display cars and pedestrian, and a more basic mode where cars are rendered as rounded rectangles. To turn-off the fancy mode you can run:
-```julia
-AutoViz.set_render_mode(:basic) # set to :fancy for fancy mode
-```
-
-In addition you can also change the color theme. Three color themes are provided: `MONOKAY` (default), `OFFICETHEME`, `LIGHTTHEME`. You can change the color theme by running:
-```julia
-using AutoViz
-set_color_theme(LIGHTTHEME)
-```
-You can also define your own color theme using a dictionary. Look at the example in `src/colorscheme.jl` to have the correct key names.
-
-
-## Change Log
-
-### v0.8.x
-
-#### Rendering
- - Clean-up of the rendering interface: there is now only one single rendering function with the signature
-```
-render!(rendermodel::RenderModel, renderables::AbstractVector; canvas_width::Int, canvas_height::Int, surface::CairoSurface))
-```
-All keyword arguments are optional. Objects of type `Renderable` now no longer have to implement the `render!` function (which is a misleading name). Instead one must implement the `add_renderable!` function which adds the rendering instructions to the `RenderModel`.
- - Implicit conversions of non-renderable objects (such as `obj::Scene{Entity{S,D,I}}`) via implementations of `Base.convert(Renderable, obj)` are now discouraged. Instead, one can overwrite the `add_renderable!` method for such types. This is done for some very common types.
- - The new `render!` function now only takes objects which are renderable, i.e. which implement the `add_renderable(rm::RenderModel, obj)` function. There is no longer a distinction between drawing roadways, scenes or overlays. They all need to satisfy the same interface, and they are drawn in the order in which they are passed to the `render!` function. This change decreases the number of available render functions from almost ten to one and should make the control flow more clear.
- - Additional arguments to `render!` such as `camera` and `car_colors` are no longer supported. Camera effects should be applied before calling `render!` (see section below) and rendering attributes such as colors should be passed in as part of a renderable object.
-
-#### Overlays
- - Changed the interface for rendering overlays to only take an instance of `RenderModel` and the overlay itself. All additional data must be stored as part of the overlay if it is needed during rendering.
- - Added a `RenderableOverlay` wrapper which makes the legacy overlays work with the new rendering interface (in which overlays do not get any input arguments for rendering)
-
-#### Cameras
- - Changed the camera interface. The full state of the camera, such as `camera_pos`, `camera_zoom`, `camera_rotation` is stored in `RenderModel` (this has already been the case in previous AutoViz versions). A `Camera` acts upon a `RenderModel` by changing these internal variables. The function `camera_set!` now becomes `update_camera!`.
- - Many setter functions for the camera have been replaced by the `set_camera!()` function which takes keyword arguments for `x`, `y` and `zoom`.
- - The implementations of `TargetFollowCamera` (former `CarFollowCamera`) and `SceneFollowCamera` have been reviewed and simplified. Additionally, a `ZoomingCamera` type which gradually changes the zoom level has been introduced and for easy extensibility there is also a `ComposedCamera` type which takes a list of cameras and applies their effects sequentially to the `RenderModel`.
- - The new `render!` function no longer takes a camera as an input argument, but assumes that the camera settings have already been applied to the `RenderModel` via `update_camera!` prior to calling `render!`. User code should be adapted accordingly.
-
-#### Visualization of Entities
- - Controlling the appearance of vehicles by setting `set_render_mode(:basic|:fancy)` is no longer encouraged. Instead, we provide new renderable types such as `EntityRectangle`, `FancyCar`, `FancyPedestrian`, `VelocityArrow` in addition to the already implemented `ArrowCar` type which can all be used to conveniently display entities.
- - A convenience function for rendering scenes directly (i.e. without explicit conversion to a `Renderable` type) is still supported.
- - TODO: make FancyCar work on my platform
-
-#### 1D Vehicles
- - Support for 1D vehicles has mostly been discontinued and some of the related functions were removed. However, the new functions should work seamlessly in many cases as long as the 1D vehicles implement basic functions such as `posg`, `width`, `length` from `AutomotiveDrivingModels.jl`
diff --git a/deps/build.jl b/deps/build.jl
deleted file mode 100644
index 3467dcc..0000000
--- a/deps/build.jl
+++ /dev/null
@@ -1,11 +0,0 @@
-using Pkg
-packages = keys(Pkg.installed())
-if !in("Vec", packages)
- Pkg.add(PackageSpec(url="https://github.com/sisl/Vec.jl.git"))
-end
-if !in("Records", packages)
- Pkg.add(PackageSpec(url="https://github.com/sisl/Records.jl.git"))
-end
-if !in("AutomotiveDrivingModels", packages)
- Pkg.add(PackageSpec(url="https://github.com/sisl/AutomotiveDrivingModels.jl.git"))
-end
\ No newline at end of file
diff --git a/dev/api/index.html b/dev/api/index.html
new file mode 100644
index 0000000..1f25064
--- /dev/null
+++ b/dev/api/index.html
@@ -0,0 +1,16 @@
+
+
Composition of several cameras. The update_camera actions of the individual cameras are applied in the order in which they are saved in the cameras array. States of individual cameras are ignored, the state of the composed camera is the one that will be used for rendering.
A drawable 'fancy' svg image of a race car. The car is placed at the position of entity and the width and length are scaled accordingly. The color of the car can be specified using the color keyword.
A drawable 'fancy' svg image of a pedestrian. The pedestrian is placed at the position of entity and the width and length of the original image are scaled accordingly. The color of the pedestrian can be specified using the color keyword.
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Fields
pos::VecE2{Float64} = VecE2(0.,0.)
coordinate_system::Symbol = :scene
label::String = "histogram"
val::Float64 = 0.5 should be between 0 and 1
width::Float64 = 2.
height::Float64 = 5.
fill_color::Colorant = colorant"blue"
line_color::Colorant = colorant"white"
font_size::Int64 = 15 # [pix]
label_pos::VecSE2{Float64} = pos + VecSE2(0., -height/2) position of the label
Display the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).
By default, the scene is tracked in x and y direction and the zoom level is adapted to fit all vehicles in the scene. Tracking in either direction can be disabled by setting the x or y keys to a desired value. The zoom level can be fixed by passing a value to zoom. The value of padding specifies the width of the additional border around the zoomed-in area.
Camera which follows the vehicle with ID target_id. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the x or y keys to a desired value.
Displays some text at the desired location. The coordinates and size units are in pixels by default. The option coordinate_system allows to use different units.
A drawable arrow representing the current velocity vector of an entity. The arrow points to the location where the vehicle will be one second in the future (assuming linear motion).
INPUT: rendermodel - the RenderModel we are adding the instruction to f - the function to be called, the first argument must be a CairoContext args - tuple of input arguments to f, skipping the CairoContext coordinatesystem - in which coordinate system are the coordinates given (one of :scene, :camerapixels, :camerarelative) :scene - coordinates are physical coordinates in the world frame in unit [meters] `:camerapixels- coordinates are in pixels and relative to the rectangle selected by the camera in unit [pixels]:camera_relative` - coordinates are in percentages in the range 0 to 1 of the rectangle selected by the camera
Draw all renderables to a surface of dimensions canvas_width x canvas_height. All renderables must implement the add_renderable! function which adds rendering instructions to the render model.
The provided camera should be updated using the update_camera!() function before calling render. If no camera is provided, the render function will default to fitting all renderable objects to the canvas.
AutoViz is a package for visualizing simple traffic scenarios using Cairo. It is primarily designed to provide rendering support for AutomotiveDrivingModels.jl. The framework currently supports building blocks such as roadways, vehicles and pedestrians and can be easily extended.
The tutorials provide a sequence of simple examples showcasing some of the main features of the AutoViz package, such as
basic rendering of vehicles and roadways
demo of the available camera behaviors
adding additional information through overlays
Note
All AutoViz tutorials are available as Jupyter notebooks by clicking on the badge at the beginning of the notebook!
The Manual section lists more details of the provided functions, which can also be accessed through the Julia REPL by typing ?function_name.
Installation instructions can be found in the repository README.
Settings
This document was generated with Documenter.jl on Monday 23 March 2020. Using Julia version 1.3.1.
diff --git a/dev/notebooks/basics.ipynb b/dev/notebooks/basics.ipynb
new file mode 100644
index 0000000..9d2871a
--- /dev/null
+++ b/dev/notebooks/basics.ipynb
@@ -0,0 +1,433 @@
+{
+ "cells": [
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "# AutoViz Basics"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "To run these tutorials, you must be using `julia 1.1+` and have `AutoViz.jl` installed."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The core function of the `AutoViz.jl` package is `AutoViz.render()`\n",
+ "\n",
+ "\n",
+ "In its simplest form, the `render` function only takes one argument:\n",
+ "an iterable collection of renderable objects, `renderables`.\n",
+ "In order for an object to be renderable, it needs to implement the\n",
+ "`add_renderable!()` function.\n",
+ "\n",
+ "By default, the `render()` function will do its best to make all the contents of\n",
+ "the scene fit to the canvas of dimensions `canvas_width` x `canvas_height`.\n",
+ "More fine-grained control over camera positioning can be achieved by providing\n",
+ "the `camera` keyword.\n",
+ "In case a custom camera is used, it is important to call\n",
+ "`update_camera!(camera, scene)` before rendering.\n",
+ "\n",
+ "The Cairo surface to be used for plotting can be specified using the `surface` keyword.\n",
+ "The `render()` function applies the rendering instructions to the `surface` and\n",
+ "returns it. In the tutorials, we will denote the returned `surface` as a\n",
+ "`snapshot` of the scene. Such snapshots can be saved to file using the command\n",
+ "\n",
+ "```julia\n",
+ "write(\"snapshot.svg\", snapshot)\n",
+ "```"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Basic rendering"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We start our example by rendering an empty roadway"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using AutomotiveDrivingModels\n",
+ "using AutoViz\n",
+ "\n",
+ "roadway = gen_straight_roadway(3, 100.0)\n",
+ "\n",
+ "snapshot = render([roadway], canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We can change the background color and render again"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "AutoViz.colortheme[\"background\"] = colorant\"white\"\n",
+ "snapshot = render([roadway], canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Let's add some vehicles to the roadway"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "car_len = 4.8\n",
+ "car_width = 1.8\n",
+ "def = VehicleDef(AgentClass.CAR, car_len, car_width)\n",
+ "w = DEFAULT_LANE_WIDTH\n",
+ "scene = Scene(Entity{VehicleState,VehicleDef,Int64}, 4) # allocate a scene for 4 agents"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "add three cars"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "push!.(Ref(scene), [\n",
+ " Entity(VehicleState(VecSE2(10.0, w, 0.0), roadway, 4.0 + 2.0randn()), def, 1),\n",
+ " Entity(VehicleState(VecSE2(40.0, 0.0, 0.0), roadway, 4.0 + 2.0randn()), def, 2),\n",
+ " Entity(VehicleState(VecSE2(70.0, w, 0.0), roadway, 4.0 + 2.0randn()), def, 3),\n",
+ "])"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "add a pedestrian"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "push!(scene, Entity(\n",
+ " VehicleState(VecSE2(50.0, 2w, -π/2), roadway, 2.0),\n",
+ " VehicleDef(AgentClass.PEDESTRIAN, 1., 1.),\n",
+ " 42\n",
+ "))\n",
+ "snapshot = render([roadway, scene], canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Vehicle Shapes\n",
+ "\n",
+ "The `render` function provides some defaults for rendering basic building blocks\n",
+ "such as entities or roadways.\n",
+ "If the value of `AutoViz.rendermode` is set to `:basic`, entities are simply\n",
+ "rendered as rectangles with arrows indicating their velocities.\n",
+ "This can also be done explicitly via"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "renderables = [\n",
+ " roadway,\n",
+ " (EntityRectangle(entity=x) for x in scene)...,\n",
+ " (VelocityArrow(entity=x) for x in scene)...,\n",
+ "]\n",
+ "snapshot = render(renderables, canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The result remains the same. The velocity arrows point to the location at which\n",
+ "the vehicle would be 1 second in the future.\n",
+ "\n",
+ "Setting `AutoViz.rendermode` to `:fancy`, the rectangles are replaced by SVG\n",
+ "images of cars (or pedestrians)."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "AutoViz.set_render_mode(:fancy)\n",
+ "snapshot = render([roadway, scene], canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Which is shorthand for"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "renderables = [\n",
+ " roadway, (FancyCar(car=scene[i]) for i in 1:3)..., FancyPedestrian(ped=scene[4])\n",
+ "]\n",
+ "snapshot = render(renderables, canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "A third visualization mode is available in the form of arrow cars, in which the\n",
+ "arrow indicates the heading direction of the car but does not scale with speed."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "renderables = [\n",
+ " roadway,\n",
+ " (ArrowCar(scene[i]) for i in 1:3)...,\n",
+ " FancyPedestrian(ped=scene[4])\n",
+ "]\n",
+ "snapshot = render(renderables, canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "It is also possible to render single vehicles"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "fancy_car = FancyCar(car=Entity(VehicleState(VecSE2(0.,0.), 0.), VehicleDef(), 1))\n",
+ "snapshot = render([fancy_car], camera=StaticCamera(zoom=100.))"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Vehicle Colors\n",
+ "\n",
+ "By default, the `render` function generates a random color for each entity based\n",
+ "on its ID using the `id_to_color()` function.\n",
+ "However, vehicle colors can also be assigned explicitly:"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "colors = [colorant\"red\", colorant\"blue\", colorant\"green\"]\n",
+ "renderables = [\n",
+ " roadway,\n",
+ " (FancyCar(car=scene[i], color=colors[i]) for i in 1:3)...,\n",
+ " FancyPedestrian(ped=scene[4], color=colorant\"yellow\")\n",
+ "]\n",
+ "snapshot = render(renderables, canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Custom Renderable Objects"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Colors\n",
+ "\n",
+ "struct MyRenderableCircle\n",
+ " pos::VecE2\n",
+ " radius::Float64\n",
+ " color::Colorant\n",
+ "end\n",
+ "\n",
+ "function AutoViz.add_renderable!(rendermodel::RenderModel, circle::MyRenderableCircle)\n",
+ " # add the desired render instructions to the rendermodel\n",
+ " add_instruction!(\n",
+ " rendermodel, AutoViz.render_circle,\n",
+ " (circle.pos.x, circle.pos.y, circle.radius, circle.color),\n",
+ " coordinate_system=:scene\n",
+ " )\n",
+ " return rendermodel\n",
+ "end\n",
+ "\n",
+ "circles = [MyRenderableCircle(VecE2(4i,3.0*(1+sin(i/4))), .5+rand(), rand(RGB)) for i in 1:20]\n",
+ "snapshot = render([roadway, circles..., scene], canvas_height=120)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Simulation and Animations"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We can simulate the scenario over time and visualize the results using `Reel`\n",
+ "(based on `ffmpeg`)."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Reel\n",
+ "\n",
+ "timestep = 0.1\n",
+ "nticks = 50\n",
+ "\n",
+ "models = Dict((i => Tim2DDriver() for i in 1:3)) # car models\n",
+ "models[42] = Tim2DDriver() # TODO: better pedestrian model\n",
+ "\n",
+ "scenes = simulate(scene, roadway, models, nticks, timestep)\n",
+ "\n",
+ "animation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n",
+ " i = Int(floor(t/dt)) + 1\n",
+ " render([roadway, scenes[i]], canvas_height=120)\n",
+ "end"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Alternatively, the scene can also be visualized interactively using `Interact`"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Interact\n",
+ "using Reel\n",
+ "using Blink\n",
+ "#nb\n",
+ "w = Window()\n",
+ "viz = @manipulate for step in 1 : length(scenes)\n",
+ " render([roadway, scenes[step]])\n",
+ "end\n",
+ "body!(w, viz)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Another common visualization package is `Reactive`."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "---\n",
+ "\n",
+ "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
+ ],
+ "metadata": {}
+ }
+ ],
+ "nbformat_minor": 3,
+ "metadata": {
+ "language_info": {
+ "file_extension": ".jl",
+ "mimetype": "application/julia",
+ "name": "julia",
+ "version": "1.3.1"
+ },
+ "kernelspec": {
+ "name": "julia-1.3",
+ "display_name": "Julia 1.3.1",
+ "language": "julia"
+ }
+ },
+ "nbformat": 4
+}
diff --git a/dev/notebooks/cameras.ipynb b/dev/notebooks/cameras.ipynb
new file mode 100644
index 0000000..00ef58a
--- /dev/null
+++ b/dev/notebooks/cameras.ipynb
@@ -0,0 +1,431 @@
+{
+ "cells": [
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "# Cameras"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "In this section, we will showcase the cameras that are supported by\n",
+ "`AutoViz.jl`.\n",
+ "\n",
+ "All cameras make use of the `CameraState` object to represent the internal camera state.\n",
+ "\n",
+ "\n",
+ "The following camera types are supported by `AutoViz`:\n",
+ "`StaticCamera`, `TargetFollowCamera`, `SceneFollowCamera`, `ZoomingCamera`,\n",
+ "`ComposedCamera`.\n",
+ "The keyword arguments accepted by the `CameraState` object can also be passed to\n",
+ "the constructors of these cameras, and they will be forwarded to the internal\n",
+ "camera state. Now, we will show how the different cameras behave based on the\n",
+ "simple stadium example.\n",
+ "\n",
+ "First, we prepare a sequence of scenes visualize"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using AutomotiveDrivingModels\n",
+ "using AutoViz\n",
+ "AutoViz.colortheme[\"background\"] = colorant\"white\"; # hide\n",
+ "\n",
+ "nlanes = 4\n",
+ "nveh = 5\n",
+ "nticks = 100\n",
+ "timestep = 0.1\n",
+ "\n",
+ "roadway = gen_stadium_roadway(nlanes)\n",
+ "\n",
+ "scene = Scene([Entity(VehicleState(\n",
+ " Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), roadway, 4.0 + 2.0rand()\n",
+ "), VehicleDef(), i) for i in 1:nveh])\n",
+ "\n",
+ "models = Dict((\n",
+ " i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())\n",
+ " for i in 1:nveh\n",
+ "))\n",
+ "set_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))\n",
+ "\n",
+ "\n",
+ "scenes = simulate(scene, roadway, models, nticks, timestep)\n",
+ "nothing # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The following helper function takes care of generating an animation from a\n",
+ "sequence of scenes, using a given `camera`.\n",
+ "Note that for `camera=nothing`, the render function attempts to fit all the\n",
+ "renderable objects on the canvas."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Reel\n",
+ "\n",
+ "function animate(roadway, scenes, camera=nothing)\n",
+ " animation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n",
+ " i = Int(floor(t/dt)) + 1\n",
+ " update_camera!(camera, scenes[i])\n",
+ " renderables = [\n",
+ " roadway, scenes[i],\n",
+ " IDOverlay(scene=scenes[i], x_off=-2, y_off=1),\n",
+ " ]\n",
+ " render(renderables, camera=camera)\n",
+ " end\n",
+ " return animation\n",
+ "end\n",
+ "nothing # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The call to `update_camera!(camera, scenes[i])` is important as it allows the\n",
+ "internal camera state to be updated based on the positions of the vehicles."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Default camera: fit to content\n",
+ "\n",
+ "The default camera uses the render instructions that are stored inside the\n",
+ "`RenderModel` in order to compute a bounding box which holds all renderable\n",
+ "objects."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes);\n",
+ "write(\"stadium_cam_default.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Note that some renderable objects (such as custom objects) may not be\n",
+ "considered by the default fit to content camera when the bounding box is\n",
+ "computed. Therefore, they may be cut off."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Static Camera\n",
+ "\n",
+ "A static camera maintains its position, zoom and rotation. It is the only camera\n",
+ "that doesn't change its state when calling `update_camera!()`."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, StaticCamera(zoom=5.))\n",
+ "write(\"stadium_cam_static_default.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We can pass in zoom, position and rotation parameters in order to change the camera state."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(\n",
+ " roadway, scenes,\n",
+ " StaticCamera(position=VecE2(20.,10.), rotation=.2, zoom=8.)\n",
+ ")\n",
+ "write(\"stadium_cam_static_custom.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Target Follow Camera\n",
+ "\n",
+ "In many applications, we are interested in tracking one particular vehicle.\n",
+ "To do this, we can use a `TargetFollowCamera` which follows a vehicle with a\n",
+ "given ID. Let's follow the vehicle with ID `3`:"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, TargetFollowCamera(3, zoom=5.))\n",
+ "write(\"stadium_cam_target.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Sometimes, it is desireable fix the x or y position of the camera.\n",
+ "For example, we can use the `TargetFollowCamera` to track a vehicle\n",
+ "horizontally (in x direction), while keeping the vertical position\n",
+ "(y direction) fixed.\n",
+ "To do this, we simply provide a fixed value for the corresponding keyword\n",
+ "argument `y`."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, TargetFollowCamera(3, zoom=10., y=40.))\n",
+ "write(\"stadium_cam_target_y.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Scene Follow Camera\n",
+ "\n",
+ "In contrast to the `TargetFollowCamera`, the `SceneFollowCamera` tracks the\n",
+ "center of mass of all the vehicles in a scene. The `padding` parameter specifies\n",
+ "how man metres of padding there should be around the vehicles in the scene"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, SceneFollowCamera(padding=4.))\n",
+ "write(\"stadium_cam_scene.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "If we desire to follow the scene, but fix the zoom level,\n",
+ "we can do so by passing in the corresponding keyword argument `zoom`."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, SceneFollowCamera(zoom=20.))\n",
+ "write(\"stadium_cam_scene_zoom.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Zooming Camera\n",
+ "\n",
+ "The zooming camera changes its zoom level by an increment `dz` anytime the\n",
+ "`update_camera!()` function is called, until a zoom level of `zoom_target` is reached."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, ZoomingCamera(zoom_target=20., dz=0.4, zoom=2.))\n",
+ "write(\"stadium_cam_zooming.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Composed Camera\n",
+ "\n",
+ "Finally, the `ComposedCamera` can be used to combine different camera behaviors.\n",
+ "For example, one can use the `TargetFollowCamera` together with the\n",
+ "`ZoomingCamera` in order to follow a vehicle and zoom in on it.\n",
+ "The constructor of the `CompostedCamera` takes an array of cameras which are\n",
+ "applied in the same sequence as they are provided in the array."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, ComposedCamera([\n",
+ " TargetFollowCamera(3),\n",
+ " ZoomingCamera(zoom_target=25., dz=0.4, zoom=1.),\n",
+ "]))\n",
+ "write(\"stadium_cam_composed.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Custom Camera\n",
+ "\n",
+ "Finally, we will show how to build a custom camera. We will build a camera whose\n",
+ "angle is always aligned with the axis of the target vehicle with ID `target_id`"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "mutable struct TargetRotateCamera{I} <: Camera\n",
+ " state::CameraState\n",
+ " target_id::I\n",
+ "end\n",
+ "TargetRotateCamera(target_id; kwargs...) = TargetRotateCamera(CameraState(;kwargs...), target_id)\n",
+ "nothing # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "In the `update_camera!()` function, we need to set the camera rotation to be the\n",
+ "same as the vehicle yaw angle"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "function AutoViz.update_camera!(camera::TargetRotateCamera{I}, scene::Scene{E}) where {I,E<:Entity}\n",
+ " target = get_by_id(scene, camera.target_id)\n",
+ " yaw = posg(target.state)[3]\n",
+ " set_camera!(camera.state, rotation=-yaw)\n",
+ " return camera.state\n",
+ "end\n",
+ "nothing # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Finally, we can use our custom camera just like the other cameras"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, TargetRotateCamera(3, zoom=5.))\n",
+ "write(\"stadium_cam_custom.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Also, we can combine the camera with other cameras to our liking"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "animation = animate(roadway, scenes, ComposedCamera([\n",
+ " TargetFollowCamera(3),\n",
+ " TargetRotateCamera(3),\n",
+ " ZoomingCamera(zoom_target=25., dz=0.4, zoom=1.),\n",
+ "]))\n",
+ "write(\"stadium_cam_composed_custom.gif\", animation) # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "---\n",
+ "\n",
+ "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
+ ],
+ "metadata": {}
+ }
+ ],
+ "nbformat_minor": 3,
+ "metadata": {
+ "language_info": {
+ "file_extension": ".jl",
+ "mimetype": "application/julia",
+ "name": "julia",
+ "version": "1.3.1"
+ },
+ "kernelspec": {
+ "name": "julia-1.3",
+ "display_name": "Julia 1.3.1",
+ "language": "julia"
+ }
+ },
+ "nbformat": 4
+}
diff --git a/dev/notebooks/overlays.ipynb b/dev/notebooks/overlays.ipynb
new file mode 100644
index 0000000..4b8c774
--- /dev/null
+++ b/dev/notebooks/overlays.ipynb
@@ -0,0 +1,561 @@
+{
+ "cells": [
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "# Overlays"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Overlays are useful to display additional information on top of a given driving scene.\n",
+ "For example, they can be used to display the ID of the vehicle, their speed, or other useful information."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "More generally, renderable objects that are passed to the render function\n",
+ "are rendered in the order they are passed in.\n",
+ "For example, if we pass a collection consisting of a roadway and a scene,\n",
+ "the roadway is rendered first, and the scene is rendered on top of the roadway."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "This behavior leaves the possibility to create overlays as well as \"underlays\"\n",
+ "that may be drawn under the vehicles."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "In this tutorial, we will use the same stadium scenario as shown in the camera example."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using AutomotiveDrivingModels\n",
+ "using AutoViz\n",
+ "AutoViz.colortheme[\"background\"] = colorant\"white\"; # hide\n",
+ "AutoViz.set_render_mode(:fancy)\n",
+ "\n",
+ "nlanes = 2\n",
+ "nveh = 8\n",
+ "nticks = 100\n",
+ "timestep = 0.1\n",
+ "\n",
+ "roadway = gen_stadium_roadway(nlanes)\n",
+ "\n",
+ "scene = Scene([\n",
+ " Entity(\n",
+ " VehicleState(\n",
+ " Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), # position\n",
+ " roadway, 4.0 + 2.0rand() # speed\n",
+ " ),\n",
+ " VehicleDef(), i\n",
+ " ) for i in 1:nveh\n",
+ "])\n",
+ "\n",
+ "models = Dict((\n",
+ " i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())\n",
+ " for i in 1:nveh\n",
+ "))\n",
+ "set_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))\n",
+ "\n",
+ "scenes = simulate(scene, roadway, models, nticks, timestep)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The following code will help us to animate the simulation using `Reel`"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Reel\n",
+ "\n",
+ "function animate(roadway, scenes, overlays, camera=TargetFollowCamera(3, zoom=15.))\n",
+ " animation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n",
+ " i = Int(floor(t/dt)) + 1\n",
+ " update_camera!(camera, scenes[i])\n",
+ " renderables = [\n",
+ " roadway, scenes[i], overlays[i]...\n",
+ " ]\n",
+ " render(renderables, camera=camera)\n",
+ " end\n",
+ " return animation\n",
+ "end\n",
+ "nothing # hide"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The `animate` function defined above takes an `overlays` object which holds a list of\n",
+ "overlays for every frame in `scenes`."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ " Note on compatibility:\n",
+ " The interface for rendering overlays has changed in version 0.8 of AutoViz.\n",
+ " In older versions of AutoViz, overlays were rendered by passing in\n",
+ " the current scene and roadway explicitly.\n",
+ " Since AutoViz 0.8, every renderable object must have the same interface.\n",
+ " As a result, an overlay that requires the `roadway` or `scene` for rendering,\n",
+ " must store those objects as internal variables.\n",
+ "\n",
+ " (`AutoViz.RenderableOverlay` is an overlay that can be used as a wrapper around older overlays\n",
+ " which rely on the `scene` and `roadway` objects.\n",
+ " However, it is recommended that overlays implement the new interface for `add_renderable!`\n",
+ " since `AutoViz.RenderableOverlay` may be removed in future versions.)"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## IDOverlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Show IDs for all vehicles in the scene"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[\n",
+ " IDOverlay(scene=scene, x_off=-2, y_off=1)\n",
+ "] for scene in scenes]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## CarFollowingStatsOverlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Diplays info about the front neighbor of a car\n",
+ "such as the difference in velocity and the relative distance.\n",
+ "Show statistics for vehicle 3:"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "### TODO: overlay name is not very descriptive"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[CarFollowingStatsOverlay(\n",
+ " scene=scene, roadway=roadway, target_id=3, font_size=20, color=colorant\"black\"\n",
+ ")] for scene in scenes]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## LineToFrontOverlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Show the line to the front vehicle for vehicle 3"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[\n",
+ " LineToFrontOverlay(scene=scene, roadway=roadway, target_id=3)\n",
+ "] for scene in scenes]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## TextOverlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The `TextOverlay` displays some text at the desired location.\n",
+ "By default, the coordinates are in camera pixels."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[TextOverlay(\n",
+ " text=[\"Overlays are nice!\", \"frame $(i)/$(length(scenes))\"],\n",
+ " font_size=30, pos=VecE2(50.0, 100.0), color=colorant\"black\",\n",
+ " coordinate_system=:camera_pixels\n",
+ ")] for i in 1:length(scenes)]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "setting the `coordinate_system` keyword to `:scene` places the text\n",
+ "in scene coordinates"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[TextOverlay(\n",
+ " text=[\"Scene Coordinates!\"],\n",
+ " font_size=10+round(20cos(.01i)),\n",
+ " pos=VecE2(2i, 40+round(20*sin(.002i))),\n",
+ " color=colorant\"black\", coordinate_system=:scene\n",
+ ")] for i in 1:length(scenes)]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## HistogramOverlay\n",
+ "\n",
+ "Display a bar at the specified position `pos`.\n",
+ "The bar has dimensions `width` and `height`\n",
+ "and is filled up to a given proportion of its height.\n",
+ "The fill proportion is set using `val`, which should be a number between 0 and 1.\n",
+ "If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n",
+ "The default units are in the camera frame."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "max_speed = 14.0\n",
+ "overlays = [[HistogramOverlay(\n",
+ " pos=VecE2(40.0, 100.0), val=get_by_id(scene, 1).state.v/max_speed, label=\"veh1 speed\",\n",
+ " fill_color=colorant\"blue\", line_color=colorant\"black\",\n",
+ " font_size=24, width=10, height=50\n",
+ ")] for scene in scenes]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## NeighborsOverlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Draws a line between a vehicle and its neighbors."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "overlays = [[\n",
+ " NeighborsOverlay(\n",
+ " scene=scene, roadway=roadway, target_id=3,\n",
+ " textparams=TextParams(color=colorant\"black\")\n",
+ " )\n",
+ "] for (i, scene) in enumerate(scenes)]\n",
+ "animation = animate(roadway, scenes, overlays)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "## Custom Overlays"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "### Lane Highlighting"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "Just like roadways and vehicles, overlays are renderable objects.\n",
+ "In order to make a custom overlay type renderable, one needs to implement\n",
+ "the `add_renderable!(::RenderModel, ::YourOverlay)` function."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "To define an overlay which highlights a lane, let's start by defining a\n",
+ "custom type `LaneOverlay`"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "struct LaneOverlay\n",
+ " lane::Lane\n",
+ " roadway::Roadway\n",
+ " color::Colorant\n",
+ "end\n",
+ "\n",
+ "function AutoViz.add_renderable!(rendermodel::RenderModel, overlay::LaneOverlay)\n",
+ " add_renderable!(rendermodel, overlay.lane, overlay.roadway, color_asphalt=overlay.color)\n",
+ " return rendermodel\n",
+ "end"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We can now initiate a `LaneOverlay` object and pass it to the `render` function"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "lane_overlay = LaneOverlay(roadway[LaneTag(1,1)], roadway, RGBA(0.0,0.0,1.0,0.5))\n",
+ "camera = TargetFollowCamera(3, zoom=15.)\n",
+ "update_camera!(camera, scene)\n",
+ "snapshot = render([roadway, lane_overlay, scene], camera=camera)"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "### Concentric Rectangle Overlay"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "In the following, we will show a more advanced example in which direct\n",
+ "manipulation of the `CairoContext` is required.\n",
+ "We will create an overlay which draws concentric rectangles around\n",
+ "a vehicle with ID `target_id`"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "struct ConcentricRectOverlay\n",
+ " target_id\n",
+ " scene::Scene\n",
+ " n::Int64\n",
+ " color::Colorant\n",
+ "end"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "We implement a new rendering function for concentric rectangles"
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "using Cairo\n",
+ "\n",
+ "function render_concentric_rects(\n",
+ " ctx::CairoContext,\n",
+ " n::Int,\n",
+ " x::Real, y::Real,\n",
+ " w::Real, l::Real,\n",
+ " yaw::Real,\n",
+ " color::Colorant\n",
+ ")\n",
+ " save(ctx)\n",
+ " translate(ctx, x, y)\n",
+ " rotate(ctx, yaw)\n",
+ "\n",
+ " for i in 1:n\n",
+ " AutoViz.render_round_rect(\n",
+ " ctx,\n",
+ " 0, 0, l+2(i-1), w+2(i-1), 1., (i-.5),\n",
+ " RGBA(color.r, color.g, color.b, 1-i/n),\n",
+ " true, false,\n",
+ " )\n",
+ " end\n",
+ "\n",
+ " restore(ctx)\n",
+ "end"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "The `add_renderable` function adds the function defined above to the\n",
+ "instruction stack of the render model via `add_instruction!`.\n",
+ "A series of common rendering instructions are already implemented as part\n",
+ "of the `AutoViz.jl` framework."
+ ],
+ "metadata": {}
+ },
+ {
+ "outputs": [],
+ "cell_type": "code",
+ "source": [
+ "function AutoViz.add_renderable!(rendermodel::RenderModel, overlay::ConcentricRectOverlay)\n",
+ " veh = get_by_id(overlay.scene, overlay.target_id)\n",
+ " x, y, yaw = posg(veh)\n",
+ " w, l = AutomotiveDrivingModels.width(veh.def), length(veh.def)\n",
+ "\n",
+ " add_instruction!(\n",
+ " rendermodel, render_concentric_rects,\n",
+ " (overlay.n, x, y, w, l, yaw, overlay.color)\n",
+ " )\n",
+ " return rendermodel\n",
+ "end\n",
+ "\n",
+ "concentric_rect_overlay = ConcentricRectOverlay(3, scene, 5, colorant\"green\")\n",
+ "snapshot = render([roadway, concentric_rect_overlay, scene], camera=camera)\n",
+ "\n",
+ "nothing"
+ ],
+ "metadata": {},
+ "execution_count": null
+ },
+ {
+ "outputs": [],
+ "cell_type": "markdown",
+ "source": [
+ "---\n",
+ "\n",
+ "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
+ ],
+ "metadata": {}
+ }
+ ],
+ "nbformat_minor": 3,
+ "metadata": {
+ "language_info": {
+ "file_extension": ".jl",
+ "mimetype": "application/julia",
+ "name": "julia",
+ "version": "1.3.1"
+ },
+ "kernelspec": {
+ "name": "julia-1.3",
+ "display_name": "Julia 1.3.1",
+ "language": "julia"
+ }
+ },
+ "nbformat": 4
+}
diff --git a/dev/search/index.html b/dev/search/index.html
new file mode 100644
index 0000000..911673e
--- /dev/null
+++ b/dev/search/index.html
@@ -0,0 +1,2 @@
+
+Search · AutoViz.jl
Loading search...
Settings
This document was generated with Documenter.jl on Monday 23 March 2020. Using Julia version 1.3.1.
diff --git a/dev/search_index.js b/dev/search_index.js
new file mode 100644
index 0000000..72dedca
--- /dev/null
+++ b/dev/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"A basic drawable rectangle representing a car. An arrow indicates the heading direction of the car.\n\nArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields:\n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left\nveh: the vehicle for which to display the blinker\ncolor: the color of the blinker\nsize: the size of the blinker\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.Camera","page":"API","title":"AutoViz.Camera","text":"Camera abstract type\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CameraState","page":"API","title":"AutoViz.CameraState","text":"CameraState(;\n position::VecE2 = VecE2(0.,0.),\n zoom::Real = 1.,\n rotation::Real = 0.,\n canvas_width::Int64 = DEFAULT_CANVAS_WIDTH\n canvas_height::Int64 = DEFAULT_CANVAS_HEIGHT\n)\n\nRepresentation of the internal camera state.\n\nposition::VecE2: the (x,y) position of the camera in [metre]. The x-direction is measured to the east, y direction to the north.\nzoom::Real: the zoom level of the camera, expressed in [pixels / metre]\nrotation::Real: the rotation angle of the camera in [radian]\ncanvas_width::Int64: the canvas width in [pixel]\ncanvas_height::Int64: the canvas width in [pixel]\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CarFollowingStatsOverlay","page":"API","title":"AutoViz.CarFollowingStatsOverlay","text":"CarFollowingStatsOverlay\n\nDisplays statistics about the front neighbor of the car of id target_id.\n\nConstructor\n\nCarFollowingStatsOverlay(;target_id, verbosity=1, color=colorant\"white\", font_size=10)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.ComposedCamera","page":"API","title":"AutoViz.ComposedCamera","text":"ComposedCamera <: Camera\n\nComposition of several cameras. The update_camera actions of the individual cameras are applied in the order in which they are saved in the cameras array. States of individual cameras are ignored, the state of the composed camera is the one that will be used for rendering.\n\nExample Usage\n\ncam = ComposedCamera(cameras=[SceneFollowCamera(), ZoomingCamera()])\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.EntityRectangle","page":"API","title":"AutoViz.EntityRectangle","text":"A drawable rectangle with rounded corners representing an entity.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.FancyCar","page":"API","title":"AutoViz.FancyCar","text":"A drawable 'fancy' svg image of a race car. The car is placed at the position of entity and the width and length are scaled accordingly. The color of the car can be specified using the color keyword.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.FancyPedestrian","page":"API","title":"AutoViz.FancyPedestrian","text":"A drawable 'fancy' svg image of a pedestrian. The pedestrian is placed at the position of entity and the width and length of the original image are scaled accordingly. The color of the pedestrian can be specified using the color keyword.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\nFields\n\npos::VecE2{Float64} = VecE2(0.,0.)\ncoordinate_system::Symbol = :scene\nlabel::String = \"histogram\"\nval::Float64 = 0.5 should be between 0 and 1\nwidth::Float64 = 2.\nheight::Float64 = 5.\nfill_color::Colorant = colorant\"blue\"\nline_color::Colorant = colorant\"white\"\nfont_size::Int64 = 15 # [pix]\nlabel_pos::VecSE2{Float64} = pos + VecSE2(0., -height/2) position of the label\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).\n\nFields\n\ncolor::Colorant = colorant\"white\"\nfont_size::Int = 15\nx_off::Float64 = 0.\ny_off::Float64 = 0.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.NeighborsOverlay","page":"API","title":"AutoViz.NeighborsOverlay","text":"NeighborsOverlay\n\nDraws a line between a vehicle and its neighbors. The neighbors are linked with different colors depending on their lanes.\n\nFields\n\ntarget_id::Int\ncolor_L::Colorant = colorant\"blue\"\ncolor_M::Colorant = colorant\"green\ncolor_R::Colorant = colorant\"red\"\nline_width::Float64 = 0.5\ntextparams::TextParams = TextParams()\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.Overwash","page":"API","title":"AutoViz.Overwash","text":"Overwash\n\noverlay that renders a plain color on the whole canvas.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.RenderModel","page":"API","title":"AutoViz.RenderModel","text":"RenderModel\n\nModel to keep track of rendering instructions and background color.\n\ninstruction_set::AbstractVector{Tuple}: set of render instructions (function, array of inputs sans ctx, coordinate_system)\nbackground_color::RGB: background color\n\nFields\n\ninstruction_set :: AbstractVector{Tuple} = Array{Tuple}(undef, 0)\nbackground_color :: RGB = colortheme[\"background\"]\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera\n\nCamera centered over all vehicles.\n\nBy default, the scene is tracked in x and y direction and the zoom level is adapted to fit all vehicles in the scene. Tracking in either direction can be disabled by setting the x or y keys to a desired value. The zoom level can be fixed by passing a value to zoom. The value of padding specifies the width of the additional border around the zoomed-in area.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.StaticCamera","page":"API","title":"AutoViz.StaticCamera","text":"StaticCamera <: Camera\n\nFix the position and the zoom as specified in the constructor.\n\nConstructor\n\nStaticCamera(position::VecE2=(0,0), zoom::Real=4)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.TargetFollowCamera","page":"API","title":"AutoViz.TargetFollowCamera","text":"TargetFollowCamera <: Camera\n\nCamera which follows the vehicle with ID target_id. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the x or y keys to a desired value.\n\nConstructor\n\nTargetFollowCamera(target_id; x=NaN, y=NaN, kwargs...)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.TextOverlay","page":"API","title":"AutoViz.TextOverlay","text":"TextOverlay\n\nDisplays some text at the desired location. The coordinates and size units are in pixels by default. The option coordinate_system allows to use different units.\n\nFields\n\ntext::Vector{String}\ncolor::Colorant = colorant\"white\"\nfont_size::Int = 10\npos::VecE2 = VecE2(10, font_size)\nline_spacing::Float64 = 1.5 multiple of font_size\ncoordinate_system::Symbol=:camera_pixels\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.VelocityArrow","page":"API","title":"AutoViz.VelocityArrow","text":"A drawable arrow representing the current velocity vector of an entity. The arrow points to the location where the vehicle will be one second in the future (assuming linear motion).\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.ZoomingCamera","page":"API","title":"AutoViz.ZoomingCamera","text":"ZoomingCamera <: Camera\n\nCamera which gradually changes the zoom level of the scene to zoom_target with step size dz.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.add_instruction!-Tuple{RenderModel,Function,Tuple}","page":"API","title":"AutoViz.add_instruction!","text":"Add an instruction to the rendermodel\n\nINPUT: rendermodel - the RenderModel we are adding the instruction to f - the function to be called, the first argument must be a CairoContext args - tuple of input arguments to f, skipping the CairoContext coordinatesystem - in which coordinate system are the coordinates given (one of :scene, :camerapixels, :camerarelative) :scene - coordinates are physical coordinates in the world frame in unit [meters] `:camerapixels- coordinates are in pixels and relative to the rectangle selected by the camera in unit [pixels]:camera_relative` - coordinates are in percentages in the range 0 to 1 of the rectangle selected by the camera\n\nex: addinstruction!(rendermodel, rendertext, (\"hello world\", 10, 20, 15, [1.0,1.0,1.0]))\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Tuple{RenderModel,String}","page":"API","title":"AutoViz.add_renderable!","text":"Render function for text\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Union{Tuple{E}, Tuple{RenderModel,AutomotiveDrivingModels.Scene{E}}} where E<:AutomotiveDrivingModels.Entity","page":"API","title":"AutoViz.add_renderable!","text":"Helper function for directly rendering frames of renderable entities\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Union{Tuple{E}, Tuple{RenderModel,E}, Tuple{RenderModel,E,Union{Nothing, Colorant}}} where E<:AutomotiveDrivingModels.Entity","page":"API","title":"AutoViz.add_renderable!","text":"Helper function for directly rendering entities, takes care of wrapping them in renderable objects\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.id_to_color-Tuple{Any}","page":"API","title":"AutoViz.id_to_color","text":"id_to_color(id)\n\nRandom color based on hash code of the ID see https://stackoverflow.com/questions/11120840/hash-string-into-rgb-color\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{AbstractArray{T,1} where T}","page":"API","title":"AutoViz.render","text":"render(\n renderables::AbstractVector;\n camera::Union{Nothing, Camera} = nothing,\n canvas_width::Int64 = (camera === nothing ? DEFAULT_CANVAS_WIDTH : canvas_width(camera)),\n canvas_height::Int64 = (camera === nothing ? DEFAULT_CANVAS_HEIGHT : canvas_height(camera)),\n surface::CairoSurface = CairoSVGSurface(IOBuffer(), canvas_width, canvas_height)\n)\n\nDraw all renderables to a surface of dimensions canvas_width x canvas_height. All renderables must implement the add_renderable! function which adds rendering instructions to the render model.\n\nThe provided camera should be updated using the update_camera!() function before calling render. If no camera is provided, the render function will default to fitting all renderable objects to the canvas.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.RenderableOverlay","page":"API","title":"AutoViz.RenderableOverlay","text":"RenderableOverlay\n\nDecorator which allows to use legacy overlay objects together with the method render([Renderables])\n\nThis is required primarily for allowing backward compatibility with overlays that use the old rendering interface.\n\nusage: RenderableOverlay(o::Overlay, scene::Scene, roadway::Roadway)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.camera_fit_to_content","page":"API","title":"AutoViz.camera_fit_to_content","text":"camera_fit_to_content(rendermodel::RenderModel, ctx::CairoContext, canvas_width::Integer = DEFAULT_CANVAS_WIDTH, canvas_height::Integer = DEFAULT_CANVAS_HEIGHT; percent_border::Real = 0.0)\n\nHelper function that determines camera parameters such that all rendered content fits on the canvas.\n\n\n\n\n\n","category":"function"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"EditURL = \"https://github.com/sisl/AutoViz.jl/blob/master/docs/lit/tutorials/cameras.jl\"","category":"page"},{"location":"tutorials/cameras/#Cameras-1","page":"Cameras","title":"Cameras","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: )","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"In this section, we will showcase the cameras that are supported by AutoViz.jl.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"All cameras make use of the CameraState object to represent the internal camera state.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"CameraState","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"The following camera types are supported by AutoViz: StaticCamera, TargetFollowCamera, SceneFollowCamera, ZoomingCamera, ComposedCamera. The keyword arguments accepted by the CameraState object can also be passed to the constructors of these cameras, and they will be forwarded to the internal camera state. Now, we will show how the different cameras behave based on the simple stadium example.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"First, we prepare a sequence of scenes visualize","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"using AutomotiveDrivingModels\nusing AutoViz\nAutoViz.colortheme[\"background\"] = colorant\"white\"; # hide\n\nnlanes = 4\nnveh = 5\nnticks = 100\ntimestep = 0.1\n\nroadway = gen_stadium_roadway(nlanes)\n\nscene = Scene([Entity(VehicleState(\n Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), roadway, 4.0 + 2.0rand()\n), VehicleDef(), i) for i in 1:nveh])\n\nmodels = Dict((\n i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())\n for i in 1:nveh\n))\nset_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))\n\n\nscenes = simulate(scene, roadway, models, nticks, timestep)\nnothing # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"The following helper function takes care of generating an animation from a sequence of scenes, using a given camera. Note that for camera=nothing, the render function attempts to fit all the renderable objects on the canvas.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"using Reel\n\nfunction animate(roadway, scenes, camera=nothing)\n animation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n i = Int(floor(t/dt)) + 1\n update_camera!(camera, scenes[i])\n renderables = [\n roadway, scenes[i],\n IDOverlay(scene=scenes[i], x_off=-2, y_off=1),\n ]\n render(renderables, camera=camera)\n end\n return animation\nend\nnothing # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"The call to update_camera!(camera, scenes[i]) is important as it allows the internal camera state to be updated based on the positions of the vehicles.","category":"page"},{"location":"tutorials/cameras/#Default-camera:-fit-to-content-1","page":"Cameras","title":"Default camera: fit to content","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"The default camera uses the render instructions that are stored inside the RenderModel in order to compute a bounding box which holds all renderable objects.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes);\nwrite(\"stadium_cam_default.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: default camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Note that some renderable objects (such as custom objects) may not be considered by the default fit to content camera when the bounding box is computed. Therefore, they may be cut off.","category":"page"},{"location":"tutorials/cameras/#Static-Camera-1","page":"Cameras","title":"Static Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"A static camera maintains its position, zoom and rotation. It is the only camera that doesn't change its state when calling update_camera!().","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, StaticCamera(zoom=5.))\nwrite(\"stadium_cam_static_default.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: static default camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"We can pass in zoom, position and rotation parameters in order to change the camera state.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(\n roadway, scenes,\n StaticCamera(position=VecE2(20.,10.), rotation=.2, zoom=8.)\n)\nwrite(\"stadium_cam_static_custom.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: static custom camera)","category":"page"},{"location":"tutorials/cameras/#Target-Follow-Camera-1","page":"Cameras","title":"Target Follow Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"In many applications, we are interested in tracking one particular vehicle. To do this, we can use a TargetFollowCamera which follows a vehicle with a given ID. Let's follow the vehicle with ID 3:","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, TargetFollowCamera(3, zoom=5.))\nwrite(\"stadium_cam_target.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: target follow camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Sometimes, it is desireable fix the x or y position of the camera. For example, we can use the TargetFollowCamera to track a vehicle horizontally (in x direction), while keeping the vertical position (y direction) fixed. To do this, we simply provide a fixed value for the corresponding keyword argument y.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, TargetFollowCamera(3, zoom=10., y=40.))\nwrite(\"stadium_cam_target_y.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: target follow camera, fixed y)","category":"page"},{"location":"tutorials/cameras/#Scene-Follow-Camera-1","page":"Cameras","title":"Scene Follow Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"In contrast to the TargetFollowCamera, the SceneFollowCamera tracks the center of mass of all the vehicles in a scene. The padding parameter specifies how man metres of padding there should be around the vehicles in the scene","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, SceneFollowCamera(padding=4.))\nwrite(\"stadium_cam_scene.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: scene follow camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"If we desire to follow the scene, but fix the zoom level, we can do so by passing in the corresponding keyword argument zoom.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, SceneFollowCamera(zoom=20.))\nwrite(\"stadium_cam_scene_zoom.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: scene follow camera)","category":"page"},{"location":"tutorials/cameras/#Zooming-Camera-1","page":"Cameras","title":"Zooming Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"The zooming camera changes its zoom level by an increment dz anytime the update_camera!() function is called, until a zoom level of zoom_target is reached.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, ZoomingCamera(zoom_target=20., dz=0.4, zoom=2.))\nwrite(\"stadium_cam_zooming.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: zooming camera)","category":"page"},{"location":"tutorials/cameras/#Composed-Camera-1","page":"Cameras","title":"Composed Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Finally, the ComposedCamera can be used to combine different camera behaviors. For example, one can use the TargetFollowCamera together with the ZoomingCamera in order to follow a vehicle and zoom in on it. The constructor of the CompostedCamera takes an array of cameras which are applied in the same sequence as they are provided in the array.","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, ComposedCamera([\n TargetFollowCamera(3),\n ZoomingCamera(zoom_target=25., dz=0.4, zoom=1.),\n]))\nwrite(\"stadium_cam_composed.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: composed camera)","category":"page"},{"location":"tutorials/cameras/#Custom-Camera-1","page":"Cameras","title":"Custom Camera","text":"","category":"section"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Finally, we will show how to build a custom camera. We will build a camera whose angle is always aligned with the axis of the target vehicle with ID target_id","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"mutable struct TargetRotateCamera{I} <: Camera\n state::CameraState\n target_id::I\nend\nTargetRotateCamera(target_id; kwargs...) = TargetRotateCamera(CameraState(;kwargs...), target_id)\nnothing # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"In the update_camera!() function, we need to set the camera rotation to be the same as the vehicle yaw angle","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"function AutoViz.update_camera!(camera::TargetRotateCamera{I}, scene::Scene{E}) where {I,E<:Entity}\n target = get_by_id(scene, camera.target_id)\n yaw = posg(target.state)[3]\n set_camera!(camera.state, rotation=-yaw)\n return camera.state\nend\nnothing # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Finally, we can use our custom camera just like the other cameras","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, TargetRotateCamera(3, zoom=5.))\nwrite(\"stadium_cam_custom.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: custom camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"Also, we can combine the camera with other cameras to our liking","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"animation = animate(roadway, scenes, ComposedCamera([\n TargetFollowCamera(3),\n TargetRotateCamera(3),\n ZoomingCamera(zoom_target=25., dz=0.4, zoom=1.),\n]))\nwrite(\"stadium_cam_composed_custom.gif\", animation) # hide","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"(Image: composed camera)","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"","category":"page"},{"location":"tutorials/cameras/#","page":"Cameras","title":"Cameras","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"EditURL = \"https://github.com/sisl/AutoViz.jl/blob/master/docs/lit/tutorials/overlays.jl\"","category":"page"},{"location":"tutorials/overlays/#Overlays-1","page":"Overlays","title":"Overlays","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: )","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Overlays are useful to display additional information on top of a given driving scene. For example, they can be used to display the ID of the vehicle, their speed, or other useful information.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"More generally, renderable objects that are passed to the render function are rendered in the order they are passed in. For example, if we pass a collection consisting of a roadway and a scene, the roadway is rendered first, and the scene is rendered on top of the roadway.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"This behavior leaves the possibility to create overlays as well as \"underlays\" that may be drawn under the vehicles.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"In this tutorial, we will use the same stadium scenario as shown in the camera example.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"using AutomotiveDrivingModels\nusing AutoViz\nAutoViz.colortheme[\"background\"] = colorant\"white\"; # hide\nAutoViz.set_render_mode(:fancy)\n\nnlanes = 2\nnveh = 8\nnticks = 100\ntimestep = 0.1\n\nroadway = gen_stadium_roadway(nlanes)\n\nscene = Scene([\n Entity(\n VehicleState(\n Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), # position\n roadway, 4.0 + 2.0rand() # speed\n ),\n VehicleDef(), i\n ) for i in 1:nveh\n])\n\nmodels = Dict((\n i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())\n for i in 1:nveh\n))\nset_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))\n\nscenes = simulate(scene, roadway, models, nticks, timestep)\nnothing # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"The following code will help us to animate the simulation using Reel","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"using Reel\n\nfunction animate(roadway, scenes, overlays, camera=TargetFollowCamera(3, zoom=15.))\n animation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n i = Int(floor(t/dt)) + 1\n update_camera!(camera, scenes[i])\n renderables = [\n roadway, scenes[i], overlays[i]...\n ]\n render(renderables, camera=camera)\n end\n return animation\nend\nnothing # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"The animate function defined above takes an overlays object which holds a list of overlays for every frame in scenes.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"note: Note\nNote on compatibility: The interface for rendering overlays has changed in version 0.8 of AutoViz. In older versions of AutoViz, overlays were rendered by passing in the current scene and roadway explicitly. Since AutoViz 0.8, every renderable object must have the same interface. As a result, an overlay that requires the roadway or scene for rendering, must store those objects as internal variables.(AutoViz.RenderableOverlay is an overlay that can be used as a wrapper around older overlays which rely on the scene and roadway objects. However, it is recommended that overlays implement the new interface for add_renderable! since AutoViz.RenderableOverlay may be removed in future versions.)","category":"page"},{"location":"tutorials/overlays/#IDOverlay-1","page":"Overlays","title":"IDOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Show IDs for all vehicles in the scene","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[\n IDOverlay(scene=scene, x_off=-2, y_off=1)\n] for scene in scenes]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_id_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with ID overlay)","category":"page"},{"location":"tutorials/overlays/#CarFollowingStatsOverlay-1","page":"Overlays","title":"CarFollowingStatsOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Diplays info about the front neighbor of a car such as the difference in velocity and the relative distance. Show statistics for vehicle 3:","category":"page"},{"location":"tutorials/overlays/#TODO:-overlay-name-is-not-very-descriptive-1","page":"Overlays","title":"TODO: overlay name is not very descriptive","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[CarFollowingStatsOverlay(\n scene=scene, roadway=roadway, target_id=3, font_size=20, color=colorant\"black\"\n)] for scene in scenes]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_car_stats_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with car stats overlay)","category":"page"},{"location":"tutorials/overlays/#LineToFrontOverlay-1","page":"Overlays","title":"LineToFrontOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Show the line to the front vehicle for vehicle 3","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[\n LineToFrontOverlay(scene=scene, roadway=roadway, target_id=3)\n] for scene in scenes]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_line_front_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with ID overlay)","category":"page"},{"location":"tutorials/overlays/#TextOverlay-1","page":"Overlays","title":"TextOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"The TextOverlay displays some text at the desired location. By default, the coordinates are in camera pixels.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[TextOverlay(\n text=[\"Overlays are nice!\", \"frame $(i)/$(length(scenes))\"],\n font_size=30, pos=VecE2(50.0, 100.0), color=colorant\"black\",\n coordinate_system=:camera_pixels\n)] for i in 1:length(scenes)]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_text_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with text overlay)","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"setting the coordinate_system keyword to :scene places the text in scene coordinates","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[TextOverlay(\n text=[\"Scene Coordinates!\"],\n font_size=10+round(20cos(.01i)),\n pos=VecE2(2i, 40+round(20*sin(.002i))),\n color=colorant\"black\", coordinate_system=:scene\n)] for i in 1:length(scenes)]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_moving_text_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with moving text overlay)","category":"page"},{"location":"tutorials/overlays/#HistogramOverlay-1","page":"Overlays","title":"HistogramOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Display a bar at the specified position pos. The bar has dimensions width and height and is filled up to a given proportion of its height. The fill proportion is set using val, which should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top. The default units are in the camera frame.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"max_speed = 14.0\noverlays = [[HistogramOverlay(\n pos=VecE2(40.0, 100.0), val=get_by_id(scene, 1).state.v/max_speed, label=\"veh1 speed\",\n fill_color=colorant\"blue\", line_color=colorant\"black\",\n font_size=24, width=10, height=50\n)] for scene in scenes]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"stadium_histogram_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with moving text overlay)","category":"page"},{"location":"tutorials/overlays/#NeighborsOverlay-1","page":"Overlays","title":"NeighborsOverlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Draws a line between a vehicle and its neighbors.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"overlays = [[\n NeighborsOverlay(\n scene=scene, roadway=roadway, target_id=3,\n textparams=TextParams(color=colorant\"black\")\n )\n] for (i, scene) in enumerate(scenes)]\nanimation = animate(roadway, scenes, overlays)\nwrite(\"neighbors_overlay.gif\", animation) # hide","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: stadium with neighbors overlay)","category":"page"},{"location":"tutorials/overlays/#Custom-Overlays-1","page":"Overlays","title":"Custom Overlays","text":"","category":"section"},{"location":"tutorials/overlays/#Lane-Highlighting-1","page":"Overlays","title":"Lane Highlighting","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"Just like roadways and vehicles, overlays are renderable objects. In order to make a custom overlay type renderable, one needs to implement the add_renderable!(::RenderModel, ::YourOverlay) function.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"To define an overlay which highlights a lane, let's start by defining a custom type LaneOverlay","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"struct LaneOverlay\n lane::Lane\n roadway::Roadway\n color::Colorant\nend\n\nfunction AutoViz.add_renderable!(rendermodel::RenderModel, overlay::LaneOverlay)\n add_renderable!(rendermodel, overlay.lane, overlay.roadway, color_asphalt=overlay.color)\n return rendermodel\nend","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"We can now initiate a LaneOverlay object and pass it to the render function","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"lane_overlay = LaneOverlay(roadway[LaneTag(1,1)], roadway, RGBA(0.0,0.0,1.0,0.5))\ncamera = TargetFollowCamera(3, zoom=15.)\nupdate_camera!(camera, scene)\nsnapshot = render([roadway, lane_overlay, scene], camera=camera)\nwrite(\"stadium_lane_overlay.svg\", snapshot)","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: lane overlay)","category":"page"},{"location":"tutorials/overlays/#Concentric-Rectangle-Overlay-1","page":"Overlays","title":"Concentric Rectangle Overlay","text":"","category":"section"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"In the following, we will show a more advanced example in which direct manipulation of the CairoContext is required. We will create an overlay which draws concentric rectangles around a vehicle with ID target_id","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"struct ConcentricRectOverlay\n target_id\n scene::Scene\n n::Int64\n color::Colorant\nend","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"We implement a new rendering function for concentric rectangles","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"using Cairo\n\nfunction render_concentric_rects(\n ctx::CairoContext,\n n::Int,\n x::Real, y::Real,\n w::Real, l::Real,\n yaw::Real,\n color::Colorant\n)\n save(ctx)\n translate(ctx, x, y)\n rotate(ctx, yaw)\n\n for i in 1:n\n AutoViz.render_round_rect(\n ctx,\n 0, 0, l+2(i-1), w+2(i-1), 1., (i-.5),\n RGBA(color.r, color.g, color.b, 1-i/n),\n true, false,\n )\n end\n\n restore(ctx)\nend","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"The add_renderable function adds the function defined above to the instruction stack of the render model via add_instruction!. A series of common rendering instructions are already implemented as part of the AutoViz.jl framework.","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"function AutoViz.add_renderable!(rendermodel::RenderModel, overlay::ConcentricRectOverlay)\n veh = get_by_id(overlay.scene, overlay.target_id)\n x, y, yaw = posg(veh)\n w, l = AutomotiveDrivingModels.width(veh.def), length(veh.def)\n\n add_instruction!(\n rendermodel, render_concentric_rects,\n (overlay.n, x, y, w, l, yaw, overlay.color)\n )\n return rendermodel\nend\n\nconcentric_rect_overlay = ConcentricRectOverlay(3, scene, 5, colorant\"green\")\nsnapshot = render([roadway, concentric_rect_overlay, scene], camera=camera)\nwrite(\"stadium_concentric_rect_overlay.svg\", snapshot)","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"(Image: lane overlay)","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"nothing","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"","category":"page"},{"location":"tutorials/overlays/#","page":"Overlays","title":"Overlays","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"EditURL = \"https://github.com/sisl/AutoViz.jl/blob/master/docs/lit/tutorials/basics.jl\"","category":"page"},{"location":"tutorials/basics/#AutoViz-Basics-1","page":"AutoViz Basics","title":"AutoViz Basics","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: )","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"To run these tutorials, you must be using julia 1.1+ and have AutoViz.jl installed.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"The core function of the AutoViz.jl package is AutoViz.render()","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"render","category":"page"},{"location":"tutorials/basics/#AutoViz.render","page":"AutoViz Basics","title":"AutoViz.render","text":"render(\n renderables::AbstractVector;\n camera::Union{Nothing, Camera} = nothing,\n canvas_width::Int64 = (camera === nothing ? DEFAULT_CANVAS_WIDTH : canvas_width(camera)),\n canvas_height::Int64 = (camera === nothing ? DEFAULT_CANVAS_HEIGHT : canvas_height(camera)),\n surface::CairoSurface = CairoSVGSurface(IOBuffer(), canvas_width, canvas_height)\n)\n\nDraw all renderables to a surface of dimensions canvas_width x canvas_height. All renderables must implement the add_renderable! function which adds rendering instructions to the render model.\n\nThe provided camera should be updated using the update_camera!() function before calling render. If no camera is provided, the render function will default to fitting all renderable objects to the canvas.\n\n\n\n\n\n","category":"function"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"In its simplest form, the render function only takes one argument: an iterable collection of renderable objects, renderables. In order for an object to be renderable, it needs to implement the add_renderable!() function.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"By default, the render() function will do its best to make all the contents of the scene fit to the canvas of dimensions canvas_width x canvas_height. More fine-grained control over camera positioning can be achieved by providing the camera keyword. In case a custom camera is used, it is important to call update_camera!(camera, scene) before rendering.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"The Cairo surface to be used for plotting can be specified using the surface keyword. The render() function applies the rendering instructions to the surface and returns it. In the tutorials, we will denote the returned surface as a snapshot of the scene. Such snapshots can be saved to file using the command","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"write(\"snapshot.svg\", snapshot)","category":"page"},{"location":"tutorials/basics/#Basic-rendering-1","page":"AutoViz Basics","title":"Basic rendering","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"We start our example by rendering an empty roadway","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"using AutomotiveDrivingModels\nusing AutoViz\n\nroadway = gen_straight_roadway(3, 100.0)\n\nsnapshot = render([roadway], canvas_height=120)\nwrite(\"empty_roadway.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: empty roadway)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"We can change the background color and render again","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"AutoViz.colortheme[\"background\"] = colorant\"white\"\nsnapshot = render([roadway], canvas_height=120)\nwrite(\"empty_roadway_whitebg.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: empty roadway)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"Let's add some vehicles to the roadway","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"car_len = 4.8\ncar_width = 1.8\ndef = VehicleDef(AgentClass.CAR, car_len, car_width)\nw = DEFAULT_LANE_WIDTH\nscene = Scene(Entity{VehicleState,VehicleDef,Int64}, 4) # allocate a scene for 4 agents","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"add three cars","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"push!.(Ref(scene), [\n Entity(VehicleState(VecSE2(10.0, w, 0.0), roadway, 4.0 + 2.0randn()), def, 1),\n Entity(VehicleState(VecSE2(40.0, 0.0, 0.0), roadway, 4.0 + 2.0randn()), def, 2),\n Entity(VehicleState(VecSE2(70.0, w, 0.0), roadway, 4.0 + 2.0randn()), def, 3),\n])","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"add a pedestrian","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"push!(scene, Entity(\n VehicleState(VecSE2(50.0, 2w, -π/2), roadway, 2.0),\n VehicleDef(AgentClass.PEDESTRIAN, 1., 1.),\n 42\n))\nsnapshot = render([roadway, scene], canvas_height=120)\nwrite(\"roadway_with_cars.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: roadway with cars)","category":"page"},{"location":"tutorials/basics/#Vehicle-Shapes-1","page":"AutoViz Basics","title":"Vehicle Shapes","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"The render function provides some defaults for rendering basic building blocks such as entities or roadways. If the value of AutoViz.rendermode is set to :basic, entities are simply rendered as rectangles with arrows indicating their velocities. This can also be done explicitly via","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"renderables = [\n roadway,\n (EntityRectangle(entity=x) for x in scene)...,\n (VelocityArrow(entity=x) for x in scene)...,\n]\nsnapshot = render(renderables, canvas_height=120)\nwrite(\"roadway_basic_manual.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: roadway basic manual)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"The result remains the same. The velocity arrows point to the location at which the vehicle would be 1 second in the future.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"Setting AutoViz.rendermode to :fancy, the rectangles are replaced by SVG images of cars (or pedestrians).","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"AutoViz.set_render_mode(:fancy)\nsnapshot = render([roadway, scene], canvas_height=120)\nwrite(\"roadway_fancy.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: roadway fancy)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"Which is shorthand for","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"renderables = [\n roadway, (FancyCar(car=scene[i]) for i in 1:3)..., FancyPedestrian(ped=scene[4])\n]\nsnapshot = render(renderables, canvas_height=120)\nwrite(\"roadway_fancy_manual.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: roadway fancy manual)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"A third visualization mode is available in the form of arrow cars, in which the arrow indicates the heading direction of the car but does not scale with speed.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"renderables = [\n roadway,\n (ArrowCar(scene[i]) for i in 1:3)...,\n FancyPedestrian(ped=scene[4])\n]\nsnapshot = render(renderables, canvas_height=120)\nwrite(\"roadway_arrow.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: roadway arrow)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"It is also possible to render single vehicles","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"fancy_car = FancyCar(car=Entity(VehicleState(VecSE2(0.,0.), 0.), VehicleDef(), 1))\nsnapshot = render([fancy_car], camera=StaticCamera(zoom=100.))\nwrite(\"fancy_car.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: fancy car)","category":"page"},{"location":"tutorials/basics/#Vehicle-Colors-1","page":"AutoViz Basics","title":"Vehicle Colors","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"By default, the render function generates a random color for each entity based on its ID using the id_to_color() function. However, vehicle colors can also be assigned explicitly:","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"colors = [colorant\"red\", colorant\"blue\", colorant\"green\"]\nrenderables = [\n roadway,\n (FancyCar(car=scene[i], color=colors[i]) for i in 1:3)...,\n FancyPedestrian(ped=scene[4], color=colorant\"yellow\")\n]\nsnapshot = render(renderables, canvas_height=120)\nwrite(\"scene_custom_colors.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: cars with custom colors)","category":"page"},{"location":"tutorials/basics/#Custom-Renderable-Objects-1","page":"AutoViz Basics","title":"Custom Renderable Objects","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"using Colors\n\nstruct MyRenderableCircle\n pos::VecE2\n radius::Float64\n color::Colorant\nend\n\nfunction AutoViz.add_renderable!(rendermodel::RenderModel, circle::MyRenderableCircle)\n # add the desired render instructions to the rendermodel\n add_instruction!(\n rendermodel, AutoViz.render_circle,\n (circle.pos.x, circle.pos.y, circle.radius, circle.color),\n coordinate_system=:scene\n )\n return rendermodel\nend\n\ncircles = [MyRenderableCircle(VecE2(4i,3.0*(1+sin(i/4))), .5+rand(), rand(RGB)) for i in 1:20]\nsnapshot = render([roadway, circles..., scene], canvas_height=120)\nwrite(\"custom_circles.svg\", snapshot) # hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: custom circles)","category":"page"},{"location":"tutorials/basics/#Simulation-and-Animations-1","page":"AutoViz Basics","title":"Simulation and Animations","text":"","category":"section"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"We can simulate the scenario over time and visualize the results using Reel (based on ffmpeg).","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"using Reel\n\ntimestep = 0.1\nnticks = 50\n\nmodels = Dict((i => Tim2DDriver() for i in 1:3)) # car models\nmodels[42] = Tim2DDriver() # TODO: better pedestrian model\n\nscenes = simulate(scene, roadway, models, nticks, timestep)\n\nanimation = roll(fps=1.0/timestep, duration=nticks*timestep) do t, dt\n i = Int(floor(t/dt)) + 1\n render([roadway, scenes[i]], canvas_height=120)\nend\n\nwrite(\"roadway_animated.gif\", animation) #hide","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"(Image: animated roadway)","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"Alternatively, the scene can also be visualized interactively using Interact","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"Another common visualization package is Reactive.","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"","category":"page"},{"location":"tutorials/basics/#","page":"AutoViz Basics","title":"AutoViz Basics","text":"This page was generated using Literate.jl.","category":"page"},{"location":"#About-1","page":"Home","title":"About","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"AutoViz is a package for visualizing simple traffic scenarios using Cairo. It is primarily designed to provide rendering support for AutomotiveDrivingModels.jl. The framework currently supports building blocks such as roadways, vehicles and pedestrians and can be easily extended.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"The tutorials provide a sequence of simple examples showcasing some of the main features of the AutoViz package, such as","category":"page"},{"location":"#","page":"Home","title":"Home","text":"basic rendering of vehicles and roadways\ndemo of the available camera behaviors\nadding additional information through overlays","category":"page"},{"location":"#","page":"Home","title":"Home","text":"note: Note\nAll AutoViz tutorials are available as Jupyter notebooks by clicking on the badge at the beginning of the notebook!","category":"page"},{"location":"#","page":"Home","title":"Home","text":"The Manual section lists more details of the provided functions, which can also be accessed through the Julia REPL by typing ?function_name.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Installation instructions can be found in the repository README.","category":"page"}]
+}
diff --git a/dev/siteinfo.js b/dev/siteinfo.js
new file mode 100644
index 0000000..3343491
--- /dev/null
+++ b/dev/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "dev";
diff --git a/dev/tutorials/basics/index.html b/dev/tutorials/basics/index.html
new file mode 100644
index 0000000..7e7daf2
--- /dev/null
+++ b/dev/tutorials/basics/index.html
@@ -0,0 +1,83 @@
+
+AutoViz Basics · AutoViz.jl
Draw all renderables to a surface of dimensions canvas_width x canvas_height. All renderables must implement the add_renderable! function which adds rendering instructions to the render model.
The provided camera should be updated using the update_camera!() function before calling render. If no camera is provided, the render function will default to fitting all renderable objects to the canvas.
In its simplest form, the render function only takes one argument: an iterable collection of renderable objects, renderables. In order for an object to be renderable, it needs to implement the add_renderable!() function.
By default, the render() function will do its best to make all the contents of the scene fit to the canvas of dimensions canvas_width x canvas_height. More fine-grained control over camera positioning can be achieved by providing the camera keyword. In case a custom camera is used, it is important to call update_camera!(camera, scene) before rendering.
The Cairo surface to be used for plotting can be specified using the surface keyword. The render() function applies the rendering instructions to the surface and returns it. In the tutorials, we will denote the returned surface as a snapshot of the scene. Such snapshots can be saved to file using the command
The render function provides some defaults for rendering basic building blocks such as entities or roadways. If the value of AutoViz.rendermode is set to :basic, entities are simply rendered as rectangles with arrows indicating their velocities. This can also be done explicitly via
renderables = [
+ roadway,
+ (EntityRectangle(entity=x) for x in scene)...,
+ (VelocityArrow(entity=x) for x in scene)...,
+]
+snapshot = render(renderables, canvas_height=120)
The result remains the same. The velocity arrows point to the location at which the vehicle would be 1 second in the future.
Setting AutoViz.rendermode to :fancy, the rectangles are replaced by SVG images of cars (or pedestrians).
renderables = [
+ roadway, (FancyCar(car=scene[i]) for i in 1:3)..., FancyPedestrian(ped=scene[4])
+]
+snapshot = render(renderables, canvas_height=120)
A third visualization mode is available in the form of arrow cars, in which the arrow indicates the heading direction of the car but does not scale with speed.
renderables = [
+ roadway,
+ (ArrowCar(scene[i]) for i in 1:3)...,
+ FancyPedestrian(ped=scene[4])
+]
+snapshot = render(renderables, canvas_height=120)
By default, the render function generates a random color for each entity based on its ID using the id_to_color() function. However, vehicle colors can also be assigned explicitly:
colors = [colorant"red", colorant"blue", colorant"green"]
+renderables = [
+ roadway,
+ (FancyCar(car=scene[i], color=colors[i]) for i in 1:3)...,
+ FancyPedestrian(ped=scene[4], color=colorant"yellow")
+]
+snapshot = render(renderables, canvas_height=120)
In this section, we will showcase the cameras that are supported by AutoViz.jl.
All cameras make use of the CameraState object to represent the internal camera state.
Missing docstring.
Missing docstring for CameraState. Check Documenter's build log for details.
The following camera types are supported by AutoViz: StaticCamera, TargetFollowCamera, SceneFollowCamera, ZoomingCamera, ComposedCamera. The keyword arguments accepted by the CameraState object can also be passed to the constructors of these cameras, and they will be forwarded to the internal camera state. Now, we will show how the different cameras behave based on the simple stadium example.
First, we prepare a sequence of scenes visualize
using AutomotiveDrivingModels
+using AutoViz
+
+nlanes = 4
+nveh = 5
+nticks = 100
+timestep = 0.1
+
+roadway = gen_stadium_roadway(nlanes)
+
+scene = Scene([Entity(VehicleState(
+ Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), roadway, 4.0 + 2.0rand()
+), VehicleDef(), i) for i in 1:nveh])
+
+models = Dict((
+ i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())
+ for i in 1:nveh
+))
+set_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))
+
+
+scenes = simulate(scene, roadway, models, nticks, timestep)
The following helper function takes care of generating an animation from a sequence of scenes, using a given camera. Note that for camera=nothing, the render function attempts to fit all the renderable objects on the canvas.
The call to update_camera!(camera, scenes[i]) is important as it allows the internal camera state to be updated based on the positions of the vehicles.
The default camera uses the render instructions that are stored inside the RenderModel in order to compute a bounding box which holds all renderable objects.
animation = animate(roadway, scenes);
"stadium_cam_default.gif"
Note that some renderable objects (such as custom objects) may not be considered by the default fit to content camera when the bounding box is computed. Therefore, they may be cut off.
In many applications, we are interested in tracking one particular vehicle. To do this, we can use a TargetFollowCamera which follows a vehicle with a given ID. Let's follow the vehicle with ID 3:
Sometimes, it is desireable fix the x or y position of the camera. For example, we can use the TargetFollowCamera to track a vehicle horizontally (in x direction), while keeping the vertical position (y direction) fixed. To do this, we simply provide a fixed value for the corresponding keyword argument y.
In contrast to the TargetFollowCamera, the SceneFollowCamera tracks the center of mass of all the vehicles in a scene. The padding parameter specifies how man metres of padding there should be around the vehicles in the scene
The zooming camera changes its zoom level by an increment dz anytime the update_camera!() function is called, until a zoom level of zoom_target is reached.
Finally, the ComposedCamera can be used to combine different camera behaviors. For example, one can use the TargetFollowCamera together with the ZoomingCamera in order to follow a vehicle and zoom in on it. The constructor of the CompostedCamera takes an array of cameras which are applied in the same sequence as they are provided in the array.
Finally, we will show how to build a custom camera. We will build a camera whose angle is always aligned with the axis of the target vehicle with ID target_id
Overlays are useful to display additional information on top of a given driving scene. For example, they can be used to display the ID of the vehicle, their speed, or other useful information.
More generally, renderable objects that are passed to the render function are rendered in the order they are passed in. For example, if we pass a collection consisting of a roadway and a scene, the roadway is rendered first, and the scene is rendered on top of the roadway.
This behavior leaves the possibility to create overlays as well as "underlays" that may be drawn under the vehicles.
In this tutorial, we will use the same stadium scenario as shown in the camera example.
using AutomotiveDrivingModels
+using AutoViz
+AutoViz.set_render_mode(:fancy)
+
+nlanes = 2
+nveh = 8
+nticks = 100
+timestep = 0.1
+
+roadway = gen_stadium_roadway(nlanes)
+
+scene = Scene([
+ Entity(
+ VehicleState(
+ Frenet(roadway[LaneTag(1,rand(1:nlanes))], 10.0*i), # position
+ roadway, 4.0 + 2.0rand() # speed
+ ),
+ VehicleDef(), i
+ ) for i in 1:nveh
+])
+
+models = Dict((
+ i => LatLonSeparableDriver(ProportionalLaneTracker(), IntelligentDriverModel())
+ for i in 1:nveh
+))
+set_desired_speed!.(values(models), 8.0 .+ 4.0rand(nveh))
+
+scenes = simulate(scene, roadway, models, nticks, timestep)
The following code will help us to animate the simulation using Reel
The animate function defined above takes an overlays object which holds a list of overlays for every frame in scenes.
Note
Note on compatibility: The interface for rendering overlays has changed in version 0.8 of AutoViz. In older versions of AutoViz, overlays were rendered by passing in the current scene and roadway explicitly. Since AutoViz 0.8, every renderable object must have the same interface. As a result, an overlay that requires the roadway or scene for rendering, must store those objects as internal variables.
(AutoViz.RenderableOverlay is an overlay that can be used as a wrapper around older overlays which rely on the scene and roadway objects. However, it is recommended that overlays implement the new interface for add_renderable! since AutoViz.RenderableOverlay may be removed in future versions.)
Display a bar at the specified position pos. The bar has dimensions width and height and is filled up to a given proportion of its height. The fill proportion is set using val, which should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top. The default units are in the camera frame.
max_speed = 14.0
+overlays = [[HistogramOverlay(
+ pos=VecE2(40.0, 100.0), val=get_by_id(scene, 1).state.v/max_speed, label="veh1 speed",
+ fill_color=colorant"blue", line_color=colorant"black",
+ font_size=24, width=10, height=50
+)] for scene in scenes]
+animation = animate(roadway, scenes, overlays)
Just like roadways and vehicles, overlays are renderable objects. In order to make a custom overlay type renderable, one needs to implement the add_renderable!(::RenderModel, ::YourOverlay) function.
To define an overlay which highlights a lane, let's start by defining a custom type LaneOverlay
In the following, we will show a more advanced example in which direct manipulation of the CairoContext is required. We will create an overlay which draws concentric rectangles around a vehicle with ID target_id
The add_renderable function adds the function defined above to the instruction stack of the render model via add_instruction!. A series of common rendering instructions are already implemented as part of the AutoViz.jl framework.
Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Display the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
This document was generated with Documenter.jl on Monday 13 January 2020. Using Julia version 1.0.5.
diff --git a/v0.7.10/search_index.js b/v0.7.10/search_index.js
new file mode 100644
index 0000000..f4dfe14
--- /dev/null
+++ b/v0.7.10/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CarFollowCamera","page":"API","title":"AutoViz.CarFollowCamera","text":"Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{Cairo.CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.10/siteinfo.js b/v0.7.10/siteinfo.js
new file mode 100644
index 0000000..7c43591
--- /dev/null
+++ b/v0.7.10/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.10";
diff --git a/v0.7.2/api/index.html b/v0.7.2/api/index.html
new file mode 100644
index 0000000..c2214d9
--- /dev/null
+++ b/v0.7.2/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.2/search_index.js b/v0.7.2/search_index.js
new file mode 100644
index 0000000..99a0e62
--- /dev/null
+++ b/v0.7.2/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=COLOR_CAR_OTHER, text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=COLOR_CAR_OTHER, text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.2/siteinfo.js b/v0.7.2/siteinfo.js
new file mode 100644
index 0000000..1d194c7
--- /dev/null
+++ b/v0.7.2/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.2";
diff --git a/v0.7.3/api/index.html b/v0.7.3/api/index.html
new file mode 100644
index 0000000..7c1da8e
--- /dev/null
+++ b/v0.7.3/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.3/search_index.js b/v0.7.3/search_index.js
new file mode 100644
index 0000000..12ee5bc
--- /dev/null
+++ b/v0.7.3/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene.\n\nFiels\n\ncolor::Colorant default white\nfont_size::Int64 default 15\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.3/siteinfo.js b/v0.7.3/siteinfo.js
new file mode 100644
index 0000000..91cd185
--- /dev/null
+++ b/v0.7.3/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.3";
diff --git a/v0.7.4/api/index.html b/v0.7.4/api/index.html
new file mode 100644
index 0000000..6db3f00
--- /dev/null
+++ b/v0.7.4/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.4/search_index.js b/v0.7.4/search_index.js
new file mode 100644
index 0000000..12ee5bc
--- /dev/null
+++ b/v0.7.4/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene.\n\nFiels\n\ncolor::Colorant default white\nfont_size::Int64 default 15\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.4/siteinfo.js b/v0.7.4/siteinfo.js
new file mode 100644
index 0000000..f7d220e
--- /dev/null
+++ b/v0.7.4/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.4";
diff --git a/v0.7.5/api/index.html b/v0.7.5/api/index.html
new file mode 100644
index 0000000..48ed991
--- /dev/null
+++ b/v0.7.5/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.5/search_index.js b/v0.7.5/search_index.js
new file mode 100644
index 0000000..12ee5bc
--- /dev/null
+++ b/v0.7.5/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene.\n\nFiels\n\ncolor::Colorant default white\nfont_size::Int64 default 15\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.5/siteinfo.js b/v0.7.5/siteinfo.js
new file mode 100644
index 0000000..886aa0a
--- /dev/null
+++ b/v0.7.5/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.5";
diff --git a/v0.7.6/api/index.html b/v0.7.6/api/index.html
new file mode 100644
index 0000000..835867c
--- /dev/null
+++ b/v0.7.6/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Display the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.6/search_index.js b/v0.7.6/search_index.js
new file mode 100644
index 0000000..ad43b3c
--- /dev/null
+++ b/v0.7.6/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CarFollowCamera","page":"API","title":"AutoViz.CarFollowCamera","text":"Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.6/siteinfo.js b/v0.7.6/siteinfo.js
new file mode 100644
index 0000000..4a9d100
--- /dev/null
+++ b/v0.7.6/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.6";
diff --git a/v0.7.7/api/index.html b/v0.7.7/api/index.html
new file mode 100644
index 0000000..8d3bac5
--- /dev/null
+++ b/v0.7.7/api/index.html
@@ -0,0 +1,5 @@
+
+API · AutoViz.jl
Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Display the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).
Render all the items in scene to a Cairo surface and return it.
scene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.
diff --git a/v0.7.7/search_index.js b/v0.7.7/search_index.js
new file mode 100644
index 0000000..f4dfe14
--- /dev/null
+++ b/v0.7.7/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"ArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=_colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\nA renderable type to represent a rectangular car with an arrow in the middle. \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CarFollowCamera","page":"API","title":"AutoViz.CarFollowCamera","text":"Camera which follows the vehicle with ID targetid. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the follow_x and follow_y keywords to false, in which case the position defaults to pos_default. The zoom keyword specifies the zoom level in pixels per meter.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera{R<:Real}\n\nCamera centered over all vehicles The zoom can be adjusted. \n\nFields\n\nzoom::R\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{Any}","page":"API","title":"AutoViz.render","text":"render(scene)\nrender(scene; kwargs...)\n\nRender all the items in scene to a Cairo surface and return it.\n\nscene is simply an iterable object (e.g. a vector) of items that are either directly renderable or renderable by conversion. See the AutoViz README for more details.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.write_to_svg-Tuple{Cairo.CairoSurface,AbstractString}","page":"API","title":"AutoViz.write_to_svg","text":"write_to_svg(surface::CairoSurface, filename::AbstractString)\n\nWrite a cairo svg surface to a file. The surface object is destroyed after.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.renderfun-Union{Tuple{Entity{S,D,I}}, Tuple{I}, Tuple{D}, Tuple{S}} where I where D where S","page":"API","title":"AutoViz.renderfun","text":"renderfun(veh::Entity{S,D,I}) where {S,D,I}\n\ndecides which rendering function to use based on the class of veh and AutoViz RENDER_MODE\n\n\n\n\n\n","category":"method"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.7.7/siteinfo.js b/v0.7.7/siteinfo.js
new file mode 100644
index 0000000..2d63fbb
--- /dev/null
+++ b/v0.7.7/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.7.7";
diff --git a/v0.8 b/v0.8
new file mode 120000
index 0000000..4ea5caf
--- /dev/null
+++ b/v0.8
@@ -0,0 +1 @@
+v0.8.0
\ No newline at end of file
diff --git a/v0.8.0/api/index.html b/v0.8.0/api/index.html
new file mode 100644
index 0000000..2049708
--- /dev/null
+++ b/v0.8.0/api/index.html
@@ -0,0 +1,4 @@
+
+API · AutoViz.jl
Composition of several cameras. The update_camera actions of the individual cameras are applied in the order in which they are saved in the cameras array. States of individual cameras are ignored, the state of the composed camera is the one that will be used for rendering.
A drawable 'fancy' svg image of a race car. The car is placed at the position of entity and the width and length are scaled accordingly. The color of the car can be specified using the color keyword.
A drawable 'fancy' svg image of a pedestrian. The pedestrian is placed at the position of entity and the width and length of the original image are scaled accordingly. The color of the pedestrian can be specified using the color keyword.
Display a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.
Fields
pos::VecE2{Float64} = VecE2(0.,0.)
coordinate_system::Symbol = :scene
label::String = "histogram"
val::Float64 = 0.5 should be between 0 and 1
width::Float64 = 2.
height::Float64 = 5.
fill_color::Colorant = colorant"blue"
line_color::Colorant = colorant"white"
font_size::Int64 = 15 # [pix]
label_pos::VecSE2{Float64} = pos + VecSE2(0., -height/2) position of the label
Display the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).
Draws a line between a vehicle and its neighbors. The neighbors are linked with different colors depending on their lanes. This overlay needs to be wrapped as a RenderableOverlay which needs a scene and a roadway to perform the calculation of the neighbors.
By default, the scene is tracked in x and y direction and the zoom level is adapted to fit all vehicles in the scene. Tracking in either direction can be disabled by setting the x or y keys to a desired value. The zoom level can be fixed by passing a value to zoom. The value of padding specifies the width of the additional border around the zoomed-in area.
Camera which follows the vehicle with ID target_id. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the x or y keys to a desired value.
Displays some text at the desired location. The coordinates and size units are in pixels by default. The option coordinate_system allows to use different units.
A drawable arrow representing the current velocity vector of an entity. The arrow points to the location where the vehicle will be one second in the future (assuming linear motion).
INPUT: rendermodel - the RenderModel we are adding the instruction to f - the function to be called, the first argument must be a CairoContext args - tuple of input arguments to f, skipping the CairoContext coordinatesystem - in which coordinate system are the coordinates given (one of :scene, :camerapixels, :camerarelative) :scene - coordinates are physical coordinates in the world frame in unit [meters] `:camerapixels- coordinates are in pixels and relative to the rectangle selected by the camera in unit [pixels]:camera_relative` - coordinates are in percentages in the range 0 to 1 of the rectangle selected by the camera
Draw all renderables to a surface using the parameters specified in rendermodel. The canvas is initialized to a CairoSurface of dimensions canvas_width, canvas_height. All renderables must inherit from Renderable and implement the add_renderable! function which adds instructions for rendering to the render model.
You should call update_camera! before calling render to adapt the camera to the new scene. The instructions of the rendermodel are reset automatically at the beginning of this function.
This document was generated with Documenter.jl on Saturday 7 March 2020. Using Julia version 1.0.5.
diff --git a/v0.8.0/search_index.js b/v0.8.0/search_index.js
new file mode 100644
index 0000000..358ac1e
--- /dev/null
+++ b/v0.8.0/search_index.js
@@ -0,0 +1,3 @@
+var documenterSearchIndex = {"docs":
+[{"location":"api/#API-1","page":"API","title":"API","text":"","category":"section"},{"location":"api/#","page":"API","title":"API","text":"List of functions and datastructure available in AutoViz","category":"page"},{"location":"api/#","page":"API","title":"API","text":"Modules = [AutoViz]","category":"page"},{"location":"api/#AutoViz.ArrowCar","page":"API","title":"AutoViz.ArrowCar","text":"A basic drawable rectangle representing a car. An arrow indicates the heading direction of the car.\n\nArrowCar{A<:AbstractArray{Float64}, C<:Colorant} <: Renderable\nArrowCar(pos::AbstractArray, angle::Float64=0.0; length = 4.8, width = 1.8, color=colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\nArrowCar(x::Real, y::Real, angle::Float64=0.0; length = 4.8, width = 1.8, color=colortheme[\"COLOR_CAR_OTHER\"], text=\"\", id=0)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.BlinkerOverlay","page":"API","title":"AutoViz.BlinkerOverlay","text":"BlinkerOverlay\n\nDisplays a circle on one of the top corner of a vehicle to symbolize a blinker. fields: \n\non: turn the blinker on\nright: blinker on the top right corner, if false, blinker on the left \nveh: the vehicle for which to display the blinker \ncolor: the color of the blinker\nsize: the size of the blinker \n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.Camera","page":"API","title":"AutoViz.Camera","text":"Camera abstract type\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CameraState","page":"API","title":"AutoViz.CameraState","text":"CameraState\n\nRepresentation of camera parameters such as position, rotation and zoom level.\n\ncamera_center::VecE2{Real}: position of camera in [N,E] relative to the mean point. meters\ncamera_zoom::Real: camera zoom in [pix/m]\ncamera_rotation::Real: camera rotation in [rad]\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.CarFollowingStatsOverlay","page":"API","title":"AutoViz.CarFollowingStatsOverlay","text":"CarFollowingStatsOverlay\n\nDisplays statistics about the front neighbor of the car of id target_id.\n\nConstructor\n\nCarFollowingStatsOverlay(;target_id, verbosity=1, color=colorant\"white\", font_size=10)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.ComposedCamera","page":"API","title":"AutoViz.ComposedCamera","text":"ComposedCamera <: Camera\n\nComposition of several cameras. The update_camera actions of the individual cameras are applied in the order in which they are saved in the cameras array. States of individual cameras are ignored, the state of the composed camera is the one that will be used for rendering.\n\nExample Usage\n\ncam = ComposedCamera(cameras=[SceneFollowCamera(), ZoomingCamera()])\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.EntityRectangle","page":"API","title":"AutoViz.EntityRectangle","text":"A drawable rectangle with rounded corners representing an entity.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.FancyCar","page":"API","title":"AutoViz.FancyCar","text":"A drawable 'fancy' svg image of a race car. The car is placed at the position of entity and the width and length are scaled accordingly. The color of the car can be specified using the color keyword.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.FancyPedestrian","page":"API","title":"AutoViz.FancyPedestrian","text":"A drawable 'fancy' svg image of a pedestrian. The pedestrian is placed at the position of entity and the width and length of the original image are scaled accordingly. The color of the pedestrian can be specified using the color keyword.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.HistogramOverlay","page":"API","title":"AutoViz.HistogramOverlay","text":"HistogramOverlay\n\nDisplay a bar at the specified position pos, the bar is of size width, height and is filled up to a given proportion of its height. The fill proportion is set using val, it should be a number between 0 and 1. If it is 0, the bar is not filled, if it is 1 it is filled to the top.\n\nFields\n\npos::VecE2{Float64} = VecE2(0.,0.)\ncoordinate_system::Symbol = :scene\nlabel::String = \"histogram\"\nval::Float64 = 0.5 should be between 0 and 1\nwidth::Float64 = 2.\nheight::Float64 = 5.\nfill_color::Colorant = colorant\"blue\"\nline_color::Colorant = colorant\"white\"\nfont_size::Int64 = 15 # [pix]\nlabel_pos::VecSE2{Float64} = pos + VecSE2(0., -height/2) position of the label\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.IDOverlay","page":"API","title":"AutoViz.IDOverlay","text":"IDOverlay\n\nDisplay the ID on top of each entity in a scene. The text can be customized with the color::Colorant (default=white) and font_size::Int64 (default=15) keywords. The position of the ID can be adjusted using x_off::Float64 and y_off::Float64 (in camera coordinates).\n\nFields\n\ncolor::Colorant = colorant\"white\"\nfont_size::Int = 15\nx_off::Float64 = 0.\ny_off::Float64 = 0.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.NeighborsOverlay","page":"API","title":"AutoViz.NeighborsOverlay","text":"NeighborsOverlay\n\nDraws a line between a vehicle and its neighbors. The neighbors are linked with different colors depending on their lanes. This overlay needs to be wrapped as a RenderableOverlay which needs a scene and a roadway to perform the calculation of the neighbors.\n\nFields\n\ntarget_id::Int\ncolor_L::Colorant = colorant\"blue\"\ncolor_M::Colorant = colorant\"green\ncolor_R::Colorant = colorant\"red\"\nline_width::Float64 = 0.5 \ntextparams::TextParams = TextParams()\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.Overwash","page":"API","title":"AutoViz.Overwash","text":"Overwash\n\noverlay that renders a plain color on the whole canvas.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.RenderModel","page":"API","title":"AutoViz.RenderModel","text":"RenderModel\n\nModel to keep track of rendering instructions and background color.\n\ninstruction_set::AbstractVector{Tuple}: set of render instructions (function, array of inputs sans ctx, coordinate_system)\nbackground_color::RGB: background color\n\nFields\n\ninstruction_set :: AbstractVector{Tuple} = Array{Tuple}(undef, 0)\nbackground_color :: RGB = colortheme[\"background\"]\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.RenderableOverlay","page":"API","title":"AutoViz.RenderableOverlay","text":"RenderableOverlay\n\nDecorator which allows to use SceneOverlay objects together with the method render([Renderables])\n\nThis is required primarily for allowing backward compatibility with overlays that use the old rendering interface.\n\nusage: RenderableOverlay(o::Overlay, scene::Frame, roadway::Roadway)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.SceneFollowCamera","page":"API","title":"AutoViz.SceneFollowCamera","text":"SceneFollowCamera\n\nCamera centered over all vehicles.\n\nBy default, the scene is tracked in x and y direction and the zoom level is adapted to fit all vehicles in the scene. Tracking in either direction can be disabled by setting the x or y keys to a desired value. The zoom level can be fixed by passing a value to zoom. The value of padding specifies the width of the additional border around the zoomed-in area.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.StaticCamera","page":"API","title":"AutoViz.StaticCamera","text":"StaticCamera <: Camera\n\nFix the position and the zoom as specified in the constructor.\n\nConstructor\n\nStaticCamera(position::VecE2=(0,0), zoom::Real=4)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.TargetFollowCamera","page":"API","title":"AutoViz.TargetFollowCamera","text":"TargetFollowCamera <: Camera\n\nCamera which follows the vehicle with ID target_id. By default, the target vehicle is tracked in x and y direction. Tracking in either direction can be disabled by setting the x or y keys to a desired value.\n\nConstructor\n\nTargetFollowCamera(target_id; x=NaN, y=NaN, kwargs...)\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.TextOverlay","page":"API","title":"AutoViz.TextOverlay","text":"TextOverlay\n\nDisplays some text at the desired location. The coordinates and size units are in pixels by default. The option coordinate_system allows to use different units.\n\nFields\n\ntext::Vector{String}\ncolor::Colorant = colorant\"white\"\nfont_size::Int = 10\npos::VecE2 = VecE2(10, font_size)\nline_spacing::Float64 = 1.5 multiple of font_size\ncoordinate_system::Symbol=:camera_pixels\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.VelocityArrow","page":"API","title":"AutoViz.VelocityArrow","text":"A drawable arrow representing the current velocity vector of an entity. The arrow points to the location where the vehicle will be one second in the future (assuming linear motion).\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.ZoomingCamera","page":"API","title":"AutoViz.ZoomingCamera","text":"ZoomingCamera <: Camera\n\nCamera which gradually changes the zoom level of the scene to zoom_target with step size dz.\n\n\n\n\n\n","category":"type"},{"location":"api/#AutoViz.add_instruction!-Tuple{RenderModel,Function,Tuple}","page":"API","title":"AutoViz.add_instruction!","text":"Add an instruction to the rendermodel\n\nINPUT: rendermodel - the RenderModel we are adding the instruction to f - the function to be called, the first argument must be a CairoContext args - tuple of input arguments to f, skipping the CairoContext coordinatesystem - in which coordinate system are the coordinates given (one of :scene, :camerapixels, :camerarelative) :scene - coordinates are physical coordinates in the world frame in unit [meters] `:camerapixels- coordinates are in pixels and relative to the rectangle selected by the camera in unit [pixels]:camera_relative` - coordinates are in percentages in the range 0 to 1 of the rectangle selected by the camera\n\nex: addinstruction!(rendermodel, rendertext, (\"hello world\", 10, 20, 15, [1.0,1.0,1.0]))\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Tuple{RenderModel,String}","page":"API","title":"AutoViz.add_renderable!","text":"Render function for text\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Union{Tuple{E}, Tuple{RenderModel,E}, Tuple{RenderModel,E,Union{Nothing, Colorant}}} where E<:Records.Entity","page":"API","title":"AutoViz.add_renderable!","text":"Helper function for directly rendering entities, takes care of wrapping them in renderable objects\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.add_renderable!-Union{Tuple{E}, Tuple{RenderModel,Frame{E}}} where E<:Records.Entity","page":"API","title":"AutoViz.add_renderable!","text":"Helper function for directly rendering frames of renderable entities\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.isrenderable","page":"API","title":"AutoViz.isrenderable","text":"Return true if an object or type is directly renderable, false otherwise.\n\nNew types should implement the isrenderable(t::Type{NewType}) method.\n\n\n\n\n\n","category":"function"},{"location":"api/#AutoViz.render-Tuple{AbstractArray{T,1} where T}","page":"API","title":"AutoViz.render","text":"Draw all renderables to a surface using the parameters specified in rendermodel. The canvas is initialized to a CairoSurface of dimensions canvas_width, canvas_height. All renderables must inherit from Renderable and implement the add_renderable! function which adds instructions for rendering to the render model.\n\nYou should call update_camera! before calling render to adapt the camera to the new scene. The instructions of the rendermodel are reset automatically at the beginning of this function.\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.set_color_theme-Tuple{Any}","page":"API","title":"AutoViz.set_color_theme","text":"set_color_theme(colortheme)\n\nChange the color theme of the package\n\n\n\n\n\n","category":"method"},{"location":"api/#AutoViz.camera_fit_to_content","page":"API","title":"AutoViz.camera_fit_to_content","text":"camera_fit_to_content(rendermodel::RenderModel, ctx::CairoContext, canvas_width::Integer = DEFAULT_CANVAS_WIDTH, canvas_height::Integer = DEFAULT_CANVAS_HEIGHT; percent_border::Real = 0.0)\n\nHelper function that determines camera parameters such that all rendered content fits on the canvas.\n\n\n\n\n\n","category":"function"},{"location":"#About-1","page":"About","title":"About","text":"","category":"section"},{"location":"#","page":"About","title":"About","text":"This the documentation for AutoViz.jl. For now it is just a list of functions. ","category":"page"},{"location":"#","page":"About","title":"About","text":"","category":"page"}]
+}
diff --git a/v0.8.0/siteinfo.js b/v0.8.0/siteinfo.js
new file mode 100644
index 0000000..9d15fd0
--- /dev/null
+++ b/v0.8.0/siteinfo.js
@@ -0,0 +1 @@
+var DOCUMENTER_CURRENT_VERSION = "v0.8.0";
diff --git a/versions.js b/versions.js
new file mode 100644
index 0000000..e60c4a3
--- /dev/null
+++ b/versions.js
@@ -0,0 +1,6 @@
+var DOC_VERSIONS = [
+ "stable",
+ "v0.8",
+ "v0.7",
+ "dev",
+];