Skip to content
Snippets Groups Projects
Commit 10a44d84 authored by Hadi's avatar Hadi Committed by Martins Mozeiko
Browse files

Update docs for new waypoint following features

parent 7ed10f9b
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ This document describes the example Python scripts that use the LGSVL Simulator
* [10-npc-follow-the-lane.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/10-npc-follow-the-lane.py): How to create NPCs and then let them drive in the nearest annotated lane
* [11-collision-callbacks.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/11-collision-callbacks.py): How to setup the simulator so that whenever the 3 created agents collide with anything, the name of the agent and the collision point is printed
* [12-create-npc-on-lane.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/12-create-npc-on-lane.py): How to create NPC vehicles in random position in a radius around the EGO vehicle, but the NPCs are placed on the nearest lane to the initial random position
* [13-npc-follow-waypoints.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/13-npc-follow-waypoints.py): How to create a list of waypoints and direct an NPC to follow them
* [13-npc-follow-waypoints.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/13-npc-follow-waypoints.py): How to create a list of waypoints with fixed wait times and direct an NPC to follow them
* [14-create-pedestrians.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/14-create-pedestrians.py): How to create pedestrians in rows in front of the spawn position
* [15-pedestrian-walk-randomly.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/15-pedestrian-walk-randomly.py): How to start and stop a pedestrian walking randomly on the sidewalk
* [16-pedestrian-follow-waypoints.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/16-pedestrian-follow-waypoints.py): How to create a list of waypoints and direct a pedestrian to follow them
......@@ -28,4 +28,6 @@ This document describes the example Python scripts that use the LGSVL Simulator
* [22-connecting-bridge.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/22-connecting-bridge.py): How to command an EGO vehicle to connect to a bridge at a specific IP address and port and then wait for the connection to be established
* [23-npc-callbacks.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/23-npc-callbacks.py): How to setup the simulator so that whenever an NPC reaches a stopline or changes lane, the name of the npc is printed
* [24-ego-drive-straight-non-realtime.py](https://github.com/lgsvl/simulator/tree/master/Api/24-ego-drive-straight-non-realtime.py): How to run the simulator at non-realtime.
* [25-waypoint-flying-npc.py](https://github.com/lgsvl/simulator/tree/master/Api/25-waypoint-flying-npc.py): How to use waypoints to define customized motion for npc.
* [26-npc-trigger-waypoints.py](https://github.com/lgsvl/simulator/tree/master/Api/26-npc-trigger-waypoints.py): How to use trigger waypoints that pause npc motion until an ego vehicle approaches.
* [99-utils-examples.py](https://github.com/lgsvl/simulator/tree/master/Api/quickstart/99-utils-examples.py): How to use several of the utility scripts to transform an arbitrary point to the coordinate system of a local transform (relative to sensor)
......@@ -279,16 +279,17 @@ the `follow` method for the npc vehicle:
```python
npc = sim.add_agent("Sedan", lgsvl.AgentType.NPC)
waypoints = [
lgsvl.DriveWaypoint(lgsvl.Vector(1,0,3), 5),
lgsvl.DriveWaypoint(lgsvl.Vector(5,0,3), 10),
lgsvl.DriveWaypoint(lgsvl.Vector(1,0,5), 5),
lgsvl.DriveWaypoint(lgsvl.Vector(1,0,3), 5, 0, 0, 0),
lgsvl.DriveWaypoint(lgsvl.Vector(5,0,3), 10, 0, 0, 0),
lgsvl.DriveWaypoint(lgsvl.Vector(1,0,5), 5, 0, 0, 0),
]
npc.follow(waypoints, loop=True)
```
Each waypoint has a position in world coordinates and a desired velocity in m/s. The NPC
Each waypoint has a position in world coordinates, a desired velocity in m/s, a desired angular orientation as a vector of Euler angles, an optional wait-time for the vehicle to stay idle, and an optional trigger distance. The NPC
will ignore all traffic rules and will not avoid collisions to try to get to the next
waypoint. You can receive information on progress by setting the `on_waypoint_reached`
waypoint. The angular orientation of the NPC will be interpolated in such a manner that it will pass through the waypoint at the angle specified in the `DriveWaypoint`. The trigger distance, if used, provides a method to pause the NPC until an ego vehicle approaches. The NPC will begin to drive as soon as its distance to an ego vehicle drops below the value specified as trigger distance in the `DriveWaypoint`.
You can receive information on progress by setting the `on_waypoint_reached`
callback. Example (see [callbacks](#callbacks) for more details):
```python
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment