#!/bin/bash
## Create Bazebo Flat
# Create a flat gazebo model
# Usage:
# Place the texture on the same directory as the script, then:
# ./create-model-flat.sh model-name texture w l texture-scale-w texture-scale-l
#
mkdir ~/.gazebo/models/$1/
mkdir ~/.gazebo/models/$1/materials/
mkdir ~/.gazebo/models/$1/materials/scripts
mkdir ~/.gazebo/models/$1/materials/textures
# model.config
cat > ~/.gazebo/models/$1/model.config <<- EOM
$1
1.0
model.sdf
EOM
# model.sdf
cat > ~/.gazebo/models/$1/model.sdf <<- EOM
true
0 0 1
$3 $4
100
50
0
0 0 1
$3 $4
EOM
# script.material
cat > ~/.gazebo/models/$1/materials/scripts/script.material <<- EOM
material $1
{
receive_shadows on
technique
{
pass
{
texture_unit
{
texture $2
filtering anistropic
max_anisotropy 16
scale $5 $6
}
}
}
}
EOM
# Texture
cp $2 ~/.gazebo/models/$1/materials/textures/
# script.material
cat <<- EOM
model://$1
EOM