added docs

This commit is contained in:
locker98 2024-11-25 14:19:31 -05:00
parent 2f743dea72
commit 8c34973617
13 changed files with 464 additions and 0 deletions

23
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: ci
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install pillow cairosvg
- run: mkdocs gh-deploy --force

View File

@ -0,0 +1,93 @@
# Setting up VSCode
first install vscode using snap
```bash
sudo snap install code --classic
```
then add the `ROS` extension from Microsoft.
# Setting up the ROS2 Package Workspace
first create the folder for the package usual it is called `packagename_ws`where `_ws` stands for then you enter the directory and create another directory called `src` then run the `colcon build` command.
```bash
colcon build
```
next go into the `install` folder and add the `setup.bash` source command to your `~/.bashrc`
```bash
...
source /home/username/package_ws/install/setup.bash
```
## Creating a Python Packages
#### Setting Up
Go to the workspace folder that was created in the last step and open the `src` folder. In this folder run this command.
```bash
ros2 pkg create {package_name} --build-type ament_python --dependencies rclpy
```
add your code in to the folder with the `__init__.py`. This is usually in the folder `src/{package_name}/{package_name}`
#### Programming
create a python file for your first node.
`my_first_node.py`
```python
#!/usr/bin/env python
import rclpy
from rclpy.node import Node
class MyNode(Node):
def __init__(self):
super().__init__('first_node')
self.get_logger().info('Hello from ROS2')
def main (args=None):
rclpy.init(args=args)
node = MyNode()
rclpy.spin(node)
rclpy.shutdown()
if __name__ == '__main__':
main()
```
Now add it to the setup.py file in the `entry_points` section.
it is setup with the name of the ROS2 command first then the equals followed by the package name, python file name that is in the same folder as the `__init__.py`, and finally the function name to call, usual `main`.
```python
entry_points={
'console_scripts': [
"test_node = husky_test.my_first_node:main"
],
},
```
The final step is building the script and testing it.
#### Building
go the the `{package_name}_ws` folder with the `src` and `install` folder in it. Then run the `colcon build` command.
```bash
colcon build
```
next run the `source ~/.bashrc` command to reload the workspace source file and the other source files.
#### Simplifying Build (specific to python)
since we are using python and it is interpreted we can simplify the build process when working buy using the symlink command to avoid building.
```bash
colcon build --symlink-install
```
then just like before run the `source ~/.bashrc` command to refresh everything and after that you will never have to worry about building or refreshing again.
## Creating a C++ Packages
Go to the workspace folder that was created in the last step and open the `src` folder. In this folder run this command.
```bash
ros2 pkg create {package_name} --build-type ament_cmake
```

8
docs/General ROS 2/Debuging.md Executable file
View File

@ -0,0 +1,8 @@
Get a map of the nodes on the ros network
```bash
ros2 run rqt_graph rqt_graph
```

56
docs/Husky 200/Simulator.md Executable file
View File

@ -0,0 +1,56 @@
launching simulator
```bash
ros2 launch clearpath_gz simulation.launch.py setup_path:=$HOME/clearpath
```
## Using Manipulator
robot.yaml
```yaml
serial_number: a200-0000
version: 0
system:
hosts:
- hostname: cpr-a200-0000
ip: 192.168.131.1
ros2:
namespace: a200_0000
platform:
attachments:
- name: front_bumper
type: a200.bumper
parent: front_bumper_mount
- name: rear_bumper
type: a200.bumper
parent: rear_bumper_mount
- name: top_plate
type: a200.top_plate
manipulators:
arms:
- model: kinova_gen3_lite
parent: top_plate_default_mount
xyz: [0.0, 0.0, 0.0]
rpy: [0.0, 0.0, 0.0]
ip: 192.168.131.40
port: 10000
gripper:
model: kinova_2f_lite
```
Launch the simulation
```
ros2 launch clearpath_gz simulation.launch.py setup_path:=$HOME/clearpath
```
Launch MoveIt! by passing the same robot setup directory and setting the simulation flag.
```
ros2 launch clearpath_manipulators moveit.launch.py setup_path:=$HOME/clearpath use_sim_time:=true
```
Launch RViz by passing the robot's namespace and enabling the simulation flag.
```
ros2 launch clearpath_viz view_moveit.launch.py namespace:=a200_0000 use_sim_time:=True
```

View File

@ -0,0 +1,3 @@
```bash
ros2 launch clearpath_viz view_model.launch.py setup_path:=/home/brickman/clearpath/
```

View File

@ -0,0 +1 @@
The Oak d Pro Camera is an 3d depth camera with integrated NPU for advance AI processing. It is equipped with three cameras two gray scale for the right and left stereo camera and on center camera for color and AI inference. It comes with yolo-v6, yolo-v8, face detector, and an model that detects your gender and age. For more information on how to use it go to [docs.luxonis.com](https://docs.luxonis.com/).

View File

@ -0,0 +1,120 @@
# SLAM
### Troubleshooting
#### Date and Time off
one of the major problems with the Turtlebot 4 and communication is the time. Make sure you use the `date` command and check what time it is. If the time is off use `rasp-config` to set the correct timezone. The standard Turtlebot 4 image does not have rasp-config install so you will probably have to install it with `sudo apt install rasp-config`.
#### The map keeps getting all messed up
try driving slower and not using the R1 shoulder button that puts the turtlebot in high speed.
#### The controller keeps disconnecting
Try pairing the controller to the computer so that you do not have to stay by the robot as it drives and maps. To pair the controller to the computer and drive it install the joy node.
```bash
sudo apt install ros-humble-turtlebot4-bringup
```
Then pair the controller to the computer like normal. Once the controller is paired start the node by running this command.
```bash
ros2 launch turtlebot4_bringup joy_teleop.launch.py namespace:=/
```
Once this command is running then you should be able to drive the robot like normal
### Launching the SLAM command
Here is the `slam.yaml` config file. You can change the resolution by changing the resolution parameter, by default it is 0.05 but i have had great success when running synchronous SLAM with values as low as 0.01.
```yaml
slam_toolbox:
ros__parameters:
# Plugin params
solver_plugin: solver_plugins::CeresSolver
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
ceres_preconditioner: SCHUR_JACOBI
ceres_trust_strategy: LEVENBERG_MARQUARDT
ceres_dogleg_type: TRADITIONAL_DOGLEG
ceres_loss_function: None
# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: base_link
scan_topic: scan
mode: mapping
debug_logging: false
throttle_scans: 1
transform_publish_period: 0.02 #if 0 never publishes odometry
map_update_interval: 0.5
resolution: 0.01 # This is were you can ajust the resolution of the lidar scan
max_laser_range: 12.0 #for rastering images
minimum_time_interval: 0.25
transform_timeout: 0.2
tf_buffer_duration: 30.
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
enable_interactive_mode: true
# General Parameters
use_scan_matching: true
use_scan_barycenter: true
minimum_travel_distance: 0.0
minimum_travel_heading: 0.0
scan_buffer_size: 20
scan_buffer_maximum_scan_distance: 12.0
link_match_minimum_response_fine: 0.1
link_scan_maximum_distance: 1.5
loop_search_maximum_distance: 3.0
do_loop_closing: true
loop_match_minimum_chain_size: 10
loop_match_maximum_variance_coarse: 3.0
loop_match_minimum_response_coarse: 0.35
loop_match_minimum_response_fine: 0.45
# Correlation Parameters - Correlation Parameters
correlation_search_space_dimension: 0.5
correlation_search_space_resolution: 0.01
correlation_search_space_smear_deviation: 0.1
# Correlation Parameters - Loop Closure Parameters
loop_search_space_dimension: 8.0
loop_search_space_resolution: 0.05
loop_search_space_smear_deviation: 0.03
# Scan Matcher Parameters
distance_variance_penalty: 0.5
angle_variance_penalty: 1.0
fine_search_angle_offset: 0.00349
coarse_search_angle_offset: 0.349
coarse_angle_resolution: 0.0349
minimum_angle_penalty: 0.9
minimum_distance_penalty: 0.5
use_response_expansion: true
```
To start the SLAM node using this command on the remote PC. If this command is run on the Turtlebot 4 you will have a smother experience and will not have as much trouble with connecting but this will limit your resolution because the raspberry pi 4 will have to do all the calculations.
```
ros2 launch turtlebot4_navigation slam.launch.py params:=/full/path/to/slam.yaml
```
To visualize the map run Rviz on the remote PC.
```bash
ros2 launch turtlebot4_viz view_robot.launch.py
```
Once you are done creating the map make sure you save it.
```bash
```
#### Navigation
To launch the navigation program on the Turtlebot 4 run the following commands. One per terminal window making sure to execute them on the Remote PC.
```bash
# Terminal Window 1
ros2 launch turtlebot4_navigation localization.launch.py map:/path/to/map.yaml
# Terminal Window 2
ros2 launch turtlebot4_navigation nav2.launch.py
# Terminal Window 3
ros2 launch turtlebot4_viz view_robot.launch.py
```
Use the `2D Pose Estimate` to select the spot on the map were the robot is at when the Navigation is launched. Then use the `Nav2 Goal` button to select where the robot should navigate to.

9
docs/TurtleBot 4/Setup.md Executable file
View File

@ -0,0 +1,9 @@
Follow these [steps](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debs.html)on the ROS 2 Documentation Page in install ROS2 on your Remote PC, laptop. Then follow these [steps](https://turtlebot.github.io/turtlebot4-user-manual/setup/basic.html) in the official Turtlebot 4 documentation to install all the Turtlebot 4 programs on your Remote PC, laptop.
###### Quick Tip
add the `source /opt/ros/humble/setup.bash` command to the `.bashrc` file so you do not have to source it everytime you open a new terminal window
```bash
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
```
Once everything is install follow the instructions to connect the Turtle bot to the wifi. The WIFI password for the turtlebot access point is `Turtlebot4` and the ssh password is `turtlebot4`. To change the settings on the Create 3 go to the Turtlebot's ip address with the port `8080` and you will see the web interface.

View File

@ -0,0 +1,10 @@
## Undock
This command undocks the Turtlebot 4 from the charging station.
```bash
ros2 action send_goal /undock irobot_create_msgs/action/Undock {}
```
## Dock
This command docks the Turtlebot 4 from the charging station.
```bash
ros2 action send_goal /dock irobot_create_msgs/action/Dock {}
```

View File

@ -0,0 +1,5 @@
## Create 3 Firmware
To install he latest version of the Create 3 firmware go to the [Create 3 firmware Page](https://iroboteducation.github.io/create3_docs/releases/overview/). Then download the latest firmware and navigate to the Create 3 Update Page. Then select the choose file button and locate the `Create3-*.*.*.swu`file on your computer. Finally before flashing make sure the Create 3 is on the charging dock. Once it is on the dock click flash button and wait patently for the robot to flash and then reboot. DO NOT SHUT DOWN OR REMOVE FROM CHARGER. You will know it is done when the robot makes is happy beep.
## Raspberry PI
To update the Raspberry pi download the raspberry pi image and take the sdcard out of the Turtlebot. Then download the latest `.img` from the [Open Source Lab](http://download.ros.org/downloads/turtlebot4/). Once it is downloaded unzip the image and Flash it using the Raspberry PI Imager.

View File

@ -0,0 +1,5 @@
Viewing the Turtlebot 4 sensor data is really easy with Rviz. to view it run the Rviz view model command.
```bash
ros2 launch turtlebot4_viz view_model.launch.py
```

70
docs/index.md Normal file
View File

@ -0,0 +1,70 @@
# Homepage
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
## Code Annotation Examples
### Codeblocks
Some `code` goes here.
### Plain codeblock
A plain codeblock:
```
Some code here
def myfunction()
// some comment
```
#### Code for a specific language
Some more code with the `py` at the start:
``` py
import tensorflow as tf
def whatever()
```
#### With a title
``` py title="bubble_sort.py"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
```
asdkfaj;sldkf
#### With line numbers
```py linenums="1"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
```
#### Highlighting lines
```py hl_lines="2 3"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
```
## Icons and Emojs
:smile:
:fontawesome-regular-face-laugh-wink:
:fontawesome-brands-twitter:{ .twitter }
:octicons-heart-fill-24:{ .heart }

61
mkdocs.yml Normal file
View File

@ -0,0 +1,61 @@
site_name: ROS2 Rhodesstate
theme:
name: material
features:
- navigation.tabs
- navigation.sections
- toc.integrate
- navigation.top
- search.suggest
- search.highlight
- content.tabs.link
- content.code.annotation
- content.code.copy
- content.code.select
language: en
palette:
- scheme: default
toggle:
icon: material/toggle-switch-off-outline
name: Switch to dark mode
primary: teal
accent: purple
- scheme: slate
toggle:
icon: material/toggle-switch
name: Switch to light mode
primary: teal
accent: lime
plugins:
- social
- search
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/thelocker98
- icon: fontawesome/brands/gitlab
link: https://gitea.locker98.com
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_langclass: true
- pymdownx.inlinehilite
- pymdownx.snippets
- admonition
- pymdownx.arithmatex:
generic: true
- footnotes
- pymdownx.details
- pymdownx.superfences
- pymdownx.mark
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
copyright: |
&copy; 2023 <a href="https://github.com/thelocker98" target="_blank" rel="noopener">locker98</a>