... | @@ -3,6 +3,16 @@ Lab 2: Navigation |
... | @@ -3,6 +3,16 @@ Lab 2: Navigation |
|
|
|
|
|
In this lab, you will start programming your first ROS node.
|
|
In this lab, you will start programming your first ROS node.
|
|
|
|
|
|
|
|
<div style="padding: 5pt;background: rgb(221, 250, 221);border-left: 3px solid rgb(106, 222, 106);margin-bottom: 1ex;">
|
|
|
|
|
|
|
|
**Remainder!**
|
|
|
|
|
|
|
|
```start_ros``` needs to be used to start ```bash``` terminal with ROS setup when you open a new Terminal window.
|
|
|
|
|
|
|
|
**This has to be run always before any commands discussed below when using new Terminal window, otherwise ROS commands will not work.**
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
Setup the environment
|
|
Setup the environment
|
|
---------------------
|
|
---------------------
|
|
|
|
|
... | @@ -28,7 +38,6 @@ In ```~/TDDE05/ros2_ws/```, you will now have four directories |
... | @@ -28,7 +38,6 @@ In ```~/TDDE05/ros2_ws/```, you will now have four directories |
|
|
|
|
|
Setup GIT Repository
|
|
Setup GIT Repository
|
|
--------------------
|
|
--------------------
|
|
|
|
|
|
<details>
|
|
<details>
|
|
<summary><span style="font-weight:bold;">Click me - Your GIT repository and adding SSH Key!</span></summary>
|
|
<summary><span style="font-weight:bold;">Click me - Your GIT repository and adding SSH Key!</span></summary>
|
|
|
|
|
... | @@ -57,6 +66,43 @@ git remote add origin git@gitlab.liu.se:tdde05-2025/air-labs-XX.git |
... | @@ -57,6 +66,43 @@ git remote add origin git@gitlab.liu.se:tdde05-2025/air-labs-XX.git |
|
git push --set-upstream origin master
|
|
git push --set-upstream origin master
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Using Visual Studio Code as IDE
|
|
|
|
--------------------
|
|
|
|
You can use Visual Studio Code to work with your files. It's important to start the VSCode in the ROS environment, that is, execute first ```start_ros``` before executing ```code``` command. Once VSCode has started ```Open Folder``` and select ```~/TDDE05/ros2_ws``` folder.
|
|
|
|
|
|
|
|
If you are using Python, no additional steps are required.
|
|
|
|
|
|
|
|
If you are using C++, you can add a custom build command by editing the default built task (```Configure Default Built Task...``` in ```Terminal``` menu bar). Use the following settings:
|
|
|
|
```bash
|
|
|
|
{
|
|
|
|
"version": "2.0.0",
|
|
|
|
"tasks": [
|
|
|
|
{
|
|
|
|
"type": "shell",
|
|
|
|
"label": "C/C++: clang-14 build active file",
|
|
|
|
"command": "tdde05-build",
|
|
|
|
"options": {
|
|
|
|
"cwd": "${fileDirname}"
|
|
|
|
},
|
|
|
|
"problemMatcher": [
|
|
|
|
"$gcc"
|
|
|
|
],
|
|
|
|
"group": {
|
|
|
|
"kind": "build",
|
|
|
|
"isDefault": true
|
|
|
|
},
|
|
|
|
"detail": "compiler: /usr/bin/clang-14"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
<details>
|
|
|
|
<summary><span style="font-weight:bold;">Click me - VSCode screenshot</span></summary>
|
|
|
|
|
|
|
|

|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
Create a package for screen and Rviz
|
|
Create a package for screen and Rviz
|
|
------------------------------------
|
|
------------------------------------
|
|
|
|
|
... | @@ -214,7 +260,7 @@ The turtlebot4 includes a motion planner that can navigate and avoid obstacles. |
... | @@ -214,7 +260,7 @@ The turtlebot4 includes a motion planner that can navigate and avoid obstacles. |
|
ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose "pose: {header: {frame_id: map}, pose: {position: {x: 6.0, y: 2.0, z: 0.0}, orientation:{x: 0.0, y: 0.0, z: 0, w: 1.0000000}}}"
|
|
ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose "pose: {header: {frame_id: map}, pose: {position: {x: 6.0, y: 2.0, z: 0.0}, orientation:{x: 0.0, y: 0.0, z: 0, w: 1.0000000}}}"
|
|
```
|
|
```
|
|
|
|
|
|
It can also be started from RViz. Before we start, you should add the following visualizations:
|
|
It can also be started from RViz. Before we start, you should add the following visualizations (similarly to Lab1, two types should be used, i.e., ```Map``` and ```Path```):
|
|
|
|
|
|
* ```/global_costmap/costmap``` and change the colorscheme to costmap
|
|
* ```/global_costmap/costmap``` and change the colorscheme to costmap
|
|
* ```/local_costmap/costmap``` and change the colorscheme to costmap
|
|
* ```/local_costmap/costmap``` and change the colorscheme to costmap
|
... | | ... | |