Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from SJSURoboticsTeam/sphinx_docs
Browse files Browse the repository at this point in the history
Created Sphinx docs
  • Loading branch information
chrehall68 authored Mar 24, 2024
2 parents 6382749 + 8e2463b commit e74b624
Show file tree
Hide file tree
Showing 64 changed files with 1,012 additions and 259 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Sphinx: Render docs"

on: push

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Build HTML
uses: ammaraskar/sphinx-action@master
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/dev'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ venv.bak/

**.freq
frequency_analysis.json
**_build
7 changes: 5 additions & 2 deletions CommandScripts/AutoHelp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import math
#from modules.LSM303 import Compass
from modules.LSM303 import Compass
from proj_modules.LSM303 import Compass
import json

class AutoHelp:
Expand Down Expand Up @@ -75,12 +75,15 @@ def jsonify_commands(self, commands):


def get_bearing(self, current_GPS, target_GPS):
"""Returns the angle between two GPS coordinates
"""
Returns the angle between two GPS coordinates
PARAMS:
current_GPS (tuple): (latitude, longitude)
target_GPS (tuple): (latitude, longitude)
RETURNS:
float. angle between the two coordinates
"""
try:
current_latitude = math.radians(current_GPS[1])
Expand Down
3 changes: 2 additions & 1 deletion CommandScripts/GPS_NAV.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os, sys

sys.path.insert(0, os.path.abspath(".."))
from modules.LSM303 import Compass
from proj_modules.LSM303 import Compass
from CommandScripts import AutoHelp
from simple_pid import PID
import time
Expand All @@ -19,6 +19,7 @@ def get_target_angle(
self, lidar_data, rover_angle, current_longlat, target_longlat
):
"""Obstacle avoidance logic that uses vector field histogram (VFH)
PARAMS:
lidar_data (list): array of 360 elements. each index is an angle
rover_angle (int): the angle that the rover is currently facing
Expand Down
25 changes: 0 additions & 25 deletions CommandScripts/MMT-drive-command.py

This file was deleted.

26 changes: 26 additions & 0 deletions CommandScripts/MMT_drive_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys
import requests
import serial.tools.list_ports as port_list
import os, sys
sys.path.insert(0, os.path.abspath(".."))
from proj_modules.Serial import SerialSystem

if __name__=='__main__':
port = "/dev/ttyUSB0"
get_initial_commands_url = "http://192.168.1.133:5000/drive"

web_response = requests.get(get_initial_commands_url)
print("Getting data from: " + web_response.text)

try:
serial = SerialSystem(port, 38400)
print("Using port: " + port)
except:
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[0].device)
port = ports[0].device
serial = SerialSystem(port, 38400)

while True:
web_response = requests.get(get_initial_commands_url)
serial.read_write_serial(web_response.text)
4 changes: 2 additions & 2 deletions CommandScripts/autonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
sys.path.insert(0, os.path.abspath(".."))
from CommandScripts.GPS_NAV import GPS_Nav
from CommandScripts import AutoHelp
from modules.LSM303 import Compass
from modules.WiFi import WiFi
from proj_modules.LSM303 import Compass
from proj_modules.WiFi import WiFi
import time
import threading

Expand Down
30 changes: 0 additions & 30 deletions CommandScripts/drive-command.py

This file was deleted.

31 changes: 31 additions & 0 deletions CommandScripts/drive_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys
import requests
import serial.tools.list_ports as port_list
import os, sys
sys.path.insert(0, os.path.abspath(".."))
from proj_modules.Serial import SerialSystem

if __name__=='__main__':
port = "/dev/ttyUSB0"
get_initial_commands_url = "http://192.168.50.243:5000/drive"

web_response = requests.get(get_initial_commands_url)
print("Getting data from: " + web_response.text)

try:
serial = SerialSystem(port, 38400)
print("Using port: " + port)
except:
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[0].device)
port = ports[0].device
serial = SerialSystem(port, 38400)

homing_end = "Starting control loop..."
while True:
response = serial.read_serial()
if homing_end in response:
while True:
web_response = requests.get(get_initial_commands_url)
serial.read_write_serial(web_response.text)

85 changes: 43 additions & 42 deletions Missions/MMT_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
sys.path.insert(0, os.path.abspath(".."))
import requests
import serial.tools.list_ports as port_list
from modules.Serial import SerialSystem
from proj_modules.Serial import SerialSystem
from CommandScripts.autonomy import Autonomy
from modules.old_GPS import gpsRead
from proj_modules.old_GPS import gpsRead
import json

serial_port = "/dev/ttyACM2"
Expand All @@ -16,51 +16,52 @@
server = 'http://13.56.207.97:5000'
GPS_list = []

try:
serial = SerialSystem(serial_port, serial_baudrate)
print("Using port: " + serial_port, "For Serial Comms")
except:
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[0].device, "For Serial Connection")
serial_port = ports[0].device
serial = SerialSystem(serial_port, serial_baudrate)
if __name__=='__main__':
try:
serial = SerialSystem(serial_port, serial_baudrate)
print("Using port: " + serial_port, "For Serial Comms")
except:
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[0].device, "For Serial Connection")
serial_port = ports[0].device
serial = SerialSystem(serial_port, serial_baudrate)


try:
GPS = gpsRead(gps_port,gps_baudrate)
print("Using port: " + gps_port, "For GPS")
except:
port_number = 0
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[port_number].device, "For GPS Connection")
port = ports[port_number].device
GPS = gpsRead(port,gps_baudrate)
while GPS.get_position() == ['error', 'error'] or GPS.get_position() == ["None", "None"]:
print("Port not found, going to next port...")
port_number += 1
gps_port = ports[port_number].device
try:
GPS = gpsRead(port,gps_baudrate)
except:
continue
break
try:
GPS = gpsRead(gps_port,gps_baudrate)
print("Using port: " + gps_port, "For GPS")
except:
port_number = 0
ports = list(port_list.comports())
print('====> Designated Port not found. Using Port:', ports[port_number].device, "For GPS Connection")
port = ports[port_number].device
GPS = gpsRead(port,gps_baudrate)
while GPS.get_position() == ['error', 'error'] or GPS.get_position() == ["None", "None"]:
print("Port not found, going to next port...")
port_number += 1
gps_port = ports[port_number].device
try:
GPS = gpsRead(port,gps_baudrate)
except:
continue
break


GPS_map_url = f"{server}/gps"
try:
GPS_map = requests.get(GPS_map_url)
except:
print("Could not get GPS map from mission control")
exit(1)
GPS_map_url = f"{server}/gps"
try:
GPS_map = requests.get(GPS_map_url)
except:
print("Could not get GPS map from mission control")
exit(1)

GPS_map = json.loads(GPS_map.text)
GPS_map = json.loads(GPS_map.text)

for i in GPS_map:
GPS_list.append(GPS_map[i])
print("GPS List:", GPS_list)
for i in GPS_map:
GPS_list.append(GPS_map[i])
print("GPS List:", GPS_list)

GPS_list = [[-121.8818685, 37.33699716666666], [-121.881868, 37.33696233333334], [-121.88177050000002, 37.336928833333324]]
print("GPS List:", GPS_list)
GPS_list = [[-121.8818685, 37.33699716666666], [-121.881868, 37.33696233333334], [-121.88177050000002, 37.336928833333324]]
print("GPS List:", GPS_list)

rover = Autonomy(serial, server, max_speed, max_angle, GPS, GPS_list)
rover.start_mission()
rover = Autonomy(serial, server, max_speed, max_angle, GPS, GPS_list)
rover.start_mission()
File renamed without changes.
Loading

0 comments on commit e74b624

Please sign in to comment.