Skip to content

Sample of saving ROS2's camera_info topic in json format to Database.

License

Notifications You must be signed in to change notification settings

koukemo/camera_info_sql

Repository files navigation

Camera Info SQL

English | 日本語

Sample of saving ROS2's camera_info topic in json format to Database.

Installing


  • Docker
  • Docker Compose
  • Python 3.6.x or later is required
    • mysql-connector-python (pip)
  • ROS2 (The test was done with Humble.)
    • v4l2_camera (webcam information publisher)

Configurations


camera_info_sql
├── docs
│   └── figures/
├── db
│   ├── migration/
│   ├── Dockerfile
│   └── docker-compose.yml
├── resource/
│   └── jsons/
└── camera_info_sql
    ├── sql_operations/
    ├── ${Python files for table operations}
    └── camera_info_sql_node.py

Develop settings


Run the following command:

Get Repository

cd ~/ros2_ws/src
git clone [email protected]:koukemo/camera_info_sql.git

Building

cd ~/ros2_ws
colcon build --packages-select camera_info_sql

Tests


Run the following command:

Terminal1 (DB)

cd camera_info_sql/db
docker-compose up

Terminal2 (Webcam publisher)

ros2 run v4l2_camera v4l2_camera_node

Terminal3 (Run camera_info_sql)

cd ~/ros2_ws
. ./install/setup.bash
ros2 run camera_info_sql camera_info_sub

Other Database Operations

Enter MySQL

With the docker DB container started, run the following:
(The password is set to "test" by default.)

mysql -h 127.0.0.1 -P 3306 -u test -p

View Table, Data, etc

View Table Name

python3 ~/ros2_ws/src/camera_info_sql/camera_info_sql/show_tables.py

View Table Datas
default settings | table : 'json_tables', column : '*'
(If you want to change the settings, edit camera_info_sql/camera_info_sql/show_columns.py)

python3 ~/ros2_ws/src/camera_info_sql/camera_info_sql/show_columns.py

Delete Data

Warning
Note that if you do the following, all tables will be empty!

Delete all data in table

python3 ~/ros2_ws/src/camera_info_sql/camera_info_sql/delete_columns.py

Results


SQL Content :

SQL_content


Json content :

Json_content

About

Sample of saving ROS2's camera_info topic in json format to Database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published