| ... | @@ -210,7 +210,7 @@ Publishing on a Topic |
... | @@ -210,7 +210,7 @@ Publishing on a Topic |
|
|
|
|
|
|
|
At this point, your node is not doing anything interesting. First, we will make our node send a message on a topic. We will make it send a velocity on ```/cmd_vel```.
|
|
At this point, your node is not doing anything interesting. First, we will make our node send a message on a topic. We will make it send a velocity on ```/cmd_vel```.
|
|
|
|
|
|
|
|
Before starting, you should study the [official Python tutorial](https://docs.ros.org/en/galactic/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.html) or the [official C++ tutorial](https://docs.ros.org/en/galactic/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html).
|
|
Before starting, you should study the [official Python tutorial](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.html) or the [official C++ tutorial](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html).
|
|
|
|
|
|
|
|
Modify the publisher example to instead publish a ```geometry_msgs/msg/Twist``` (you can import it from ```import geometry_msgs.msg```) with a linear velocity of ```0.1``` and angular velocity of ```0.05```. We strongly advise that you follow an incremental approach:
|
|
Modify the publisher example to instead publish a ```geometry_msgs/msg/Twist``` (you can import it from ```import geometry_msgs.msg```) with a linear velocity of ```0.1``` and angular velocity of ```0.05```. We strongly advise that you follow an incremental approach:
|
|
|
|
|
|
| ... | @@ -220,7 +220,7 @@ Modify the publisher example to instead publish a ```geometry_msgs/msg/Twist``` |
... | @@ -220,7 +220,7 @@ Modify the publisher example to instead publish a ```geometry_msgs/msg/Twist``` |
|
|
* Check that it runs properly, you can use ```ros2 topic echo ...``` or ```rqt``` to check that a message is published by the node, it should be a string.
|
|
* Check that it runs properly, you can use ```ros2 topic echo ...``` or ```rqt``` to check that a message is published by the node, it should be a string.
|
|
|
* Modify the script to publish a ```geometry_msgs/msg/Twist``` on ```/cmd_vel``` with a linear velocity of ```0.1``` and angular velocity of ```0.05```.
|
|
* Modify the script to publish a ```geometry_msgs/msg/Twist``` on ```/cmd_vel``` with a linear velocity of ```0.1``` and angular velocity of ```0.05```.
|
|
|
|
|
|
|
|
The documentation for ```geometry_msgs/Twist``` can be found online at [geometry_msgs/Twist](https://docs.ros2.org/galactic/api/geometry_msgs/msg/Twist.html) or by running ```ros2 msg info geometry_msgs/Twist```.
|
|
The documentation for ```geometry_msgs/Twist``` can be found online at [geometry_msgs/Twist](https://docs.ros2.org/humble/api/geometry_msgs/msg/Twist.html) or by running ```ros2 msg info geometry_msgs/Twist```.
|
|
|
|
|
|
|
|
Listening to a Topic
|
|
Listening to a Topic
|
|
|
-----------------
|
|
-----------------
|
| ... | @@ -244,7 +244,7 @@ So that we can run our program this way: |
... | @@ -244,7 +244,7 @@ So that we can run our program this way: |
|
|
ros2 run air_lab2 lab2_node --ros-args -p linear:=0.5 -p angular:=0.1 -p distance:=0.4
|
|
ros2 run air_lab2 lab2_node --ros-args -p linear:=0.5 -p angular:=0.1 -p distance:=0.4
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Before starting, you should study the [official Python tutorial](https://docs.ros.org/en/galactic/Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-Python.html) or the [official C++ tutorial](https://docs.ros.org/en/galactic/Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-CPP.html).
|
|
Before starting, you should study the [official Python tutorial](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-Python.html) or the [official C++ tutorial](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-CPP.html).
|
|
|
|
|
|
|
|
Create a ```linear```, ```angular``` and ```distance``` parameter.
|
|
Create a ```linear```, ```angular``` and ```distance``` parameter.
|
|
|
|
|
|
| ... | @@ -301,7 +301,7 @@ We will use the ```NavigateToPose``` action. You can check its type with: |
... | @@ -301,7 +301,7 @@ We will use the ```NavigateToPose``` action. You can check its type with: |
|
|
ros2 interface show nav2_msgs/action/NavigateToPose
|
|
ros2 interface show nav2_msgs/action/NavigateToPose
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Before starting the implementation, study the [official action tutorial](https://docs.ros.org/en/galactic/Tutorials/Intermediate/Writing-an-Action-Server-Client/Py.html).
|
|
Before starting the implementation, study the [official action tutorial](https://docs.ros.org/en/humble/Tutorials/Intermediate/Writing-an-Action-Server-Client/Py.html).
|
|
|
|
|
|
|
|
We already modified the tutorial, so that you can use the following in ```random_exploration.py``` to go to a single location:
|
|
We already modified the tutorial, so that you can use the following in ```random_exploration.py``` to go to a single location:
|
|
|
|
|
|
| ... | @@ -382,7 +382,7 @@ We will use the ```NavigateToPose``` action. You can check its type with: |
... | @@ -382,7 +382,7 @@ We will use the ```NavigateToPose``` action. You can check its type with: |
|
|
ros2 interface show nav2_msgs/action/NavigateToPose
|
|
ros2 interface show nav2_msgs/action/NavigateToPose
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Before starting the implementation, study the [official action tutorial](https://docs.ros.org/en/galactic/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.html).
|
|
Before starting the implementation, study the [official action tutorial](https://docs.ros.org/en/humble/Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.html).
|
|
|
|
|
|
|
|
We already modified the tutorial, so that you can use the following in ```random_exploration.py``` to go to a single location:
|
|
We already modified the tutorial, so that you can use the following in ```random_exploration.py``` to go to a single location:
|
|
|
|
|
|
| ... | | ... | |