Monash-Connected-Autonomous-Vehicle / autoware

Autoware - the world's leading open-source software project for autonomous driving
https://www.autoware.org/
Apache License 2.0
1 stars 0 forks source link

CARLA setup #17

Open dylan-gonzalez opened 8 months ago

dylan-gonzalez commented 8 months ago

CARLA Debian package only has support for Ubuntu 18.04 and Ubuntu 22.04

dylan-gonzalez commented 8 months ago

Trying latest carlasim image

docker pull carlasim/carla:latest sudo docker run --privileged --gpus all --net=host -e DISPLAY=$DISPLAY carlasim/carla:latest /bin/bash ./CarlaUE4.sh

This loads up the default CARLA window view - works.

CARLA pythonAPI

We do not need to run the pythonAPI from inside the docker container. To grab the pythonAPI that should be compatible with the CARLA instance running inside the docker container, we can follow the steps with this tutorial.

Follow the Python3.7 installation steps in the same tutorial: add-apt-repository ppa:deadsnakes/ppa sudo apt-get install python3.7 sudo apt-get install python3-pip && python3.7-distutils (i added python3.7-distutils) pip install virtualenv virtualenv --python=/usr/bin/python3.7 venv source venv/bin/activate pip3 --version #it should display (python 3.7) pip3 install pygame numpy deactivate

Working setup - CARLA + PythonAPI

Run CARLA in 1 terminal: docker run \ -p 2000-2002:2000-2002 \ --cpuset-cpus="0-5" \ --runtime=nvidia \ --gpus 'all,"capabilities=graphics,utility,display,video,compute"' \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -it \ carlasim/carla \ ./CarlaUE4.sh -opengl $1

Run PythonAPI in 2nd terminal: cd PythonAPI source venv/bin/activate cd examples ./manual_control.py

The provided bash script seems to work okay, but it would be better if it used docker-compose to run both the PythonAPI and CARLA instance simultaneously without the user having to do anything.

Should figure out a way to run Autoware Universe with CARLA now. This https://autoware.org/running-multiple-autoware-powered-vehicles-in-carla-using-zenoh/ looks like a viable option, although may be overkill for in the short term.

dylan-gonzalez commented 8 months ago

To run the HIL demo, would need to just also put in a startup script:

Jokua commented 7 months ago

when testing out the tutorial dylan posted, there will be a problem related to no octomap cmake or the like, so it can be solved by running sudo apt install ros-humble-octomap-ros

Image

Jokua commented 7 months ago

At the moment I am running into a problem related to grid_map_ros package which I am not entirely sure why it keeps failing.

Image

Image

dylan-gonzalez commented 7 months ago

does the OpenPlanner tutorial use Ros humble?

Jokua commented 7 months ago

Nah it uses galactic, a version older

Jokua commented 7 months ago

going to swap to using this https://github.com/carla-simulator/carla-autoware, as the open planner tutorial has quite a few bugs to fix especially when building the workspace (another issue came up for grid_map_pcl)

Image

Jokua commented 7 months ago

ran into another problem when following the instructions in the carla-autoware demo

Image

Image

Jokua commented 7 months ago

going to continue seeing if i can debug the issue, but otherwise the zenoh carla thing dylan posted might be another option because i found the github page for it https://github.com/evshary/autoware_carla_launch

Jokua commented 7 months ago

well this sucks, the zatitech thing we tried at first has this problem in their tutorial page recently when reading through the zenoh thing and saw that it was referenced

Image

Jokua commented 7 months ago

ok, so far for the zenoh setup, i've downloaded the bridge docker image

Image

Image

Image

Image

Image

going to have to enter the container some time later and run the rest of these commands, as well as build the other docker container

Image

dylan-gonzalez commented 7 months ago

so no errors so far??

Jokua commented 7 months ago

Nope, so far so good which looks like a good sign

Jokua commented 7 months ago

ok, just now got the bridge built, no errors so far

Image

Don't panic if the folder location doesn't look right, what i understood what rocker does is that it "loads" the folders from your host machine into the docker container, and even if it gets removed every change to those folders stays so you don't lose progress (i think so far)

Jokua commented 7 months ago

building the autoware packages in another container now (fingers crossed it works bcs i didn't bother checking if it uses localhost or not but eh we'll cross that bridge when it gets to it). It seems to be downloading a custom Zenoh Version of autoware, so going to take a while.

Image

Jokua commented 7 months ago

just finished building the autoware packages

Image

Jokua commented 7 months ago

both containers are now built, now only left to test the demo case to see if it works

Jokua commented 7 months ago

ok, when running these commands for the demo, the map for carla did change, so at least that's working for now

Image

Jokua commented 7 months ago

but i'm not particularly sure when it's asking for the host1 ip (the pc running carla ) is the docker IP OR the actual host IP

Jokua commented 7 months ago

well seems like it works, i took the docker IP after finding it using hostname -I

Image

Image

the IP address that starts with 172

Jokua commented 7 months ago

ok, seems like i can get the car to move by setting the goal pose, but dang it is LAGGY

Image

Jokua commented 7 months ago

yep, it works, and confirmed on both the rviz side and CARLA sim side, but it's really laggy so running in headless mode for CARLA should be more sensible.

dylan-gonzalez commented 7 months ago

11-12-23

@Jokua to do some more testing with CARLA + Autoware-Universe

Jokua commented 6 months ago

ok, a bit of an update on what I have done so far:

I have managed to reduce the burden on the pc by running CARLA in "headless mode", which means it's gonna run without the GUI so it saves us some more resources.

Image

it can be done when creating a new docker container with this command docker run -p 2000-2002:2000-2002 --cpuset-cpus="0-5" --runtime=nvidia --gpus 'all,"capabilities=graphics,utility,display,video,compute"' -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -it carlasim/carla ./CarlaUE4.sh -opengl $1 -RenderOffScreen -quality-level=Epic

Also i've managed to make it run properly on my laptop (well once, will update if i run into any issues because there was some error that goes like sh: 1: xdg-user-dir: not found when trying to follow the tutorial for setting up carla in your local env in this tutorial.

Jokua commented 6 months ago

I have managed to run two instances as the demo has shown

Image

I have also managed to get them both to move at the same time, though it is sort of laggy?

Image

Also I don't know why it decided to stop running by itself after moving once, so that's probably another thing to make note of for troubleshooting later.

Additionally, there is a FAQ on the Zenoh's github page about how to change the map here

Still unsure on how to change the car's URDF or model, might have to look up on how carla spawns it or ask someone who has used CARLA before.

dylan-gonzalez commented 6 months ago

I have managed to reduce the burden on the pc by running CARLA in "headless mode", which means it's gonna run without the GUI so it saves us some more resources.

This would be very useful for the CI/CD pipeline guys @AnthonyZhOon @sxppro @npnquang

I have also managed to get them both to move at the same time, though it is sort of laggy?

If you record a rosbag and play it back again, is it still laggy?

Jokua commented 6 months ago

If you record a rosbag and play it back again, is it still laggy?

I had to look up what a rosbag is, but how would I do that exactly?

Also I'll update the wiki on how to set it up and use it in the beast as well, since I've confirmed it can work on my laptop (be warned it takes ages if your internet is shite to download the zenoh autoware bridge and autoware docker images)

dylan-gonzalez commented 6 months ago

@Jokua if you're interested https://github.com/orgs/autowarefoundation/discussions/2828#discussioncomment-7929757

Jokua commented 6 months ago

oh, thanks! I'll check it out, hopefully the guy updated some things

dylan-gonzalez commented 6 months ago

@Jokua to do some more testing for the next 2 days

Jokua commented 6 months ago

I have just finished some testing, seems like the problem I had about not being able to set another route may be just slight user error, apart from that recorded quite a lengthy video (with some cropping issues, i accidentally captures my other screen as well, as well as the fact i couldn't record my own voice). But otherwise, the basic functionality seems to be working for a single car RViz running, i spawned two cars but only operated one due to my laptop spec contraints.