Skip to content

Commit

Permalink
add gif of empty world visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Jan 13, 2025
1 parent bdf214b commit f1a727b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion doc/1_world_visualization/1_world_visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,57 @@ Finally, this "draw" method is defined to execute simulation including updating
```

## 1.2 Visualize empty world
I prepared for [a sample progoram to visualize an empty world](/doc/1_world_visualization/visualize_world.py). You will be able to understand how to use the above world visualization class by reading the code. By executing this, you can see that an empty world simulation is visualized as follow.
I prepared for [a sample progoram to visualize an empty world](/doc/1_world_visualization/visualize_world.py).
```python
"""
visualize_world.py
Author: Shisato Yano
"""

# import path setting
import numpy as np
import sys
from pathlib import Path

abs_dir_path = str(Path(__file__).absolute().parent)
relative_path = "/../../src/components/"

sys.path.append(abs_dir_path + relative_path + "visualization")


# import component modules
from global_xy_visualizer import GlobalXYVisualizer
from min_max import MinMax
from time_parameters import TimeParameters


# flag to show plot figure
# when executed as unit test, this flag is set as false
show_plot = True


def main():
"""
Main process function
"""

# set simulation parameters
x_lim, y_lim = MinMax(-30, 30), MinMax(-30, 30)
vis = GlobalXYVisualizer(x_lim, y_lim, TimeParameters(span_sec=20))

# add objects here

# plot figure is not shown when executed as unit test
if not show_plot: vis.not_show_plot()

# show plot figure
vis.draw()


# execute main process
if __name__ == "__main__":
main()
```
You will be able to understand how to use the above world visualization class by reading the code. By executing this, you can see that an empty world simulation is visualized as follow.
![](/doc/1_world_visualization/visualize_world.gif)
Binary file added doc/1_world_visualization/visualize_world.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f1a727b

Please sign in to comment.