Skip to content

Commit

Permalink
Map management - load GeoJSON map (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaflik committed Dec 1, 2023
1 parent dacdb7a commit 787837f
Show file tree
Hide file tree
Showing 39 changed files with 1,908 additions and 154 deletions.
12 changes: 10 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get update \
&& apt-get install -y ssh \
python3-pip \
curl \
rsync \
&& rm -rf /var/lib/apt/lists/*

RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
Expand All @@ -26,7 +27,7 @@ RUN mkdir -p /home/ws/build /home/ws/install /home/ws/log \
RUN ( \
echo "source /opt/ros/iron/setup.bash"; \
echo "source /home/ws/install/setup.bash"; \
echo "source /home/ws/src/openmower/config/sim-config.env.sh"; \
echo "source /home/ws/.devcontainer/openmower_config.env"; \
echo "export DISPLAY=:0"; \
) >> /home/$USERNAME/.bashrc

Expand All @@ -38,4 +39,11 @@ RUN ( \
RUN sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config
RUN mkdir /run/sshd

CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

USER $USERNAME

ENTRYPOINT ["/entrypoint.sh"]

CMD ["/usr/bin/sudo", "/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
5 changes: 5 additions & 0 deletions .devcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groot-build:
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag jkaflik/behaviortree-groot:latest -f groot.Dockerfile .

groot-publish:
docker push jkaflik/behaviortree-groot:latest
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
]
}
},
"containerUser": "openmower",
"postCreateCommand": "sudo apt update && rosdep update && make custom-deps deps"
"containerUser": "openmower"
}
22 changes: 22 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ services:
- "8765:8765" # Foxglove Studio websocket
- "9002:9002" # Gazebo websocket
volumes:
- ./home:/home/openmower/.openmower
- /opt/ros
- ../:/home/ws
- build:/home/ws/build # keep container pre-build
- install:/home/ws/install # keep container pre-build
Expand All @@ -34,6 +36,26 @@ services:
- xserver
depends_on:
- xserver
groot:
profiles:
- with_groot
image: jkaflik/behaviortree-groot:latest
ipc: host
pid: host
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
volumes:
- ../:/home/ws
environment:
- DISPLAY=:0
volumes_from:
- xserver
- workspace
depends_on:
- xserver
- workspace
volumes:
build:
install:
Expand Down
15 changes: 15 additions & 0 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e

if [ ! -d "/home/ws" ]; then
echo "ERROR: /home/ws does not exist. Please mount your workspace to /home/ws"
exit 1
fi

cd /home/ws

sudo apt update
rosdep update
make custom-deps deps

exec "$@"
36 changes: 36 additions & 0 deletions .devcontainer/groot.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:jammy

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y -q \
git \
build-essential \
cmake \
python3 \
qtbase5-dev \
libqt5svg5-dev \
libzmq3-dev \
libdw-dev \
libtinfo-dev \
libncurses5-dev \
libncursesw5-dev

RUN git clone https://github.com/BehaviorTree/Groot.git &&\
cd Groot &&\
git submodule update --init --recursive &&\
cd depend/BehaviorTree.CPP &&\
mkdir build ; cd build &&\
cmake .. &&\
make &&\
make install &&\
cd /Groot &&\
mkdir build; cd build &&\
cmake .. &&\
make &&\
# add alias for Groot GUI (simply type "Groot" in terminal)
echo 'alias Groot="cd /Groot/build && ./Groot"' >> ~/.bashrc

# fixes: "error while loading shared libraries: libbehaviortree_cpp_v3.so: cannot open shared object"
RUN ldconfig

WORKDIR /Groot/build
CMD ./Groot
237 changes: 237 additions & 0 deletions .devcontainer/home/map.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"id": "0859c0c1-ec2d-4197-96b7-2d12f6cf1cd9",
"name": "backyard",
"type": "lawn",
"fill": "#00ff00"
},
"geometry": {
"coordinates": [
[
[
-43.20007309019093,
-22.899998069679626
],
[
-43.20006688758278,
-22.900006871946417
],
[
-43.200002346928954,
-22.899972743856168
],
[
-43.19999715014916,
-22.899979847441557
],
[
-43.200002011652515,
-22.899984943491773
],
[
-43.20000352039554,
-22.899987877581054
],
[
-43.200001508737785,
-22.89999529001645
],
[
-43.19999882652931,
-22.899998687383203
],
[
-43.199989774073345,
-22.900001003768594
],
[
-43.19998390674169,
-22.900001621472214
],
[
-43.199976027752285,
-22.89999992278834
],
[
-43.199966304744464,
-22.899997143125205
],
[
-43.19991584568825,
-22.89996363273525
],
[
-43.199949708576725,
-22.89991792269754
],
[
-43.20007309019093,
-22.899998069679626
]
]
],
"type": "Polygon"
},
"id": 0
},
{
"type": "Feature",
"properties": {
"id": "6387f8e9-bc4e-48a5-95e2-fedd3b3b5c09",
"name": "driveway",
"type": "navigation",
"fill": "#ffffff"
},
"geometry": {
"coordinates": [
[
[
-43.19991601332646,
-22.89996363273525
],
[
-43.19996664002096,
-22.899996988699343
],
[
-43.19995825811796,
-22.90000887948092
],
[
-43.19990629031864,
-22.8999759867976
],
[
-43.19991601332646,
-22.89996363273525
]
]
],
"type": "Polygon"
},
"id": 1
},
{
"type": "Feature",
"properties": {
"id": "a7a3e913-5e9e-4959-8044-059f40356996",
"type": "lawn",
"fill": "#00ff00"
},
"geometry": {
"coordinates": [
[
[
-43.19990654164289,
-22.899975703751664
],
[
-43.19995834180392,
-22.900008596436095
],
[
-43.19996638843159,
-22.899996860080364
],
[
-43.199998742577066,
-22.899998713189134
],
[
-43.20000008368183,
-22.899983116188707
],
[
-43.200020703164,
-22.90003299569868
],
[
-43.20000259825318,
-22.900055850700596
],
[
-43.199891286578776,
-22.899990528624386
],
[
-43.19990654164289,
-22.899975703751664
]
]
],
"type": "Polygon"
},
"id": 2
},
{
"type": "Feature",
"properties": {
"fill": "#ff0000",
"type": "obstacle",
"name": "tree",
"id": "90cd67cb-a606-4878-be1c-2c08f8fc085d"
},
"geometry": {
"coordinates": [
[
[
-43.19996538260324,
-22.899949451369395
],
[
-43.199974435058095,
-22.899951304478776
],
[
-43.199975776162916,
-22.899958871343117
],
[
-43.199966891345184,
-22.899964585096825
],
[
-43.1999563301473,
-22.899959180193974
],
[
-43.19995666542377,
-22.899953312014105
],
[
-43.19996538260324,
-22.899949451369395
]
]
],
"type": "Polygon"
},
"id": 3
},
{
"type": "Feature",
"properties": {
"id": "0706aa36-bf67-4831-9472-be2c4275815d",
"type": "docking_station",
"name": "First docking station"
},
"geometry": {
"coordinates": [
[
-43.1999118467661,
-22.899969157137434
],
[
-43.19991519952754,
-22.89997131909847
]
],
"type": "LineString"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export OM_DATUM_LAT=-22.9
export OM_DATUM_LONG=-43.2
export OM_MAP_PATH=$HOME/.openmower/map.geojson
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ sim:
run:
ros2 launch src/openmower/launch/openmower.launch.py

dev:
cd .devcontainer && docker-compose up -d

run-realsense:
ros2 launch realsense2_camera rs_launch.py initial_reset:=true pointcloud.enable:=true publish_tf:=false enable_infra1:=true enable_depth:=true enable_gyro:=true enable_accel:=true unite_imu_method:=1

Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default withMermaid({
{ text: 'ROS workspace', link: '/ros-workspace' },
{ text: 'Mainboard firmware', link: '/omros2-firmware' },
{ text: 'Robot localization', link: '/localization' },
{ text: 'Map management', link: '/map-management' },
]
},
{
Expand Down
Loading

0 comments on commit 787837f

Please sign in to comment.