to process .bag (ROS Bag file)
| Info | |
|---|---|
| Using device | RealSense(D455), Multipleye |
| Operating System & Version | Ubuntu 20.04 |
| Platform | PC |
| SDK Version | 2.0 |
| Language | Python |
A. "ROS Bag file" contain all data of each stream type(Color, Depth, Infrared)
A. ROS Bag file extracts depth and information of detected objects, PointCloud, Color, etc..
- 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'- 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 -- Installation
First, make sure your Debian package index is up-to-date:
sudo apt updateNow 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-fullDesktop Install: Everything in ROS-Base plus tools like rqt and rviz
sudo apt install ros-noetic-desktopROS-Base: (Bare Bones) ROS packaging, build, and communication libraries. No GUI tools.
sudo apt install ros-noetic-ros-basemore packages available in ROS, to find packages
apt search ros-noeticand install (PACKAGE => e.g. slam-gmapping)
sudo apt install ros-noetic-PACKAGE- Environment setup
source /opt/ros/noetic/setup.bash(.zsh, ...)
bash
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrczsh
echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc- Dependencies for building packages
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essentialsudo apt-get install python3-roslaunch sudo apt-get install python3-rosbag - 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- Add the ROS 2 apt repository
sudo apt install software-properties-common
sudo add-apt-repository universesudo 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.gpgecho "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- Downloading ROS 2
sudo apt update && sudo apt upgradesudo apt install ros-rolling-desktopsudo apt install ros-rolling-ros-base- Install
sudo apt-get install ros-fuerte-visualizationsudo apt-get install ros-noetic-rviz- Display
source /opt/ros/noetic/setup.bash(.zsh ..)
roscore &rosrun rviz rviz- 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.pyrosdep install --from-paths src --ignore-src --rosdistro foxy- Quick Start Demo
ros2 run rviz_visual_toolspip3 install -U bagpypip3 install pyrealsense2rosrun rosbag record -O ~~~.bag /velodyne_packetsrosbag play ~~~.bagimport bagpy
from bagpy import bagreader
import pandas as pd
import numpy as npb = bagreader('[DATA Location]') # load bag fileb.topic_tabledata = b.message_by_topic('[Title in table]')df_out = pd.read_csv(data)
df_outimport rosbag
from std_msgs.msg import Int32, Stringbag = rosbag.Bag('[DATA Location]') # load bag file'''
Use Method
'''bag.close # free bagConsole-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/dataSLAM is still being written.
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