-
 

Package Summary

Tags No category tags.
Version 2.1.28
License Apache
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2024-07-10
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

The rostwitter package

Additional Links

No additional links.

Maintainers

  • k-okada

Authors

No additional authors.

rostwitter

This package is a ROS wrapper for Twitter. You can tweet via ROS.

How to use

Get access key for API.

Please get access to the Twitter API. Please refer to the following URL.

https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api

After that, save the yaml file in the following format.

CKEY: <Your Consumer API Key>
CSECRET: <Your Consumer SECRET API Key>
AKEY: <Your API Key>
ASECRET: <Your API Secret Key>

Launch tweet node

roslaunch rostwitter tweet.launch account_info:=<PATH TO YOUR YAML FILE>

Tweet text

You can tweet by simply publish on the /tweet topic.

rostopic pub /tweet std_msgs/String "Hello. Tweet via rostwitter (https://github.com/jsk-ros-pkg/jsk_3rdparty)"

If the string to be tweeted exceeds 140 full-width characters or 280 half-width characters, it will be tweeted in the “thread” display.

rostopic pub /tweet std_msgs/String """The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
"""

Tweet text with image

You can also tweet along with your images.

If a base64 or image path is inserted in the text, it will jump to the next reply in that section.

Image path

wget https://github.com/k-okada.png -O /tmp/k-okada.png
rostopic pub /tweet std_msgs/String "/tmp/k-okada.png"

Base64

You can even tweet the image by encoding in base64. The following example is in python.

Do not concatenate multiple base64 images without spaces.

import rospy
import cv2
import std_msgs.msg
import numpy as np
import matplotlib.cm

from rostwitter.cv_util import extract_media_from_text
from rostwitter.cv_util import encode_image_cv2

rospy.init_node('rostwitter_sample')
pub = rospy.Publisher('/tweet', std_msgs.msg.String, queue_size=1)
rospy.sleep(3.0)

colormap = matplotlib.cm.get_cmap('hsv')

text = 'Tweet with images. (https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/375)\n'
N = 12
for i in range(N):
    text += str(i)
    color = colormap(1.0 * i / N)[:3]
    img = color * np.ones((10, 10, 3), dtype=np.uint8) * 255
    img = np.array(img, dtype=np.uint8)
    text += encode_image_cv2(img) + ' '
pub.publish(text)

The result of the tweet.

CHANGELOG

Changelog for package rostwitter

2.1.28 (2023-07-24)

2.1.27 (2023-06-24)

  • fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
  • Contributors: Kei Okada

2.1.26 (2023-06-14)

  • add LICENSE files (#476)
  • Contributors: Kei Okada

2.1.25 (2023-06-08)

  • [rostwitter] use sub and not delete (#446)
  • [rostwitter] reduce save file io (#441)
  • [rostwitter] Support extracting base64 images and tweet them from text. with jpeg suffix support (#437)
  • [tweet_image_server] control volume by dynamic_reconfigure (#398)
  • rostwitter : install resource directory (#370)
  • [rostwitter] Suppress tweet log (#378)
  • GithubAction: add test for aarch64(melodic) / indigo (arm64) (#365)
    • tweet_image_server.py: sound_play version < 0.3.7 does not support 'sound_action' argument, so it uses robot_sound, instead of robot_sound_jp
  • add rostwitter.test (#285)
  • [rostwitter] set_aborted when error in tweet_image_server.py (#277)
  • Contributors: Aoi Nakane, Iori Yanokura, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata

2.1.24 (2021-07-26)

2.1.23 (2021-07-21)

2.1.22 (2021-06-10)

  • Refactor rostwitter (#235)
    • fix desired_encoding=bgr8
    • use action
    • speak warning
    • remove only if exists
    • add utf-8 encoding
    • add tweet_image_server
    • do not raise error
    • add util.py
    • add Tweet srv
    • add twitter.py for reuse
  • Contributors: Shingo Kitagawa

2.1.21 (2020-08-19)

2.1.20 (2020-08-07)

2.1.19 (2020-07-21)

2.1.18 (2020-07-20)

  • Fix for noetic (#200)
    • clean up CMakeList.txt find_package
    • use package.xml format 3 for package contains python depends
  • Contributors: Kei Okada

2.1.17 (2020-04-16)

2.1.16 (2020-04-16)

2.1.15 (2019-12-12)

2.1.14 (2019-11-21)

  • remove debug print line in rostwitter to suppress log (#178)
  • Contributors: Shingo Kitagawa

2.1.13 (2019-07-10)

2.1.12 (2019-05-25)

2.1.11 (2018-08-29)

2.1.10 (2018-04-25)

2.1.9 (2018-04-24)

2.1.8 (2018-04-17)

2.1.7 (2018-04-09)

2.1.6 (2017-11-21)

2.1.5 (2017-11-20)

  • update to use python-requests-oauthlib, maybe we can now just to copy python-twitter (#128 )
  • Contributors: Kei Okada

2.1.4 (2017-07-16)

2.1.3 (2017-07-07)

2.1.2 (2017-07-06)

2.1.1 (2017-07-05)

2.1.0 (2017-07-02)

  • rostwitter: fix error message when access token is not found (#100)
  • Contributors: Kei Okada

2.0.20 (2017-05-09)

2.0.19 (2017-02-22)

2.0.18 (2016-10-28)

2.0.17 (2016-10-22)

2.0.16 (2016-10-17)

2.0.15 (2016-10-16)

2.0.14 (2016-03-20)

2.0.13 (2015-12-15)

2.0.12 (2015-11-26)

2.0.11 (2015-10-07)

2.0.10 (2015-10-07)

2.0.9 (2015-09-26)

2.0.8 (2015-09-15)

2.0.7 (2015-09-14)

2.0.6 (2015-09-08)

2.0.5 (2015-08-23)

2.0.4 (2015-08-18)

2.0.3 (2015-08-01)

2.0.2 (2015-06-29)

2.0.1 (2015-06-19)

2.0.0 (2015-06-19)

  • move from jsk_common to jsk_3rdparty
  • [tweet.py] fix to post more than 116 character on PostMedia
  • Contributors: Kei Okada

1.0.72 (2015-06-07)

1.0.71 (2015-05-17)

1.0.70 (2015-05-08)

1.0.69 (2015-05-05)

1.0.68 (2015-05-05)

1.0.67 (2015-05-03)

  • [scripts/tweet.py] fix for error handling
  • Contributors: Kanae Kochigami

1.0.66 (2015-04-03)

1.0.65 (2015-04-02)

1.0.64 (2015-03-29)

1.0.63 (2015-02-19)

1.0.62 (2015-02-17)

1.0.61 (2015-02-11)

1.0.60 (2015-02-03)

1.0.59 (2015-02-03)

  • Remove rosbuild files
  • Contributors: Ryohei Ueda

1.0.58 (2015-01-07)

1.0.57 (2014-12-23)

1.0.56 (2014-12-17)

1.0.55 (2014-12-09)

1.0.54 (2014-11-15)

  • add python-requests
  • Contributors: Kei Okada

1.0.53 (2014-11-01)

1.0.52 (2014-10-23)

1.0.51 (2014-10-20)

1.0.50 (2014-10-20)

1.0.49 (2014-10-13)

1.0.48 (2014-10-12)

1.0.47 (2014-10-08)

1.0.46 (2014-10-03)

1.0.45 (2014-09-29)

  • Merge pull request #543 from k-okada/use_deb_request rewrite twitter.py to use ubuntu python-oauth2 and python-request
  • rewrite twitter.py to use ubuntu python-oauth2 and python-request

1.0.44 (2014-09-26)

1.0.43 (2014-09-26)

1.0.42 (2014-09-25)

  • add oauth2 and oauthlib to depends
  • Contributors: Kei Okada

1.0.41 (2014-09-23)

  • Fix rostwitter to call Api.postUpdate
  • Contributors: Ryohei Ueda

1.0.40 (2014-09-19)

1.0.39 (2014-09-17)

1.0.38 (2014-09-13)

1.0.36 (2014-09-01)

1.0.35 (2014-08-16)

1.0.34 (2014-08-14)

1.0.33 (2014-07-28)

1.0.32 (2014-07-26)

1.0.31 (2014-07-23)

1.0.30 (2014-07-15)

1.0.29 (2014-07-02)

1.0.28 (2014-06-24)

1.0.27 (2014-06-10)

1.0.26 (2014-05-30)

1.0.25 (2014-05-26)

  • do not error if pip is not installed

1.0.24 (2014-05-24)

  • rostwitter/rbayesian_belief_networks : add disable_ssl

1.0.23 (2014-05-23)

  • add rostwitter
  • Contributors: Kei Okada

1.0.22 (2014-05-22)

1.0.21 (2014-05-20)

1.0.20 (2014-05-09)

1.0.19 (2014-05-06)

1.0.18 (2014-05-04)

1.0.17 (2014-04-20)

1.0.16 (2014-04-19 23:29)

1.0.15 (2014-04-19 20:19)

1.0.14 (2014-04-19 12:52)

1.0.13 (2014-04-19 11:06)

1.0.12 (2014-04-18 16:58)

1.0.11 (2014-04-18 08:18)

1.0.10 (2014-04-17)

1.0.9 (2014-04-12)

1.0.8 (2014-04-11)

1.0.7 (2014-04-10)

1.0.6 (2014-04-07)

1.0.5 (2014-03-31)

1.0.4 (2014-03-29)

1.0.3 (2014-03-19)

1.0.2 (2014-03-12)

1.0.1 (2014-03-07)

1.0.0 (2014-03-05)

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rostwitter at Robotics Stack Exchange

Package Summary

Tags No category tags.
Version 2.1.28
License Apache
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2024-07-10
Dev Status DEVELOPED
CI status Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

The rostwitter package

Additional Links

No additional links.

Maintainers

  • k-okada

Authors

No additional authors.

rostwitter

This package is a ROS wrapper for Twitter. You can tweet via ROS.

How to use

Get access key for API.

Please get access to the Twitter API. Please refer to the following URL.

https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api

After that, save the yaml file in the following format.

CKEY: <Your Consumer API Key>
CSECRET: <Your Consumer SECRET API Key>
AKEY: <Your API Key>
ASECRET: <Your API Secret Key>

Launch tweet node

roslaunch rostwitter tweet.launch account_info:=<PATH TO YOUR YAML FILE>

Tweet text

You can tweet by simply publish on the /tweet topic.

rostopic pub /tweet std_msgs/String "Hello. Tweet via rostwitter (https://github.com/jsk-ros-pkg/jsk_3rdparty)"

If the string to be tweeted exceeds 140 full-width characters or 280 half-width characters, it will be tweeted in the “thread” display.

rostopic pub /tweet std_msgs/String """The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
"""

Tweet text with image

You can also tweet along with your images.

If a base64 or image path is inserted in the text, it will jump to the next reply in that section.

Image path

wget https://github.com/k-okada.png -O /tmp/k-okada.png
rostopic pub /tweet std_msgs/String "/tmp/k-okada.png"

Base64

You can even tweet the image by encoding in base64. The following example is in python.

Do not concatenate multiple base64 images without spaces.

import rospy
import cv2
import std_msgs.msg
import numpy as np
import matplotlib.cm

from rostwitter.cv_util import extract_media_from_text
from rostwitter.cv_util import encode_image_cv2

rospy.init_node('rostwitter_sample')
pub = rospy.Publisher('/tweet', std_msgs.msg.String, queue_size=1)
rospy.sleep(3.0)

colormap = matplotlib.cm.get_cmap('hsv')

text = 'Tweet with images. (https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/375)\n'
N = 12
for i in range(N):
    text += str(i)
    color = colormap(1.0 * i / N)[:3]
    img = color * np.ones((10, 10, 3), dtype=np.uint8) * 255
    img = np.array(img, dtype=np.uint8)
    text += encode_image_cv2(img) + ' '
pub.publish(text)

The result of the tweet.

CHANGELOG

Changelog for package rostwitter

2.1.28 (2023-07-24)

2.1.27 (2023-06-24)

  • fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
  • Contributors: Kei Okada

2.1.26 (2023-06-14)

  • add LICENSE files (#476)
  • Contributors: Kei Okada

2.1.25 (2023-06-08)

  • [rostwitter] use sub and not delete (#446)
  • [rostwitter] reduce save file io (#441)
  • [rostwitter] Support extracting base64 images and tweet them from text. with jpeg suffix support (#437)
  • [tweet_image_server] control volume by dynamic_reconfigure (#398)
  • rostwitter : install resource directory (#370)
  • [rostwitter] Suppress tweet log (#378)
  • GithubAction: add test for aarch64(melodic) / indigo (arm64) (#365)
    • tweet_image_server.py: sound_play version < 0.3.7 does not support 'sound_action' argument, so it uses robot_sound, instead of robot_sound_jp
  • add rostwitter.test (#285)
  • [rostwitter] set_aborted when error in tweet_image_server.py (#277)
  • Contributors: Aoi Nakane, Iori Yanokura, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata

2.1.24 (2021-07-26)

2.1.23 (2021-07-21)

2.1.22 (2021-06-10)

  • Refactor rostwitter (#235)
    • fix desired_encoding=bgr8
    • use action
    • speak warning
    • remove only if exists
    • add utf-8 encoding
    • add tweet_image_server
    • do not raise error
    • add util.py
    • add Tweet srv
    • add twitter.py for reuse
  • Contributors: Shingo Kitagawa

2.1.21 (2020-08-19)

2.1.20 (2020-08-07)

2.1.19 (2020-07-21)

2.1.18 (2020-07-20)

  • Fix for noetic (#200)
    • clean up CMakeList.txt find_package
    • use package.xml format 3 for package contains python depends
  • Contributors: Kei Okada

2.1.17 (2020-04-16)

2.1.16 (2020-04-16)

2.1.15 (2019-12-12)

2.1.14 (2019-11-21)

  • remove debug print line in rostwitter to suppress log (#178)
  • Contributors: Shingo Kitagawa

2.1.13 (2019-07-10)

2.1.12 (2019-05-25)

2.1.11 (2018-08-29)

2.1.10 (2018-04-25)

2.1.9 (2018-04-24)

2.1.8 (2018-04-17)

2.1.7 (2018-04-09)

2.1.6 (2017-11-21)

2.1.5 (2017-11-20)

  • update to use python-requests-oauthlib, maybe we can now just to copy python-twitter (#128 )
  • Contributors: Kei Okada

2.1.4 (2017-07-16)

2.1.3 (2017-07-07)

2.1.2 (2017-07-06)

2.1.1 (2017-07-05)

2.1.0 (2017-07-02)

  • rostwitter: fix error message when access token is not found (#100)
  • Contributors: Kei Okada

2.0.20 (2017-05-09)

2.0.19 (2017-02-22)

2.0.18 (2016-10-28)

2.0.17 (2016-10-22)

2.0.16 (2016-10-17)

2.0.15 (2016-10-16)

2.0.14 (2016-03-20)

2.0.13 (2015-12-15)

2.0.12 (2015-11-26)

2.0.11 (2015-10-07)

2.0.10 (2015-10-07)

2.0.9 (2015-09-26)

2.0.8 (2015-09-15)

2.0.7 (2015-09-14)

2.0.6 (2015-09-08)

2.0.5 (2015-08-23)

2.0.4 (2015-08-18)

2.0.3 (2015-08-01)

2.0.2 (2015-06-29)

2.0.1 (2015-06-19)

2.0.0 (2015-06-19)

  • move from jsk_common to jsk_3rdparty
  • [tweet.py] fix to post more than 116 character on PostMedia
  • Contributors: Kei Okada

1.0.72 (2015-06-07)

1.0.71 (2015-05-17)

1.0.70 (2015-05-08)

1.0.69 (2015-05-05)

1.0.68 (2015-05-05)

1.0.67 (2015-05-03)

  • [scripts/tweet.py] fix for error handling
  • Contributors: Kanae Kochigami

1.0.66 (2015-04-03)

1.0.65 (2015-04-02)

1.0.64 (2015-03-29)

1.0.63 (2015-02-19)

1.0.62 (2015-02-17)

1.0.61 (2015-02-11)

1.0.60 (2015-02-03)

1.0.59 (2015-02-03)

  • Remove rosbuild files
  • Contributors: Ryohei Ueda

1.0.58 (2015-01-07)

1.0.57 (2014-12-23)

1.0.56 (2014-12-17)

1.0.55 (2014-12-09)

1.0.54 (2014-11-15)

  • add python-requests
  • Contributors: Kei Okada

1.0.53 (2014-11-01)

1.0.52 (2014-10-23)

1.0.51 (2014-10-20)

1.0.50 (2014-10-20)

1.0.49 (2014-10-13)

1.0.48 (2014-10-12)

1.0.47 (2014-10-08)

1.0.46 (2014-10-03)

1.0.45 (2014-09-29)

  • Merge pull request #543 from k-okada/use_deb_request rewrite twitter.py to use ubuntu python-oauth2 and python-request
  • rewrite twitter.py to use ubuntu python-oauth2 and python-request

1.0.44 (2014-09-26)

1.0.43 (2014-09-26)

1.0.42 (2014-09-25)

  • add oauth2 and oauthlib to depends
  • Contributors: Kei Okada

1.0.41 (2014-09-23)

  • Fix rostwitter to call Api.postUpdate
  • Contributors: Ryohei Ueda

1.0.40 (2014-09-19)

1.0.39 (2014-09-17)

1.0.38 (2014-09-13)

1.0.36 (2014-09-01)

1.0.35 (2014-08-16)

1.0.34 (2014-08-14)

1.0.33 (2014-07-28)

1.0.32 (2014-07-26)

1.0.31 (2014-07-23)

1.0.30 (2014-07-15)

1.0.29 (2014-07-02)

1.0.28 (2014-06-24)

1.0.27 (2014-06-10)

1.0.26 (2014-05-30)

1.0.25 (2014-05-26)

  • do not error if pip is not installed

1.0.24 (2014-05-24)

  • rostwitter/rbayesian_belief_networks : add disable_ssl

1.0.23 (2014-05-23)

  • add rostwitter
  • Contributors: Kei Okada

1.0.22 (2014-05-22)

1.0.21 (2014-05-20)

1.0.20 (2014-05-09)

1.0.19 (2014-05-06)

1.0.18 (2014-05-04)

1.0.17 (2014-04-20)

1.0.16 (2014-04-19 23:29)

1.0.15 (2014-04-19 20:19)

1.0.14 (2014-04-19 12:52)

1.0.13 (2014-04-19 11:06)

1.0.12 (2014-04-18 16:58)

1.0.11 (2014-04-18 08:18)

1.0.10 (2014-04-17)

1.0.9 (2014-04-12)

1.0.8 (2014-04-11)

1.0.7 (2014-04-10)

1.0.6 (2014-04-07)

1.0.5 (2014-03-31)

1.0.4 (2014-03-29)

1.0.3 (2014-03-19)

1.0.2 (2014-03-12)

1.0.1 (2014-03-07)

1.0.0 (2014-03-05)

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rostwitter at Robotics Stack Exchange