-
Tommy Persson authoredTommy Persson authored
- Local ROS Installation and LRS
- Preparation
- Scripts
- wexec
- wgrun
- wrun
- wpull
- How to start different parts
- Pull the Image
- Start a ros core and the docker container:
- Loading config files for units
- Start gazebo using docker (optionally)
- dji 0
- Start tstdisplayserver
- RVIZ
- Test the dji0
- Starting dji sim without controller
- Compiling Simulator
- Running Simulator Locally
Local ROS Installation and LRS
Here we descripe how to use a local ROS installation and interface with the LRS Modules available through docker. The intention is that this should be enough for a person knowledgeable about ROS to start develop there own functionality and interface with the available ROS modules.
See:
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-djisdk-md/
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent-md/
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent_tst-md/ for en overview of the available functionality.
Preparation
Get the waraps repo:
git clone git@gitlab.liu.se:lrs/waraps.git
Put the script directory of the waraps repo in your PATH plus add some variables that are needed. For example in .bashrc:
export PATH="...../waraps/script:$PATH"
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
If you have gotten a lot of running containers that interfere with each other you can stop allrunning containers with:
docker stop $(docker container ls -q)
And to clean up:
docker system prune
Scripts
You now have the following scripts in your path:
wexec
Execute commands in a running docker container.
#!/bin/bash
docker exec -it waradevel "$@"
wgrun
Start a docker container named waradevel and run the commands there. Use this if you have NVIDIA graphics.
#!/bin/bash
docker run --gpus all \
--network host \
--ulimit nofile=1024 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix${DISPLAY}\
-e ROS_HOSTNAME=localhost \
--rm -it --name wara gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest "$@"
wrun
Start a docker container named waradevel and run the command there. Use if you do not have NVIDIA graphics.
#!/bin/bash
docker run \
--network host \
--ulimit nofile=1024 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix${DISPLAY}\
-e ROS_HOSTNAME=localhost \
--rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest "$@"
wpull
Pull the image.
#!/bin/bash
docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest
How to start different parts
Pull the Image
Start by puling the image:
wpull
Start a ros core and the docker container:
wgrun roscore
Loading config files for units
Assume we want to use unit /dji0 in Gränsö. The do:
roslaunch lrs_launch config.launch location:=granso no_airspace_booking:=true ns:=/dji0
Start gazebo using docker (optionally)
If you have a NVIDIA graphics card and support for that in docker then you can if needed start gazebo (and if the container was started with wgrun):
wexec roslaunch lrs_wara_gazebo gazebo.launch
Load the dji model in gazebo:
wexec roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=0
dji 0
wexec roslaunch lrs_launch djisimtst.launch dynamics:=true mpc:=true ns:=/dji0
Start tstdisplayserver
wexec rosrun lrs_util_tst tstdisplayserver.py __ns:=/dji0
RVIZ
Gränsö:
wexec roslaunch lrs_dji_sim rviz_granso.launch
Geneneral, uses the location given to config. Currently only Gränsö ortho photo installed.
wexec roslaunch lrs_launch rviz_outside.launch
Test the dji0
On the local machine do:
Watch the geopose:
rostopic echo /dji0/geopose
Takeoff
wexec rosrun lrs_tst tstcommand.py --takeoff --exec __ns:=/dji0 --disp --op /dji0
Flyto
wexec rosrun lrs_tst tstcommand.py --fly -x 100 -y 100 -z 12 --speed 3 --exec __ns:=/dji0 --disp --op /dji0
Starting dji sim without controller
To plug in your own controller djisim can be started without any controller:
wexec roslaunch lrs_launch djisimtst.launch dynamics:=true ns:=/dji0
The "state" is available on topics:
- /dji0/world_position
- /dji0/dji_sdk/gps_position
The control is done on the topic:
- /dji0/dji_sdk/flight_control_setpoint_generic
and the control mode must be:
- roll
- pitch
- thrust
- yawrate
Compiling Simulator
If you have access to the simulator repos you can compile it locally.
Needed extra packages:
git clone git@gitlab.liu.se:lrs/lrs_basic.git
git clone git@gitlab.liu.se:lrs/motion_models.git
git clone git@gitlab.liu.se:lrs/nonlinearmpc.git
git clone https://github.com/dji-sdk/Onboard-SDK-ROS.git
cd Onboard-SDK-ROS
git checkout 3.8
Install the DJI SDK:
git clone https://github.com/dji-sdk/Onboard-SDK.git
cd Onboard-SDK
git checkout 3.8
cd osd-core
mkdir build
cd build
cmake ../
make -j 4 djiosdk-core
sudo make install djiosdk-core
Running Simulator Locally
TO BE WRITTEN.
roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true ns:=/dji0
wexec roslaunch lrs_launch djisimtst.launch simulator:=false ns:=/dji0