Commit 49854ec7 authored by Helge's avatar Helge

Merge branch 'merge-attempt-1' of...

Merge branch 'merge-attempt-1' of https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/applications/carlacomponents into merge-attempt-1
parents 593a3832 5b7ed517
Pipeline #187305 failed with stage
in 37 seconds
<!-- (c) https://github.com/MontiCore/monticore -->
# How to install everything
- Download Carla (We are using the precompiled version 0.9.5, because this version is currently supported by the ros-bridge) from `https://github.com/carla-simulator/carla/releases/tag/0.9.5`
- Download Carla (We are using the precompiled version 0.9.5, because this is the latest version that was supported by the ros-bridge at the time) from `https://github.com/carla-simulator/carla/releases/tag/0.9.5`
- Extract it
- If the file carla-0.9.5-py2.7-linux-x86_64.egg is not present inside the PythonAPI folder copy it there from PythonAPI/carla/dist
- Install Docker
- If you want to build the CarlaRosBridge Docker Container yourself you can use the scripts in docker/carla-ros-bridge
- If you want to build the CarlaRosBridge Docker Container yourself you can use the scripts in docker/carla-ros-bridge; note that we use the tag 0.9.5.1 of the carla-ros-bridge as the latest version is not compatible with Carla 0.9.5 anymore.
You can edit your IP adress in the Dockerfile.
# How to run it on Linux
## How to execute the code for the bumper bot and read the collision sensor?
- Start Carla by executing: `CarlaUE4.sh`
- Execute in PythonAPI/examples to create a vehicle for the ros-bridge: `python manual_control.py --rolename=ego_vehicle`
- Start the ego-vehicle: `docker/egovehicle.sh`
It executes `python manual_control.py --rolename=ego_vehicle` in PythonAPI/examples to create a vehicle for the ros-bridge.
- To start the container execute inside the project folder:
`docker/bumpbot/run.sh`
`docker/Linux/carla-ros-bridge.sh`
Then execute in a new terminal to compile and execute the generated code for the bumpbot:
`docker/bumpbot/compile_exec.sh`
`docker/Linux/bumpbot.sh`
If you want to read additional messages from a rostopic you can execute:
`docker/bumpbot/open_shell.sh` and inside the container read the topic with e.g. `rostopic echo /carla/ego_vehicle/collision`
`docker/Linux/open_shell.sh` and inside the container read the topic with e.g. `rostopic echo /carla/ego_vehicle/collision`
# Running with docker on Windows
I tested this code in a Command Prompt/Power Shell. For the use of other consoles the commands might need to be adjusted for example with winpty
I tested this code in a Command Prompt/Power Shell. For the use of other consoles the commands might need to be adjusted for example with winpty.
Similarly to how you run it on Linux, there are shell scripts for Windows: carla-ros-bridge.sh, [component].sh and open_shell.sh. Depending on your system, these might need to be edited.
The scripts worked on the Setup: Windows 10 Home, Docker Toolbox, executed in git-bash.
To copy the assets into the docker container, I had to have the project folder in an shared-drive (you need to edit the carla-ros-bridge.sh). For me the output in `rostopic echo /carla/ego_vehicle/collision` was with great delay (~1 minute) or none at all, which just might be because of my slow system vs the Carla-simulator.
I do not recommend trying to run everything on Windows.
## Running the code
- In the Docker Settings GUI select the drive where you want to work on as shared drive, else using volumes won't work.
......
<!-- (c) https://github.com/MontiCore/monticore -->
Steps to build a component:
* 1.) move **mw-generator.jar** to the directory of the component you wish to build.
* 2.) open shell, cd to the directory of the component and execute: **java -jar mw-generator.jar project.json** (in this case it's called **valid.json** for both components)
* 3.) switch to the target directory (**cd target/**)
* 4.) execute compile.sh (**./compile.sh**)
* 5.) if the generator can't find carla_msgs message type: execute the following command and retry step 4
* export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/path/to/rosbridge/catkin_ws/devel/share/carla_msgs/cmake
* usually the path is something like "~/carla-ros-bridge/catkin_ws/devel/share/carla_msgs/cmake"
* 6.) after successfull compiling the generated code switch to install/bin directory (**cd install/bin/**)
* 7.) execute Coordinator_<model-package>_<component-name> (here it's **./Coordinator_test_bumpBot** or **./Coordinator_test_collisionDetection**)
## Wie bringe ich das Auto zum Fahren und lese den Kollisionssensor aus?
Carla Starten
Unter PythonAPI/examples: `python manual_control.py --rolename=ego_vehicle`
Zum Starten des Containers in den Ordner des Projektes (hier ein ausgechecktes Verzeichnis BumbBot_test) gehen:
`docker/run.sh`
Dann in einem neuen Terminal um das Auto fahren zu lassen:
`docker/compile_exec.sh`
Um den Collision Sensor auszulesen in einem neuen Terminal:
`docker/open_shell.sh` und darin `rostopic echo /carla/ego_vehicle/collision`
## Steps to build a component:
1. Move **mw-generator.jar** to the directory of the component you wish to build.
2. Open shell, cd to the directory of the component and execute:
java -jar mw-generator.jar project.json
(in this case it's called **valid.json** or **settings.json**)
3. Switch to the target directory:
cd target/
4. Execute compile.sh:
./compile.sh
5. If the generator can't find carla_msgs message type: execute the following command and retry step 4:
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/path/to/rosbridge/catkin_ws/devel/share/carla_msgs/cmake
usually the path is something like `~/carla-ros-bridge/catkin_ws/devel/share/carla_msgs/cmake`.
6. After successfull compiling the generated code switch to install/bin directory:
cd install/bin/
7. Execute Coordinator_\<model-package\>_\<component-name\>. Here it's:
./Coordinator_test_bumpBot
or
./Coordinator_test_collisionDetection
## How to move the Car by using ROS and reading information from the collision Sensor:
1. Start the Carla-Simulator.
2. Run the following command within the PythonAPI/examples directory:
python manual_control.py --rolename=ego_vehicle
3. To start the (docker-) container go to the project containing directory and run:
docker/run.sh
4. To move the vehicle by using ROS, open a new terminal and run:
docker/compile_exec.sh
5. You can now read information from the collision sensor by running:
docker/open_shell.sh
and within the shell:
rostopic echo /carla/ego_vehicle/collision
## Correlation with other projects:
This project can be compiled as follows:
1. with the EMAM2Middleware project directly as shown above
2. using the maven-streamtest plugin that also uses the EMAM2Middleware generator.
- run `mvn clean install -s settings.xml`
EMAM2Middleware is build on top of EmbeddedMontiArc
## Sample projects:
[EMAM2Carla](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/applications/carlacomponents/tree/master/EMAM2Carla) is a project where a bumperbot controls a car in the carla-simulator.
[Autopilot](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/applications/carlacomponents/tree/autopilot-wrapper_experiments) contains code to reuse an autopilot for steering a car in carla.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment