Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Install_Dependencies",
"type": "shell",
"command": "source /opt/ros/humble/setup.sh && source install/setup.sh && sudo apt-get update && rosdep install --from-path src",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"shell": {
"executable": "/bin/bash",
"args": ["--login", "-i", "-c"] // --login loads your ~/.bashrc
}
},
"problemMatcher": []
},
{
"label": "Build",
"type": "shell",
"command": "echo '---- building -----' && source /opt/ros/humble/setup.sh && source install/setup.sh && colcon build",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"shell": {
"executable": "/bin/bash",
"args": ["--login", "-i", "-c"] // --login loads your ~/.bashrc
}
},
"problemMatcher": []
},
{
"label": "Run_Simulation",
"type": "shell",
"command": "echo '----- running simulation -----' source ~/.bashrc && source /opt/ros/humble/setup.sh && source install/setup.sh && ros2 launch simulation simulation.launch.py",
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": ["Build"],
"options": {
"shell": {
"executable": "/bin/bash",
"args": ["--login", "-i", "-c"] // --login loads your ~/.bashrc
}
},
"problemMatcher": []
},
{
"label": "Run_Raw_Gazebo",
"type": "shell",
"command": "echo '----- running simulation -----' source ~/.bashrc && source /opt/ros/humble/setup.sh && source install/setup.sh && ign gazebo worlds/test.world",
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": ["Build"],
"options": {
"shell": {
"executable": "/bin/bash",
"args": ["--login", "-i", "-c"] // --login loads your ~/.bashrc
}
},
"problemMatcher": []
}

]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Wisconsin Robotics

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
inst_dep:
sudo apt-get update
rosdep install --from-path src
build_env:
colcon build
echo "DONT FORGET TO SOURCE!"
run:
ros2 launch simulation simulation.launch.py

clean:
rm -rf build/ install/ log/

run_and_build: install_dependencies build run

fast_build: clean build_env run
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,69 @@
This is the official repository for WRover Software Simulation.

## Tools and Lanugages
Currently using Rosviz with Gazebo for simulation
- Rosviz
- Gazebo for simulation.
- ROS2GZ bridge
- Xacro udrf
- Custom VSCode build scripts

## Pushing and Pulling (TODO: David)
All development work to be done on the dev branch of the repository.
Code which is free of syntax errors and basic bugs will be moved to test (via PR) for further testing and analysis
Once either software lead (Aditya or David) approves the changes it will be merged to main.
Merges to main will only be done after code has been thoroughly tested and works in a reliable manner.

## Notes
Documentation about the software being used, resources for development, things that need to be done, can all be found in [/docs/](./docs/)


# Simulation Setup
starting from the root of the WiscRobo directory (where this readme is).
- NOTE: for development purposes, it is recommended to use VScode seeing as there are custom build commands and compile tasks in VSCode
- WSL has varying support for different graphics card. If there is trouble running the software, please refer to [/docs/graphics.md](./docs/graphics.md) and contribute to such file.

### Prereqs
These are required to be installed on the system in order for the simulation to work.
```
sudo apt install python3-colcon-common-extensions
sudo apt-get install python3-rosdep2
sudo apt install ros-humble-joint-state-publisher-gui
```

### Raw Build and Run Commands

```
# Install package dependencies
source /opt/ros/humble/setup.sh
sudo apt-get update
rosdep install --from-path src

# Build projcet
colcon build

# Run Sim
source install/setup.sh
ros2 launch simulation simulation.launch.py
```

### Shortcuts
``` bash
# For fast builds use fast_build script at the top level
# This will do the entire build, source, and run routine for you
# make sure to chmod the script
./fast_build

# clean repo
make clean

# install ros dependencies
make inst_dep

# build project
make build_env

# run after source
make run
```


Empty file added docs/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions docs/TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO

- [ ] Run test vs real rover to see how similar the simulation is to the real rover
- [ ] Calibrate the inertial values of the rover to be similar to the real thing
- [ ] Calibrate sensors to be similar to the sensors on the real rover
5 changes: 5 additions & 0 deletions docs/documents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Docs
These files all outline design decisions, software stack, and resources for other developers

1. [development resources](./Resources.md) - a list of documents related to ROS, gazebo, and simulation development
2. [todo](./TODO.md) - lists all things that need to get done on the rover
13 changes: 13 additions & 0 deletions docs/graphics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Graphics information
WSL is supper funky when it comes to graphics. You might need to make some changes in order to get this to render on your computer


## INTEL Arc Graphics cards
Intel Arc graphics cards have proven problematic, you need to use software rendering if
possible by your computer.

```bash
# Run the following in your shell instance
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=llvmpipe
```
42 changes: 42 additions & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# Resources and Notes
These all serve as notes and general resources aimed at helping other developers. If you find anything useful please put it here

## Gazebo Plugins
Gazebo plugins are scarce and not very common, here are some that are found regarding plugin development.

Gazebo Plugin Development
1) [Gazebo Plugin Tutorial Website by Hrithik Verma](https://sites.google.com/view/gazebo-plugin-tutorials/3-write-a-world-plugin?authuser=0)
2) [Gazebo Plugin Tutorial Youtube Series by Hrithik Verma](https://www.youtube.com/watch?v=UNZMce9z5Fc&list=PLOQhCaBjYnseDMTpd-b52spLSq7hg0ar1&index=1)

Gazebo Documentations
1) [Defualt Gazeo Plugins Github](https://github.com/gazebosim/gz-sim/tree/main/src/systems)
2) [Default Gazebo Plugins Docs](https://gazebosim.org/api/gazebo/6/namespaceignition_1_1gazebo_1_1systems.html)
3) [Gazebo API Docs](https://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/index.html)
4) [Ignition Math Docs](https://osrf-distributions.s3.amazonaws.com/ign-math/api/1.0.0/namespaceignition_1_1math.html)

Gazebo ROS intigration
1) [Example Gazebo/ROS2 project](https://github.com/gazebosim/ros_gz_project_template/tree/main)



## Inertials
This is a note about inertials. Intertials are what tell the simulation how the links interact with the world.
A great wiki artical about this is [Moment of Inertia Wiki Page](https://en.wikipedia.org/wiki/Moment_of_inertia#Inertia_tensor), specifically the inertia tensors since that is what URDF uses.

### Approximation Methods
There are two main methods for estimating inertial values: getting it from CAD and estimating it with general shapes.
#### CAD
in Onshape, you can take the moment of inertia from the shapes themselves

### URDF Reference frames
Take the exampple:
``` xml
<joint name="rd_to_bw" type="continuous">
<parent link="right_chasis"/>
<child link="back_swivel"/>
<origin xyz="${bw_pos_x} ${bw_pos_y} ${bw_pos_z}" rpy="0 0 0"/>
<axis xyz = "0 0 1"/>
</joint>
```
In the case of URDF, the intertials of the child will be relative to the origin axis, the origin axis being based off the parent's frame of reference
20 changes: 20 additions & 0 deletions fast_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Exit on error
set -e

# clearing
clear

# Source ROS2
source /opt/ros/humble/setup.bash

# clean project and build
make clean
make build_env

# Source workspace
source install/setup.bash

# Launch simulation
make run
Empty file added src/.gitkeep
Empty file.
Loading