ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi, Bool messages has data field, you can see it by calling dir(c) in your case.
I have checked this scenario in terminal by simpling typing python and then:
import rospy
from std_msgs.msg import Bool
z = Bool()
dir(z) # This outputs the values below
['__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__getattribute__', '__getstate__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_check_types', '_connection_header', '_full_text', '_get_types', '_has_header', '_md5sum', '_slot_types', '_type', 'data', 'deserialize', 'deserialize_numpy', 'serialize', 'serialize_numpy']
z.data # This outputs the value of the data
False
z.data = True
p = rospy.Publisher('/asd',Bool,queue_size=1)
rospy.init_node('asdd')
p.publish(z)