my_bot

https://github.com/SunzidHassan/my_bot/issues

Robot Navigation

We want to develop a robot navigation algorithm that can process robot’s sensor data to generate robot navigation commands to fulfill the given objective.

For this toy problem, we have a differential driver robot with the following sensors:

Objective: we want to write a program that can guide the robot to score goals!

Environments:

We can first develop our algorithm in a simulation environment:
Simulation Environment

And then test the algorithm in real world.
Robot

For simulation, we need:

Setting up Robot Operating System Envrionment

Robot Operating System (ROS) requires specific versions of Ubuntu. For example, ROS 2 Humble require Ubuntu 22.04. We can use Visual Studio Code dev container to setup ROS environment in a wide variety of operating systems. For this we need:

Install Visual Studio Code

Use app store, or visit Download Visual Studio Code.

Install docker engine

Ubuntu

Find Install using the convenience script from Install Docker Engine on Ubuntu. In your terminal, execute

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh

Post installation steps

sudo groupadd docker
sudo usermod -aG docker $USER

Then reboot your pc.

Setup ROS Container

Please don’t add PyThon or Anaconda extensions.

Clone the robot code

Go to https://github.com/SunzidHassan/src.git, click Use this template > Create a new repository. Give it a suitable name, and copy the url of your repository.

Setting up the simulation environment

Open a terminal and execute the following commands:

cd my_bot && mkdir src
git clone <URL OF YOUR REPOSITORY>
cd my_bot
colcon build --symlink-install
source install/setup.bash
ros2 launch my_bot launch_sim.launch.py world:=./src/my_bot/worlds/football.world

Wait for the simulation to start. Then open a new terminal and execute the following commands:

cd my_bot
source install/setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard

You can now drive the robot in the simulated environment.

To observe the sensor readings, open a new terminal and execute:

rviz2 -d src/my_bot/config/view_bot.rviz

Controlling the robot

Open a new terminal and execute:

ros2 run my_bot_controller my_bot_subpub

You’ll find the robot has started to move automatically. You can also find some informative output in the terminal.

In your vscode editor, open the file: my_bot>src>my_bot_controller>my_bot_controller>my_bot_subpub.py

In lines 84, 85, you’ll file the lines:

msg.linear.x = 0.01
msg.angular.z = 0.05

Change the values (stay within 0-1). Stop the program my_bot_subpub by pressing ctrl+c and run it again. Notice any changes in robot’s movement?