Skip to content
Yoonseok Pyo edited this page Aug 27, 2015 · 33 revisions

ROS-TMS Database (mongodb)

Setting

$ sudo vi /etc/hostname
ros-tms-server
 
$ sudo vi /etc/hosts
127.0.1.1 ros-tms-server

$ sudo reboot
mkdir ~/mongodb_store
sudo gedit /etc/mongodb.conf
bind_ip = 127.0.0.1 → bind_ip = 0.0.0.0 
HOSTNAME=ros-tms-server roslaunch mongodb_store mongodb_store.launch db_path:=/home/rts/mongodb_store port:=62345

web browser

http://rt:63345/

ROS-TMS Database Tables

table name type explanation
id none Basic information
history_data none History data
backup_data none Long-term storage data
data_person Object 1000 : person Data (person)
data_robot Object 2000 : robot Data (robot)
data_sensor Object 3000 : sensor Data (sensor)
data_structure Location 4000 : structure Data (structure)
data_space Location 5000 : space Data (space)
data_furniture Location 6000 : furniture Data (furniture)
data_object Location 7000 : object Data (object)
data_task Task 8000 : task Data (task)
data_subtask Task 9000 : subtask Data (subtask)
data_state Task 10000 : state Data (state of environment)

How to make the ROS-TMS database table

CREATE TABLE `data` (
  `time` datetime(6) NOT NULL,
  `type` varchar(30) DEFAULT NULL,
  `id` int(11) DEFAULT NULL,
  `name` varchar(30) DEFAULT NULL,
  `x` double DEFAULT NULL,
  `y` double DEFAULT NULL,
  `z` double DEFAULT NULL,
  `rr` double DEFAULT NULL,
  `rp` double DEFAULT NULL,
  `ry` double DEFAULT NULL,
  `offset_x` double DEFAULT NULL,
  `offset_y` double DEFAULT NULL,
  `offset_z` double DEFAULT NULL,
  `joint` varchar(500) DEFAULT NULL,
  `weight` double DEFAULT NULL,
  `rfid` varchar(30) DEFAULT NULL,
  `etcdata` varchar(500) DEFAULT NULL,
  `place` int(11) DEFAULT NULL,
  `extfile` varchar(500) DEFAULT NULL,
  `sensor` int(11) DEFAULT NULL,
  `probability` double DEFAULT NULL,
  `state` int(11) DEFAULT NULL,
  `task` varchar(500) DEFAULT NULL,
  `note` varchar(500) DEFAULT NULL,
  `tag` varchar(500) DEFAULT NULL,
  PRIMARY KEY (`time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

移動候補点の定義:【id table】

👍 robot/furnitureのetc_dataに,以下の形で定義 (複数のロボットに対して定義するときは,「;」で繋ぐ)

robot_name;x(mm),y(mm),yaw(deg)

タスクの定義:【id table(8001~8999)】

例(get_object): 9001$oid 9002$oid + 9003$uid +

User Requestから来る最大の引数データ

oid:object_id, uid:user_id, rid:robot_id, pid:place_id

Update the content of ID Table

UPDATE `rostmsdb`.`id` SET `time`='0', `x`='0', `y`='0', `z`='0', `rr`='0', `rp`='0', `ry`='0', `offset_x`='0', `offset_y`='0', `offset_z`='0', `joint`='', `weight`='0', `rfid`='', `etcdata`='', `place`='0', `extfile`='', `sensor`='0', `probability`='0.0', `state`='0', `task`='', `note`='', `tag`='' WHERE `id`='1000';
SELECT * FROM rostmsdb.id;

PrimaryKey setting of each table

id,   PRIMARY KEY (`id`)
history_data, PRIMARY KEY (`time`)
backup_data, PRIMARY KEY (`time`)
data_xxx, PRIMARY KEY (`time`)

tmsdbStamped.msg

Header            header
tms_msg_db/Tmsdb[]  tmsdb

tmsdb.msg

string    time
string    type
int32     id
string    name
float64   x
float64   y
float64   z
float64   rr
float64   rp
float64   ry
float64   offset_x
float64   offset_y
float64   offset_z
string    joint
float64   weight
string    rfid
string    etcdata
int32     place
string    extfile
int32     sensor
float64   probability
int32     state
string    task
string    note
string    tag

TmsdbGetData.srv

tms_msg_db/Tmsdb  tmsdb
---
tms_msg_db/Tmsdb[]  tmsdb

The contents of each item of tmsdb

column name content datatype
time Time (ms unit)​ string
type Target type​ string
id Target ID​ int32
name Target name​ string
x Target position of x​ float64
y Target position of y​ float64
z Target position of z​ float64
rr Roll (x axis)​ float64
rp Pitch (y axis)​ float64
ry Yaw (z axis)​ float64
offset_x Offset X from the center point float64
offset_y Offset y from the center point float64
offset_z Offset z from the center point float64
joint Angle of each joint​ string
weight Weight​ float64
rfid Number of RF tag string
etcdata Other values, temperature, etc.​ string
place Location int32
extfile External file, FTP Addr such as pcd and image file string
sensor Sensor ID​ int32
probability Probability (0.0~1.0) float64
state State​ int32
task Task​ string
note note​ string
tag tag​ string
  • joint (smartpal5) : lumba_low, lumba_high, jR[0]...[6], gripper_right, jL[0]...[6], gripper_left

Basic unit of ROS-TMS

Unit ROS ROS-TMS
length meter mm
mass kilogram gram
time second micro sec
current ampere ampere
angle radian degree
frequency hertz hertz
force newton newton
power watt watt
voltage volt volt
temperature celsius celsius
time GMT GMT +9H

Coordinates of ROS-TMS

coordinate explanation color
x Forward R
y Left G
z Up B

Center position of model in ROS-TMS

  • Center coordinates of the model: Middle of model

Setting of ROSTMS Database

setting of FTP

sudo apt-get install vsftpd 
sudo nano /etc/vsftpd.conf 

anonymous_enable=NO local_enable=YES wirte_enable=YES local_umask=022

sudo adduser rtsftp 

ftp 192.168.4.170 id: rtsftp pw: tmsftp

setting of mysql

sudo apt-get install mysql-server-5.6 mysql-client-5.6
sudo nano /etc/mysql/my.cnf 

#skip-external-locking #bind-address = 127.0.0.1

mysql -u root -p 
mysql> create database rostmsdb; 
mysql> show databases; 
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" identified by 'tmsdb'; 
mysql> flush privileges; 

backup

mysqldump -h 192.168.4.170 -u root -p rostmsdb > rostmsdb.sql 
mysqldump -h 192.168.4.170 -u root -p rostmsdb id > rostmsdb_id.sql 
  • password : tmsdb

restore

mysql -h 192.168.4.170 -u root -p rostmsdb < rostmsdb.sql 
mysql -h 192.168.4.170 -u root -p rostmsdb < rostmsdb_id.sql 

connect

mysql -h 192.168.4.170 -u root -p

install mysql workbench (client pc)

sudo apt-get install mysql-client mysql-client-5.5 mysql-workbench

Also, we can connect the DB using web browser

http://192.168.4.170/phpmyadmin/

  • id : tmsdb
  • password : tmsdb

mysql 5.6 reference manual

http://dev.mysql.com/doc/refman/5.6/en/index.html

model_list.txt (tms_rp_rostms_plugin)

ros_tms/tms_rp/tms_models/model_list.txt

Object 25

Clone this wiki locally