update website
This commit is contained in:
parent
d1920d9c63
commit
cdea73fdd7
@ -1,24 +1,7 @@
|
|||||||
# Setup
|
# Building ROS2 packages
|
||||||
## Installing VSCode
|
## Setup
|
||||||
first install vscode using snap
|
|
||||||
```bash
|
|
||||||
sudo snap install code --classic
|
|
||||||
```
|
|
||||||
then add the `ROS` extension from Microsoft.
|
|
||||||
|
|
||||||
## Installing Colcon
|
### Setting up the ROS2 Package Workspace
|
||||||
To install colcon first run the sudo apt install command.
|
|
||||||
``` bash
|
|
||||||
sudo apt install python3-colcon-common-extensions
|
|
||||||
```
|
|
||||||
|
|
||||||
then add the colcon autocomplete to the `.bashrc` file.
|
|
||||||
``` bash
|
|
||||||
echo 'source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash' >> ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# 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.
|
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
|
```bash
|
||||||
colcon build
|
colcon build
|
||||||
@ -29,7 +12,7 @@ echo "source /home/username/package_ws/install/setup.bash" >> ~/.bashrc
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Creating a Python Packages
|
## Creating a Python Packages
|
||||||
#### Setting Up
|
### 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.
|
Go to the workspace folder that was created in the last step and open the `src` folder. In this folder run this command.
|
||||||
```bash
|
```bash
|
||||||
ros2 pkg create {package_name} --build-type ament_python --dependencies rclpy
|
ros2 pkg create {package_name} --build-type ament_python --dependencies rclpy
|
||||||
@ -37,10 +20,10 @@ 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}`
|
add your code in to the folder with the `__init__.py`. This is usually in the folder `src/{package_name}/{package_name}`
|
||||||
|
|
||||||
#### Programming
|
### Programming
|
||||||
create a python file for your first node.
|
create a python file for your first node.
|
||||||
|
|
||||||
```python title="my_first_node.py"
|
```python title="my_first_node.py" linenums="1"
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import rclpy
|
import rclpy
|
||||||
from rclpy.node import Node
|
from rclpy.node import Node
|
||||||
@ -76,7 +59,7 @@ it is setup with the name of the ROS2 command first then the equals followed by
|
|||||||
|
|
||||||
The final step is building the script and testing it.
|
The final step is building the script and testing it.
|
||||||
|
|
||||||
#### Building
|
### Building
|
||||||
go the the `{package_name}_ws` folder with the `src` and `install` folder in it. Then run the `colcon build` command.
|
go the the `{package_name}_ws` folder with the `src` and `install` folder in it. Then run the `colcon build` command.
|
||||||
```bash
|
```bash
|
||||||
colcon build
|
colcon build
|
||||||
@ -84,7 +67,13 @@ colcon build
|
|||||||
|
|
||||||
next run the `source ~/.bashrc` command to reload the workspace source file and the other source files.
|
next run the `source ~/.bashrc` command to reload the workspace source file and the other source files.
|
||||||
|
|
||||||
#### Simplifying Build (specific to python)
|
To help improve the build speed we can also use `--packages-select` to only build a specific package.
|
||||||
|
```bash
|
||||||
|
colcon build --packages-select {package_name}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 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.
|
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
|
```bash
|
||||||
colcon build --symlink-install
|
colcon build --symlink-install
|
||||||
@ -103,7 +92,7 @@ ros2 pkg create {package_name} --build-type ament_cmake --dependencies rclcpp
|
|||||||
|
|
||||||
next create a file in `{package_name}/src`and call it `node_name.cpp`
|
next create a file in `{package_name}/src`and call it `node_name.cpp`
|
||||||
|
|
||||||
```cpp title="node_name.cpp"
|
```cpp title="node_name.cpp" linenums="1"
|
||||||
#include "rclcpp/rclcpp.hpp"
|
#include "rclcpp/rclcpp.hpp"
|
||||||
|
|
||||||
class MyNode : public rclcpp::Node
|
class MyNode : public rclcpp::Node
|
||||||
@ -140,7 +129,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
Next open the program menu on VSCode using `CTRL + SHIFT + P`. Select the `C/C++: Edit Configurations (JSON)`. Make Sure the `c_cpp_properties.json` file has the `"/opt/ros/humble/include/**"` include
|
Next open the program menu on VSCode using `CTRL + SHIFT + P`. Select the `C/C++: Edit Configurations (JSON)`. Make Sure the `c_cpp_properties.json` file has the `"/opt/ros/humble/include/**"` include
|
||||||
|
|
||||||
```json hl_lines="9"
|
```json hl_lines="9" linenums="1"
|
||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
@ -1,4 +1,12 @@
|
|||||||
# Installing
|
# Installing Tools
|
||||||
|
## Installing VSCode
|
||||||
|
first install vscode using snap
|
||||||
|
```bash
|
||||||
|
sudo snap install code --classic
|
||||||
|
```
|
||||||
|
then add the `ROS` extension from Microsoft.
|
||||||
|
|
||||||
|
## Installing Colcon
|
||||||
To install colcon first run the sudo apt install command.
|
To install colcon first run the sudo apt install command.
|
||||||
``` bash
|
``` bash
|
||||||
sudo apt install python3-colcon-common-extensions
|
sudo apt install python3-colcon-common-extensions
|
||||||
@ -7,4 +15,5 @@ sudo apt install python3-colcon-common-extensions
|
|||||||
then add the colcon autocomplete to the `.bashrc` file.
|
then add the colcon autocomplete to the `.bashrc` file.
|
||||||
``` bash
|
``` bash
|
||||||
echo 'source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash' >> ~/.bashrc
|
echo 'source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash' >> ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
28
docs/General ROS 2/Building ROS 2 Packages/Message Types.md
Executable file
28
docs/General ROS 2/Building ROS 2 Packages/Message Types.md
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
# Message Types
|
||||||
|
## What is a Message Type
|
||||||
|
In ROS 2 (Robot Operating System 2), a `msg` type refers to a message definition that contains data structures used for communication between nodes. These messages are the building blocks for publishing and subscribing to topics, which enable nodes to exchange information with each other. Think of a message as a container that holds specific types and amounts of data, like a digital package being sent between nodes in a ROS 2 nodes. Each type of message corresponds to a particular set of data fields and their data types (e.g., `int8`, `float32`, `String`). When you define a message, you're specifying the structure of the data that will be sent or received by nodes. This allows for more organized and efficient communication between nodes.
|
||||||
|
## How to find them
|
||||||
|
When creating a publisher you have to figure out what data type it is going to publish. To find examples of the different data types in ROS 2 you can run a special command.
|
||||||
|
|
||||||
|
```bash { .annotate }
|
||||||
|
ros2 interface show example_interfaces/msg/String #(1)
|
||||||
|
```
|
||||||
|
|
||||||
|
1. In this case it was the `String` type that I used but it could have been any other type. To get a list use `Tab`before typing `String` for a autocomplete list of options.
|
||||||
|
|
||||||
|
## Including Message Types
|
||||||
|
Once you have found the message type you will need to make sure that it is imported. This can be pretty easily in both C++ and Python.
|
||||||
|
|
||||||
|
Below you can see that we use the `String` as the message type. This example works for other types as well of messages as well. You can just swap `String` for whatever other data type that is available.
|
||||||
|
=== "Python"
|
||||||
|
```python
|
||||||
|
from example_interfaces.msg import String
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "C++"
|
||||||
|
``` c++
|
||||||
|
#include "example_interfaces/msg/string.hpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
80
docs/General ROS 2/Building ROS 2 Packages/Publisher.md
Executable file
80
docs/General ROS 2/Building ROS 2 Packages/Publisher.md
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
# Publisher
|
||||||
|
## Sample Code
|
||||||
|
Here is the code for creating a node that publishes strings to `/robot_news` at 2Hz.
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
``` python title="robot_news_station.py" linenums="1"
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import rclpy
|
||||||
|
from rclpy.node import Node
|
||||||
|
# import message type
|
||||||
|
from example_interfaces.msg import String
|
||||||
|
|
||||||
|
class RobotNewsStationNode(Node):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("robot_news_station")
|
||||||
|
|
||||||
|
# Create publisher with the proper message type
|
||||||
|
self.publisher_ = self.create_publisher(String, "robot_news", 10)
|
||||||
|
# Create timer to triger message at 2Hz
|
||||||
|
self.timer_ = self.create_timer(0.5, self.publish_news)
|
||||||
|
self.get_logger().info("Starting the robot news station")
|
||||||
|
|
||||||
|
def publish_news(self):
|
||||||
|
# Create massage payload
|
||||||
|
msg = String()
|
||||||
|
# Add 'Hello' as the data
|
||||||
|
msg.data = "Hello"
|
||||||
|
# Publish the data payload
|
||||||
|
self.publisher_.publish(msg)
|
||||||
|
|
||||||
|
|
||||||
|
def main (args=None):
|
||||||
|
rclpy.init(args=args)
|
||||||
|
node = RobotNewsStationNode()
|
||||||
|
rclpy.spin(node)
|
||||||
|
rclpy.shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "C++"
|
||||||
|
``` python title="robot_news_station.cpp" linenums="1"
|
||||||
|
#include "rclcpp/rclcpp.hpp"
|
||||||
|
#include "example_interfaces/msg/string.hpp"
|
||||||
|
|
||||||
|
class RobotNewsStationNode : public rclcpp::Node
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RobotNewsStationNode() : Node("robot_news_station")
|
||||||
|
{
|
||||||
|
publisher_ = this->create_publisher<example_interfaces::msg::String>("robot_news", 10);
|
||||||
|
timer_ = this->create_wall_timer(std::chrono::milliseconds(500),
|
||||||
|
std::bind(&RobotNewsStationNode::publishNews, this));
|
||||||
|
RCLCPP_INFO(this->get_logger(),"Robot News Station has been started.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void publishNews()
|
||||||
|
{
|
||||||
|
auto msg = example_interfaces::msg::String();
|
||||||
|
msg.data = std::string("Hi, this is") + robot_name_ + std::string(" from the Robot News Station") ;
|
||||||
|
publisher_->publish(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string robot_name_;
|
||||||
|
rclcpp::Publisher<example_interfaces::msg::String>::SharedPtr publisher_;
|
||||||
|
rclcpp::TimerBase::SharedPtr timer_;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
rclcpp::init(argc, argv);
|
||||||
|
auto node = std::make_shared<RobotNewsStationNode>();
|
||||||
|
rclcpp::spin(node);
|
||||||
|
rclcpp::shutdown();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
91
docs/General ROS 2/Building ROS 2 Packages/ROS 2 Dependencies.md
Executable file
91
docs/General ROS 2/Building ROS 2 Packages/ROS 2 Dependencies.md
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
# ROS 2 Dependencies
|
||||||
|
## Dependencies
|
||||||
|
When I comes to adding packages and libraries to ROS 2 you will have to include them in the respective programs but they will also need to be added to the build files as dependencies. Doing this is just a little bit different in python and C++ so I will show both ways. You can import or include any library but for simplicity we will just use the `example_interface` library in this example
|
||||||
|
|
||||||
|
## Python
|
||||||
|
In python you only have to add the library to the `package.xml` like shown.
|
||||||
|
|
||||||
|
```xml title="package.xml" hl_lines="10-11" linenums="1"
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||||
|
<package format="3">
|
||||||
|
<name>my_py_pkg</name>
|
||||||
|
<version>0.0.0</version>
|
||||||
|
<description>TODO: Package description</description>
|
||||||
|
<maintainer email="ros-laptop1@todo.todo">ros-laptop1</maintainer>
|
||||||
|
<license>TODO: License declaration</license>
|
||||||
|
|
||||||
|
<depend>rclpy</depend>
|
||||||
|
<depend>example_interfaces</depend>
|
||||||
|
|
||||||
|
<test_depend>ament_copyright</test_depend>
|
||||||
|
<test_depend>ament_flake8</test_depend>
|
||||||
|
<test_depend>ament_pep257</test_depend>
|
||||||
|
<test_depend>python3-pytest</test_depend>
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_python</build_type>
|
||||||
|
</export>
|
||||||
|
</package>
|
||||||
|
```
|
||||||
|
|
||||||
|
## C++
|
||||||
|
In C++ it is a little harder to add libraries to the build files. The first place to add the library is the `package.xml` just like in python.
|
||||||
|
|
||||||
|
```xml title="package.xml" hl_lines="12-13" linenums="1"
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||||
|
<package format="3">
|
||||||
|
<name>my_cpp_pkg</name>
|
||||||
|
<version>0.0.0</version>
|
||||||
|
<description>TODO: Package description</description>
|
||||||
|
<maintainer email="ros-laptop1@todo.todo">ros-laptop1</maintainer>
|
||||||
|
<license>TODO: License declaration</license>
|
||||||
|
|
||||||
|
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||||
|
|
||||||
|
<depend>rclcpp</depend>
|
||||||
|
<depend>example_interfaces</depend>
|
||||||
|
|
||||||
|
<test_depend>ament_lint_auto</test_depend>
|
||||||
|
<test_depend>ament_lint_common</test_depend>
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_cmake</build_type>
|
||||||
|
</export>
|
||||||
|
|
||||||
|
</package>
|
||||||
|
```
|
||||||
|
|
||||||
|
Next you have to add the libraries to multiple places in the `CMakeLists.txt`.
|
||||||
|
```cmake title="CMakeLists.txt" hl_lines="9-11 17 20" linenums="1"
|
||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
project(my_cpp_pkg)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# find dependencies
|
||||||
|
find_package(ament_cmake REQUIRED)
|
||||||
|
find_package(rclcpp REQUIRED)
|
||||||
|
find_package(example_interfaces REQUIRED)
|
||||||
|
|
||||||
|
add_executable(cpp_node src/my_first_node.cpp)
|
||||||
|
ament_target_dependencies(cpp_node rclcpp)
|
||||||
|
|
||||||
|
add_executable(robot_news_station src/robot_news_station.cpp)
|
||||||
|
ament_target_dependencies(robot_news_station rclcpp example_interfaces)
|
||||||
|
|
||||||
|
add_executable(smartphone src/smartphone.cpp)
|
||||||
|
ament_target_dependencies(smartphone rclcpp example_interfaces)
|
||||||
|
|
||||||
|
install(TARGETS
|
||||||
|
cpp_node
|
||||||
|
robot_news_station
|
||||||
|
smartphone
|
||||||
|
DESTINATION lib/${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_package()
|
||||||
|
```
|
67
docs/General ROS 2/Building ROS 2 Packages/Subscriber.md
Executable file
67
docs/General ROS 2/Building ROS 2 Packages/Subscriber.md
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
# Subscriber
|
||||||
|
|
||||||
|
## Sample Code
|
||||||
|
Here is the code for creating a python node that subscribes to `/robot_news` at 2Hz.
|
||||||
|
|
||||||
|
=== "Python"
|
||||||
|
``` python title="smartphone.py" linenums="1"
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import rclpy
|
||||||
|
from rclpy.node import Node
|
||||||
|
from example_interfaces.msg import String
|
||||||
|
|
||||||
|
class SmartphoneNode(Node):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("smartphone")
|
||||||
|
self.subscriber_ = self.create_subscription(String, 'robot_news', self.callback_robot_news, 10)
|
||||||
|
self.get_logger().info("Smartphone has been starte.")
|
||||||
|
|
||||||
|
def callback_robot_news(self, msg):
|
||||||
|
self.get_logger().info(msg.data)
|
||||||
|
|
||||||
|
def main (args=None):
|
||||||
|
rclpy.init(args=args)
|
||||||
|
node = SmartphoneNode()
|
||||||
|
rclpy.spin(node)
|
||||||
|
rclpy.shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
=== "C++"
|
||||||
|
``` python title="smartphone.cpp" linenums="1"
|
||||||
|
#include "rclcpp/rclcpp.hpp"
|
||||||
|
#include "example_interfaces/msg/string.hpp"
|
||||||
|
|
||||||
|
class SmartphoneNode : public rclcpp::Node
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SmartphoneNode() : Node("smartphone")
|
||||||
|
{
|
||||||
|
subscriber_ = this->create_subscription<example_interfaces::msg::String>(
|
||||||
|
"robot_news", 10,
|
||||||
|
std::bind(&SmartphoneNode::callbackRobotNews, this, std::placeholders::_1));
|
||||||
|
RCLCPP_INFO(this->get_logger(), "Smartphone has been started.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void callbackRobotNews(const example_interfaces::msg::String::SharedPtr msg)
|
||||||
|
{
|
||||||
|
RCLCPP_INFO(this->get_logger(), "%s", msg->data.c_str());
|
||||||
|
}
|
||||||
|
rclcpp::Subscription<example_interfaces::msg::String>::SharedPtr subscriber_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
rclcpp::init(argc, argv);
|
||||||
|
auto node = std::make_shared<SmartphoneNode>();
|
||||||
|
rclcpp::spin(node);
|
||||||
|
rclcpp::shutdown();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
38
docs/General ROS 2/Debugging.md
Executable file
38
docs/General ROS 2/Debugging.md
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
# Debugging
|
||||||
|
## RQT and RQT_Graph
|
||||||
|
RQT is a GUI tool to debug your ROS 2 environment and nodes. It helps visualize what is going on in the different ROS 2 programs and how they are linked to gather. It also helps us see where bugs might occur and how they might be solved and prevented.
|
||||||
|
|
||||||
|
To launch RQT we can just simply run `rqt` in our terminal.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rqt
|
||||||
|
```
|
||||||
|
|
||||||
|
RQT is made up of a bunch of different plugins. One of the most useful plugins is the `node graph` plugin found under `Plugins>Introspection>Node Graph`. This tool allows us to visualize the layout of our nodes and how they are communicating
|
||||||
|
|
||||||
|
You can also start rqt with the graph plugin enabled with one of the following two commands
|
||||||
|
```bash
|
||||||
|
# Method 1
|
||||||
|
ros2 run rqt_graph rqt_graph
|
||||||
|
|
||||||
|
# Method 2
|
||||||
|
rqt_graph
|
||||||
|
```
|
||||||
|
|
||||||
|
## Debugging ROS 2 Topics
|
||||||
|
To get the frequency of how fast a topic is being published the run this command:
|
||||||
|
```bash
|
||||||
|
ros2 topic hz /topic_to_see
|
||||||
|
```
|
||||||
|
|
||||||
|
To get information on who is publishing and listening to a topic run this command:
|
||||||
|
```bash
|
||||||
|
ros2 topic info /topic_to_see
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the bandwidth of a topic can can run this command:
|
||||||
|
```bash
|
||||||
|
ros2 topic bw /topic_to_see
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
Get a map of the nodes on the ros network
|
|
||||||
```bash
|
|
||||||
ros2 run rqt_graph rqt_graph
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
59
docs/General ROS 2/Micro ROS/Micro ROS Bridge.md
Executable file
59
docs/General ROS 2/Micro ROS/Micro ROS Bridge.md
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
# Micro ROS Bridge
|
||||||
|
## Serial Bridge
|
||||||
|
|
||||||
|
=== "docker run"
|
||||||
|
```bash
|
||||||
|
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO serial --dev [YOUR BOARD PORT] -v6
|
||||||
|
```
|
||||||
|
=== "docker compose"
|
||||||
|
```yaml title="docker-compose.yaml"
|
||||||
|
services:
|
||||||
|
micro_ros_agent:
|
||||||
|
image: microros/micro-ros-agent:humble
|
||||||
|
command: serial --dev [YOUR BOARD PORT] -v6
|
||||||
|
network_mode: "host"
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /dev:/dev
|
||||||
|
- /dev/shm:/dev/shm
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## TCP Bridge
|
||||||
|
|
||||||
|
=== "docker run"
|
||||||
|
```bash
|
||||||
|
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO tcp4 --port 8888 -v6
|
||||||
|
```
|
||||||
|
=== "docker compose"
|
||||||
|
```yaml title="docker-compose.yaml"
|
||||||
|
services:
|
||||||
|
micro_ros_agent:
|
||||||
|
image: microros/micro-ros-agent:humble
|
||||||
|
command: tcp4 --port 8888 -v6
|
||||||
|
network_mode: "host"
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /dev:/dev
|
||||||
|
- /dev/shm:/dev/shm
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## UDP Bridge
|
||||||
|
|
||||||
|
=== "docker run"
|
||||||
|
```bash
|
||||||
|
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO udp4 --port 8888 -v6
|
||||||
|
```
|
||||||
|
=== "docker compose"
|
||||||
|
```yaml title="docker-compose.yaml"
|
||||||
|
services:
|
||||||
|
micro_ros_agent:
|
||||||
|
image: microros/micro-ros-agent:humble
|
||||||
|
command: udp4 --port 8888 -v6
|
||||||
|
network_mode: "host"
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /dev:/dev
|
||||||
|
- /dev/shm:/dev/shm
|
||||||
|
```
|
@ -1,3 +1,25 @@
|
|||||||
# Nodes
|
dd# ROS 2 Nodes
|
||||||
|
## Node Layout
|
||||||
Nodes are the different ROS topics. in the below picture the nodes are in blue.
|
Nodes are the different ROS topics. in the below picture the nodes are in blue.
|
||||||
![[ros2_nodes.png|900]]
|
![[ros2_nodes.png|900]]
|
||||||
|
|
||||||
|
## Getting Node info
|
||||||
|
To get information about a ROS 2 node you can use the ros2 cli to explore the nodes.
|
||||||
|
|
||||||
|
The command `ros2 node list` shows a list of all the nodes avalible. It can be handy to make sure the nodes are all discovered and working properly.
|
||||||
|
```bash
|
||||||
|
ros2 node list
|
||||||
|
```
|
||||||
|
|
||||||
|
Their is also a ROS 2 command for getting information about an individual node.
|
||||||
|
```bash
|
||||||
|
ros2 node info {/node_name}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Renaming a Node at Runtime
|
||||||
|
Renaming a node at runtime is useful when their are two ROS packages with the same node name. This method will allow you to change the name of the node so that both packages can run with out interference.
|
||||||
|
|
||||||
|
The command to rename a node is:
|
||||||
|
```bash
|
||||||
|
ros2 run {package_name} {node_name} --ros-args -r __node:{new_name}
|
||||||
|
```
|
29
docs/General ROS 2/ROS 2 Topics.md
Executable file
29
docs/General ROS 2/ROS 2 Topics.md
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
# ROS 2 Topics
|
||||||
|
## ROS 2 Topic Overview
|
||||||
|
In ROS 2, **topics** are the communication channels used for **publish-subscribe messaging**. They allow nodes to exchange data asynchronously without direct connections. Here's how it works:
|
||||||
|
|
||||||
|
1. **Publishers**: Nodes that send messages to a topic. For example, a sensor node might publish temperature readings to a `/temperature` topic.
|
||||||
|
2. **Subscribers**: Nodes that receive messages from a topic. For instance, a logging node might subscribe to the `/temperature` topic to record data.
|
||||||
|
3. **Messages**: The data structure exchanged over topics. These are predefined formats (like integers, strings, arrays, etc.) specified in `.msg` files.
|
||||||
|
|
||||||
|
|
||||||
|
## Key Features:
|
||||||
|
|
||||||
|
- **Decoupled Communication**: Publishers and subscribers do not need to know about each other.
|
||||||
|
- **Topic Names**: Identified by strings (e.g., `/robot/speed`).
|
||||||
|
- **Quality of Service (QoS)**: Configurations like reliability and durability to ensure robust communication in various environments.
|
||||||
|
- **Tools**:
|
||||||
|
- Use `ros2 topic list` to view active topics.
|
||||||
|
- Use `ros2 topic echo` to see the data published on a topic.
|
||||||
|
- Use `ros2 topic pub` to manually publish data for testing.
|
||||||
|
|
||||||
|
This structure supports scalable and modular robotic applications.
|
||||||
|
|
||||||
|
|
||||||
|
## Renaming a Topic at Runtime
|
||||||
|
Renaming a node at runtime is useful when their are two ROS packages with the same node name. This method will allow you to change the name of the node so that both packages can run with out interference.
|
||||||
|
|
||||||
|
The command to rename a topic is:
|
||||||
|
```bash
|
||||||
|
ros2 run {package_name} {node_name} --ros-args -r __{topic_old_name}:{topic_new_name}
|
||||||
|
```
|
18
docs/General ROS 2/TurtleSim/Turtlesim Overview.md
Executable file
18
docs/General ROS 2/TurtleSim/Turtlesim Overview.md
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
# Turtlesim Overview
|
||||||
|
## What is Turtlesim
|
||||||
|
Turtlesim is a simple python node that helps you learn ROS 2 with simple examples and tutorials.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
To install the ROS 2 Turtlesim you will need run `sudo apt install ros-humble-turtlesim`.
|
||||||
|
```bash
|
||||||
|
sudo apt install ros-humble-turtlesim
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Basic Features of Turtlesim
|
||||||
|
The Turtlesim package comes with two simple nodes a `turtlesim_node` and a `turtle_teleop_key` node. The `turtlesim_node` launches a window that has a little 2D turtle in it. The `turtle_teleop_key` node allows you to use the arrow keys to move and steer the little turtle around its 2D world. These can be launched using their respective commands.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 turtlesim turtlesim_node
|
||||||
|
ros2 turtlesim turtle_teleop_key
|
||||||
|
```
|
19
docs/Husky 200/Husky 200 Simulator.md
Executable file
19
docs/Husky 200/Husky 200 Simulator.md
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
# Husky 200 Simulator
|
||||||
|
## Launching Simulator
|
||||||
|
To launch Gazbo with the Husky 200 robot in it run the following command.
|
||||||
|
```bash
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
|||||||
launching simulator
|
# robot.yaml
|
||||||
|
The `robot.yaml` file has all the configurations for the Husky 200 robot and the other clearpathrobotics robots.
|
||||||
|
## Visualizing
|
||||||
|
To see the `robot.yaml` file run the following command. It will show you how the robot looks and where all the sensors are placed. It comes in hand for not only confirming that everything is on the robot in the right place but that their is also no errors in the robot.yaml file.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ros2 launch clearpath_gz simulation.launch.py setup_path:=$HOME/clearpath
|
ros2 launch clearpath_viz view_model.launch.py setup_path:=/home/brickman/clearpath/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Using Manipulator
|
## Sample file
|
||||||
robot.yaml
|
Below is a sample of the robot.yaml file.
|
||||||
```yaml
|
|
||||||
|
```yaml title="robot.yaml" linenums="1"
|
||||||
serial_number: a200-0000
|
serial_number: a200-0000
|
||||||
version: 0
|
version: 0
|
||||||
system:
|
system:
|
||||||
@ -36,21 +41,3 @@ manipulators:
|
|||||||
gripper:
|
gripper:
|
||||||
model: kinova_2f_lite
|
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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
```bash
|
|
||||||
ros2 launch clearpath_viz view_model.launch.py setup_path:=/home/brickman/clearpath/
|
|
||||||
```
|
|
@ -1 +1,3 @@
|
|||||||
|
# Oak D Pro Camera
|
||||||
|
## Information and Resources
|
||||||
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/).
|
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/).
|
@ -1,4 +1,5 @@
|
|||||||
# SLAM
|
# SLAM and Navigation
|
||||||
|
## SLAM
|
||||||
### Troubleshooting
|
### Troubleshooting
|
||||||
#### Date and Time off
|
#### 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`.
|
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`.
|
||||||
@ -20,7 +21,7 @@ Once this command is running then you should be able to drive the robot like nor
|
|||||||
|
|
||||||
### Launching the SLAM command
|
### 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.
|
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 title="slam.yaml"
|
```yaml title="slam.yaml" linenums="1"
|
||||||
slam_toolbox:
|
slam_toolbox:
|
||||||
ros__parameters:
|
ros__parameters:
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ ros2 run nav2_map_server map_saver_cli -f "map_name"
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Navigation
|
## 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.
|
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
|
```bash
|
||||||
# Terminal Window 1
|
# Terminal Window 1
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
# Setting Up Turtlebot 4
|
||||||
|
## Resources
|
||||||
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.
|
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
|
## 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
|
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
|
```bash
|
||||||
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
|
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
|
@ -1,3 +1,4 @@
|
|||||||
|
# Turtlebot 4 ROS 2 Commands
|
||||||
## Undock
|
## Undock
|
||||||
This command undocks the Turtlebot 4 from the charging station.
|
This command undocks the Turtlebot 4 from the charging station.
|
||||||
```bash
|
```bash
|
@ -1,3 +1,4 @@
|
|||||||
|
# Updating ROS on Turtlebot 4
|
||||||
## Create 3 Firmware
|
## 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.
|
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.
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# Viewing Turtlebot 4 Sensor Data
|
||||||
Viewing the Turtlebot 4 sensor data is really easy with Rviz. to view it run the Rviz view model command.
|
Viewing the Turtlebot 4 sensor data is really easy with Rviz. to view it run the Rviz view model command.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -52,6 +52,8 @@ markdown_extensions:
|
|||||||
- footnotes
|
- footnotes
|
||||||
- pymdownx.details
|
- pymdownx.details
|
||||||
- pymdownx.superfences
|
- pymdownx.superfences
|
||||||
|
- pymdownx.tabbed:
|
||||||
|
alternate_style: true
|
||||||
- pymdownx.mark
|
- pymdownx.mark
|
||||||
- attr_list
|
- attr_list
|
||||||
- pymdownx.emoji:
|
- pymdownx.emoji:
|
||||||
|
Loading…
Reference in New Issue
Block a user