Given that the realtime chatting app Telegram
enables the use of bots why not connect your robot via that service?
You need python-telegram-bot
.
sudo pip install python-telegram-bot --upgrade
You need to get a TOKEN talking to the @botfather bot as described here. Remember you can use the Telegram web client, although you still need a phone with telegram to allow connecting to it.
Copy from config/example_token.yaml to token.yaml
and add your token.
cp `rospack find telegram_robot`/config/example_token.yaml `rospack find telegram_robot`/config/token.yaml
You can test if your token works with:
roslaunch telegram_robot echobot_example.launch
The bot should echo what you write to it.
- To publish anything the bot receives in the chat in a
std_msgs/String
topic (/telegram_bot/telegram_chat
) use:
roslaunch telegram_robot chat_pub.launch
Then you can do whatever you want with the sentences from any other node you program.
- To make the robot answer you back an image of your choosing of any
sensor_msgs/Image
topic available:
roslaunch telegram_robot chat_pub.launch
Watch it working in this video.
- To drive the robot via a
geometry_msgs/Twist
topic run:
roslaunch telegram_robot arrows.launch
Watch it working in this video.
Telegram recommends the Python libraries:
-
Telepot
. Python framework for Telegram Bot API. https://github.com/nickoala/telepot -
twx.botapi
. Library and client + documentation with Python examples. https://github.com/datamachine/twx.botapi
And googling you also find:
python-telegram-bot
. Pure Python interface for the Telegram Bot API. It's compatible with Python versions 2.7, 3.3+ and PyPy. It also works with Google App Engine. https://github.com/python-telegram-bot/python-telegram-bot
So we choose python-telegram-bot
after checking which had the biggest and most active community of users and also had good documentation.