Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portuguese Ledge world #172

Merged
merged 11 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,24 +511,6 @@ And with levels:

![portuguese_ledge_no_levels](https://user-images.githubusercontent.com/5751272/159813230-809d1cad-b3f5-457a-af19-3752bec0710f.gif)

#### Generating Portuguese Ledge world

The generated file is committed to the repository. Whenever it is changed, a
manual step is needed to regenerate it.

Pre-requisites:

```
sudo apt install python3-empy
```

Generate:

```
cd lrauv_ignition_plugins/worlds
python3 portuguese_ledge.py
```

### Troubleshoot

After issuing control commands, for example, rudder and thrust, if you then
Expand Down
3 changes: 2 additions & 1 deletion docker/debug_integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN apt-get update \
lsb-release \
tzdata \
wget \
python3-empy \
python3-numpy

# Add Ignition's latest packages, which may be more up-to-date than the ones from the MBARI image
Expand All @@ -47,7 +48,7 @@ RUN /bin/sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable

# Install the latest Ignition binaries
RUN apt-get -qq update && apt-get -q -y install \
ignition-garden python3-numpy
ignition-garden

# Install PCL
RUN apt-get update \
Expand Down
1 change: 0 additions & 1 deletion docker/empty_world/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ RUN apt-get update \
software-properties-common \
sudo \
vim \
python3-numpy \
chapulina marked this conversation as resolved.
Show resolved Hide resolved
&& apt-get clean

# setup timezone
Expand Down
1 change: 1 addition & 0 deletions docker/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN apt-get update \
lsb-release \
tzdata \
wget \
python3-empy \
python3-numpy

# Add Ignition's latest packages, which may be more up-to-date than the ones from the MBARI image
Expand Down
14 changes: 14 additions & 0 deletions lrauv_ignition_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/hooks/hook.dsv" @ONLY
)

#============================================================================
# World generation
set(WORLD_NAME "portuguese_ledge")
add_custom_command(
OUTPUT world_gen_cmd
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/worlds/empy_expander.py
${CMAKE_CURRENT_SOURCE_DIR}/worlds/${WORLD_NAME}.sdf.em
${CMAKE_CURRENT_BINARY_DIR}/worlds/${WORLD_NAME}.sdf
)

add_custom_target(world_gen_target ALL
DEPENDS world_gen_cmd
)

#============================================================================
# Tests
if(BUILD_TESTING)
Expand Down
21 changes: 21 additions & 0 deletions lrauv_ignition_plugins/worlds/empy_expander.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Takes in a template and generates an SDF file.

import em
import os
import sys

def main(in_file, out_file):
with open(in_file) as infile:
template = infile.read()
result = em.expand(template, {})
os.makedirs(os.path.dirname(out_file), exist_ok=True)
with open(out_file, 'w') as outfile:
outfile.write(result)

if __name__ == '__main__':
if len(sys.argv) != 3:
print("Usage:")
print("empy_expander.py <infile> <outfile>")
exit(-100)
chapulina marked this conversation as resolved.
Show resolved Hide resolved

sys.exit(main(sys.argv[1], sys.argv[2]))
17 changes: 0 additions & 17 deletions lrauv_ignition_plugins/worlds/portuguese_ledge.py

This file was deleted.

2 changes: 1 addition & 1 deletion lrauv_ignition_plugins/worlds/portuguese_ledge.sdf.em
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ for tile in tiles:
<direction>-0.5 0.1 -0.9</direction>
</light>

@[for tile in tiles[:18]]@
@[for tile in tiles]@
<model name="portuguese_ledge_tile_@(tile.index)">
<static>true</static>
<link name="link">
Expand Down