Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
adenjonah authored May 17, 2024
1 parent 4f22f00 commit 054a5e5
Showing 1 changed file with 34 additions and 135 deletions.
169 changes: 34 additions & 135 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,161 +12,60 @@ Check it out [here!](https://columbiaspace.github.io/SUITS-23-24-LMCC/)
- **Rover Control:** Real-time location and camera data display.
- **Geological Sampling:** Interactive geological map and rock data management.

## Installation
# Project Setup

1. Clone the repository:
```
git clone <repository-url>
```
2. Navigate to the project directory:
```
cd CUITS-2024-LMCC
```
3. Install dependencies:
```
npm install
```

## Usage

1. Start the application:
```
npm start
```
2. Open `http://localhost:3000` in a web browser.

## Pages

- **/Constant:** Constant monitoring of mission-critical data.
- **/Focus:** Landing page for mission focus.
- **/Setup:** Configuration of mission parameters and settings.
- **/Egress:** Procedures for exiting the habitat.
- **/Nav:** Interactive navigation system.
- **/Equipment:** Equipment diagnosis and repair procedures.
- **/Rocks:** Geological sampling data and analysis.
- **/Rover:** Rover telemetry and control.
- **/Ingress:** Procedures for re-entering the habitat.

## Contributing
## Software Requirements

Contributions to the CUITS 2024 LMCC project are welcome. Please follow the standard git workflow for contributions:
- Docker Desktop
- Python 3.12.3
- pip
- Node.js
- npm

1. Clone the repository.
2. Create a new feature branch (`git checkout -b feature/your_feature`).
3. Make changes and commit (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin feature/your_feature`).
5. Create a new Pull Request.
## Steps

# Backend API
```
# SUITS API Documentation
1. **Clone the Repository**

This API provides access to JSON data for various resources including rocks, teams, and telemetry details. The API is built with FastAPI and runs locally on `http://localhost:8000`.
## Prerequisites
Before you can run the API, ensure you have the following installed:
- Python 3.8+
- FastAPI
- Uvicorn
- httpx
You can install the necessary libraries with pip:
```bash
pip install fastapi uvicorn httpx
```

## Running the API

To start the API server, use the following command in the directory containing your FastAPI application:

```bash
uvicorn main:app --reload
```

This command will start the server on `http://127.0.0.1:8000` and will automatically reload the server upon any file changes.

## API Endpoints

Here are some of the available endpoints:

- `/json_data/{filename}`: General endpoint for fetching JSON data such as `COMM.json`, `DCU.json`, etc.
- `/json_data/rocks/RockData.json`: Fetches detailed rock data.
- `/json_data/teams/{team_number}/{filename}`: Fetches team-specific data.
```sh
git clone https://github.com/columbiaspace/SUITS-23-24-LMCC.git
```

## Requesting Data from Unity C#
2. **Install Python Requirements**

To request data from the API in a Unity C# application, you can use the `UnityWebRequest` class. Here's an example of how to fetch data from the rocks endpoint:
Navigate to the cloned repository and install the Python dependencies listed in the `requirements.txt` file.

```csharp
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
```sh
pip install -r requirements.txt
```

public class DataLoader : MonoBehaviour
{
private void Start()
{
StartCoroutine(GetRockData());
}
3. **Setup the TSS Using Docker**

IEnumerator GetRockData()
{
string uri = "http://localhost:8000/json_data/rocks/RockData.json";
using (UnityWebRequest webRequest = UnityWebRequest.Get(uri))
{
// Request and wait for the desired page.
yield return webRequest.SendWebRequest();
Follow the instructions in the README at [TSS_2024 Docker Setup](https://github.com/dignojrteogalbo/TSS_2024/tree/docker) to set up the TSS.

if (webRequest.result != UnityWebRequest.Result.Success)
{
Debug.Log("Error: " + webRequest.error);
}
else
{
Debug.Log("Received: " + webRequest.downloadHandler.text);
}
}
}
}
```
4. **Acquire a Mapbox API Key**

## Requesting Data from ReactJS
Get a Mapbox API key by following the instructions at [Mapbox Access Token Documentation](https://docs.mapbox.com/help/glossary/access-token/).

For ReactJS applications, you can use the Fetch API to request data from the API. Here is an example of how to fetch team data in ReactJS:
5. **Run the Project**

```javascript
import React, { useEffect, useState } from 'react';
- If on macOS, run:

function TeamData() {
const [teamData, setTeamData] = useState(null);
```sh
./run_lmcc_mac.sh
```

useEffect(() => {
const fetchData = async () => {
const response = await fetch('http://localhost:8000/json_data/teams/1/Completed_EVA.json');
const data = await response.json();
setTeamData(data);
};
- If on Windows, run:

fetchData();
}, []);
```sh
./run_lmcc_windows.sh
```

return (
<div>
<h1>Team Data</h1>
{teamData && <pre>{JSON.stringify(teamData, null, 2)}</pre>}
</div>
);
}
## Additional Notes

export default TeamData;
```
Make sure all software requirements are installed before proceeding with the steps. If you encounter any issues during the setup process, refer to the respective documentation for Docker, Python, pip, Node.js, and npm.

This script makes a GET request to the API and displays the JSON data on the page.
---

## Conclusion
This project is part of the SUITS 2023-2024 program at Columbia Space Initiative.

This API provides a straightforward method for accessing JSON data for various use cases in development. By following the above instructions, you can integrate this API into Unity C# projects or ReactJS applications.
```

0 comments on commit 054a5e5

Please sign in to comment.