diff --git a/jsk_robot_common/jsk_robot_startup/launch/robot_databse_mongo_server.launch b/jsk_robot_common/jsk_robot_startup/launch/robot_databse_mongo_server.launch new file mode 100644 index 0000000000..9a826b441d --- /dev/null +++ b/jsk_robot_common/jsk_robot_startup/launch/robot_databse_mongo_server.launch @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/README.md b/jsk_robot_common/jsk_robot_startup/lifelog/README.md index 7ac192515a..13d5e9125e 100644 --- a/jsk_robot_common/jsk_robot_startup/lifelog/README.md +++ b/jsk_robot_common/jsk_robot_startup/lifelog/README.md @@ -85,3 +85,45 @@ Save object detection result to database * `~robot_frame` (String, default: `base_footprint`) robot base tf frame + + +## Examples + +You can start a mongodb logging system using `lifelog/mongodb.launch` and `lifelog/common_logger.launch` files. + See [jsk_pr2_lifelog/db_client.launch](https://github.com/jsk-ros-pkg/jsk_robot/blob/5d90d483aaa674d33968f34db83f53cd3d018bd4/jsk_pr2_robot/jsk_pr2_startup/jsk_pr2_lifelog/db_client.launch), [fetch_lifelog.xml](https://github.com/jsk-ros-pkg/jsk_robot/blob/921097b7a9c16cd99d0eb8f9f271bda4784dadc5/jsk_fetch_robot/jsk_fetch_startup/launch/fetch_lifelog.xml) and [jsk_baxter_lifelog/db_client.launch](https://github.com/jsk-ros-pkg/jsk_robot/blob/c03dc5af06d8b7786b4212b132047acaa229eb0e/jsk_baxter_robot/jsk_baxter_startup/jsk_baxter_lifelog/db_client.launch) for examples. + +## Sample client + +Sample program to retrieve stored data can be found at [jsk_robot_startup/scripts/robot_databse_monogo_example.py](./scripts/robot_databse_monogo_example.py). + +To connect replicator server (musca), you need to start [jsk_robot_startup/launch/robot_databse_monogo_server.launch](./launch/robot_databse_monogo_server.launch). Please be careful about `ROS_MASTER_URI`, because `robot_databse_monogo_server.launch` will starts same node name as robot system nodes, thus it may corrupt some settings. + +## Troubleshooting + +If you encounter following error +``` +[ERROR] [1666693339.502586]: Could not get message store services. Maybe the message store has not been started? Retrying.. +[ERROR] [1666693339.502586]: Could not get message store services. Maybe the message store has not been started? Retrying.. +``` + +1) Is mongodb service working correctly? +``` +sudo systemctl status mongodb.service +sudo systemctl start mongodb.service +``` + +2) Is `mongo` command works? +``` +mongo localhost:27017 +``` + +3) Check /etc/mongodb.conf +``` +$ cat /etc/mongodb.conf | grep -v ^# +dbpath=/var/lib/mongodb +logpath=/var/log/mongodb/mongodb.log +logappend=true +bind_ip = 0.0.0.0 +journal=true +``` +Default `bind_jp` is `127.0.0.1`, and it not work on some machines, see [#1706](https://github.com/jsk-ros-pkg/jsk_robot/issues/1706) for more info. diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/common_logger.launch b/jsk_robot_common/jsk_robot_startup/lifelog/common_logger.launch index 4d53b2e6e4..337b95ba23 100644 --- a/jsk_robot_common/jsk_robot_startup/lifelog/common_logger.launch +++ b/jsk_robot_common/jsk_robot_startup/lifelog/common_logger.launch @@ -6,6 +6,7 @@ + @@ -236,6 +237,18 @@ + + + + topics: + - /vqa/caption_result + + + sample program for robot database") + print("> 1: get latest smach data") + print("> 2: get last 1 hours image data") + #key = int(input("> {1, 2, 3..} : ")) + key = 2 + + if key == 1: + msgs = query_latest_smach() + elif key == 2: + msgs = query_images(then = datetime(2022, 11, 1, 17, 0, tzinfo=JST), + now = datetime(2022, 11, 1, 20, 10, tzinfo=JST)) + else: + print("unknown inputs...") + + # show data.. + for msg in msgs: + print(" @{}".format(datetime.fromtimestamp(msg.header.stamp.to_sec(), JST))) + cv_image = bridge.compressed_imgmsg_to_cv2(msg, "bgr8") + cv2.imshow('image', cv_image) + cv2.waitKey(50)