Skip to content

Quickstart Guide

This guide will help you quickly get MOLARS up and running for development and testing purposes. We'll use the provided spinup.bash script to launch all required components at once.

Prerequisites

Before starting, make sure you have:

  1. Completed the installation process
  2. Built the MOLARS system successfully
  3. Sourced the setup file: source setup.bash

Using the Spinup Script

MOLARS consists of multiple components that need to run simultaneously. While you can start each component manually in separate terminals, the spinup.bash script automates this process.

What the Script Does

The spinup.bash script:

  1. Launches a dummy estimator/controller (for simulation)
  2. Starts the control server
  3. Starts the navigation server
  4. Starts the mission server
  5. Launches the REST API
  6. Handles proper shutdown when you exit (Ctrl+C)

Running the System

To start all MOLARS components at once:

./spinup.bash

You should see output indicating that each component has started:

Starting: ./build/dummy_estimator_controller DUMMY_TGT_REFERENCE DUMMY_STATE DUMMY_REFERENCE DUMMY_STATE_GLOBAL
Starting: ./build/control_server_node DUMMY_TGT_REFERENCE DUMMY_STATE DUMMY_REFERENCE DUMMY_STATE_GLOBAL
Starting: ./build/nav_server_node
Starting: ./build/mission_server_node
Starting: python -m api

Note

The script will keep running in your terminal. To stop all components, press Ctrl+C once, and the script will properly shut down all processes.

Interacting with the Running System

Once the system is running, you can interact with it using the REPL or the REST API.

Using the REPL

In a new terminal window (while the spinup script is running), start the REPL:

python repl.py

You can now control the simulated vehicle using the mission script API. For example:

>>> # Get the current state
>>> state = get_state()
>>> print(state.pose)
Pose(position=Point(x=0.0, y=0.0, z=0.0), orientation=Quaternion(x=0.0, y=0.0, z=0.0, w=1.0))
>>> 
>>> # Move 2 meters forward
>>> run(move(x=2.0))
>>> 
>>> # Execute a simple square pattern
>>> async def square_pattern():
...     # Move in a 5x5 meter square
...     await move(x=5.0)
...     await move(y=5.0)
...     await move(x=-5.0)
...     await move(y=-5.0)
...     print("Square pattern completed")
... 
>>> run(square_pattern())

For more examples, see the Scripting Guide.

Using the REST API

The API runs on http://localhost:8080 by default. You can use tools like curl, Postman, or any HTTP client to interact with it:

# Get the current state
$ http get http://localhost:8080/control/state
HTTP/1.1 200 OK
content-length: 256
content-type: application/json
date: Wed, 16 Apr 2025 00:29:55 GMT
server: uvicorn

{
    "header": {
        "frame_id": "dummy_state",
        "sequence": 713,
        "timestamp": 1744763395658561
    },
    "pose": {
        "orientation": {
            "w": 1.0,
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        },
        "position": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        }
    },
    "twist": {
        "angular": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        },
        "linear": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        }
    }
}

See the API documentation at http://localhost:8080/molars/docs for more details on available endpoints.