Gzweb/GzwebMobile


 * 1) Mobile Interface for Gazebo's WebGL Client

Gzweb Mobile is a mobile interface for Gzweb, a WebGL client for Gazebo. Currently under development.




 * 1) Graphical user interface

Interactions with the interface are possible by touch or mouse+keyboard. The design should be suitable for different screen sizes and aspect ratios.


 * 1) Side panel menu
 * Pressing [[File:GzwebBars.png]] opens the panel.
 * Either pressing [[File:GzwebDelete.png]] or anywhere outside the panel closes it.

Edit


 * `Reset World`: Resets model poses and time.
 * `Reset Model Poses`: Resets all models to their positions when they were first inserted.
 * `Reset View`: Returns the view to the default view.
 * `Snap to grid`: Models snap to grid when translating.

View


 * `Collisions`: Shows collision visuals.

Insert

Insert simple shapes into the world.




 * 1) Object menu


 * Long press a model in the world to select it and open its menu.
 * Drag the finger towards the desired option and lift the finger.




 * 1) Clock
 * Pressing Play [[File:GzwebPlay.png]] starts the physics engine.
 * Pressing Pause [[File:GzwebPause.png]] pauses the physics engine.
 * Pressing [[File:GzwebClock.png]] opens the clock pop-up:
 * Real Time: Displays how long the simulation has been running in real time.
 * Sim time: Displays how long the simulation itself has been running.
 * On the menu, `Edit -> Reset World` resets the physics engine.




 * 1) View mode
 * View mode allows the user to control the camera view.
 * Pressing [[File:GzwebArrow.png]] enters view mode.
 * `Edit -> Reset View` to return to the default view.

Mouse controls
 * Translate: Left press + drag
 * Orbit: Middle press + drag
 * Zoom: Scroll wheel / Right press + drag vertically

Touch controls
 * Translate: 2 finger drag
 * Orbit: 1 finger drag
 * Zoom: 2 finger pinch / spread


 * 1) Manipulating models


 * 1) Translate mode
 * Pressing [[File:GzwebTranslate.png]] on the header or on the object menu enters translate mode.
 * Pressing a model selects it and places the translate handles on the object.

Mouse controls
 * There are 5 rotation handles.
 * Placing the mouse over a handle highlights it.
 * Left-press + drag a handle to rotate the model.

Touch controls
 * There are 3 rotation handles (X,Y,Z).
 * Touching and dragging a handles highlights it and rotates the model.


 * 1) Inserting models

Mouse controls
 * Choose a shape at `Insert -> Box|Sphere|Cylinder`, the panel closes automatically and a transparent model appears.
 * Move the mouse (without pressing any buttons) to the desired position on the ground and left-press.

Touch controls In the touch version, models are dragged from the menu directly into the scene in one move.
 * Choose a shape at `Insert -> Box|Sphere|Cylinder`, the panel closes automatically and a transparent model appears.
 * Drag the shape to the desired position on the ground and lift the finger.


 * 1) Deleting models


 * Selecting [[File:GzwebTrash.png]] on the object menu deletes the object.
 * This feature is not available on the desktop version.


 * 1) To do


 * Conduct usability tests
 * Issue tracker

Due to limitations in computing power and memory, complex models must be simplified to render quickly on mobile devices.
 * 1) Graphics optimization

Gzweb's local database is created during deployment (see install). When using touch devices, if the coarse model is available, it will be used instead of the original model.
 * 1) Adding coarse models to the database


 * To coarse the whole database to 50% quality during deployment, add `-c` flag.

`./deploy.sh -m -c`

or if the database had already been created, just:

`./deploy.sh -c`


 * To hand-pick models to be coarsened and to which percentage, run:

`./coarse_db.sh `

where ` ` is the edges ratio with respect to the original mesh (0 to 100), and ` ` is the path of the models. For example:

`./coarse_db.sh 20 http/client/assets/bowl/`

Once you have Gazebo installed, there's no need to install dependencies.
 * 1) Dependencies


 * GTS (GNU Triangulated Surface) for mesh simplification


 * TinyXML to parse COLLADA files


 * nanoflann for nearest neighbor search


 * Gazebo to help with conversion

Models in Gzweb's local database are stored in COLLADA format. The conversion goes through the following steps:
 * 1) How it works

`COLLADA file -> Gazebo mesh -> GTS mesh -> simplification -> GTS mesh -> Gazebo mesh -> COLLADA file`


 * `COLLADA file -> Gazebo mesh`: use Gazebo's [COLLADA loader](https://bitbucket.org/osrf/gazebo/src/601decf8b7af9362f57410fc32baf3824f5e9867/gazebo/common/ColladaLoader.hh?at=default)
 * `Gazebo mesh -> GTS mesh`: adapted from Gazebo's [ConvertMeshtoGTS](https://bitbucket.org/osrf/gazebo/src/601decf8b7af9362f57410fc32baf3824f5e9867/gazebo/common/MeshCSG.hh?at=default#cl-58)
 * `GTS mesh -> simplification -> GTS mesh`: adapted from GTS's [coarsen](https://github.com/lsaavedr/gts/blob/master/examples/coarsen.c) example
 * `GTS mesh -> Gazebo mesh` and `Gazebo mesh -> COLLADA file` are done with a simplified COLLADA exporter as follows.


 * 1) COLLADA exporter

Most elements are copied from the original COLLADA file:
 * asset (except unit, which becomes meter after conversion)
 * library_images
 * library_materials
 * library_effects


 * 1) library_visual_scenes

This element cannot be copied because it might refer to several geometries, while the simplified model will always have a single geometry.

Moreover, transform elements are taken into account when loading the mesh into Gazebo, so the mesh is already properly translated, rotated and scaled.

Thus, the new visual_scene refers to a single geometry and binds it to the first material. Multiple materials are not supported yet.


 * 1) library_geometries

The simplified GTS mesh doesn't contain texture or normals.


 * VERTEX: stored in a Gazebo mesh and then copied
 * NORMAL: generated with Gazebo's RecalculateNormals and then copied
 * TEXCOORD: remapped copying the UV coordinates from the original mesh which best match the new vertices
 * triangles: indices for VERTEX and NORMAL copied from Gazebo mesh, indices from TEXCOORD generated during remapping


 * 1) To do


 * Solve mesh conversion issues, as several meshes are not being properly converted yet.
 * Support multiple materials.
 * Improve texture remapping.
 * Implement a progressive mesh scheme which loads a base mesh and refines it as much as each device can handle.