Code Monkey home page Code Monkey logo

erdos-project / pylot Goto Github PK

View Code? Open in Web Editor NEW
451.0 16.0 126.0 10.35 MB

Modular autonomous driving platform running on the CARLA simulator and real-world vehicles.

Home Page: https://pylot.readthedocs.io/

License: Apache License 2.0

Shell 1.24% Python 98.42% Dockerfile 0.35%
autonomous-vehicles autonomous-driving carla perception planning prediction control machine-learning traffic-light-detection carla-simulator obstacle-tracking lane-detection self-driving-car

pylot's Introduction

Build Status Documentation Status

Pylot is an autonomous vehicle platform for developing and testing autonomous vehicle components (e.g., perception, prediction, planning) on the CARLA simulator and real-world cars.

Setup instructions

Deploy using Docker

The easiest way to get Pylot running is to use our Docker image. Please ensure you have nvidia-docker on your machine before you start installing Pylot. In case you do not have nvidia-docker please run ./scripts/install-nvidia-docker.sh

We provide a Docker image with both Pylot and CARLA already setup.

docker pull erdosproject/pylot
nvidia-docker run -itd --name pylot -p 20022:22 erdosproject/pylot /bin/bash

Following, start the simulator in the container:

nvidia-docker exec -i -t pylot /home/erdos/workspace/pylot/scripts/run_simulator.sh

Finally, start Pylot in the container:

nvidia-docker exec -i -t pylot /bin/bash
cd ~/workspace/pylot/
python3 pylot.py --flagfile=configs/detection.conf

Visualizing components

In case you desire to visualize outputs of different components (e.g., bounding boxes), you have to forward X from the container. First, add your public ssh key to the ~/.ssh/authorized_keys in the container:

nvidia-docker cp ~/.ssh/id_rsa.pub pylot:/home/erdos/.ssh/authorized_keys
nvidia-docker exec -i -t pylot sudo chown erdos /home/erdos/.ssh/authorized_keys
nvidia-docker exec -i -t pylot sudo service ssh start

Finally, ssh into the container with X forwarding:

ssh -p 20022 -X erdos@localhost
cd /home/erdos/workspace/pylot/
python3 pylot.py --flagfile=configs/detection.conf --visualize_detected_obstacles

If everything worked ok, you should be able to see a visualization like the one below:

Pylot obstacle detection

Manual installation instructions

Alternatively, you can install Pylot on your base system by executing the following steps:

./install.sh
pip install -e ./

Next, start the simulator:

export CARLA_HOME=$PYLOT_HOME/dependencies/CARLA_0.9.10.1/
./scripts/run_simulator.sh

In a different terminal, setup the paths:

export CARLA_HOME=$PYLOT_HOME/dependencies/CARLA_0.9.10.1/
cd $PYLOT_HOME/scripts/
source ./set_pythonpath.sh

Finally, run Pylot:

cd  $PYLOT_HOME/
python3 pylot.py --flagfile=configs/detection.conf

Pylot components

Pylot comprises of several components: obstacle detection, traffic light detection, lane detection, obstacle tracking, localization, segmentation, fusion, prediction, planners, and control. Each component is implemented using one or more ERDOS operators and can be executed in isolation or with the entire Pylot application. Please read the Documentation for a more in depth description.

Pylot pipeline

Run the following command to see a demo of all the components, and the Pylot driving policy:

python3 pylot.py --flagfile=configs/demo.conf

The demo will execute: obstacle detection, traffic light detection, segmentation, prediction, planning, and the driving policy.


You can also run components in isolation:

Obstacle detection

Pylot supports three object detection models: frcnn_resnet101, ssd-mobilenet-fpn-640 and ssdlite-mobilenet-v2. The following command runs a detector in isolation:

python3 pylot.py --flagfile=configs/detection.conf

In case you want to evaluate the detector (i.e., compute mAP), you can run:

python3 pylot.py --flagfile=configs/detection.conf --evaluate_obstacle_detection

In case you are not satisfied with the accuracy of our obstacle detector, you can run a perfect version of it:

python3 pylot.py --flagfile=configs/perfect_detection.conf

If the detector does not run at your desired frequency, or if you want to track obstacles across frames, you can use a mix of detector plus tracker by running:

python3 pylot.py --flagfile=configs/tracking.conf

Traffic light detection

Pylot has uses a separate component for traffic light detection and classification. The following command runs the component in isolation:

python3 pylot.py --flagfile=configs/traffic_light.conf

In case you require higher accuracy, you can run perfect traffic light detection by passing the --perfect_traffic_light_detection flag.

Lane detection

python3 pylot.py --flagfile=configs/lane_detection.conf

Obstacle tracking

python3 pylot.py --flagfile=configs/tracking.conf

Segmentation

In order to run Pylot's segmentation component in isolation execute the following command:

python3 pylot.py --flagfile=configs/segmentation.conf

Similarly, pass --perfect_segmentation if you desire ideal pixel semantic segmentation.

Prediction

Pylot offers a simple linear prediction component:

python3 pylot.py --flagfile=configs/prediction.conf

Planning

The planning component provides two planning options, which can be specified using the --planning_type flag:

  1. waypoint: a simple planner that follows predefined waypoints. These waypoints can either be either pre-specified or computed using the A-star planner part of the CARLA simulator map. The planner ensures that the ego-vehicle respects traffic lights, stops whenever there are obstacles in its path, but does not implement obstacle avoidance.
  2. frenet_optimal_trajectory: a Frenet Optimal Trajectory planner.
  3. rrt_star: a Rapidly-explory Random Tree planner.
  4. hybrid_astar: a Hybrid A* planner.
# To run the Frenet Optimal Trajectory planner.
python3 pylot.py --flagfile=configs/frenet_optimal_trajectory_planner.conf

# To run the RRT* planner.
python3 pylot.py --flagfile=configs/rrt_star_planner.conf

# To run the Hybrid A* planner.
python3 pylot.py --flagfile=configs/hybrid_astar_planner.conf

Control

Pylot supports three controllers, which can be specified using the control flag:

  1. pid: follows the waypoints computed by the planning component using a PID controller.
  2. mpc: uses model predictive control for speed and waypoint following.
  3. simulator_auto_pilot: uses the simulator auto pilot to drive on predefined routes. This controller drives independent of the output of the other components.

You can run all the components, together with one of the two policies by executing:

# Runs all components using the algorithms we implemented and the models we trained:
python3 pylot.py --flagfile=configs/e2e.conf
# Runs the MPC
python3 pylot.py --flagfile=configs/mpc.conf
# Runs the simulator auto pilot.
python3 pylot.py --control=simulator_auto_pilot

Debug logs

In case you want to debug the application, you can active additional logging by passing: --log_file_name=pylot.log --v=1 to your command.

Data collection

Pylot also provides a script for collecting CARLA data such as: RGB images, segmented images, obstacle 2D bounding boxes, depth frames, point clouds, traffic lights, obstacle trajectories, and data in Chauffeur format.

Run python3 data_gatherer.py --help to see what data you can collect. Alternatively, you can inspect this configuration for an example of a data collection setup.

Build your own Docker image

In case you want to build your own images from the latest code, you can execute:

cd docker
./build_images.sh

The script creates two Docker images: one that contains the CARLA simulator and another one that contains ERDOS and Pylot.

CARLA autonomous driving challenge

Pylot can also be used as a baseline for executing on the CARLA Leaderboard routes. We provide an agent that offers reference implementations for perception (i.e., detection, tracking), localization (Extended Kalman filter), prediction, planning (e.g., waypoint follower, Frenet optimal trajectory, RRT*, Hybrid A*), and control.

To test this agent you can pull our image which has all the necessary software already installed.

docker pull erdosproject/pylot-carla-challenge
nvidia-docker run -itd --name pylot-challenge -p 20022:22 erdosproject/pylot-carla-challenge /bin/bash

Alternatively, you can manually install the dependencies on your machine by following the instructions provided below:

mkdir challenge
export CHALLENGE_ROOT=`pwd`
# Clone the challenge leaderboard repository.
git clone -b stable --single-branch https://github.com/carla-simulator/leaderboard.git
export LEADERBOARD_ROOT=${CHALLENGE_ROOT}/leaderboard/
cd ${LEADERBOARD_ROOT} ; pip3 install -r requirements.txt ; cd ${CHALLENGE_ROOT}
# Clone the CARLA scenario runner repository. This is used by the leaderboard.
git clone -b leaderboard --single-branch https://github.com/carla-simulator/scenario_runner.git
export SCENARIO_RUNNER_ROOT=${CHALLENGE_ROOT}/scenario_runner/
cd ${SCENARIO_RUNNER_ROOT} ; pip3 install -r requirements.txt ; cd ${CHALLENGE_ROOT}
# Checkout the CARLA challenge branch.
cd ${PYLOT_HOME} ; git checkout -b challenge origin/challenge
export CARLA_ROOT=Path to CARLA 0.9.10.1.
cd ${CHALLENGE_ROOT}
export TEAM_CODE_ROOT=${PYLOT_HOME} ; ${LEADERBOARD_ROOT}/scripts/make_docker.sh

Notes on the Pylot CARLA challenge agent

Similar to regular Pylot, the Challenge agent not only connects different reference implementation, but also provides the option of testing them in different configurations (e.g., test prediction, planning and control with perfect perception). This can be done by changing the flags in the challenge configuration according to the specification from the Pylot documentation.

More Information

To read more about the ideas behind Pylot, refer to our paper, Pylot: A Modular Platform for Exploring Latency-Accuracy Tradeoffs in Autonomous Vehicles (IEEE) (arXiv). If you find Pylot useful to your work, please cite our paper as follows:

@inproceedings{gog2021pylot,
  title={Pylot: A modular platform for exploring latency-accuracy tradeoffs in autonomous vehicles},
  author={Gog, Ionel and Kalra, Sukrit and Schafhalter, Peter and Wright, Matthew A and Gonzalez, Joseph E and Stoica, Ion},
  booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)},
  pages={8806--8813},
  year={2021},
  organization={IEEE}
}

Getting Involved

  • Community on Slack: Join our community on Slack for discussions about development, questions about usage, and feature requests.
  • Github Issues: For reporting bugs.

pylot's People

Contributors

alvkao58 avatar amandhar avatar cathyliyuanchen avatar eyalsel avatar fangedward avatar icgog avatar mageofboy avatar objorkman avatar paulwong16 avatar pschafhalter avatar shaviv-hoffman-lowitz avatar sukritkalra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylot's Issues

Questions

Hi

I have a few questions. Please excuse me if I'm missing something obvious:

  1. What is a good way to exit from the simulator?
  2. Every time I run, I start from a different location. Is there a way to fix the world parameters for a particular route? (I'm trying to evaluate one of the pieces of the pipeline. So I need the rest of the parameters to remain the same.)
  3. Is there a notion of speed limits or obstacle density that can be varied?

Thanks!

Processes do not "kill itself" after termination

Hi, I am still a noob to how processes work but I know that in the original Carla, when i want to quite the client, I can just do a ctrl+c in the terminal that i am running the client.

I did the same thing here, and although the ERDOS/Pylot process did end, the Pygame window does not close.

I've also looked in to my GPU using nvidia-smi, it seems like python is also still running. Is there anyways to "chain up" the termination command?

Screenshot from 2020-07-22 19-25-53

I'd like to mention that this is NOT an issue in the docker version, just the manual install version

Best,
Michael

Optimize RRT*

RRT* is slow (>1s) for large search spaces, work on optimizing this to run at more reasonable rates (<0.5s)

Issue with running docker container

Hi
After talking with @pschafhalter , I tried to follow the Deploy using Docker tutorial. I encountered some hiccup and eventually am stucked on an error.

The small hiccups are as follows, maybe it can help improve documentation:

  • The command listed on the instruction ssh -p 20022 -X erdos@localhost /bin/bash will cause my command line to just hang there, therefore I just did ssh -p 20022 -X erdos@localhost and then when I am in the server, I manually execute /bin/bash, does this change affect anything?

  • Also, it seems like PyGame is not installed by default in this docker image, I manually installed it using pip3 install pygame.


The error is described below:
The error log is attached here

Have you guys happened to encounter this? It seems like my GPU has ran its ram? From the nvidia-smi command, it seems like python is taking most from it? But I am not running any other program besides this one.

My system specification are as follows:
OS: Ubuntu 18.04
Graphics Driver: NVIDIA-SMI 450.36.06 Driver Version: 450.36.06 CUDA Version: 11.0
GPU: Nvidia RTX 2070 Super, 8GB memory

Here's the output from nvidia-smi
Screenshot from 2020-07-18 22-14-57

Here's screenshot of the the window for confirming Xauth is setted up correctly, carla server is running, and the terminal for running python3 pylot.py --flagfile=configs/detection.conf --visualize_detected_obstacles.
Screenshot from 2020-07-18 22-06-56

Please let me know if any other info would be necessary.

Thank you!

X Error of failed request: BadValue (integer parameter out of range for operation)

Hey everyone,
This might be related to the previous issue so feel free to close whichever you find is less important. I tried to use the new syntax of docker instead nvidia-docker, however when following the first example that is supposed to produce detected objects, I end up with the above mentioned error. Here are the steps:

  1. docker run --gpus all -itd --name pylot -p 20022:22 erdosproject/pylot /bin/bash

  2. docker exec -i -t pylot /home/erdos/workspace/pylot/scripts/run_simulator.sh

    1. Leads to

    sh: 1: xdg-user-dir: not found
    ALSA lib confmisc.c:767:(parse_card) cannot find card '0'

    According to what I read this is not an issue

  3. Then I follow the steps leading to visualize detected objects (the only difference is that I use docker directly instead of nvidia-docker since it is deprecated) but I get the following message, :

    erdos@75a2ddf2bdc5:~/workspace/pylot$ python3 pylot.py --flagfile=configs/detection.conf --visualize_detected_obstacles
    I0306 17:18:32.899067 140158380492608 init.py:409] $HOME=/home/erdos
    I0306 17:18:32.899491 140158380492608 init.py:409] matplotlib data path /home/erdos/.local/lib/python3.6/site-packages/matplotlib/mpl-data
    I0306 17:18:32.904089 140158380492608 init.py:1156] loaded rc file /home/erdos/.local/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
    I0306 17:18:32.906330 140158380492608 init.py:1879] matplotlib version 2.2.4
    I0306 17:18:32.906501 140158380492608 init.py:1880] interactive is False
    I0306 17:18:32.907129 140158380492608 init.py:1881] platform is linux

    .......

    pygame 2.0.0 (SDL 2.0.12, python 3.6.9)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    X Error of failed request: BadValue (integer parameter out of range for operation)
    Major opcode of failed request: 155 (GLX)
    Minor opcode of failed request: 3 (X_GLXCreateContext)
    Value in failed request: 0x0
    Serial number of failed request: 86
    Current serial number in output stream: 87

    Can someone please help me identify what could be wrong? Thank you!

    I am using Ubuntu 18.04

    Nvidia drivers: 450.102.04

    Cuda Version: 11.0

Need to install libgeos-dev for manual install

README for manual install should include instruction to run the following:
sudo apt install libgeos-dev

Otherwise, the install fails with:
OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']

Error installing Pylot/no open3d-python on Python 3.7

Terminal output:

Collecting open3d-python==0.4.0.0 (from erdos-pylot==0.2)
  Could not find a version that satisfies the requirement open3d-python==0.4.0.0 (from erdos-pylot==0.2) (from versions: 0.1.4, 0.1.5, 0.1.5.1, 0.1.5.3, 0.1.5.4, 0.1.5.5, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.5.0.0, 0.6.0.0, 0.7.0.0)
No matching distribution found for open3d-python==0.4.0.0 (from erdos-pylot==0.2)

Refactor Pylot

  • Fix the weather presets. We don't need to pass arbitrary integers and can use strings with named presets now.
  • Fix the pylot versions of Location and Transform. We have multiple helper functions across the pipeline that could be refactored as methods inside these classes.
  • Consolidate the functions that reference pylot.BoundingBox inside the class.
  • Deprecate to_pylot_transform and to_pylot_location
  • Introduce a Vector3D class as a base class for Location and Orientation and then deprecate Orientation.
  • Move *_to_unreal_transform functions inside the Setup classes as static methods.
  • Create a new class for Rotation and deprecate forward_vector as an input to Transform. Retrieve it from the Rotation class.
  • Move flags to individual modules.
  • Deprecate inverse_transform and introduce functions that convert locations with respect to the transform.

Randomized traffic light identifiers in Town03

In the get_traffic_lights_bbox_state function, we depend on hardcoded values to figure out which of the traffic lights in Town03 contain more than one lights attached to the pole.

However, after running config.py from CARLA, these identifiers are randomized and thus our checks fail. We need to come up with a more robust way of figuring out which traffic lights contain more than one lights on a pole.

Lanenet_model not found

Hi,
I am using the docker to run the pylot and I am getting this error in case of lane detection module

Traceback (most recent call last):
File "pylot.py", line 272, in main
node_handle, control_display_stream = driver()
File "pylot.py", line 150, in driver
center_camera_stream, pose_stream, open_drive_stream)
File "/home/erdos/workspace/pylot/pylot/component_creator.py", line 248, in add_lane_detection
center_camera_stream)
File "/home/erdos/workspace/pylot/pylot/operator_creator.py", line 221, in add_lanenet_detection
from pylot.perception.detection.lanenet_detection_operator import
File "/home/erdos/workspace/pylot/pylot/perception/detection/lanenet_detection_operator.py", line 20, in
from lanenet_model import lanenet # noqa: I100 E402
ModuleNotFoundError: No module named 'lanenet_model'

I have tried changing the pythonpath, adding the path using sys but nothing works.

Any leads regarding this?

Improve object location estimation

Pylot computes object locations by taking the center point of their 2D bounding boxes and using depth information to transform these point to coordinates in world frame of reference. This technique works well as long as the center point of the bounding box does not change. However, when an object beings to exist from the camera view, the center the bounding box changes in relation to the center of the object. Thus, Pylot computes slightly different object location.

In the image below, the truck is stationary, but Pylot predicts that it's moving backwards due to this limitation.

foo

Unable to Run Pylot & CARLA Simulator in WSL 2

Here is my experience trying to set up Pylot using Windows Subsystem for Linux (WSL 2) and issues I met along the way. I hope this can be useful for people trying to do the same thing in the future.

TL;DR There seems to be issues with WSL or nvidia-docker that Pylot can't be run in WSL 2; would not recommend anyone trying to deploy Pylot on WSL 2 yet.

Motivation
I decided to try spinning up Pylot on WSL to utilize my GPU locally instead of running on servers, for easier development and potentially better performance. The recent NVIDIA's support for CUDA on WSL seems to be a possible way to get this working.

Spec and Set Up

  • WSL Version: 2, runs Ubuntu 20.04.1 LTS.
  • GPU: NVIDIA GeForce GTX 1060 with 6 GB VRAM
  • Windows: Version 2004, OS build 21296.1010 (installed with Windows Insider Program, using Fast Ring/Dev Channel, do this at your own risk)
  • X11 forwarding with VcXsrv in WSL 2 to show graphics; firewall config changed to allow forwarding.

I mostly followed the instructions using this CUDA on WSL User Guide on NVIDIA developer zone. Be very careful what drivers you are installing. This a pretty good guide and by following it I was able to:

  • set up special driver and nvidia-docker in WSL using latest early preview Windows build
  • able to run images (not Pylot) using nvidia-docker and get GPU acceleration working. Particular docker run --gpus all [nvcr.io/nvidia/k8s/cuda-sample:nbody](http://nvcr.io/nvidia/k8s/cuda-sample:nbody) nbody -gpu -benchmark
  • set up X11 and VcXsrv to forward any graphics running in WSL to show up
  • boot up Pylot docker image in WSL 2

However, the main issue is that the CARLA simulator cannot start successfully.

When I run nvidia-docker exec -i -t pylot /home/erdos/workspace/pylot/scripts/run_simulator.sh, the following output occurs and the program quits immediately.

4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
sh: 1: xdg-user-dir: not found

Turns out these are normal warning flags from CARLA, but the simulator is unable to start successfully.

Since ./run_simulator.sh is running in headless state, no graphical window would open but it shouldn't be the case that it quits immediately.

Although the simulator cannot be run, the pylot.py scripts still can be run; it will just quit after timing out not finding a working simulator to connect to.

I tried a few things but none ended up working, including

  • Running ./run_simulator.sh inside the container instead of running through nvidia-docker exec
  • Running docker run --gpus and docker run -d -it --runtime=nvidia instead of using nvidia-docker as examples shown in the NVIDIA developer guide.
  • Not deploy Pylot by Docker, but by manual installation.

I found similar issues on the CARLA repo, notably issues #2970 and issues #3431; it seems people (both using docker and without using docker) have no success with starting CARLA simulator in WSL yet and faces similar issues as I described. In fact, one of the CARLA's lead developers said they have not tested a WSL setup (here).

I believe this is an issue either with CARLA simulator, or nvidia-docker and WSL 2's support for CUDA in WSL. It is hard to debug as nvidia-smi does not work in WSL 2 yet (link). I can't tell whether the CARLA simulator running in docker was able to find the right GPU driver, and based on the Task Manager monitoring, the GPU was never active when I attempt to start the simulator.

Thanks @pschafhalter for help me debug this! Right now, I don't recommend anyone try run Pylot and CARLA simulator on WSL, as a lot of the WSL-GPU infrastructure has just been released and lack some essential tooling. If you found a way to resolve this, please share it with us!

Metric Implementation

Hi

I'm wondering if there are any metrics available for end-to-end evaluation of a drive quality?
Section 6 provides some of these metrics, Collision tables/Distance to vehicles. Are these implementations available?

MPC Operator

Take the MPC code on edward_evaluation branch and repurpose it into a control operator for pylot.

Integrate `pygame` for visualization and driving around.

The current setup does not allow remote clients to drive the vehicle and visualize the output from the various detection modules. Integrating pygame (similar to Carla's manual_control.py) would make the experience of running pylot much nicer.

RRT* Planning Operator

Developing a planning operator based on RRT*

Shown below are two versions integrated with MPC for controls. The first plans only when blocking obstacles are detected, the other plans at each step.

  • the total time per step is roughly 0.3-0.4 seconds
  • planning distance is roughly 20m ahead

rrt_star_mpc
Webp net-gifmaker

The plan is to refine the code and convert this to a pylot operator next week, ~11/17

Speed limit sign detection code is too slow.

The get_speed_limit_det_objs in pylot/simulation/utils.py takes too long (upwards of 2 seconds) to detect speed limit signs in an image. This considerably slows down our data collection capabilities and needs to be fixed.

We should investigate if its possible to put bounding boxes on the speed limit signs by looking at their static meshes in Carla (similar to Traffic light bounding boxes) and deprecate this function.

Fix Velodyne LIDAR to Pointgrey camera transformation.

We assume that the LIDAR and the cameras are located at the same position (which is possible in Carla). However, when testing on Lincoln MKZ, we need to provide transforms that convert points from the LIDAR's frame of reference to the camera frame of reference.

The initial estimates show that (0.3, 0.3) in (x, y) should suffice for atleast for the scenarios we have in the rosbag. But, we still need to investigate the z-value, and make sure that the (x, y) values are correct.

For now, the rosbags work fine, so this is low priority.

Bug in EfficientDetOperator

The EfficientDetOperator expects to receive both time_to_decision and detection_deadline from the TimeToDecisionOperator, but the TimeToDecisionOperator only provides time_to_decision.

One potential workaround is to set detection_deadline = ttd_msg.data which fixes the exception. However, this solution doesn't work for dynamic configurations since the time allocated to detection is too large.

CC @sauravmittal

Related Lines of Code

ttd, detection_deadline = ttd_msg.data

def on_pose_update(self, msg, time_to_decision_stream):
self._logger.debug('@{}: {} received pose message'.format(
msg.timestamp, self.config.name))
ttd = TimeToDecisionOperator.time_to_decision(msg.data.transform,
msg.data.forward_speed,
None)
time_to_decision_stream.send(erdos.Message(msg.timestamp, ttd))
time_to_decision_stream.send(erdos.WatermarkMessage(msg.timestamp))
def on_obstacles_update(self, msg):
self._last_obstacles_msg = msg
@staticmethod
def time_to_decision(pose, forward_speed, obstacles):
"""Computes time to decision (in ms)."""
# Time to deadline is 400 ms when driving at 10 m/s
# Deadline decreases by 10ms for every 1m/s of extra speed.
time_to_deadline = 400 - (forward_speed - 10) * 10
# TODO: Include other environment information in the calculation.
return time_to_deadline

Improve DeepSORT Tracking

Need to collect additional data with bounding boxes now that those are more accurate. Then should re-train the pedestrian feature extractor net and add to pylot.

Imprecise vehicle and pedestrian bounding boxes in perfect detector

Carla provides 3d world bounding boxes for pedestrians and vehicles. We transform these bounding boxes into 2d bounding boxes which are into the field of view of the RGB camera. However, when we compute the 2d bounding box we take the furthest apart points https://github.com/erdos-project/pylot/blob/master/pylot/simulation/utils.py#L576 . Instead, we should use the orienatation of the pedestrian to select the correct plane, and thus provide more accurate 2d bounding boxes.

See for more details on Carla bounding boxes: https://carla.readthedocs.io/en/stable/measurements/

See bounding box we create:
carla-bb-48

Error running in Docker mode

I tried the docker demo by ssh into cloud server ( Ubuntu 18.04 server, 64G, 8 TitanXp, CUDA 11.0 Driver 450) . I want to see the visualization so I chose to forward X method.

The steps were

terminal 1:
docker pull erdosproject/pylot
nvidia-docker run -itd --name pylot -p 20022:22 erdosproject/pylot /bin/bash
nvidia-docker exec -i -t pylot /home/erdos/workspace/pylot/scripts/run_simulator.sh

the log is

4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
sh: 1: xdg-user-dir: not found
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default

terminal 2:
nvidia-docker cp ~/.ssh/id_rsa.pub pylot:/home/erdos/.ssh/authorized_keys
nvidia-docker exec -i -t pylot sudo chown erdos /home/erdos/.ssh/authorized_keys
nvidia-docker exec -i -t pylot sudo service ssh start
ssh -p 20022 -X erdos@localhost
cd /home/erdos/workspace/pylot/
python3 pylot.py --flagfile=configs/detection.conf --visualize_detected_obstacles

the log is

erdos@2da4247771a2:$ cd /home/erdos/workspace/pylot/
erdos@2da4247771a2:
/workspace/pylot$ python3 pylot.py --flagfile=configs/detection.conf --visualize_detected_obstacles
I0312 06:01:58.631235 139723968956224 init.py:409] $HOME=/home/erdos
I0312 06:01:58.631560 139723968956224 init.py:409] matplotlib data path /home/erdos/.local/lib/python3.6/site-packages/matplotlib/mpl-data
I0312 06:01:58.635867 139723968956224 init.py:1156] loaded rc file /home/erdos/.local/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
I0312 06:01:58.637890 139723968956224 init.py:1879] matplotlib version 2.2.4
I0312 06:01:58.637976 139723968956224 init.py:1880] interactive is False
I0312 06:01:58.638494 139723968956224 init.py:1881] platform is linux
I0312 06:01:58.638668 139723968956224 init.py:1882] loaded modules: ['builtins', 'sys', '_frozen_importlib', '_imp', '_warnings', '_thread', '_weakref', '_frozen_importlib_external', '_io', 'marshal', 'posix', 'zipimport', 'encodings', 'codecs', '_codecs', 'encodings.aliases', 'encodings.utf_8', '_signal', 'main', 'encodings.latin_1', 'io', 'abc', '_weakrefset', 'site', 'os', 'errno', 'stat', '_stat', 'posixpath', 'genericpath', 'os.path', '_collections_abc', '_sitebuiltins', 'sysconfig', '_sysconfigdata_m_linux_x86_64-linux-gnu', '_bootlocale', '_locale', 'types', 'funct
....

pygame 2.0.0 (SDL 2.0.12, python 3.6.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "pylot.py", line 272, in main
node_handle, control_display_stream = driver()
File "pylot.py", line 229, in driver
prediction_stream, waypoints_stream, control_stream)
File "/home/erdos/workspace/pylot/pylot/operator_creator.py", line 818, in add_visualizer
pygame.HWSURFACE | pygame.DOUBLEBUF)
pygame.error: No available video device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "pylot.py", line 285, in
app.run(main)
File "/home/erdos/.local/lib/python3.6/site-packages/absl/app.py", line 303, in run
_run_main(main, args)
File "/home/erdos/.local/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "pylot.py", line 280, in main
shutdown_pylot(node_handle, client, world)
UnboundLocalError: local variable 'node_handle' referenced before assignment

Unable to run docker

Hi

I am getting this error while running the docker

pygame 2.0.0 (SDL 2.0.12, python 3.6.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 86
Current serial number in output stream: 87

is there any work around for this?

Improve lane detection

We need lane detection for when we don't have access to a fully detailed HD Map. To address this limitation, we can either extract lanes from segmented frames, or integrate Lanenet into Pylot (or any better alternative). We've previously tested Lanenet with this script, but we haven't wrapped it in an operator.

Readme instructions outdated?

Hello everyone,
I am trying to get started but it seems to me that the instructions in the readme file are somehow outdated? For example running nvidia-docker seems to be deprecated and now one should use something like "docker run --gpus all ....". Now, for me as a beginner, it is getting quite difficult to run the simulator using nvidia-docker. I can run the "hello world" example using nvidia docker, but I do not know how to run the pylot using the new syntax and running the command
nvidia-docker run -itd --name pylot -p 20022:22 erdosproject/pylot /bin/bash
ends up with
"docker: Error response from daemon: Unknown runtime specified nvidia"

So would it be possible to tell me how to get started and maybe update the readme file? Thanks a lot!

Fix stereo camera depth estimation

Our AnyNet-based depth estimation is currently broken. I've updated the code in this PR so that it currently infers the model, but I haven't yet:

  1. Ensured we're using the correct image sizes.
  2. Transformed the output from disparity to depth.

xdg-user-dir: not found

Hello, thank you very much for the code.
However, when I run nvidia-docker exec -i -t pylot /home/erdos/workspace/pylot/scripts/run_simulator.sh I get an error. It seems that I can not start the CARLA. I would appreciate it if you could help me@ICGog .

4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
sh: 1: xdg-user-dir: not found
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default

Constant Velocity Predictor Operator

  • Add visualization for trajectories of future waypoints.
  • Add a naive prediction operator that performs linear regression on past states of an agent to estimate velocity, then assumes the agent will maintain that velocity.

Introduce behavioral planning

@fangedward @fywu85 I'm creating this issue to continue the discussion about the behavior planner, and to keep track of it.

I'm attaching Fangyu's state machine design, which we can discuss and implement as a first cut.

Screenshot from 2020-03-03 10-16-02

run into OOM for demo.conf

Hi,

I am running with native mode. My PC environment: Ubuntu 18.04 64G RAM, Nvidia Driver Version: 460.32.03 CUDA Version: 11.2, GPU GTX1080. Python 3.6. Carla was directly started from the pylot/dependencies/CARLA_0.9.10.1/CarlaUE.sh (not from run_simulator.sh)

I was able to run the detection command without error: python3 pylot.py --flagfile=configs/detection.conf

I0208 21:09:45.181998 140304352266048 init.py:409] $HOME=/home/demo
I0208 21:09:45.182323 140304352266048 init.py:409] matplotlib data path /home/demo/.local/lib/python3.6/site-packages/matplotlib/mpl-data
I0208 21:09:45.186905 140304352266048 init.py:1156] loaded rc file /home/demo/.local/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
I0208 21:09:45.189215 140304352266048 init.py:1879] matplotlib version 2.2.4
I0208 21:09:45.189343 140304352266048 init.py:1880] interactive is False
I0208 21:09:45.189993 140304352266048 init.py:1881] platform is linux
I0208 21:09:45.190147 140304352266048 init.py:1882] loaded modules: ['builtins', 'sys', '_frozen_importlib', '_imp', '_warnings', '_thread', '_weakref', '_frozen_importlib_external', '_io', 'marshal', 'posix', 'zipimport', 'encodings', 'codecs', '_codecs', 'encodings.aliases', 'encodings.utf_8', '_signal', 'main', 'encodings.latin_1', 'io', 'abc', '_weakrefset', 'site', 'os', 'errno', 'stat', '_stat', 'posixpath', 'genericpath', 'os.path', '_collections_abc', '_sitebuiltins', 'encodings.cp437', 'sysconfig', '_sysconfigdata_m_linux_x86_64-linux-gnu', '_bootlocale', '_locale', 'types', 'functools', '_functools', 'collections', 'operator', '_operator', 'keyword', 'heapq', '_heapq', 'itertools', 'reprlib', '_collections', 'weakref', 'collections.abc', 'importlib', 'importlib._bootstrap', 'importlib._bootstrap_external', 'warnings', 'importlib.util', 'importlib.abc', 'importlib.machinery', 'contextlib', 'mpl_toolkits', 'google', 'zope', 'sitecustomize', 'apport_python_hook', 'signal', 'enum', 'absl', 'absl.app', 'future', 'pdb', 're', 'sre_compile', '_sre', 'sre_parse', 'sre_constants', 'copyreg', 'cmd', 'string', '_string', 'bdb', 'fnmatch', 'inspect', 'ast', '_ast', 'dis', 'opcode', '_opcode', 'linecache', 'tokenize', 'token', 'code', 'traceback', 'argparse', 'copy', 'textwrap', 'gettext', 'locale', 'struct', '_struct', 'codeop', 'glob', 'pprint', 'absl.command_name', 'absl.flags', 'getopt', 'absl.flags._argument_parser', 'csv', '_csv', 'absl.flags._helpers', 'fcntl', 'termios', 'six', 'six.moves', 'absl.flags._defines', 'absl.flags._exceptions', 'absl.flags._flag', 'absl._collections_abc', 'absl.flags._flagvalues', 'logging', 'time', 'threading', 'atexit', 'xml', 'xml.dom', 'xml.dom.domreg', 'xml.dom.minidom', 'xml.dom.minicompat', 'xml.dom.xmlbuilder', 'xml.dom.NodeFilter', 'typing', 'typing.io', 'typing.re', 'absl.flags._validators', 'absl.logging', 'getpass', 'socket', '_socket', 'selectors', 'math', 'select', 'timeit', 'gc', 'absl.logging.converter', 'faulthandler', 'erdos', 'multiprocessing', 'multiprocessing.context', 'multiprocessing.process', 'multiprocessing.reduction', 'pickle', '_compat_pickle', '_pickle', 'array', 'mp_main', 'erdos.internal', 'erdos.streams', 'erdos.message', 'erdos.timestamp', 'erdos.operator', 'json', 'json.decoder', 'json.scanner', '_json', 'json.encoder', 'numpy', 'numpy._globals', 'numpy.config', 'numpy.version', 'numpy._distributor_init', 'numpy.core', 'numpy.core.info', 'numpy.core.multiarray', 'numpy.core.overrides', 'datetime', '_datetime', 'numpy.core._multiarray_umath', 'numpy.compat', 'numpy.compat._inspect', 'numpy.compat.py3k', 'pathlib', 'ntpath', 'urllib', 'urllib.parse', 'numpy.core.umath', 'numpy.core.numerictypes', 'numbers', 'numpy.core._string_helpers', 'numpy.core._type_aliases', 'numpy.core._dtype', 'numpy.core.numeric', 'numpy.core._internal', 'platform', 'subprocess', '_posixsubprocess', 'ctypes', '_ctypes', 'ctypes._endian', 'numpy.core.fromnumeric', 'numpy.core._methods', 'numpy.core.arrayprint', 'numpy.core.defchararray', 'numpy.core.records', 'num
.....

However when I run demo command I got OOM error :

python3 pylot.py --flagfile=configs/demo.conf

2021-02-08 21:28:08.108142: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at conv_ops.cc:886 : Resource exhausted: OOM when allocating tensor with shape[256,64,1,1] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

(0) Resource exhausted: OOM when allocating tensor with shape[256,64,1,1] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[node FirstStageFeatureExtractor/resnet_v1_101/resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/Conv2D (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

 [[SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/strided_slice/_235]]

Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

(1) Resource exhausted: OOM when allocating tensor with shape[256,64,1,1] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[node FirstStageFeatureExtractor/resnet_v1_101/resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/Conv2D (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

0 successful operations.
0 derived errors ignored.

I have tried another laptop with Ubuntu 16.04 with 64G RAM with CUDA 11 (GTX1070) but got same error. What is minimum hardware required to run this? Thanks.

Bug in pylot.py

Reference before assignment error for node_handle in pylot.py on line 277.

pylot/pylot.py

Line 277 in 793b0c2

shutdown_pylot(node_handle, client, world)

If the code gets an exception before the variable is assigned in the try block then the call to shutdown_pylot throws a UnboundLocalError reference before assignment error. So far, this bug has been observed when Pylot fails to find a graphics card.

pylot/pylot.py

Lines 266 to 278 in 793b0c2

try:
if FLAGS.simulation_recording_file is not None:
client.start_recorder(FLAGS.simulation_recording_file)
node_handle, control_display_stream = driver()
signal.signal(signal.SIGINT, shutdown)
if pylot.flags.must_visualize():
pylot.utils.run_visualizer_control_loop(control_display_stream)
node_handle.wait()
except KeyboardInterrupt:
shutdown_pylot(node_handle, client, world)
except Exception:
shutdown_pylot(node_handle, client, world)
raise

This might need more specific error catching blocks so we only call shutdown_pylot with node_handle only when we have access to the variable and only when we need it.

CC: @pschafhalter

Leaderboard Evaluation Instructions

Hi there,

I'm interested in benchmarking pylot in the carla leaderboard.

Would it be possible to provide some instructions to build Dockerfile-challenge.master and run the evaluation?

Kind Regards,

Jonathan

Simulation is very laggy

Hi,
I am finally able to run PyLot.

I found that the simulation is very laggy, especially when starting. And it freezes after a couple smooth frames

I've recorded a short clip to demonstrate the issue:
Manual Installation
Docker

I am pretty sure that I am using my GPU
Screenshot from 2020-07-22 19-17-35

My system specification is as follows:
OS: Ubuntu 18.04
GPU: RTX 2070 Super 8GB memory
CPU: Ryzen 3700X

As you can see in the video, im not running any other processes besides this. It would be great if you could provide a video demo.

Also I observe that there is this constant stream of error, that did not lead the program to crash, but might be alarming
Screenshot from 2020-07-22 19-12-04

Convert tracking output stream messages for prediction tasks

The object tracker operator sends ObstaclesMessage objects on an output stream, as these messages contain bounding boxes that are read by the tracking evaluation operator. However, the prediction component requires past trajectory information from trackers, which should come in an ObstacleTrajectoriesMessage.

To address this, write an operator that converts ObstaclesMessages to ObstacleTrajectoriesMessages.

Problem running CARLA autonomous driving challenge manually on the machine

Hi,

I am trying to execute the version of Pylot submitted for carla challenge. It works fine in the docker but I am trying to configure outside docker to be able to make changes in it.

When I execute the last command it fails in step 11. Below is the error I found

Step 11/38 : RUN packages='py_trees==0.8.3 shapely six dictor requests ephem tabulate' && pip3 install ${packages}
---> Running in 5ad1799e8506
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
Removing intermediate container 5ad1799e8506
The command '/bin/sh -c packages='py_trees==0.8.3 shapely six dictor requests ephem tabulate' && pip3 install ${packages}' returned a non-zero code: 1

any help in this case will be highly appreciated

Perfect detector operator not detecting (or flickering) on bicycles

Hello,

When running Pylot with the perfect detector operator on obstacles (such as in the perfect_detection.conf), I noticed that the detector often misses bicycles (even when the bicycle is very close to the ego vehicle) and occasionally some other vehicles.

I think that the self.__segmentation_threshold (line 59) field in the obstacle.py file is likely causing the missing bicycles in the detector when it is being used to populate the 2D bounding boxes for the perfect detector’s obstacles. Currently, the threshold value is 0.20 and causes a lot of the missed/flickering detections, but we noticed that changing it to a lower value like 0.01 causes the detector to consistently detect all of the bicycles.

Here is an example of the detector not detecting bicycles when the threshold=0.20:
nodetection2

Here is an example of the detections when the threshold=0.01:
bbox

The text and color of the bounding boxes might be different since I was modifying that part a bit before discovering this issue.

Just wanted to give a heads up -- Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.