jsk-ros-pkg / jsk_robot

jsk-ros-pkg/jsk_robot
https://github.com/jsk-ros-pkg/jsk_robot
73 stars 97 forks source link

mognodbの使い方 #667

Closed furushchev closed 7 years ago

furushchev commented 7 years ago
  1. 画像を入れる
  2. イベントを入れる
  3. 認識結果を入れる
furushchev commented 7 years ago

setup

store message

(ros::roseus "sample_node")
(require :mongo-client "package://roseus_mongo/euslisp/mongo-client.l")

;; store event
(mongo::insert (instance jsk_demo_common::FunctionEvent :init :name "pick") :meta '((:result . "success")))

;; store result
(setq *ac* (instance ros::simple-action-client :init "awesome_recognition" ActionMsg))
(send *ac* :send-goal goal)
(mongo::insert (send *ac* :get-result))

;; store image
(ros::subscribe "image" sensor_msgs::Image
  #'(lambda (m)
       (mongo::insert m :meta '((:memo . "my awesome image")))))
(ros::spin)

see more detail: sample code

store by topic

$ rosrun jsk_pr2_startup mongodb_log.py --help
Usage: mongodb_log.py [options] [TOPICs...]

Options:
  -h, --help            show this help message and exit
  --nodename-prefix=ROS_NODE_NAME
                        Prefix for worker node names
  --mongodb-host=HOST   Hostname of MongoDB
  --mongodb-port=PORT   Hostname of MongoDB
  --mongodb-name=NAME   Name of DB in which to store values
  --mongodb-collection=COLLECTION
                        Name of Collection in which to store values. All
                        topics are stored in the collection if used this
                        option, otherwise topic names are used as collections
  -a, --all-topics      Log all existing topics (still excludes /rosout,
                        /rosout_agg)
  -e, --regex           Log topics matching the follow regular expression
  --all-topics-interval=ALL_TOPICS_INTERVAL
                        Time in seconds between checks for new topics
  -x REGEX, --exclude=REGEX
                        Exclude topics matching REGEX, may be given multiple
                        times
  --no-specific         Disable specific loggers
$ rosrun jsk_pr2_startup mongodb_log.py /camera/rgb/image_rect_color
furushchev commented 7 years ago

Viewer

comming soon... (deprecated: https://github.com/furushchev/ros_mongo_viewer)

furushchev commented 7 years ago

Cc: @k-okada @knorth55

furushchev commented 7 years ago

@knorth55 認識結果は過去のJSKのプログラムではposedetection_msgs/ObjectDetectionというメッセージでやりとりされていて、これをロボットの位置などとともに蓄積するプログラムが、現在ではjsk_pr2_startup/jsk_pr2_lifelog/objectdetection_db.pyにあります。 PR2固有のプログラムでもないので、ドキュメントとともにjsk_robot_startup/lifelogに移そうと思っています。 https://github.com/jsk-ros-pkg/jsk_robot/pull/672 マージされるまでは上リンクを見てもらえるといいと思います。

knorth55 commented 7 years ago

@furushchev ありがとうございます。参考にさせていただきます