Class: Sensor_msgs::JoyFeedback
- Inherits:
-
ROS::Message
- Object
- ROS::Message
- Sensor_msgs::JoyFeedback
- Defined in:
- lib/sensor_msgs/JoyFeedback.rb
Constant Summary collapse
- TYPE_LED =
Pseudo-constants
0
- TYPE_RUMBLE =
1
- TYPE_BUZZER =
2
- @@struct_C2f =
::ROS::Struct.new("C2f")
- @@struct_L =
::ROS::Struct.new("L")
- @@slot_types =
['uint8','uint8','float32']
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#intensity ⇒ Object
Returns the value of attribute intensity.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#_get_types ⇒ String
internal API method.
-
#deserialize(str) ⇒ Object
unpack serialized message in str into this message instance @param [String] str: byte array of serialized message.
- #has_header? ⇒ Boolean
-
#initialize(args = {}) ⇒ JoyFeedback
constructor
Constructor.
- #message_definition ⇒ Object
-
#serialize(buff) ⇒ Object
serialize message into buffer.
Constructor Details
#initialize(args = {}) ⇒ JoyFeedback
Constructor. You can set the default values using keyword operators.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 57 def initialize(args={}) # message fields cannot be None, assign default values for those that are if args[:type] @type = args[:type] else @type = 0 end if args[:id] @id = args[:id] else @id = 0 end if args[:intensity] @intensity = args[:intensity] else @intensity = 0.0 end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
44 45 46 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 44 def id @id end |
#intensity ⇒ Object
Returns the value of attribute intensity.
44 45 46 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 44 def intensity @intensity end |
#type ⇒ Object
Returns the value of attribute type.
44 45 46 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 44 def type @type end |
Class Method Details
.md5sum ⇒ Object
8 9 10 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 8 def self.md5sum "f4dcd73460360d98f36e55ee7f2e46f1" end |
.type ⇒ Object
12 13 14 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 12 def self.type "sensor_msgs/JoyFeedback" end |
Instance Method Details
#_get_types ⇒ String
internal API method
78 79 80 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 78 def _get_types @slot_types end |
#deserialize(str) ⇒ Object
unpack serialized message in str into this message instance
@param [String] str: byte array of serialized message
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 95 def deserialize(str) begin end_point = 0 start = end_point end_point += ROS::Struct::calc_size('C2f') (@type, @id, @intensity,) = @@struct_C2f.unpack(str[start..(end_point-1)]) return self rescue => exception raise "message DeserializationError: #{exception}" #most likely buffer underfill end end |
#has_header? ⇒ Boolean
16 17 18 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 16 def has_header? false end |
#message_definition ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 20 def "# Declare of the type of feedback uint8 TYPE_LED = 0 uint8 TYPE_RUMBLE = 1 uint8 TYPE_BUZZER = 2 uint8 type # This will hold an id number for each type of each feedback. # Example, the first led would be id=0, the second would be id=1 uint8 id # Intensity of the feedback, from 0.0 to 1.0, inclusive. If device is # actually binary, driver should treat 0<=x<0.5 as off, 0.5<=x<=1 as on. float32 intensity " end |
#serialize(buff) ⇒ Object
serialize message into buffer
84 85 86 87 88 89 90 91 |
# File 'lib/sensor_msgs/JoyFeedback.rb', line 84 def serialize(buff) begin buff.write(@@struct_C2f.pack(@type, @id, @intensity)) rescue => exception raise "some erro in serialize: #{exception}" end end |