Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[database_talker] add database_talker #1388

Open
wants to merge 60 commits into
base: master
Choose a base branch
from

Conversation

sktometometo
Copy link
Contributor

@sktometometo sktometometo commented Apr 13, 2023

@k-okada
hoge.py を追加し、スタンドアロンで動作するようにしているパッケージです。
現在動作確認中です.

CC: @tkmtnt7000

@sktometometo
Copy link
Contributor Author

all done, ready まではいくようになりました。

@tkmtnt7000
Copy link
Member

tkmtnt7000 commented Apr 13, 2023

all done readyから先にもトラップが何重かありました.
再審のhoge.pyを利用する必要があります
ちなみに今も岡田先生とデバグ中です.

@sktometometo
Copy link
Contributor Author

@k-okada どういうデモのプログラムか聞いてないんですが全体像としてはどういうものなのですか?

@tkmtnt7000
Copy link
Member

@sktometometo hoge.pyで以下の画像のようなことができるようになります.
image

メモ書き

  • Fetchのキッチンとかタスクしている瞬間のいい感じのやり取りをつくってみる

やらなくていいことリスト

  • google chatに画像をトピックで送れるようにする(Twitterでやったやつ)
  • 聞いてきたチャットのスペースに返せるようにdialogflowとチャットの連携を切って,hoge.pyが返事する

やったらいいことリスト

  • 時間の情報を使って,昨日とか今日とか先週とかアクセスすべき時間帯を指定できるようにする

@mqcmd196 リスト

  • VQA, ClipのAPIを常時立ち上げる

@sktometometo
Copy link
Contributor Author

inputはチャット?

@tkmtnt7000
Copy link
Member

チャットがinputになっています

@tkmtnt7000
Copy link
Member

昨日の作業を簡単にまとめておくと
Fetchでいい感じに動かすには,

<launch>
 <!-- spam-k-okada.launch -->
  <node pkg="topic_tools" type="transform" name="publish_trigger_mongodb_event_google_chat_ros_send_goal"
        args="--wait-for-start /google_chat_ros/send/goal /publish_trigger_mongodb_event std_msgs/Header
              'std_msgs.msg.Header(stamp=m.header.stamp, frame_id=m._connection_header[&quot;callerid&quot;])' --import std_msgs" />
  <node pkg="topic_tools" type="transform" name="publish_trigger_mongodb_event_google_chat_ros_message_activity"
        args="--wait-for-start /google_chat_ros/message_activity /publish_trigger_mongodb_event std_msgs/Header
              'std_msgs.msg.Header(stamp=rospy.Time.now(), frame_id=m._connection_header[&quot;callerid&quot;])' --import std_msgs rospy" />

  <!-- republish compressed/throttled image data only when /publish_trigger_mongodb_event is published -->
  <node name="camera_throttle_nodelet"
        pkg="nodelet" type="nodelet"
        args="load jsk_topic_tools/SynchronizedThrottle mongodb_lifelog_nodelet_manager" >
    <rosparam subst_value="true">
      approximate_sync: true
      topics:
      - /publish_trigger_mongodb_event
      - /head_camera/rgb/image_rect_color/compressed
    </rosparam>
  </node>

  <!-- <group ns="lifelog"> -->
  <!--   <include file="lifelog_rgb_image.launch" > -->
  <!--     <arg name="node_name" value="hand_color_logger" /> -->
  <!--     <arg name="image" value="/head_camera/rgb/image_rect_color/compressed" /> -->
  <!--     <arg name="manager" value="mongodb_record_nodelet_manager" /> -->
  <!--   </include> -->
  <!-- </group> -->

  <arg name="launch_manager" default="true" />
  <arg name="manager" default="mongodb_lifelog_nodelet_manager" />
  <arg name="respawn" default="false" />
  <arg name="image" default="/head_camera/rgb/image_rect_color/compressed/throttled" />
  <arg name="node_name" default="hand_color_logger" />


  <node name="hand_color_logger"
        pkg="nodelet" type="nodelet"
        args="load jsk_robot_lifelog/LightweightLogger /$(arg manager)"
        respawn="$(arg respawn)">
    <remap from="~input" to="$(arg image)" />
    <rosparam subst_value="true">
      enable_monitor: false
      vital_check: false
    </rosparam>
  </node>

</launch>

ことが必要でした.

  • JSK Robot botにたまに生のエラーメッセージが表示される.
    list index out of range とかhuman is not in listはvqaかclipか(どっちかあまり理解していないですが)で対応するチャットに近い画像を見つけられなかったときのエラーらしい.適当にtimestampを調整して画像を探しに行く時間帯を広げてやるといいかもしれない.

常時Fetchで動かすには

  • どこかGPUの使えるマシンでvqa, clip, openai_rosを常時起ち上げておく
  • dialogflow関連のノードのnamespaceを変更できるようにして名前衝突を回避し,dialogflowを複数起ち上げられるようにする
  • ros_google_cloud_languageを起動しておく

あたりが必要かと思いました.

すごく面白いシステムになりそうだと昨日デバグしながら思っていましたが,この仕組みをそのまま常時動かすのは,今後のデバグが結構面倒な気がするので,常時動かす際にはもう少しシンプルなシステムにできないものかとおもいました.
システム変更は難しいとしてもせめてシステム構成図をきちんと丁寧に書いておいて,初見の人でもREADMEを読んだだけでプログラムの流れがわかるようにしておくのは必須かなと思いました.
(蛇足1:hoge.pyのmake_reply関数の中身をもうすこし細かく関数に分けられると読みやすいかもしれない)
(蛇足2:hoge.pyがアクセスしに行く各システムの奥深さも低減されると嬉しい)

cc: @a-ichikura @mqcmd196

Comment on lines 42 to 45
<include file="$(find jsk_perception)/launch/classification.launch">
<arg name="run_api" value="true"/>
<arg name="CLASSIFICATION_INPUT_IMAGE" value="$(arg INPUT_IMAGE)"/>
</include>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this and other nodes that need GPU should split launch file because those nodes are usually launched at remote PC such as dlbox.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or another option, we may use something like machine tag and these inference nodes automatically launches at remote PC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mqcmd196 will privde 24/7 API service at dlbox until 12:00 today, so we only set 'run_api' to false and add host here.

return text

def translate(self, text, dest):
return Translated(text=text, dest=dest, src="en", origin="unknown", pronunciation="unknown")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://gist.github.com/k-okada/a22cc574d398937d0f4726edef4cad77
で 18.04のgoogletrans 2.4.0 にパッチ充てると,この行を消せると思います.確認してみてください @tkmtnt7000

で,これで日本語ベースでやり取りするのが出来ると思います.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます.確認してみます.

rosパッケージ化してしまえば,catkin_virtualenvを使ってpython3環境でgoogletrans==3.1.0a0をバージョン指定して入れるような感じでもいいのかなと考えていました.

result = {'message': message,
'message_translate': message_translate,
'timestamp': timestamp,
'similarity': difflib.SequenceMatcher(None, query, message_translate).ratio(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保存されているchatのメッセージと,make_replyのqueryの類似性の計算方法がよく分かっていないので,
@a-ichikura に解説してもらいたいです.

Copy link
Member

@tkmtnt7000 tkmtnt7000 Apr 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-ichikura kindly ping

@tkmtnt7000
Copy link
Member

関連するパッケージのPRがマージされているのでfetchのdevelopブランチにマージしてapp_chooserから起動できるようにしておこうと思います.パッケージの名前等変更したほうが良ければこのタイミングで変えておきます.

@mqcmd196
Copy link
Member

hoge.py だけ変えませんか

@sktometometo
Copy link
Contributor Author

@tkmtnt7000 Can you create new PR from this branch?

@k-okada
Copy link
Member

k-okada commented Jun 22, 2023

この機能は全ロボットで常時動いたら良いので、fetch/develop としては、

  • デフォルトで各種サービスのnode が立ち上がるようにしましょう -> launch ファイル的なものが jsk_robot_common に入るイメージですが、dialogflowやchatは既に上がっているので、それ以外のものになるのかな?
    • それにはVQA関連のサーバを研究室管理にする必要があるけど、 dlbox で上がっているかな?→この部分はmasterにもPR出せるはず
  • hoge.py は、まだデモ投入されていないという理解で、現状の問題は、この時点でプログラム動かしても、例えば先日の豊島の結果がさっと出てこないが最初の問題だと思います。で、多分muscaに画像の問い合わせが入ると時間がかかるんだけど、解決策は1) muscaの画像を間引く 2) message typeを指定しなければ早かった気がするんだけど、本当だっけ?であれば、データをとってきて、こちらでメッセージのフィルター掛けるとか、Queryのなにかの指定の仕方がまずいのかを調査する必要があると思って宿題に積んである。これを解決してデモで投入されたらパッケージとして運用しましょう。

@tkmtnt7000
Copy link
Member

tkmtnt7000 commented Jun 23, 2023

デフォルトで各種サービスのnode が立ち上がるようにしましょう -> launch ファイル的なものが jsk_robot_common に入るイメージですが、dialogflowやchatは既に上がっているので、それ以外のものになるのかな?

そうなると思います.jsk_robotに出ているjsk-ros-pkg/jsk_robot#1792https://github.com/tkmtnt7000/jsk_robot/blob/cd0a897deb224038674e88ac7599502f7caf5d59/jsk_robot_common/jsk_robot_startup/launch/sample_database_talker.launch を使って追加で常時起ち上げられるようにします.

それにはVQA関連のサーバを研究室管理にする必要があるけど、 dlbox で上がっているかな?→この部分はmasterにもPR出せるはず

現状はは73B2に置かれているdlbox15で一時的に手動で起ち上げっぱなしにしています.GUIでポチポチできると嬉しいかなと思っています(イメージとしてはsystemdのseviceファイルを書いてcookpitのようなものを使う)が,このあたりは手を付けていません.

hoge.py は、まだデモ投入されていないという理解で、現状の問題は、この時点でプログラム動かしても、例えば先日の豊島の結果がさっと出てこないが最初の問題だと思います。で、多分muscaに画像の問い合わせが入ると時間がかかるんだけど、解決策は1) muscaの画像を間引く 2) message typeを指定しなければ早かった気がするんだけど、本当だっけ?であれば、データをとってきて、こちらでメッセージのフィルター掛けるとか、Queryのなにかの指定の仕方がまずいのかを調査する必要があると思って宿題に積んである。これを解決してデモで投入されたらパッケージとして運用しましょう。

画像と音声の問い合わせに時間がかかっています.検索結果が空の場合はは指定した時間分すべてを走査するので特に返ってこない,という印象です.muscaのスペックの問題かこちらのQueryの投げ方が悪いのか,,,などまだ問題ごとに調べきれていないので調査中..というところです.

@tkmtnt7000
Copy link
Member

tkmtnt7000 commented Jun 27, 2023

  1. message typeを指定しなければ早かった気がするんだけど、本当だっけ?であれば、データをとってきて、こちらでメッセージのフィルター掛けるとか、Queryのなにかの指定の仕方がまずいのかを調査する必要があると思って宿題に積んである。

message typeを指定しないと早いのはおそらくそうで,以下のスクリプトでタイプを指定しないで引っ張ってくるように検証するとおよそ5時間分/1400枚の画像をdumpするのに5分でした.

robot_database_mongo_dump.py: https://gist.github.com/tkmtnt7000/11bdace2ff71354a65b42aa07b4c2f21

tsukamoto@tsukamoto-desktop /mnt/almagest/73B2/tsukamoto/Shared/mongo_dump 
$ time python ~/robot_database_mongo_dump.py -c "fetch1075" --start "2023-06-10 09:30:00" --end "2023-06-10 14:30:00
...

...
real    4m51.350s
user    3m4.234s
sys     0m15.167s

5分でもインタラクティブなやり取りには長いと感じているので,人間が夢を見ながら記憶整理をするように,ロボットも夜の間に記憶整理(夢を見る)と称してオフライン処理をしても良いかもしれないと思いました.

@a-ichikura
Copy link

@k-okada

環境構築には成功しましたがbson packageでエラーになりました。

$ rosrun database_talker make_diary.py --prompt-type personality
<string>:869: SyntaxWarning: "is not" with a literal. Did you mean "!="?
<string>:872: SyntaxWarning: "is" with a literal. Did you mean "=="?
Traceback (most recent call last):
  File "/home/leus/aibo_ws/src/jsk_demos/database_talker/scripts/make_diary.py", line 13, in <module>
    from database_talker import DatabaseTalkerBase
  File "/home/leus/aibo_ws/devel/lib/python3/dist-packages/database_talker/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 10, in <module>
ImportError: cannot import name 'json_util' from 'bson' (/home/leus/aibo_ws/devel/.private/database_talker/share/database_talker/venv/lib/python3.8/site-packages/bson/__init__.py)

bsonのversionは

$ pip show bson
Name: bson
Version: 0.5.10
Summary: BSON codec for Python
Home-page: http://github.com/py-bson/bson
Author: Ayun Park
Author-email: [email protected]
License: BSD
Location: /home/leus/.local/lib/python3.8/site-packages
Requires: python-dateutil, six
Required-by: 

です。

ちなみに、
$ roslaunch database_talker sample.launch
したときに、

[usb_cam-2] restarting process
process[usb_cam-2]: started with pid [32071]
[ INFO] [1712115706.826342285]: using default calibration URL
[ INFO] [1712115706.826535198]: camera calibration URL: file:///home/leus/.ros/camera_info/head_camera.yaml
[ INFO] [1712115706.826555872]: Unable to open camera calibration file [/home/leus/.ros/camera_info/head_camera.yaml]
[ WARN] [1712115706.826562218]: Camera calibration file /home/leus/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1712115706.826569998]: Starting 'head_camera' (/dev/video0) at 320x240 via mmap (yuyv) at 10 FPS
[ERROR] [1712115706.826584841]: Cannot identify '/dev/video0': 2, No such file or directory

になるのはaibo(karashi)が起動していないからですか?

@a-ichikura
Copy link

pymongoをとりあえずupgradeしてみましたが結果は変わらずです。
参考

$ pip show pymongo
Name: pymongo
Version: 4.6.3
Summary: Python driver for MongoDB <http://www.mongodb.org>
Home-page: None
Author: The MongoDB Python Team
Author-email: None
License: Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Location: /home/leus/.local/lib/python3.8/site-packages
Requires: dnspython
Required-by: 
leus@leus-System-Product-Name:~/aibo_ws/src/jsk_demos/database_talker$ 

@k-okada
Copy link
Member

k-okada commented Apr 3, 2024

  • 他に影響がなければ pip uninstall bson して apt install python3-bson です。pymongoも同様にpip ではなくてaptで動作確認しています。どうしても、pipが良ければ/必要であれば、やり方考えるので教えてください。

  • [ERROR] [1712115706.826584841]: Cannot identify '/dev/video0': 2, No such file or directory このサンプルはPC+PCにUSBカメラがつながっている前提ですので、USBカメラをつなげてみてください。ノートPCみたいにフロントカメラがあるとか、カメラがつながっているとかあれば、https://github.com/sktometometo/jsk_demos/blob/c361fd491a22f9a52358f62b350c0b900a0a628b/database_talker/sample/sample.launch#L9 の arg を使ってみてください。

@a-ichikura
Copy link

ありがとうございます。

他に影響がなければ pip uninstall bson して apt install python3-bson です。pymongoも同様にpip ではなくてaptで動作確認しています。どうしても、pipが良ければ/必要であれば、やり方考えるので教えてください。

pip である必要はないので、aptで入れ直したのですが同じエラーでした…

$ rosrun database_talker make_diary.py --prompt-type personality
<string>:869: SyntaxWarning: "is not" with a literal. Did you mean "!="?
<string>:872: SyntaxWarning: "is" with a literal. Did you mean "=="?
Traceback (most recent call last):
  File "/home/leus/aibo_ws/src/jsk_demos/database_talker/scripts/make_diary.py", line 13, in <module>
    from database_talker import DatabaseTalkerBase
  File "/home/leus/aibo_ws/devel/lib/python3/dist-packages/database_talker/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 10, in <module>
ImportError: cannot import name 'json_util' from 'bson' (/home/leus/aibo_ws/devel/.private/database_talker/share/database_talker/venv/lib/python3.8/site-packages/bson/__init__.py)
$ pip show bson
WARNING: Package(s) not found: bson
$ apt show python3-bson
Package: python3-bson
Version: 3.10.1-0ubuntu2
Priority: optional
Section: python
Source: pymongo
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Federico Ceratto <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 214 kB
Depends: python3:any
Recommends: python3-bson-ext
Homepage: https://api.mongodb.org/python/
Download-Size: 34.8 kB
APT-Manual-Installed: yes
APT-Sources: http://jp.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: Python3 implementation of BSON for MongoDB
 BSON Python3 module contains all of the Binary JSON encoding and decoding
 logic for MongoDB.
$ apt show python3-pymongo
Package: python3-pymongo
Version: 3.10.1-0ubuntu2
Priority: optional
Section: python
Source: pymongo
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Federico Ceratto <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,058 kB
Depends: python3-bson (= 3.10.1-0ubuntu2), python3:any
Recommends: python3-gridfs (>= 3.10.1-0ubuntu2), python3-pymongo-ext
Suggests: python-pymongo-doc
Homepage: https://api.mongodb.org/python/
Download-Size: 162 kB
APT-Manual-Installed: yes
APT-Sources: http://jp.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: Python3 interface to the MongoDB document-oriented database
 MongoDB is a high-performance, open source, schema-free
 document-oriented data store. Pymongo provides an interface
 to easily access it from Python3.
 Consider installing the python3-pymongo-ext C extension to improve performance.

[ERROR] [1712115706.826584841]: Cannot identify '/dev/video0': 2, No such file or directory このサンプルはPC+PCにUSBカメラがつながっている前提ですので、USBカメラをつなげてみてください。

デスクトップで試していたので、webカメラを指したらエラーなくなりました。ありがとうございます。

@k-okada
Copy link
Member

k-okada commented Apr 3, 2024

ごめんなさい

roscd database_talker
./scripts/make_diary.py (必要なオプション)

で動くとおもいます.rosrun ... で動かすには,git pullか何かでソースを新しくして

 catkin clean database_talker ; catkin build database_talker --start-with database_talker -vi

としてみて下さい.

@a-ichikura
Copy link

$ git status
On branch PR/hoge-py
Your branch is up to date with 'origin/PR/hoge-py'.

nothing to commit, working tree clean

$ git log
commit 627827226b29beea36d9eafa4e09dca9ad749d7c (HEAD -> PR/hoge-py, origin/PR/hoge-py)
Author: Kei Okada <[email protected]>
Date:   Wed Apr 3 18:01:14 2024 +0900

    use USE_SYSTEM_PACKAGES FALSE to avoid bson error

したのですが、

$ python3 ./scripts/make_diary.py --prompt-type personality
<string>:869: SyntaxWarning: "is not" with a literal. Did you mean "!="?
<string>:872: SyntaxWarning: "is" with a literal. Did you mean "=="?
Traceback (most recent call last):
  File "./scripts/make_diary.py", line 13, in <module>
    from database_talker import DatabaseTalkerBase
  File "/home/leus/aibo_ws/devel/lib/python3/dist-packages/database_talker/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 44, in <module>
ModuleNotFoundError: No module named 'mongodb_store'
$ rosrun database_talker make_diary.py --prompt-type personality
<string>:869: SyntaxWarning: "is not" with a literal. Did you mean "!="?
<string>:872: SyntaxWarning: "is" with a literal. Did you mean "=="?
Traceback (most recent call last):
  File "/home/leus/aibo_ws/src/jsk_demos/database_talker/scripts/make_diary.py", line 13, in <module>
    from database_talker import DatabaseTalkerBase
  File "/home/leus/aibo_ws/devel/lib/python3/dist-packages/database_talker/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 44, in <module>
ModuleNotFoundError: No module named 'mongodb_store'

どちらも同じエラー(mongodb_storeがない)になりました。

catkin clean database_talker ; catkin build database_talker --start-with database_talker -vi
としてみて下さい.
ここは実行済みです。

@k-okada
Copy link
Member

k-okada commented Apr 3, 2024

roscd database_talkerしたところで
rosdep install --from-path . --ignore-src してみてください apt install ros-noetic-mongodb-store が走ると思うんだけど..

@a-ichikura
Copy link

ありがとうございます。
できました!


Dear diary,

Today, I saw something super cool on a screen! It was all glitchy and looked like a puzzle. I haven't seen something like that in a long time, like 7 days! It was so fascinating to watch. I wish I could make something like that too!

From,
Dummy
水 03  4月 2024
[INFO] [1712139050.554929]: response = ぼくの日記、

今日、画面ですごくかっこいいものを見たよ!それは全部グリッチしてて、パズルみたいだった。ぼくはもう7日間ぐらい見てなかったよ!見てるのがすごく面白かった。ぼくもあんなもの作れた
らいいな!

ダミー より

tmp8p995a9b

@k-okada
Copy link
Member

k-okada commented Apr 3, 2024

あれ?カメラ変?rqt_image_view でも同じ画像になっている?

@a-ichikura
Copy link

変ですね‥webカメラ変えたら正常になったので、カメラが問題のような気がします。

プログラムは正常です。

@k-okada
Copy link
Member

k-okada commented Apr 4, 2024

変ですね‥webカメラ変えたら正常になったので、カメラが問題のような気がします。

エンコード関係かもしれないですね。Windowsとかでカメラつなげて、Zoom?か何かで見てみて、ちゃんと写っているなら、カメラ問題ではなくて、ソフトウェア側の問題だと切り分けられます。

https://github.com/sktometometo/jsk_demos/blob/c361fd491a22f9a52358f62b350c0b900a0a628b/database_talker/sample/sample.launch#L18-L19
https://github.com/ros-drivers/usb_cam?tab=readme-ov-file#device-supported-formats

k-okada and others added 18 commits April 12, 2024 16:19
…urred, also check similarity with past 10 sentences
…ause data retrieval from Lovot is only supported on daily basis, so we must replacate them on the next day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants