ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure why you're converting to a string and then back to an int.

If you have an Int8, you should be able to call bin() on the data member directly:

# Import the Int8 message definition
from std_msgs.msg import Int8

# create an Int8 message and assign 32 to it
num = Int8()
num.data = 32

# call bin() on our Int8 data and print the result
print bin(num.data)