Skip to content

bharath5673/ros_ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

ROS2 (As Ease As Possible)

Goal of the project is to build computer vision projects easier on ROS

Computer vision is an important application of ROS2, as it allows robots and other autonomous systems to understand and interact with their environment. Here are some common topics related to computer vision in ROS2:

Image processing: Process images from cameras and other sensors. These libraries enable developers to implement various computer vision algorithms, such as object detection, segmentation, and tracking.

Depth sensing: In addition to cameras, many robots use depth sensors, such as LIDAR or depth cameras, to perceive their environment. ROS2 provides several libraries, such as depth_image_proc and pointcloud2, to process and analyze depth data.

Perception algorithms: Various perception algorithms that can be used for object detection, tracking, and recognition.

Integration with other ROS2 components: Computer vision algorithms in ROS2 are often used in conjunction with other ROS2 components, such as navigation, manipulation, and planning. ROS2 provides various communication and messaging protocols, such as ROS2 Topics and ROS2 Services, that enable developers to integrate these components and create complex systems.



tested on
## ros distro
abc@xyz:~$ rosversion -d
humble

## ubuntu version
abc@xyz:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

## python version
abc@xyz:~$ python3 --version
Python 3.10.6



my ros_ws

### steps for setting up
git clone https://github.com/bharath5673/ros_ws.git
cd ros_ws
colcon build
cd ..



1. turtlebot

Screenshot from 2023-01-27 14-14-57

### steps for turtleot
source ros_ws/install/setup.bash
ros2 run turtlesim turtlesim_node & ros2 run my_robot_controller turtle_controller


2. opencv-python


Screenshot from 2023-01-27 14-22-57

### steps for opencv

source ros_ws/install/setup.bash
ros2 run test_opencv run_test


3. mediapipe


ai-mediapipe-holistic

pip install mediapipe


### steps for facemesh

source ros_ws/install/setup.bash
ros2 run test_mediapipe facemesh_demo
### steps for pose

source ros_ws/install/setup.bash
ros2 run test_mediapipe pose_demo


### steps for hands

source ros_ws/install/setup.bash
ros2 run test_mediapipe hands_demo
### steps for holistic

source ros_ws/install/setup.bash
ros2 run test_mediapipe holistic_demo


4. yolov5


test

pip install yolov5


### steps for yolov5n

source ros_ws/install/setup.bash
ros2 run test_yolov5 yolov5n_demo
### steps for yolov5s

source ros_ws/install/setup.bash
ros2 run test_yolov5 yolov5s_demo


5. Self-Driving-Car



### steps for testing installation


## install dependancies
python3 -m pip install -r src/self_driving_car_pkg/requirements.txt
sudo apt install ros-humble-gazebo-ros
sudo apt-get install ros-humble-gazebo-msgs
sudo apt-get install ros-humble-gazebo-plugins


## copy models to gazebo env
cp -r ros_ws/src/self_driving_car_pkg/models/* /home/bharath/.gazebo/models


## once build you can run the simulation e.g [ ros2 launch (package_name) world(launch file) ]

source ros_ws/install/setup.bash
source /opt/ros/humble/setup.bash
ros2 launch self_driving_car_pkg world_gazebo.launch.py


## To activate the SelfDriving Car

source ros_ws/install/setup.bash
source /opt/ros/humble/setup.bash
ros2 run self_driving_car_pkg computer_vision_node


### steps to run Self-Driving-Car


## Launch the maze_solving world in gazebo

source ros_ws/install/setup.bash
source /opt/ros/humble/setup.bash
ros2 launch self_driving_car_pkg maze_solving_world.launch.py



## in another terminal

source ros_ws/install/setup.bash
source /opt/ros/humble/setup.bash
ros2 run self_driving_car_pkg sdc_V2


for detailed explainations and tutorilas @ https://github.com/noshluk2/ROS2-Self-Driving-Car-AI-using-OpenCV



6. rosbag and dataFrame


Screenshot from 2023-02-06 19-22-51

### steps for rosbag turtle vel cmds

source ros_ws/install/setup.bash
ros2 run turtlesim turtlesim_node &  ros2 run test_turtle_bag turtlebot_for_rosbag


### steps to control turtlebot

source ros_ws/install/setup.bash
ros2 run turtlesim turtle_teleop_key

saving bag file

Screenshot from 2023-02-06 19-21-34

### open turtlebot

source ros_ws/install/setup.bash
ros2 run turtlesim turtlesim_node


### steps to rosbag play

source ros_ws/install/setup.bash
ros2 bag play 'ros_ws/src/test_turtle_bag/test_turtle_bag/rosbag2_2023_02_06-18_46_50/rosbag2_2023_02_06-18_46_50_0.db3' -d 0.5



@https://github.com/bharath5673/ros_ws/blob/main/src/test_turtle_bag/test_turtle_bag/rosbag.ipynb

7. ROS2 yolobot

## prerequisites

sudo apt install ros-humble-gazebo-ros
sudo apt-get install ros-humble-gazebo-msgs
sudo apt-get install ros-humble-gazebo-plugins

pip install yolov5


## copy models to gazebo env
cp -r ros_ws/src/yolobot/models/* /home/bharath/.gazebo/models

Screenshot from 2023-01-28 17-31-40

### step for roslaunch
source /opt/ros/humble/setup.bash
source ros_ws/install/setup.bash

ros2 launch yolobot yolobot_launch.py


Screenshot from 2023-01-28 16-55-02

### on new terminal


### step for yolobot detetcion
source /opt/ros/humble/setup.bash
source ros_ws/install/setup.bash

python3 ros_ws/src/yolobot/yolobot_recognition/ros_recognition_yolo.py

for detailed explainations and tutorilas @ https://www.youtube.com/watch?v=594Gmkdo-_s&t=610s



8. PICO-W with MPU-6050 accelerometer and gyroscope module (EXCLUSIVE)

## prerequisites

sudo apt-get install ros-humble-imu-tools

Screenshot from 2023-02-14 13-58-54

### step for simple testing imu sensors with random data
source /opt/ros/humble/setup.bash
source ros_ws/install/setup.bash

 ros2 run test_imu simple_imu
### on new terminal for rviz

source ros_ws/install/setup.bash
rviz2

now click on add create visualization By Topic /Imu/imu

Getting MPU-6050 Sensor Readings: Accelerometer, Gyroscope

flash ur pico-W on Thonny with https://github.com/bharath5673/ros_ws/blob/main/src/test_imu/pico_W/sketch1.py

demo 1

Note : please ignore those other components on the board showing in the below demo.. my circuit was built for different use case.. u can connect ur pico-w and mpu6050 as shown in this below simple circuit diagram

demo 2


### step to read imu MPU6050 data from pico-W and visualize on rviz2
source /opt/ros/humble/setup.bash
source ros_ws/install/setup.bash

ros2 run test_imu picoW_mpu6050


### on new terminal for rviz

source ros_ws/install/setup.bash
rviz2


Getting MPU-6050 Sensor Readings: Accelerometer, Gyroscope

flash ur ESP32 on Arduino with https://github.com/bharath5673/ros_ws/blob/main/src/test_imu/esp_32/sketch2.ino

demo 3

Note : please ignore those other components on the board showing in the below demo.. my circuit was built for different use case.. u can connect ur esp-32 and mpu6050 as shown in this below simple circuit diagram

demo 4


### step to read imu MPU6050 data from pico-W and visualize on rviz2
source /opt/ros/humble/setup.bash
source ros_ws/install/setup.bash

ros2 run test_imu esp32_mpu6050


### on new terminal for rviz

source ros_ws/install/setup.bash
rviz2



9. OpenCV AI Kit


complete-collection-of-opencv-ai-kits-

The OAK (OpenCV AI Kit) is a series of edge computing devices developed by Luxonis, designed to provide high-performance AI inference for computer vision applications in a compact and low-power form factor. a dedicated AI accelerator chip that provides high-speed neural network inference for running complex AI models on-device. With the OAK devices, users can deploy AI models for tasks such as object detection, facial recognition, and gesture recognition and making it ideal for edge AI applications.

DepthAI

DepthAI is a Spatial AI platform API that supports OAK devices
### steps for installing Death-AI

python3 -m pip install depthai --upgrade
### set USB rules to recognise and access oak devices to grant permission

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

OAK-1 demo



### steps for running yolo on oak-1 publisher

source ros_ws/install/setup.bash
ros2 run test_OAK OAK_1_publisher
### on new terminal for subscriber

source ros_ws/install/setup.bash
ros2 run test_OAK OAK_subscriber


OAK-D demo



### steps for running yolo on oak-D publisher

source ros_ws/install/setup.bash
ros2 run test_OAK OAK_D_publisher
### on new terminal for subscriber

source ros_ws/install/setup.bash
ros2 run test_OAK OAK_subscriber



10. ROS2 Navigation Stack


Simple and easy project, about building a custom robot maps and that can navigate autonomously using the ROS2 Navigation Stack.

output3

@https://github.com/bharath5673/ros_ws/tree/main/src/navigation_tb3



Cite

Expand