THIS REPOSITORY IS NOW OUTDATED, PLEASE GO TO https://github.com/Stanford-AUV/RoboSub FOR THE MOST RECENT CODE!
Update from initial instructions: Make sure to select in your VM more storage than 20 GB! You'll likely need at least 30 GB.
- Install VMWare Fusion (the free version, not the pro version).
- Download the Ubuntu ISO from https://cdimage.ubuntu.com/jammy/daily-live/current/jammy-desktop-arm64.iso.
- Open VMWare and drag the downloaded Debian ISO for installation.
- Press continue, then finish, and name your instance (leaving the default name is fine).
- Select "Try to install Ubuntu". Then click "Install Ubuntu" from the desktop.
- Proceed with the installation leaving everything as the default values.
- Shutdown the virtual machine (Virtual Machine > Shutdown).
- Go to Virtual Machine > Settings > CD/DVD and select autodetect.
- Still in settings, go to Startup Disk and select Hard Disk and then Restart.
- When prompted for Ubuntu, press enter, and then login.
- Run the following:
sudo apt-get update && sudo apt-get install open-vm-tools-desktop
- Shutdown the Virtual Machine, then restart it, and copy-pasting shortcuts should work.
- Run the following in a Terminal:
sudo apt-get install openssh-server && sudo apt install net-tools && sudo apt install git-all && service ssh start
- Note the USER@HOST shown in the VM's Ubuntu Terminal. Then open a Terminal on your local computer (i.e. your Mac) and enter
ssh USER@HOST.local
. - If you connect successfully, now type
logout
, and then typessh-keygen -t ed25519
leaving all fields as default. Finally typessh-copy-id -i ~/.ssh/id_ed25519.pub USER@HOST.local
, once more replacing USER and HOST with your own credentials. - Install VSCode from https://code.visualstudio.com.
- Install the VSCode Remote SSH extension.
- Open a new VSCode window, press
CMD + Shift + P
, and typeRemote-SSH: Connect to Host
followed byEnter
. SelectAdd New SSH Host
. Enterssh USER@HOST.local
followed byEnter
. Select your user's configuration file to update. Finally press connect. - Choose
Clone Repository
in the sidebar, selectClone from GitHub
, and select the Stanford AUV Autonomy repository. Choose a folder to clone it in (something like~/GitHub/
). - Open a Terminal in VSCode and run:
bash install.sh
- Install all VSCode extensions from the
.vscode/extensions.json
. - You're all set!
Make sure to use VSCode. Install all the extensions mentioned in the .vscode/extensions.json
file.
In every new Terminal, run:
source /opt/ros/humble/setup.bash
export PYTHONPATH=${PYTHONPATH}:$PWD/src
To use the Gazebo simulator, follow these steps:
- Open a Terminal in the VM (not in VSCode! a GUI is necessary for this).
- Run the commands from the Development section.
- Run the following command:
bash gazebo.sh
All topics exposed from Gazebo to ROS are located in gazebo_bridge.yaml
.
To test manually, avoid using Gazebo commands directly. Always prefer going through the bridge. For example, to manually set thrust:
ros2 topic pub gz/thruster_1 std_msgs/Float64 "data: -15"
First, make sure you have all the dependencies:
rosdep install -i --from-path src --rosdistro humble -y
To build the code, please run the following:
colcon build && source install/setup.bash
To run a ROS node, please run the following:
ros2 run MODULE_NAME NODE_NAME
For example:
ros2 run control thruster_manager
You can also run a launch file (which launches multiple nodes at once) like so:
ros2 launch src/control/launch/sim.py
To run tests, use the unittest
module like so:
python3 -m unittest MODULE_NAME.tests.TEST_CLASS_NAME
For example:
python3 -m unittest control.tests.TestEKF
You can also run specific tests using:
python3 -m unittest MODULE_NAME.tests.TEST_CLASS_NAME.TEST_NAME
For example:
python3 -m unittest control.tests.TestEKF.test_initial_state
Make sure you have permissions to read from the joystick by first typing:
lsusb
Then read the ID for the Gamepad, something like 046d:c21d
. The first number is the VID and the second number is the PID.
sudo nano /etc/udev/rules.d/80-joystick.rules
Then enter:
SUBSYSTEM=="usb", ATTRS{idVendor}=="VID", ATTRS{idProduct}=="PID", MODE="0666"
Replacing the VID and PID with the values found above. After saving the above file, reload the rules by typing:
sudo udevadm control --reload-rules
Then unplug and replug the Joystick. Make sure to select Connect to Linux
on the VM.
Run the joystick code with the joystick plugged-in through USB:
python src/control/remote.py --record