Skip to content

hwk06023/To-process.bag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To-process.bag

to process .bag (ROS Bag file)

My Development Environment

Info
Using device RealSense(D455), Multipleye
Operating System & Version Ubuntu 20.04
Platform PC
SDK Version 2.0
Language Python

Q. What is "ROS Bag file"?

A. "ROS Bag file" contain all data of each stream type(Color, Depth, Infrared)

Q. What does this program process(handle)?

A. ROS Bag file extracts depth and information of detected objects, PointCloud, Color, etc..



I. Install Library

ROS 1

noetic

  1. Setup your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

  1. Set up your keys
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

  1. Installation

First, make sure your Debian package index is up-to-date:

sudo apt update

Now pick how much of ROS you would like to install.

Desktop-Full Install: (Recommended) : Everything in Desktop plus 2D/3D simulators and 2D/3D perception packages

sudo apt install ros-noetic-desktop-full

Desktop Install: Everything in ROS-Base plus tools like rqt and rviz

sudo apt install ros-noetic-desktop

ROS-Base: (Bare Bones) ROS packaging, build, and communication libraries. No GUI tools.

sudo apt install ros-noetic-ros-base

more packages available in ROS, to find packages

apt search ros-noetic

and install (PACKAGE => e.g. slam-gmapping)

sudo apt install ros-noetic-PACKAGE

  1. Environment setup
source /opt/ros/noetic/setup.bash(.zsh, ...)

bash

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

zsh

echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc

  1. Dependencies for building packages
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

sudo apt-get install python3-roslaunch 
sudo apt-get install python3-rosbag 


ROS 2

rolling

  1. Set locale
locale  # check for UTF-8

sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

locale  # verify settings

  1. Add the ROS 2 apt repository
sudo apt install software-properties-common

sudo add-apt-repository universe

sudo apt update && sudo apt install curl gnupg lsb-release

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

  1. Downloading ROS 2
sudo apt update && sudo apt upgrade
sudo apt install ros-rolling-desktop
sudo apt install ros-rolling-ros-base


Rviz - Ros1

noetic

  1. Install
sudo apt-get install ros-fuerte-visualization
sudo apt-get install ros-noetic-rviz
  1. Display
source /opt/ros/noetic/setup.bash(.zsh ..)
roscore &
rosrun rviz rviz


Rviz - Ros2

foxy

  1. Build from Source
sudo apt install ros-foxy-ros-base

sudo apt install ros-foxy-desktop

source /opt/ros/foxy/setup.bash(.zsh)
sudo apt-get install ros-foxy-rviz-visual-tools

ros2 launch rviz_visual_tools demo_rviz.launch.py
rosdep install --from-paths src --ignore-src --rosdistro foxy

  1. Quick Start Demo
ros2 run rviz_visual_tools


Bagpy

pip3 install -U bagpy

Pyrealsense2

pip3 install pyrealsense2



II. Rviz

rosrun rosbag record -O ~~~.bag /velodyne_packets
rosbag play ~~~.bag


III. Bagpy in Python3

import bagpy
from bagpy import bagreader
import pandas as pd
import numpy as np
b = bagreader('[DATA Location]') # load bag file
b.topic_table
data = b.message_by_topic('[Title in table]')
df_out = pd.read_csv(data)
df_out


IV. Rosbag API in python3

import rosbag
from std_msgs.msg import Int32, String
bag = rosbag.Bag('[DATA Location]') # load bag file
'''
Use Method
'''
bag.close # free bag


VI. Point Cloud

Console-1

roscore &

Console-2

rosbag play --clock [Data] -l

[Data] : ex_1.bag, ex_2.bag ...

Option
(--clock) : To displaytime
(-l) : endless repetition


Console-1

rostopic echo /device_0/sensor_0/Depth_0/image/data


SLAM

SLAM is still being written.



My Device in ROS info

Multipleye RealSense



Reference

https://dev.intelrealsense.com/docs/python2
https://dev.intelrealsense.com/docs/ros-wrapper
https://dev.intelrealsense.com/docs/opencv-wrapper
http://wiki.ros.org/rosbag/Code%20API#Python_API
http://wiki.ros.org/rosbag/Commandline
https://jmscslgroup.github.io/bagpy/index.html
https://docs.ros.org/en/rolling/Installation/Alternatives/Ubuntu-Development-Setup.html
https://index.ros.org/p/rviz_visual_tools/
https://index.ros.org/p/example_interfaces/#humble-overview
https://velog.io/@717lumos/Rviz-Rviz-%EC%8B%9C%EA%B0%81%ED%99%94%ED%95%98%EA%B8%B0-Marker

About

to process .bag file

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •