Skip to content

Commit

Permalink
Merge branch 'main' into samanvis/readme_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TiaSinghania authored Oct 1, 2024
2 parents 96d0366 + f6a47b2 commit c793631
Show file tree
Hide file tree
Showing 25 changed files with 2,752 additions and 2,178 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ A complete re-write of the old RoboBuggy. This code was run for RD23, RD24 and R
- Installation instructions here: https://foxglove.dev/

### VSCode
- https://code.visualstudio.com/download

### Git

- https://git-scm.com/downloads

### Install Softwares: WSL, Ubuntu
- Go to Microsoft Store to install "Ubuntu 20.04.6 LTS". TODO: is this actually necessary?
Expand All @@ -37,10 +38,18 @@ A complete re-write of the old RoboBuggy. This code was run for RD23, RD24 and R
- Note: Ensure that the SSH keys are generated while in the WSL terminal
- In the website above, see these two pages: [Generating a new SSH key and adding it to the ssh-agent](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and ["Adding a new SSH key to your GitHub account"](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).

### TODO: this is setup for MacOS

## Installation (for MacOS)
### Install Softwares: Docker, Foxglove
- Go install Foxglove https://foxglove.dev/.
- You will need [Docker](https://docs.docker.com/get-docker/) installed.

### Apple Silicon Mac Only:
- In Docker Desktop App: go to settings -> general and turn on "Use Rosetta for x86/amd64 emulation on Apple Silicon"

### Set up repository
- To set up ssh key, follow this link: [Connecting to GitHub with SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh).
- Note: Ensure that the SSH keys are generated while in the WSL terminal
- Note: Ensure that the SSH keys are generated while in the terminal
- In the website above, see these two pages: [Generating a new SSH key and adding it to the ssh-agent](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and ["Adding a new SSH key to your GitHub account"](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).


Expand All @@ -61,6 +70,7 @@ This is so you can edit our codebase locally, and sync your changes with the res
- ![image](https://github.com/CMU-Robotics-Club/RoboBuggy2/assets/116482510/66965d34-502b-4130-976e-1419c0ac5f69)



### X11 Setup (recommended)
TODO: explain what X11 is for (i think it's only for the manual velocity updater in the sim?)
- Install the appropriate X11 server on your computer for your respective operating systems (Xming for Windows, XQuartz for Mac, etc.).
Expand Down Expand Up @@ -114,7 +124,7 @@ Then `$ cd RoboBuggy2`
(wait until no longer prints “waiting for covariance to be better”)

When launching NAND:
- WORK IN PROGRESS
- Ask software lead (WIP)

When shutting down the buggy:
- Stop roslauch
Expand All @@ -126,7 +136,7 @@ When shutting down the buggy:

## Documentation
### Infrastructure Documentation
WORK IN PROGRESS
Ask Software Lead (WIP)

### Simulator notes
- Longitude + Latitude for Foxglove visualization on map: `/state/pose_navsat` (sensor_msgs/NavSatFix)
Expand All @@ -137,4 +147,4 @@ Commands:
- Velocity: `/buggy/velocity` in m/s (std_msgs/Float64)

### Auton Logic
WORK IN PROGRESS
Ask someone with experience (WIP)
70 changes: 70 additions & 0 deletions camera.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
########################################################################
#
# Copyright (c) 2022, STEREOLABS.
#
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
########################################################################

import sys
from signal import signal, SIGINT
import argparse


import pyzed.sl as sl

cam = sl.Camera()

#Handler to deal with CTRL+C properly
def handler(signal_received, frame):
cam.disable_recording()
cam.close()
sys.exit(0)

signal(SIGINT, handler)

def main():

init = sl.InitParameters()
init.depth_mode = sl.DEPTH_MODE.NONE # Set configuration parameters for the ZED

status = cam.open(init)
if status != sl.ERROR_CODE.SUCCESS:
print("Camera Open", status, "Exit program.")
exit(1)

recording_param = sl.RecordingParameters(opt.output_svo_file, sl.SVO_COMPRESSION_MODE.H264) # Enable recording with the filename specified in argument
err = cam.enable_recording(recording_param)
if err != sl.ERROR_CODE.SUCCESS:
print("Recording ZED : ", err)
exit(1)

runtime = sl.RuntimeParameters()
print("SVO is Recording, use Ctrl-C to stop.") # Start recording SVO, stop with Ctrl-C command
frames_recorded = 0

while True:
if cam.grab(runtime) == sl.ERROR_CODE.SUCCESS : # Check that a new image is successfully acquired
frames_recorded += 1
print("Frame count: " + str(frames_recorded), end="\r")

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--output_svo_file', type=str, help='Path to the SVO file that will be written', required= True)
opt = parser.parse_args()
if not opt.output_svo_file.endswith(".svo") and not opt.output_svo_file.endswith(".svo2"):
print("--output_svo_file parameter should be a .svo file but is not : ",opt.output_svo_file,"Exit program.")
exit()
main()
9 changes: 5 additions & 4 deletions docker_auton/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM nvidia/cuda:11.6.2-base-ubuntu20.04 as CUDA
# FROM nvidia/cuda:11.6.2-base-ubuntu20.04 as CUDA

FROM osrf/ros:noetic-desktop-full-focal

COPY --from=CUDA /usr/local/cuda /usr/local/
# COPY --from=CUDA /usr/local/cuda /usr/local/


RUN apt update
Expand All @@ -16,10 +16,11 @@ RUN apt-get install -y -qq \
ros-noetic-foxglove-bridge \
ros-noetic-microstrain-inertial-driver \
ros-noetic-realsense2-camera \
ros-noetic-realsense2-description
ros-noetic-realsense2-description \
ros-${ROS_DISTRO}-mavros ros-${ROS_DISTRO}-mavros-extras ros-${ROS_DISTRO}-mavros-msgs

# Run this now to cache it separately from other requirements
COPY cuda-requirements_TEMP_DO_NOT_EDIT.txt cuda-requirements.txt
# COPY cuda-requirements_TEMP_DO_NOT_EDIT.txt cuda-requirements.txt
# RUN pip3 install -r cuda-requirements.txt


Expand Down
File renamed without changes.
64 changes: 64 additions & 0 deletions docs/architecture/node_interactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ROS Node Interaction Document
## Scope
The purpose of this file is to descirbe the architecture of the RD25 stack from a ROS node level. This document should be updated whenever any ROS topics are added, removed or modified.

## Viewing On VSCode
Install `bierner.markdown-mermaid` from the extension marketplace to render the charts in VSCode markdown preview.

## List of topics
| Topic Name | Type | is custom message |
| ---------- | ----------------------- | ------------------ |
| ego/state | BuggyState | yes |
| other_buggy/state | BuggyState | yes |
| ego/trajectory | BuggyTrajectory | yes |
| ego/steering_cmd | [Float64](https://docs.ros.org/en/melodic/api/std_msgs/html/msg/Float64.html) | no |
| add new topic here | | |

## ROS Nodes Graph
Auton Loop [Sequence Diagram](https://en.wikipedia.org/wiki/Sequence_diagram#:~:text=A%20sequence%20diagram%20shows%2C%20as,order%20in%20which%20they%20occur.)

```mermaid
sequenceDiagram
A->>B: "some/topic"
```

means A publishes a message of `some/topic` and B receives the message.

```mermaid
sequenceDiagram
participant I as Ego State Estimator Node
participant P as Planner Node
participant C as Controller Node
participant S as Firmware Comms Node
box Grey HBK 3DM-GQ7 INS
participant I
end
box Purple Auton Core
participant P
participant C
end
box Blue Communication with Sensors, Actuators and Other Buggy
participant S
end
loop 100hz
I->>P: "ego/state"
I->>C: "ego/state"
end
loop 10hz
S->>P: "other_buggy/state"
end
loop 10hz
P->>C: "ego/trajectory"
end
loop 100hz
C->>S: "ego/steering_cmd"
end
```

Empty file.
1 change: 1 addition & 0 deletions python-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
matplotlib==3.1.2
NavPy==1.0
numba==0.58.0
numpy<1.21.0
osqp==0.6.3
Expand Down
Loading

0 comments on commit c793631

Please sign in to comment.