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

Revision history [back]

Your exact syntax is incorrect, but you can definitely set individual bits and decode the number in a subscriber. For example, something like msg.data = 8 would set the data field to have 0b00001000 in binary. You can set values using hex/binary/decimal (see integer literals), and you can also use C++ bitwise operators to set and access individual bits.