Envision is a visualization front-end for SMARTS providing real-time view of environment state. It's built on web-technologies (including React, WebGL, and websockets) allowing it to run easily in your browser. Envision is composed of a few parts: a client which SMARTS uses directly; a server used for state broadcasting; and the web application where all the visualization and rendering happens.
# From SMARTS project root; starts SMARTS and the Envision server
scl envision start -p 8081
# Then to visit the Envision web app in your browser,
http://localhost:8081/
To contribute to envision it's easiest to start and control the processes manually. Start the Envision server by running,
# From SMARTS project root; runs on port 8081 by default
python envision/server.py --debug
Then start the Envision web application. npm (version >= 6) and node (version >= 12) are required.
cd envision/web
# Install dependencies
npm install
# Build, run dev server, and watch code changes
npm run watch
This development flow currently requires reloading the webpage after update.
If you've made changes to the Envision web application you'll want to save an updated distribution which users access directly (so they don't have to setup Envision's development dependencies). Simply run,
# Saves to envision/web/dist
npm run build
For recording simply add envision_record_data_replay_path
to the gym.make(...)
call,
env = gym.make(
"smarts.env:hiway-v0",
scenarios=args.scenarios,
agents={AGENT_ID: agent},
headless=args.headless,
visdom=False,
fixed_timestep_sec=0.1,
envision_record_data_replay_path="./data_replay",
)
then run with scl run --envision <examples/script_path> <scenarios/path>
(currently Envision server needs to be up for data recording to work).
For replay make sure you have Envision server running then use the following tool - passing in your replay files,
scl scenario replay -d ./data_replay/1590892375a -t 0.1
INFO:root:Replaying 1 record(s) at path=data_replay/1590892375a with timestep=0.1s