Let's try Ignition Fortress

## Let's try Ignition Fortress

out of curiosity, just wanted to try out Ignition Gazebo Simulator from source code build.


### Environment

- Ubuntu 20.04 Docker Container
- Nvidia Runtime Acceleration
- Ignition Fortress

### Nvidia Runtime

to access hardware via container, we need to install `nvidia-docker2`, which enables backend runtime to be issued by `docker --gpus` option.
the procedure is really easy and described in [container-toolkit/install-guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html).

with nvidia container runtime, we can see that it can access GPUs from container as following.

```bash
>docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
Thu Dec 16 06:42:31 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.73.01    Driver Version: 460.73.01    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0  On |                  N/A |
| 49%   46C    P0    N/A /  75W |    763MiB /  4036MiB |      3%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+
```


### Ignition Build & Run

- start container runtime with GPUs

```bash
# this is required to allow access to host window system
>xhost +

# instantiate docker container
>docker run --gpus all -it --privileged -e DISPLAY="$DISPLAY" --network host --name ubuntu20_ign --volume="$HOME/.Xauthority:/root/.Xauthority:rw" -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/tomoyafujita/DVT/docker_ws:/root/docker_ws nvidia/opengl:base

# glmarks / glxinfo should be working
> apt update
> apt install -y glmark2 mesa-utils
>glmark2
...
>glxinfo
...
```

- ignition source build

refer to [fortress/install_ubuntu_src](https://ignitionrobotics.org/docs/fortress/install_ubuntu_src).

some warnings come up though, but i guess that we can just ignore for now.

<details>
<summary>colcon build --merge-install --parallel-workers 4</summary>
--- stderr: ignition-physics5                                         
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc: In copy constructor ‘ignition::physics::tpelib::CapsuleShape::CapsuleShape(const ignition::physics::tpelib::CapsuleShape&)’:
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc:98:11: warning: implicitly-declared ‘ignition::physics::tpelib::CapsuleShape& ignition::physics::tpelib::CapsuleShape::operator=(const ignition::physics::tpelib::CapsuleShape&)’ is deprecated [-Wdeprecated-copy]
   98 |   *this = _other;
      |           ^~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc:95:1: note: because ‘ignition::physics::tpelib::CapsuleShape’ has user-provided ‘ignition::physics::tpelib::CapsuleShape::CapsuleShape(const ignition::physics::tpelib::CapsuleShape&)’
   95 | CapsuleShape::CapsuleShape(const CapsuleShape &_other)
      | ^~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc: In copy constructor ‘ignition::physics::tpelib::EllipsoidShape::EllipsoidShape(const ignition::physics::tpelib::EllipsoidShape&)’:
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc:201:11: warning: implicitly-declared ‘ignition::physics::tpelib::EllipsoidShape& ignition::physics::tpelib::EllipsoidShape::operator=(const ignition::physics::tpelib::EllipsoidShape&)’ is deprecated [-Wdeprecated-copy]
  201 |   *this = _other;
      |           ^~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/tpe/lib/src/Shape.cc:198:1: note: because ‘ignition::physics::tpelib::EllipsoidShape’ has user-provided ‘ignition::physics::tpelib::EllipsoidShape::EllipsoidShape(const ignition::physics::tpelib::EllipsoidShape&)’
  198 | EllipsoidShape::EllipsoidShape(const EllipsoidShape &_other)
      | ^~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh: In member function ‘ignition::physics::RequireData<StringData>& ignition::physics::RequireData<StringData>::operator=(const ignition::physics::RequireData<StringData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:173:11: warning: implicitly-declared ‘ignition::physics::ExpectData<StringData>& ignition::physics::ExpectData<StringData>::operator=(const ignition::physics::ExpectData<StringData>&)’ is deprecated [-Wdeprecated-copy]
  173 |     class RequireData<Required> : public virtual ExpectData<Required>
      |           ^~~~~~~~~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:357,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:44:5: note: because ‘ignition::physics::ExpectData<StringData>’ has user-provided ‘ignition::physics::ExpectData<Expected>::ExpectData(const ignition::physics::ExpectData<Expected>&) [with Expected = StringData]’
   44 |     ExpectData<Expected>::ExpectData(const ExpectData<Expected> &)
      |     ^~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::RequireData<StringData>& ignition::physics::RequireData<StringData>::operator=(const ignition::physics::RequireData<StringData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh: In member function ‘ignition::physics::RequireData<BoolData>& ignition::physics::RequireData<BoolData>::operator=(const ignition::physics::RequireData<BoolData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:173:11: warning: implicitly-declared ‘ignition::physics::ExpectData<BoolData>& ignition::physics::ExpectData<BoolData>::operator=(const ignition::physics::ExpectData<BoolData>&)’ is deprecated [-Wdeprecated-copy]
  173 |     class RequireData<Required> : public virtual ExpectData<Required>
      |           ^~~~~~~~~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:357,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:44:5: note: because ‘ignition::physics::ExpectData<BoolData>’ has user-provided ‘ignition::physics::ExpectData<Expected>::ExpectData(const ignition::physics::ExpectData<Expected>&) [with Expected = BoolData]’
   44 |     ExpectData<Expected>::ExpectData(const ExpectData<Expected> &)
      |     ^~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::RequireData<BoolData>& ignition::physics::RequireData<BoolData>::operator=(const ignition::physics::RequireData<BoolData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh: In member function ‘ignition::physics::RequireData<CharData>& ignition::physics::RequireData<CharData>::operator=(const ignition::physics::RequireData<CharData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:173:11: warning: implicitly-declared ‘ignition::physics::ExpectData<CharData>& ignition::physics::ExpectData<CharData>::operator=(const ignition::physics::ExpectData<CharData>&)’ is deprecated [-Wdeprecated-copy]
  173 |     class RequireData<Required> : public virtual ExpectData<Required>
      |           ^~~~~~~~~~~~~~~~~~~~~
In file included from /root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/SpecifyData.hh:357,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/utils/TestDataTypes.hh:24,
                 from /root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:22:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:44:5: note: because ‘ignition::physics::ExpectData<CharData>’ has user-provided ‘ignition::physics::ExpectData<Expected>::ExpectData(const ignition::physics::ExpectData<Expected>&) [with Expected = CharData]’
   44 |     ExpectData<Expected>::ExpectData(const ExpectData<Expected> &)
      |     ^~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::RequireData<CharData>& ignition::physics::RequireData<CharData>::operator=(const ignition::physics::RequireData<CharData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::RequireData<BoolData, CharData>& ignition::physics::RequireData<BoolData, CharData>::operator=(const ignition::physics::RequireData<BoolData, CharData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:435:11: note: synthesized method ‘ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<BoolData>, ignition::physics::RequireData<CharData> >&)’ first required here
  435 |     class RequireData<DataType1, OtherDataTypes...>
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::RequireData<BoolData, CharData>& ignition::physics::RequireData<BoolData, CharData>::operator=(const ignition::physics::RequireData<BoolData, CharData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::RequireData<StringData, BoolData, CharData>& ignition::physics::RequireData<StringData, BoolData, CharData>::operator=(const ignition::physics::RequireData<StringData, BoolData, CharData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:435:11: note: synthesized method ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData>, ignition::physics::RequireData<BoolData, CharData> >&)’ first required here
  435 |     class RequireData<DataType1, OtherDataTypes...>
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::RequireData<StringData, BoolData, CharData>& ignition::physics::RequireData<StringData, BoolData, CharData>::operator=(const ignition::physics::RequireData<StringData, BoolData, CharData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >& ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: warning: implicitly-declared ‘ignition::physics::ExpectData<IntData>& ignition::physics::ExpectData<IntData>::operator=(const ignition::physics::ExpectData<IntData>&)’ is deprecated [-Wdeprecated-copy]
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:44:5: note: because ‘ignition::physics::ExpectData<IntData>’ has user-provided ‘ignition::physics::ExpectData<Expected>::ExpectData(const ignition::physics::ExpectData<Expected>&) [with Expected = IntData]’
   44 |     ExpectData<Expected>::ExpectData(const ExpectData<Expected> &)
      |     ^~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: warning: implicitly-declared ‘ignition::physics::ExpectData<FloatData>& ignition::physics::ExpectData<FloatData>::operator=(const ignition::physics::ExpectData<FloatData>&)’ is deprecated [-Wdeprecated-copy]
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:44:5: note: because ‘ignition::physics::ExpectData<FloatData>’ has user-provided ‘ignition::physics::ExpectData<Expected>::ExpectData(const ignition::physics::ExpectData<Expected>&) [with Expected = FloatData]’
   44 |     ExpectData<Expected>::ExpectData(const ExpectData<Expected> &)
      |     ^~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::ExpectData<IntData, FloatData>& ignition::physics::ExpectData<IntData, FloatData>::operator=(const ignition::physics::ExpectData<IntData, FloatData>&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:424:11: note: synthesized method ‘ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >& ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::ExpectData<IntData>, ignition::physics::ExpectData<FloatData> >&)’ first required here
  424 |     class ExpectData<DataType1, OtherDataTypes...>
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh: In member function ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >&)’:
/root/docker_ws/ignition_ws/src/ign-physics/include/ignition/physics/detail/SpecifyData.hh:321:11: note: synthesized method ‘ignition::physics::ExpectData<IntData, FloatData>& ignition::physics::ExpectData<IntData, FloatData>::operator=(const ignition::physics::ExpectData<IntData, FloatData>&)’ first required here
  321 |     class SpecifyData<DataSpec1, DataSpec2> :
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc: In member function ‘virtual void SpecifyData_Copy_Test::TestBody()’:
/root/docker_ws/ignition_ws/src/ign-physics/src/SpecifyData_TEST.cc:683:16: note: synthesized method ‘ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >& ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >::operator=(const ignition::physics::SpecifyData<ignition::physics::RequireData<StringData, BoolData, CharData>, ignition::physics::ExpectData<IntData, FloatData> >&)’ first required here
  683 |     opEqData = data;
      |                ^~~~
</details>

then start sample world.

```bash
ign gazebo shapes.sdf -v 4
```

![ignition_gazebo_via_container.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/112819/dad60e29-19ab-e985-aadd-91eadbf507e1.png)


### What's next

probably try some examples from [ros_ign](https://github.com/ignitionrobotics/ros_ign) to comprehend how it works.


### Reference

- https://ignitionrobotics.org/docs/fortress
- https://ignitionrobotics.org/docs/fortress/install_ubuntu_src
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html
- https://github.com/ignitionrobotics/ros_ign