|
| 1 | +MORSE quickstart |
| 2 | +================ |
| 3 | + |
| 4 | +Creating your first simulation with MORSE is easy. |
| 5 | + |
| 6 | +First, the boring part: |
| 7 | + |
| 8 | +- :doc:`Install MORSE<user/installation>` |
| 9 | +- Open a terminal and check everything is well configured |
| 10 | + |
| 11 | +:: |
| 12 | + |
| 13 | + $ morse check |
| 14 | + |
| 15 | +Then, the funny part:: |
| 16 | + |
| 17 | + $ morse create mysim |
| 18 | + $ morse run mysim |
| 19 | + |
| 20 | +This should be enough to launch MORSE and display a sample simulation. You can |
| 21 | +already control the robot with the arrow keys and check collisions with |
| 22 | +surrounding objects. Press :kbd:`h` to display the list of keyboard shortcuts. |
| 23 | + |
| 24 | +.. image:: ../media/initial_sim.jpg |
| 25 | + :align: center |
| 26 | + |
| 27 | +So, what happened here? |
| 28 | + |
| 29 | +`morse create mysim` actually created a new subfolder in the current directory. |
| 30 | + |
| 31 | +If you inspect it, you will find a Python file called `default.py` and two |
| 32 | +folders. `default.py` is what we call a **Builder script** (because it uses MORSE's :doc:`Builder API<user/builder>`) and it describes your simulation. |
| 33 | + |
| 34 | +.. note:: |
| 35 | + Note that the script is still Python: besides the Builder API, you can use any |
| 36 | + standard Python constructs to program your simulation. |
| 37 | + |
| 38 | +Open `default.py` in your favorite text editor. There are plenty of comments and |
| 39 | +it should be mostly self-explanatory: it builds a simulation with one robot, |
| 40 | +called *Morsy*, two actuators (including the keyboard for debugging/testing), |
| 41 | +one sensor, and these simulated components talk to the outside world via a |
| 42 | +socket. |
| 43 | + |
| 44 | +By checking the :doc:`component library<components_library>`, you get a first |
| 45 | +glimpse on what standard robots, actuators and sensors are available *out of |
| 46 | +the box*. You can add new elements to your simulation by directly editing |
| 47 | +`default.py`. |
| 48 | + |
| 49 | +.. note:: |
| 50 | + All simulations in MORSE are (by default) self-contained. This means that you |
| 51 | + can share your simulation folder (zipping it, sharing with GIT, etc.) with |
| 52 | + others, they can import it with `morse import <path>` (only required the |
| 53 | + first time), and then run it exactly as you did. Convenient to work on a shared |
| 54 | + project. |
| 55 | + |
| 56 | +What if you want to create a custom robot or a custom actuator/sensor? |
| 57 | + |
| 58 | +:: |
| 59 | + |
| 60 | + $ morse add robot MyCustomRobot mysim |
| 61 | + |
| 62 | +This will create a template for your robot. Open the robot description as |
| 63 | +hinted on the output. You will see that by default, your custom robot has the |
| 64 | +same two actuators and sensor as in `default.py`. You can change them to build |
| 65 | +a robot that match your need. |
| 66 | + |
| 67 | +Check as well `morse add actuator` and `morse add sensor` if you need to create |
| 68 | +custom actuators/sensors. |
| 69 | + |
| 70 | +That's all folks! You now know the basics of MORSE. Head to the |
| 71 | +:doc:`tutorials` section to learn how to interact with your simulated robots |
| 72 | +and for more advanced examples. |
| 73 | + |
| 74 | + |
| 75 | + |
0 commit comments