Skip to content

[jsk_fetch_startup] Enable to attach pictures to kitchen demo#1463

Open
tkmtnt7000 wants to merge 2 commits intojsk-ros-pkg:masterfrom
tkmtnt7000:add-take-photo-kitchen
Open

[jsk_fetch_startup] Enable to attach pictures to kitchen demo#1463
tkmtnt7000 wants to merge 2 commits intojsk-ros-pkg:masterfrom
tkmtnt7000:add-take-photo-kitchen

Conversation

@tkmtnt7000
Copy link
Member

@tkmtnt7000 tkmtnt7000 commented Apr 20, 2022

Upstream pull requests


Please merge after #1462.
I cherry-picked knorth55#164.

This PR enables Fetch to attach pictures to kitchen-patrol-demo result email. I add take-photo function to attach pictures in email.
A photo of the inside of the trash can is now sent as an attachment to the email.

kitchen-demo

@k-okada
Copy link
Member

k-okada commented Apr 21, 2022

Can we embed images within the mail?

I think notification message contains two parts, one is a message for users, and the other one is a message to developers.
So, my idea is

Hi,
I succeeded in doing "Go to kitchen" job !!
I found kettle in kitchen stove and try in trash cans! See images below
<embed image or animation gif>

I also noticed trashcan is full!!
<embed images>

Best
Fetch 1074
===
Following smach is reported..
Following object .. reported...
Following trash .. reported..
I suceeded to upload data to...
 ...
 ..
 ...

@a-ichikura @kochigami may have an idea.

@708yamaguchi
Copy link
Member

In the daily go-to-kitchen demo, we use app_manager_utils/mail_notifier_plugin.py
https://github.com/knorth55/app_manager_utils/blob/54fa4f5c47415da5b941dfdde225b47824703d11/app_notifier/src/app_notifier/mail_notifier_plugin.py

In this python script, we use mailutils command to send email.

We can embed image in the email like this. (Please edit the last email address)

echo "<b>Hello, I go to kitchen.</b> <br> <img src='https://github.com/jsk-ros-pkg/jsk_robot/raw/master/jsk_fetch_robot/jsk_fetch_startup/apps/go_to_kitchen/go_to_kitchen.png'</img> <br> <b>There are kettles on the kitchen.</b>" | mail -s "$(echo -e "Go to kitchen succeeded\nContent-Type: text/html")" yamaguchi at jsk.imi.i.u-tokyo.ac.jp

Sent email:
image_embed

@k-okada
Copy link
Member

k-okada commented Apr 21, 2022

if our robot can send you a message in not a first person view, but the third person view, that would be great!!

@a-ichikura
Copy link
Contributor

a-ichikura commented Apr 25, 2022

I imagined ideal mails from fetch(or other robots).

Black letters mean diary text.
Blue small letters mean Classification of texts.

Image 1 and 2 are like morning repots.
Image 3 and 4 are like evening reports.

All version include Time, Place, People, and Greet.
Morning ones include "suggestion" and "To do in a day".
Evening ones include "Event in that day" and "Robot's feeling."(感想)

I use pictures from Microsoft PowerPoint.

スライド2
スライド3
スライド4
スライド5

@knorth55
Copy link
Member

@a-ichikura SUPER COOL! 😎

@a-ichikura
Copy link
Contributor

In kitchen demo, fetch can suggest beverage or food according to the weather(season).
For example,
If fetch finds a pot in Summer, "How about drinking cool Mugicha?"
In Winter, "How about drinking hot cocoa?"

When we decorate a flower vase in the kitchen,
Fetch may able to recognize from flower even though he can't go outside.
For example,
If fetch finds Sunflower in a flower vase, "How beautiful the iconic SUMMER flower is!"
In Christmas days, "I'm so excited to see Christmas Tree!"

I remember a B4 student tries to decorate with flowers, so I come up with these examples.

@tkmtnt7000 tkmtnt7000 force-pushed the add-take-photo-kitchen branch from 9c6f116 to c32ad30 Compare April 26, 2022 02:55
@tkmtnt7000
Copy link
Member Author

tkmtnt7000 commented Apr 26, 2022

I rebased 708yamaguchi/use-relative-coords #1458 to resolve conflicts and catch up origin/master.

@tkmtnt7000
Copy link
Member Author

Can we embed images within the mail?

メールに画像を埋め込む方法は今JSKのロボットで使っているメール送信ノードの種類によって違いがあると思います.

  1. https://github.com/knorth55/app_manager_utils/tree/master/app_notifier を使う方法
    こちらの場合はメール本文にhtmlを直書きすれば,山口さんが以前送っていたような感じで(インターネットからアクセスできる)画像を埋め込んで送ることができると思います.html直書きせずに指定の位置に画像を埋め込んで送るには,使用しているjsonのキーを増やす必要があるのかなと思っています.

  2. https://github.com/jsk-ros-pkg/jsk_robot/blob/4ff519bae7530141af9c6d01d8da42903d11da81/jsk_robot_common/jsk_robot_startup/scripts/email_topic.py を使う方法
    こちらの場合にはメール本文にhtmlを直書きしても画像を埋め込んで送れないので,以下のように新たにrosmsgを作成してリストか何かにして送るような形になります.ただ,新たなrosmsgを作成する場合には機能追加する場合(例:メール中の埋め込み画像を中央揃えしたい) にmsgを作り直す必要がある気がしていて,それをいちいちやり直すのは手間が増えるような気がします.

# EmailMsgs.msg?
string type # text, img, ...
string message # For text type
std_msgs/int16 height # For img type about image size
std_msgs/int16 width # For img type about image size
...

上のような感じで考えてみたのですが,実装方法についてもう少し相談したいです.
また,メール送信に関するプログラムが複数あるので,今後統合していくのか,用途に応じて使い分けるのかも検討が必要そうです.
Cc: @knorth55 @708yamaguchi

@knorth55
Copy link
Member

個人的には2に統合しようと思っています
2の形でいい感じのAPIになることを模索するのがいいと思います
最悪msgにHTMLをStringで送る形でも

@708yamaguchi
Copy link
Member

今のemail_topic.pyでは,email.mimeライブラリにあるオブジェクトを利用してメールを生成しています.

from email.mime.text import MIMEText

同じように,email.mime以下にあるクラスをカバーするようなrosmsgを生成するのが良いんじゃないでしょうか.
MIMEAudio, MIMEImage, MIMETextくらいに対応すればいいのかな
https://docs.python.org/ja/3.7/library/email.mime.html

@tkmtnt7000
Copy link
Member Author

北川さん,山口さんありがとうございます.
ひとまずemail_topic.pyからいい感じに送れるように作成してみます.

@tkmtnt7000
Copy link
Member Author

Make PR in #1485 and support embed image.

@tkmtnt7000 tkmtnt7000 changed the title [Merge after #1462] [jsk_fetch_startup] Enable to attach pictures to kitchen demo [jsk_fetch_startup] Enable to attach pictures to kitchen demo Jul 21, 2022
@tkmtnt7000 tkmtnt7000 force-pushed the add-take-photo-kitchen branch from c32ad30 to 29d23a1 Compare July 21, 2022 07:55
@tkmtnt7000
Copy link
Member Author

I rebased current jsk-ros-pkg/jsk_robot master branch to resolve conflicts.

@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

please resolve the conflict.

@tkmtnt7000 tkmtnt7000 force-pushed the add-take-photo-kitchen branch from 7cf231a to c6f5e80 Compare October 4, 2022 05:32
@tkmtnt7000
Copy link
Member Author

I rebased current origin/master again.

@sktometometo sktometometo force-pushed the add-take-photo-kitchen branch from c6f5e80 to 62385f8 Compare June 27, 2023 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants