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

How to send a Twist message #65

Open
vbelkina opened this issue Apr 17, 2023 · 1 comment
Open

How to send a Twist message #65

vbelkina opened this issue Apr 17, 2023 · 1 comment

Comments

@vbelkina
Copy link

Hello,

I am wondering if you could give an example of formatting the JSON to send a Twist message.

Thank you!

@danielcranston
Copy link

I assume you're asking about the required format (data layout) of the JSON string in order to create a Twist message.

To answer these kinds of questions you can always "go the opposite direction": take a arbitrarily instantiated Twist message (or whatever ROS message you're interested in) and convert it to JSON:

>>> from geometry_msgs.msg import Twist
>>> from rospy_message_converter import json_message_converter
>>> json_message_converter.convert_ros_message_to_json(Twist())
'{"linear": {"x": 0.0, "y": 0.0, "z": 0.0}, "angular": {"x": 0.0, "y": 0.0, "z": 0.0}}'

Likewise for convert_ros_message_to_dictionary obviously.

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

No branches or pull requests

2 participants