asterism 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -4
  3. data/NOTICE +12 -7
  4. data/README.md +148 -17
  5. data/data/icon.png +0 -0
  6. data/data/msgs/LICENSE-BSD-3-Clause-tf2_msgs.txt +29 -0
  7. data/data/msgs/NOTICE +19 -13
  8. data/data/msgs/builtin_interfaces/msg/Duration.rb +4 -0
  9. data/data/msgs/builtin_interfaces/msg/Time.rb +4 -0
  10. data/data/msgs/diagnostic_msgs/msg/DiagnosticArray.rb +40 -0
  11. data/data/msgs/diagnostic_msgs/msg/DiagnosticStatus.rb +55 -0
  12. data/data/msgs/diagnostic_msgs/msg/KeyValue.rb +37 -0
  13. data/data/msgs/example_interfaces/srv/AddTwoInts.rb +7 -0
  14. data/data/msgs/geometry_msgs/msg/Accel.rb +4 -0
  15. data/data/msgs/geometry_msgs/msg/AccelStamped.rb +4 -0
  16. data/data/msgs/geometry_msgs/msg/Point.rb +5 -0
  17. data/data/msgs/geometry_msgs/msg/Point32.rb +5 -0
  18. data/data/msgs/geometry_msgs/msg/PointStamped.rb +4 -0
  19. data/data/msgs/geometry_msgs/msg/Pose.rb +4 -0
  20. data/data/msgs/geometry_msgs/msg/Pose2D.rb +5 -0
  21. data/data/msgs/geometry_msgs/msg/PoseStamped.rb +4 -0
  22. data/data/msgs/geometry_msgs/msg/PoseWithCovariance.rb +39 -0
  23. data/data/msgs/geometry_msgs/msg/Quaternion.rb +6 -0
  24. data/data/msgs/geometry_msgs/msg/QuaternionStamped.rb +4 -0
  25. data/data/msgs/geometry_msgs/msg/Transform.rb +4 -0
  26. data/data/msgs/geometry_msgs/msg/TransformStamped.rb +5 -0
  27. data/data/msgs/geometry_msgs/msg/Twist.rb +4 -0
  28. data/data/msgs/geometry_msgs/msg/TwistStamped.rb +4 -0
  29. data/data/msgs/geometry_msgs/msg/TwistWithCovariance.rb +39 -0
  30. data/data/msgs/geometry_msgs/msg/Vector3.rb +5 -0
  31. data/data/msgs/geometry_msgs/msg/Vector3Stamped.rb +4 -0
  32. data/data/msgs/geometry_msgs/msg/Wrench.rb +4 -0
  33. data/data/msgs/geometry_msgs/msg/WrenchStamped.rb +4 -0
  34. data/data/msgs/nav_msgs/msg/MapMetaData.rb +52 -0
  35. data/data/msgs/nav_msgs/msg/OccupancyGrid.rb +44 -0
  36. data/data/msgs/nav_msgs/msg/Odometry.rb +49 -0
  37. data/data/msgs/nav_msgs/msg/Path.rb +40 -0
  38. data/data/msgs/rcl_interfaces/msg/Log.rb +64 -0
  39. data/data/msgs/rcl_interfaces/msg/Parameter.rb +39 -0
  40. data/data/msgs/rcl_interfaces/msg/ParameterEvent.rb +52 -0
  41. data/data/msgs/rcl_interfaces/msg/ParameterValue.rb +69 -0
  42. data/data/msgs/sensor_msgs/msg/BatteryState.rb +18 -0
  43. data/data/msgs/sensor_msgs/msg/CompressedImage.rb +43 -0
  44. data/data/msgs/sensor_msgs/msg/FluidPressure.rb +5 -0
  45. data/data/msgs/sensor_msgs/msg/Illuminance.rb +5 -0
  46. data/data/msgs/sensor_msgs/msg/Imu.rb +9 -0
  47. data/data/msgs/sensor_msgs/msg/JointState.rb +7 -0
  48. data/data/msgs/sensor_msgs/msg/LaserScan.rb +71 -0
  49. data/data/msgs/sensor_msgs/msg/MagneticField.rb +5 -0
  50. data/data/msgs/sensor_msgs/msg/NavSatFix.rb +9 -0
  51. data/data/msgs/sensor_msgs/msg/NavSatStatus.rb +4 -0
  52. data/data/msgs/sensor_msgs/msg/PointCloud2.rb +68 -0
  53. data/data/msgs/sensor_msgs/msg/PointField.rb +53 -0
  54. data/data/msgs/sensor_msgs/msg/Range.rb +9 -0
  55. data/data/msgs/sensor_msgs/msg/RelativeHumidity.rb +5 -0
  56. data/data/msgs/sensor_msgs/msg/Temperature.rb +5 -0
  57. data/data/msgs/std_msgs/msg/Bool.rb +3 -0
  58. data/data/msgs/std_msgs/msg/Byte.rb +3 -0
  59. data/data/msgs/std_msgs/msg/ByteMultiArray.rb +4 -0
  60. data/data/msgs/std_msgs/msg/Char.rb +3 -0
  61. data/data/msgs/std_msgs/msg/ColorRGBA.rb +6 -0
  62. data/data/msgs/std_msgs/msg/Empty.rb +1 -0
  63. data/data/msgs/std_msgs/msg/Float32.rb +3 -0
  64. data/data/msgs/std_msgs/msg/Float32MultiArray.rb +4 -0
  65. data/data/msgs/std_msgs/msg/Float64.rb +3 -0
  66. data/data/msgs/std_msgs/msg/Float64MultiArray.rb +4 -0
  67. data/data/msgs/std_msgs/msg/Header.rb +4 -0
  68. data/data/msgs/std_msgs/msg/Int16.rb +3 -0
  69. data/data/msgs/std_msgs/msg/Int16MultiArray.rb +4 -0
  70. data/data/msgs/std_msgs/msg/Int32.rb +3 -0
  71. data/data/msgs/std_msgs/msg/Int32MultiArray.rb +4 -0
  72. data/data/msgs/std_msgs/msg/Int64.rb +3 -0
  73. data/data/msgs/std_msgs/msg/Int64MultiArray.rb +4 -0
  74. data/data/msgs/std_msgs/msg/Int8.rb +3 -0
  75. data/data/msgs/std_msgs/msg/Int8MultiArray.rb +4 -0
  76. data/data/msgs/std_msgs/msg/MultiArrayDimension.rb +5 -0
  77. data/data/msgs/std_msgs/msg/MultiArrayLayout.rb +4 -0
  78. data/data/msgs/std_msgs/msg/String.rb +3 -0
  79. data/data/msgs/std_msgs/msg/UInt16.rb +3 -0
  80. data/data/msgs/std_msgs/msg/UInt16MultiArray.rb +4 -0
  81. data/data/msgs/std_msgs/msg/UInt32.rb +3 -0
  82. data/data/msgs/std_msgs/msg/UInt32MultiArray.rb +4 -0
  83. data/data/msgs/std_msgs/msg/UInt64.rb +3 -0
  84. data/data/msgs/std_msgs/msg/UInt64MultiArray.rb +4 -0
  85. data/data/msgs/std_msgs/msg/UInt8.rb +3 -0
  86. data/data/msgs/std_msgs/msg/UInt8MultiArray.rb +4 -0
  87. data/data/msgs/tf2_msgs/msg/TFMessage.rb +35 -0
  88. data/data/msgs/visualization_msgs/msg/Marker.rb +132 -0
  89. data/data/msgs/visualization_msgs/msg/MarkerArray.rb +35 -0
  90. data/data/msgs/visualization_msgs/msg/MeshFile.rb +37 -0
  91. data/data/msgs/visualization_msgs/msg/UVCoordinate.rb +37 -0
  92. data/lib/asterism/cruby/objects.rb +13 -1
  93. data/lib/asterism/cruby.rb +38 -0
  94. data/lib/asterism/version.rb +4 -3
  95. data/lib/asterism.rb +1 -1
  96. data/mrblib/asterism.rb +5 -0
  97. data/mrblib/profile.rb +362 -0
  98. data/mrblib/ros.rb +71 -6
  99. data/tools/asterism_msggen.rb +32 -5
  100. metadata +28 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1100d56c90f65bbfdf0d6fcd5c383483e61bbb815ced349307e67226b07ebcdb
4
- data.tar.gz: 6adef73606920ab9e432b9bddf430038924181d77bdaa5d2fb60e424882204d7
3
+ metadata.gz: b55c825f8859d86ba09baad0585c0f416a168023b8032c3f871d63bebef0538c
4
+ data.tar.gz: 4d6fd26b326e62348e4fba8c6881c48b5b7145dd0b0c701eb7ba1dcc1bf5b261
5
5
  SHA512:
6
- metadata.gz: 2bc05b237dc8cd2fc04b169c132263004718ef8c5fe04f7037bf8ec415ae72e3da57e962d77ccd93b224f5875187004c511e13b25145f496e3c85f5ef0006135
7
- data.tar.gz: c12becb195ae73c664bb31e274865ff738c2074d42ffc0381312ccf32b73c883c9ec0605079b5c867272c47246116e37b65ca51db7a8e2b5c287ba020032b70a
6
+ metadata.gz: 0acc8e1c4e4f028124d247a54e35ebda3451449dcfc46da503d345c857502200b1b68b4f15a4d59fbb7a603d9331f6996aa9072b1426e039fea87b43efbddd5e
7
+ data.tar.gz: 03b912800f24b881a7e01eb6479c2d8c3c2c32a3346538ea60ae5f65c431f3035e097f5fc90fdcaec7734efbf95496544c4b0dd174b12e6be20cabfec2db3635
data/CHANGELOG.md CHANGED
@@ -1,10 +1,84 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to asterism (the CRuby gem) and picoruby-asterism (the
4
- mrbgem; the same `mrblib/`). Nothing has been published to rubygems.org
5
- yet; the versions below are the ones in this repository. From 0.4.0 the
6
- two Zenoh bindings (asterism-zenoh, picoruby-asterism-zenoh) carry the
7
- same version number.
4
+ mrbgem; the same `mrblib/`). 0.4.0 is the first version on rubygems.org;
5
+ the earlier ones are only in this repository. From 0.4.0 the two Zenoh
6
+ bindings (asterism-zenoh, picoruby-asterism-zenoh) carry the same minor
7
+ version (a patch release of one may come without the other).
8
+
9
+ ## 0.5.0
10
+
11
+ Node profiles; every 0.4.x call works as before. Needs asterism-zenoh /
12
+ picoruby-asterism-zenoh 0.4.0 (unchanged).
13
+
14
+ Added
15
+
16
+ - Node profiles (README "Profiles"): `Asterism.profile(kind:, name:, host:,
17
+ icon:)` sets this node's profile (the fields given; the rest stay) and
18
+ returns it, `Asterism.profile` returns it, `Asterism.profile_of(node,
19
+ icon: true, timeout: 2.0)` asks another node's (nil when it does not
20
+ answer). The CRuby API: `net.profile`, `net.profile_of`. Answered on
21
+ `asterism/<node>/@profile` (a queryable of every connected application,
22
+ MessagePack Hash: `kind`, `host`, `name`, `icon`, `icon_hash`; the
23
+ parameter `icon=0` leaves the icon out), and put on the same key without
24
+ the icon at connect and on each change.
25
+ - Defaults: `kind` is `cruby` on CRuby and `picoruby` on mruby / PicoRuby;
26
+ the icon is the file at `Asterism.default_icon_path` when it is there:
27
+ the gem's `data/icon.png` on CRuby (new; a ruby, 32x32), and
28
+ `/usr/share/asterism/icon.png` on the boards.
29
+ - `Asterism::Profile`: `png_info` (the icon checks: PNG signature, chunks
30
+ from IHDR to IEND, 8 KB, 256x256; and `icon_hash`, the Adler-32 of the
31
+ chunks' CRCs), `check` (cleans a received profile: an icon that does not
32
+ pass is dropped), the limits as constants.
33
+ - `rake test:mruby` and `host_test/`: the shared layer on mruby (built with
34
+ picoruby-asterism-zenoh, MRB_UTF8_STRING as on the boards), profiles
35
+ between two mruby processes. CI runs it.
36
+
37
+ Changed
38
+
39
+ - The "Ruby profile" (0.4.0) is now called the Ruby feature table, so that
40
+ it is not taken for a node's profile: `docs/ruby_profile.md` is
41
+ `docs/ruby_features.md`. The probes' directory `profile/` and its code
42
+ keep their names.
43
+
44
+ ## 0.4.1
45
+
46
+ Additions and a fix; every 0.4.0 call works as before. Needs
47
+ asterism-zenoh / picoruby-asterism-zenoh 0.4.0 (unchanged).
48
+
49
+ Added
50
+
51
+ - More bundled types (`data/msgs`, 62 -> 84 files): rcl_interfaces (Log for
52
+ `/rosout`, ParameterEvent, Parameter, ParameterValue), nav_msgs
53
+ (Odometry, Path, MapMetaData, OccupancyGrid), sensor_msgs (LaserScan,
54
+ PointField, PointCloud2, and CompressedImage for Marker),
55
+ diagnostic_msgs (DiagnosticArray, DiagnosticStatus, KeyValue),
56
+ tf2_msgs/TFMessage, visualization_msgs (Marker, MarkerArray, MeshFile,
57
+ UVCoordinate), geometry_msgs PoseWithCovariance and TwistWithCovariance
58
+ (for Odometry). Every type hash matches ROS 2 Jazzy's type description
59
+ JSON. tf2_msgs is under the BSD 3-Clause License
60
+ (`data/msgs/LICENSE-BSD-3-Clause-tf2_msgs.txt`); the gem's licenses are
61
+ now `MIT`, `Apache-2.0` and `BSD-3-Clause`.
62
+ - `FIELD_TYPES` in every generated message: per field
63
+ `[name, base, kind, nested, capacity, string_capacity]`, plain Arrays,
64
+ Strings, Integers and nil (kind is `"scalar"`, `"array"`,
65
+ `"bounded_sequence"` or `"sequence"`). A string sequence and a number
66
+ sequence can now be told apart without the .msg.
67
+ - `Asterism::ROS.field_types(type)`: the `FIELD_TYPES` of a type and of
68
+ every message type it is made of, `{ROS name => FIELD_TYPES}` (for a
69
+ service, its Request and Response).
70
+
71
+ Fixed
72
+
73
+ - `Asterism::ROS.require_type` checks the type name before it builds a
74
+ path: `pkg/msg/Name` or `pkg/srv/Name`, the package `[a-z][a-z0-9_]*`,
75
+ the name `[A-Z][A-Za-z0-9]*` (checked byte by byte; the boards have no
76
+ Regexp). A package name with `..` could point above a `TYPE_PATH`
77
+ directory. Anything else raises `ArgumentError`, as a malformed name did
78
+ before.
79
+
80
+ Types generated by the 0.4.0 generator still load; regenerate them to get
81
+ `FIELD_TYPES`.
8
82
 
9
83
  ## 0.4.0
10
84
 
data/NOTICE CHANGED
@@ -4,7 +4,8 @@ Asterism's own code is under the MIT License (LICENSE).
4
4
 
5
5
  This repository also contains material made from ROS 2 message and service
6
6
  definitions, which are licensed under the Apache License, Version 2.0
7
- (data/msgs/LICENSE-Apache-2.0.txt):
7
+ (data/msgs/LICENSE-Apache-2.0.txt), except tf2_msgs, which is under the BSD
8
+ 3-Clause License (data/msgs/LICENSE-BSD-3-Clause-tf2_msgs.txt):
8
9
 
9
10
  - tools/ros2_jazzy/: the .msg / .srv definitions and the package.xml of
10
11
  their packages as distributed with ROS 2 Jazzy
@@ -16,12 +17,16 @@ definitions, which are licensed under the Apache License, Version 2.0
16
17
  - test/msgs/golden_cdr.tsv and test/msgs/test_type_hashes.txt: values
17
18
  computed by ROS 2's tools (rclpy, rosidl) in a ROS 2 Jazzy image.
18
19
 
19
- The ROS 2 packages these come from, all "Apache License 2.0" in their
20
- package.xml:
20
+ The ROS 2 packages these come from, with the license in their package.xml:
21
21
 
22
- - std_msgs, geometry_msgs, sensor_msgs (ros2/common_interfaces)
23
- - builtin_interfaces, service_msgs (ros2/rcl_interfaces)
24
- - example_interfaces (ros2/example_interfaces)
22
+ - std_msgs, geometry_msgs, sensor_msgs, nav_msgs, diagnostic_msgs,
23
+ visualization_msgs (ros2/common_interfaces): "Apache License 2.0"
24
+ - builtin_interfaces, service_msgs, rcl_interfaces (ros2/rcl_interfaces):
25
+ "Apache License 2.0"
26
+ - example_interfaces (ros2/example_interfaces): "Apache License 2.0"
27
+ - tf2_msgs (ros2/geometry2): "BSD" (the BSD 3-Clause License of that
28
+ repository; Copyright (c) 2008, Willow Garage, Inc.)
25
29
 
26
30
  Copyright in the definitions belongs to their authors (Open Source Robotics
27
- Foundation, Inc. and the ROS 2 contributors); see those repositories.
31
+ Foundation, Inc., Willow Garage, Inc. and the ROS 2 contributors); see those
32
+ repositories.
data/README.md CHANGED
@@ -10,10 +10,12 @@ repository holds the pure Ruby layers, written once for every Ruby:
10
10
  | `mrblib/` | The layers: remote objects (`Asterism`), `Asterism::CDR`, `Asterism::ROS`. The source of truth for both forms below |
11
11
  | `mrbgem.rake` | The mrbgem `picoruby-asterism` (mruby / PicoRuby): compiles `mrblib/` |
12
12
  | `asterism.gemspec`, `lib/` | The CRuby gem `asterism`: `lib/asterism.rb` loads `mrblib/` as it is, `lib/asterism/cruby.rb` adds what CRuby needs, `lib/asterism/cruby/` the CRuby API (CRuby only) |
13
- | `data/msgs/` | ROS 2 message types generated from ROS 2 Jazzy's definitions (Apache-2.0, see NOTICE) |
13
+ | `data/icon.png` | CRuby's default profile icon (32x32 PNG; [Profiles](#profiles)) |
14
+ | `data/msgs/` | ROS 2 message types generated from ROS 2 Jazzy's definitions (Apache-2.0; tf2_msgs BSD-3-Clause; see NOTICE) |
14
15
  | `tools/` | The type generator `asterism_msggen.rb`, the Jazzy definitions it reads, `ros2_types.rb` (refreshes them from a ROS 2 image) |
15
- | `test/` | `test/msgs` (types, CDR; CRuby only), `test_asterism.rb` (objects and ROS between CRuby sessions), `test_api_*.rb` (the CRuby API) |
16
- | `examples/` | CRuby: `node.rb` (objects with a board), `node_polled.rb` (the same with the portable API of the boards), `ros2_talker.rb` (topics, a timer, services with ROS 2), `zenoh.rb` (plain Zenoh) |
16
+ | `test/` | `test/msgs` (types, CDR; CRuby only), `test_asterism.rb` (objects and ROS between CRuby sessions), `test_profile.rb` (node profiles), `test_api_*.rb` (the CRuby API) |
17
+ | `host_test/` | `rake test:mruby`: the shared layer on mruby (profiles between two mruby processes) |
18
+ | `examples/` | CRuby: `node.rb` (objects with a board), `node_polled.rb` (the same with the portable API of the boards), `ros2_talker.rb` (topics, a timer, services with ROS 2), `ros2_rover.rb` (drive a ROS 2 robot: `/cmd_vel`, `/odom`, `/imu`), `zenoh.rb` (plain Zenoh), `mujoco/` (MuJoCo run from CRuby through Fiddle, its robot exposed as Asterism objects; see its README) |
17
19
 
18
20
  The Zenoh binding underneath is a separate gem with the same Ruby API on
19
21
  each Ruby:
@@ -35,7 +37,9 @@ Both gems are on rubygems.org (`gem install asterism` installs
35
37
  asterism-zenoh too). What changed in each version is in
36
38
  [CHANGELOG.md](CHANGELOG.md); 0.4.0 is the first step toward 1.0
37
39
  ([docs/api_review.md](docs/api_review.md)) and only adds and deprecates
38
- (see [Deprecations and 1.0](#deprecations-and-10)).
40
+ (see [Deprecations and 1.0](#deprecations-and-10)); 0.5.0 adds node
41
+ profiles ([Profiles](#profiles): what a node runs on, where, a name and an
42
+ icon).
39
43
 
40
44
  ## Which API?
41
45
 
@@ -83,7 +87,7 @@ build but not yet tested. To install from the repositories instead:
83
87
 
84
88
  ```
85
89
  (cd ../asterism-zenoh && rake gem) && rake gem
86
- gem install --local ../asterism-zenoh/pkg/asterism-zenoh-0.4.0.gem pkg/asterism-0.4.0.gem
90
+ gem install --local ../asterism-zenoh/pkg/asterism-zenoh-0.4.0.gem pkg/asterism-0.5.0.gem
87
91
  ```
88
92
 
89
93
  From the working trees, without installing:
@@ -111,8 +115,17 @@ rake test:msgs # generator, type hashes, CDR, bundled types (CRuby only;
111
115
  rake test:objects # objects and Asterism::ROS between CRuby sessions over a local peer link
112
116
  rake test:api # the CRuby API (blocks, receiving threads, Enumerators)
113
117
  ASTERISM_TEST_ROUTER=tcp/127.0.0.1:7447 rake test:objects test:api # the same through a zenohd router
118
+ rake test:mruby # the shared layer on mruby (builds mruby; not part of `rake`)
114
119
  ```
115
120
 
121
+ `test:mruby` builds mruby with picoruby-asterism-zenoh and this gem
122
+ (MRB_UTF8_STRING, as on Family mruby's boards) and runs `host_test/`: two
123
+ mruby processes over a local peer link. It takes the mruby and zenoh-pico
124
+ pinned by a picoruby-asterism-zenoh checkout next to this one (its
125
+ `rake mruby:fetch zenoh:fetch`), or `PICORUBY_ASTERISM_ZENOH_DIR` /
126
+ `MRUBY_DIR`. A small MessagePack for the test is in
127
+ `host_test/msgpack.rb` (the boards bring their own).
128
+
116
129
  `test:objects` and `test:api` need asterism-zenoh: built next to this repository
117
130
  (`../asterism-zenoh`, its `rake compile`), or `ASTERISM_ZENOH_DIR`, or the
118
131
  installed gem. The tests run with deprecated calls raising
@@ -131,6 +144,17 @@ ruby examples/node_polled.rb --router tcp/192.0.2.2:7447 # the same, polled
131
144
  # /cruby/add_two_ints served, AddTwoInts calls
132
145
  ruby examples/ros2_talker.rb --router tcp/192.0.2.2:7447 [--service NAME]
133
146
 
147
+ # ROS 2: drive a robot (made for family-mruby's MuJoCo rover,
148
+ # docker-compose.mujoco.yml): 1 m forward and 90 degrees left by /odom,
149
+ # compared with /ground_truth/odom; or the keyboard
150
+ ruby examples/ros2_rover.rb --router tcp/192.0.2.2:7447 [--keys]
151
+
152
+ # MuJoCo from CRuby (Fiddle), the robot as objects mujoco/rover/{drive,state,world};
153
+ # the MuJoCo release is fetched into examples/mujoco/vendor (examples/mujoco/README.md)
154
+ ruby examples/mujoco/fetch.rb
155
+ ruby examples/mujoco/rover.rb --router tcp/192.0.2.2:7447
156
+ ruby examples/mujoco/drive.rb --router tcp/192.0.2.2:7447 [--keys]
157
+
134
158
  # plain Zenoh: run two with different --name
135
159
  ruby examples/zenoh.rb --router tcp/192.0.2.2:7447 --name pc1
136
160
  ```
@@ -227,6 +251,7 @@ end
227
251
  | `net.each(pattern = "**")` | the proxies alive now; an Enumerator without a block. With a block it returns their number (1.0: `self`, as Ruby's `each` does; `net.count` is the number) |
228
252
  | `net.on_join { \|node\| }` / `net.on_leave { \|node\| }` | `Asterism.on_join` / `on_leave` of the portable API (the same blocks, told from `Asterism.poll`), here on the receiving thread; what they raise goes to `on_error`. `net.off_join(proc)` / `off_leave(proc)` remove one |
229
253
  | `net.start` / `stop` / `run` / `running?` / `on_error` | as for Zenoh. A method of an exposed object that raises is answered to its caller as a `RemoteError`, as before; `on_error` gets what `on_join` / `on_leave` raise |
254
+ | `net.profile(**fields)` / `net.profile_of(node, icon: true, timeout: 2.0)` | `Asterism.profile` / `profile_of` ([Profiles](#profiles)); `profile_of` waits for the receiving thread's ticks while it runs |
230
255
  | `net.nodes`, `node_id`, `app`, `connected?`, `lost_reason`, `poll`, `close` | |
231
256
 
232
257
  ### Over TLS (a router on the internet)
@@ -339,9 +364,11 @@ MIT (LICENSE) for Asterism's code. The ROS 2 definitions in
339
364
  `tools/ros2_jazzy/` (with the package.xml of their packages), the types
340
365
  generated from them in `data/msgs/` and the fixtures computed by ROS 2's
341
366
  tools in `test/msgs/` are under the Apache License 2.0 (NOTICE,
342
- `data/msgs/NOTICE`, `data/msgs/LICENSE-Apache-2.0.txt`). Each generated
343
- type names its package and license at its top. The gem `asterism` is
344
- therefore `MIT` and `Apache-2.0`, each for its own files.
367
+ `data/msgs/NOTICE`, `data/msgs/LICENSE-Apache-2.0.txt`), except those of
368
+ tf2_msgs, which are under the BSD 3-Clause License
369
+ (`data/msgs/LICENSE-BSD-3-Clause-tf2_msgs.txt`). Each generated type names
370
+ its package and license at its top. The gem `asterism` is therefore `MIT`,
371
+ `Apache-2.0` and `BSD-3-Clause`, each for its own files.
345
372
 
346
373
  Not in this repository: the gems Asterism depends on are not bundled.
347
374
  `msgpack` (CRuby) and `asterism-zenoh` (the CRuby Zenoh binding, which in
@@ -398,6 +425,60 @@ Asterism.nodes # => ["linux", "fmruby-bbbbbb"]
398
425
  | `Asterism.nodes` | `[String]` | Node IDs alive now, this one first. |
399
426
  | `Asterism.connected?` / `node_id` / `app` / `exposed` / `lost_reason` | | |
400
427
  | `Asterism.close` | nil | Withdraws every exposed object. Idempotent. |
428
+ | `Asterism.profile(kind:, name:, host:, icon:)` / `Asterism.profile` | Hash | This node's profile: sets the fields given and returns it; without arguments, returns it. See [Profiles](#profiles). |
429
+ | `Asterism.profile_of(node, icon: true, timeout: 2.0)` | Hash or nil | Another node's profile, nil when it does not answer (an older version, a ROS 2 node). |
430
+
431
+ ## Profiles
432
+
433
+ A node tells what it is (0.5.0): what Ruby runs it, where, a display name
434
+ and an icon. A console draws it with that; anyone can ask.
435
+
436
+ ```ruby
437
+ Asterism.profile(name: "Rover", icon: File.binread("rover.png")) # this node's (any time)
438
+ Asterism.profile
439
+ # => {"kind" => "cruby", "name" => "Rover", "icon" => "\x89PNG...", "icon_hash" => "2a8c0626"}
440
+ Asterism.profile_of("fmruby-aaaaaa")
441
+ # => {"kind" => "family_mruby", "host" => "atoms3r", "icon" => "\x89PNG...", "icon_hash" => "..."}
442
+ Asterism.profile_of("fmruby-aaaaaa", icon: false) # the same without the icon bytes
443
+ Asterism.profile_of("an-older-node") # => nil
444
+ ```
445
+
446
+ | Field | Value | Default |
447
+ |---|---|---|
448
+ | `kind` | what Ruby runs the node: `family_mruby`, `picoruby`, `cruby`, `console` (a lower-case word: `a-z`, `0-9`, `_`, up to 32 bytes; other words are allowed) | `cruby` on CRuby, `picoruby` on mruby / PicoRuby; Family mruby's firmware sets `family_mruby` |
449
+ | `host` | where it runs, e.g. `atoms3r`, `tab5`, `p4nano`, `browser`, `sim` (up to 32 bytes) | none; Family mruby's firmware sets it from the board |
450
+ | `name` | a display name (up to 64 bytes) | none |
451
+ | `icon` | the bytes of a PNG: at most 8 KB and 256x256 (32x32 is the size meant). PNG only: an SVG can carry scripts | the file at `Asterism.default_icon_path` when it is there: on CRuby the gem's `data/icon.png` (a ruby), on the boards `/usr/share/asterism/icon.png` |
452
+ | `icon_hash` | set by Asterism, never given: the icon's summary (8 hex digits: the Adler-32 of the PNG's chunk CRCs, so a board computes it from a few bytes) | |
453
+
454
+ - **Setting.** `Asterism.profile(**fields)` changes the fields given and keeps
455
+ the others; `nil` leaves `name` / `host` out, goes back to the default
456
+ `kind`, and means no icon for `icon:`. It raises `ArgumentError` for a
457
+ field it does not accept (an unknown name, a `kind` that is not a word, an
458
+ icon that is not a PNG, larger than 8 KB or 256x256). It may be called
459
+ before connecting and at any time after; the profile belongs to the
460
+ process (the VM on a board) and survives `close`. A firmware can set its
461
+ defaults with the same call before the application runs (Family mruby
462
+ sets `kind`, `host` and, through `/usr/share/asterism/icon.png`, the icon).
463
+ - **Reading.** `Asterism.profile_of(node)` asks `asterism/<node>/@profile`
464
+ and waits like a call (`timeout:` / `timeout_ms:`); this node's own comes
465
+ without the network. The answer is cleaned (`Asterism::Profile.check`):
466
+ only the fields above, each checked; an icon that is not an acceptable
467
+ PNG is dropped with its hash, an answer without a valid `kind` is `nil`.
468
+ `icon: false` asks without the icon (the parameter `icon=0`): a reader
469
+ that already has the icon of that `icon_hash` asks this way.
470
+ - **Following.** At each connect and at each change while connected, the
471
+ node also puts its profile without the icon on `asterism/<node>/@profile`;
472
+ subscribe to `asterism/*/@profile` to follow the changes (and fetch the
473
+ icon again only when `icon_hash` changed). Older nodes neither answer nor
474
+ put.
475
+ - **Several applications of one node** (a board running two): each answers
476
+ for the node, and `profile_of` takes the first answer. Give them the same
477
+ profile (Family mruby's firmware defaults are the same in each), or set it
478
+ in one and read the notices, where the last change wins.
479
+ - `Asterism::Profile.png_info(bytes)` gives `[width, height, icon_hash]` of
480
+ an acceptable PNG (nil otherwise), for a tool that wants to check an icon
481
+ first.
401
482
 
402
483
  ## Errors
403
484
 
@@ -439,6 +520,7 @@ is closed (1.0: `Disconnected`, as the object layer).
439
520
  | Receiving interval of the CRuby API | 2 ms | `interval:` |
440
521
  | Calls waiting inside each other | 4 | `MAX_NESTING` |
441
522
  | Encoding depth of a value | 16 | `Codec::MAX_DEPTH` |
523
+ | A profile icon | 8 KB, 256x256, PNG only | `Asterism::Profile::ICON_MAX`, `ICON_SIDE_MAX` |
442
524
  | `get` consolidation | `:none` (every reply; zenoh's own default is `:auto`, but services and the object layer want every reply) | `consolidation:` |
443
525
 
444
526
  ### Queues
@@ -528,8 +610,10 @@ caller gets `RemoteError` (`Asterism::EncodeError`). Nesting is limited to
528
610
  | `asterism/<node>/<app>/<object>/meta` | get / queryable | reply: `{"methods" => [[name, arity], ...]}` (arity `-1` when not declared). The object may be `*` in the query: one reply per object |
529
611
  | `asterism/<node>` | liveliness | the node is connected |
530
612
  | `asterism/<node>/<app>/<object>` | liveliness | the object is exposed |
613
+ | `asterism/<node>/@profile` | get / queryable, and put | query (parameter `icon=0` for no icon): reply the node's profile, a Hash (`kind`, `host`, `name`, `icon`, `icon_hash`; [Profiles](#profiles)). The node also puts the profile without the icon at connect and on each change. `@profile` is a verbatim chunk, so `asterism/**` does not match it: the object layer's wildcards never see it. An application's own profile would go at `asterism/<node>/<app>/@profile` (not in 0.5.0) |
531
614
 
532
- One queryable per application (`asterism/<node>/<app>/**`). A call whose
615
+ One queryable per application (`asterism/<node>/<app>/**`), and one for the
616
+ profile (`asterism/<node>/@profile`). A call whose
533
617
  node or app is a wildcard reaches every application that exposes that
534
618
  object, each answering with its own key; `Asterism` itself only sends calls
535
619
  to one object.
@@ -599,7 +683,7 @@ nested type (`geometry_msgs/msg/Twist`) at start-up took 0.6 KB more.
599
683
  different on Family mruby's PicoRuby: `^x` of an outer local inside a
600
684
  block, `^(expr)`, `Const[...]` and `**rest` next to another key. The full
601
685
  list of what the boards' Ruby can and cannot do is in
602
- [docs/ruby_profile.md](docs/ruby_profile.md).
686
+ [docs/ruby_features.md](docs/ruby_features.md) (the Ruby feature table).
603
687
 
604
688
  ## ROS 2 (rmw_zenoh): `Asterism::ROS` and `Asterism::CDR`
605
689
 
@@ -738,11 +822,51 @@ std_msgs (Bool, Byte, Char, String, Empty, the integer and float types,
738
822
  Header, ColorRGBA, MultiArrayDimension / Layout and every *MultiArray),
739
823
  builtin_interfaces (Time, Duration), geometry_msgs (Vector3, Point, Point32,
740
824
  Quaternion, Pose, Pose2D, Twist, Accel, Transform, Wrench and their
741
- *Stamped), sensor_msgs (Imu, BatteryState, Temperature, Range,
742
- MagneticField, Illuminance, FluidPressure, RelativeHumidity, JointState,
743
- NavSatStatus, NavSatFix), example_interfaces/srv/AddTwoInts. The list is
744
- `tools/bundled_types.txt`. Nothing of them is compiled into the mrbgem: an
745
- application loads what it uses, and each file loads the types it is made of.
825
+ *Stamped, PoseWithCovariance, TwistWithCovariance), sensor_msgs (Imu,
826
+ BatteryState, Temperature, Range, MagneticField, Illuminance,
827
+ FluidPressure, RelativeHumidity, JointState, NavSatStatus, NavSatFix,
828
+ LaserScan, PointField, PointCloud2, CompressedImage), nav_msgs (Odometry,
829
+ Path, MapMetaData, OccupancyGrid), diagnostic_msgs (DiagnosticArray,
830
+ DiagnosticStatus, KeyValue), tf2_msgs/TFMessage, visualization_msgs
831
+ (Marker, MarkerArray, MeshFile, UVCoordinate), rcl_interfaces (Log for
832
+ `/rosout`, ParameterEvent, Parameter, ParameterValue),
833
+ example_interfaces/srv/AddTwoInts. The list is `tools/bundled_types.txt`
834
+ (84 files, 0.23 MB). Nothing of them is compiled into the mrbgem: an
835
+ application loads what it uses, and each file loads the types it is made
836
+ of.
837
+
838
+ ### Field types
839
+
840
+ Each generated message has `FIELD_TYPES` next to `FIELDS`: what each field
841
+ is, as plain Arrays, Strings, Integers and nil (the same on the boards),
842
+ one `[name, base, kind, nested, capacity, string_capacity]` per field:
843
+
844
+ | Element | Value |
845
+ |---|---|
846
+ | `name` | the field name (a String) |
847
+ | `base` | the .msg type: `"float64"`, `"string"`, `"uint8"`, ..., or the full name of a message (`"std_msgs/msg/Header"`) |
848
+ | `kind` | `"scalar"`, `"array"` (`T[N]`), `"bounded_sequence"` (`T[<=N]`) or `"sequence"` (`T[]`) |
849
+ | `nested` | the full name of the message type, or nil |
850
+ | `capacity` | N of an array or a bounded sequence, else nil |
851
+ | `string_capacity` | N of `string<=N`, else nil |
852
+
853
+ ```ruby
854
+ Asterism::ROS::SensorMsgs::JointState::FIELD_TYPES
855
+ # => [["header", "std_msgs/msg/Header", "scalar", "std_msgs/msg/Header", nil, nil],
856
+ # ["name", "string", "sequence", nil, nil, nil],
857
+ # ["position", "float64", "sequence", nil, nil, nil], ...]
858
+ Asterism::ROS.field_types("sensor_msgs/msg/Imu")
859
+ # => {"sensor_msgs/msg/Imu" => [...], "std_msgs/msg/Header" => [...],
860
+ # "geometry_msgs/msg/Quaternion" => [...], "geometry_msgs/msg/Vector3" => [...],
861
+ # "builtin_interfaces/msg/Time" => [...]}
862
+ ```
863
+
864
+ `Asterism::ROS.field_types(type)` takes a type or its name, loads the
865
+ types it is made of and gives the `FIELD_TYPES` of each, the type first
866
+ (for a service, its Request and Response). A byte array or sequence
867
+ (`uint8`, `byte`, `char`) is a binary String in Ruby (see the table
868
+ above). Types generated before 0.4.1 have no `FIELD_TYPES`; regenerate
869
+ them (`field_types` raises `Asterism::ROS::UnknownType` for them).
746
870
 
747
871
  ### Making types: `tools/asterism_msggen.rb`
748
872
 
@@ -783,8 +907,9 @@ the hashes from Jazzy's JSON (`type_hashes.txt`) that the tests
783
907
  (`rake test:msgs`) compare with. `tools/ros2_types.rb` refreshes both, and
784
908
  `data/msgs`, from a ROS 2 Jazzy docker image (`rake types:refresh` with
785
909
  `ASTERISM_ROS2_IMAGE`; `rake types:check` only compares). The definitions
786
- are from ros2/common_interfaces, ros2/rcl_interfaces and
787
- ros2/example_interfaces (Apache License 2.0, see NOTICE).
910
+ are from ros2/common_interfaces, ros2/rcl_interfaces,
911
+ ros2/example_interfaces (Apache License 2.0) and ros2/geometry2 (tf2_msgs,
912
+ BSD 3-Clause License); see NOTICE.
788
913
 
789
914
  ### Loading
790
915
 
@@ -797,3 +922,9 @@ Time and Quaternion 32.8 KB more, std_msgs/Float32MultiArray with its
797
922
  layout types 20.0 KB more (68 KB for nine files, 340 ms). Evaluating a file
798
923
  compiles it on the caller's stack (about 2.5 KB deeper than the update
799
924
  loop); load the types in `on_create`, not in a deep call chain.
925
+
926
+ A type name may come from the network, so `require_type` checks it before
927
+ it builds a path: `pkg/msg/Name` or `pkg/srv/Name`, the package
928
+ `[a-z][a-z0-9_]*`, the name `[A-Z][A-Za-z0-9]*` (ROS 2's rules for
929
+ interface names). Anything else (`../msg/Foo`, an empty part, an upper-case
930
+ package, more slashes, NUL) raises `ArgumentError`.
data/data/icon.png ADDED
Binary file
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2008, Willow Garage, Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/data/msgs/NOTICE CHANGED
@@ -1,17 +1,23 @@
1
1
  ROS 2 message and service types for Asterism (Asterism::ROS).
2
2
 
3
3
  Each .rb file here was generated by Asterism's tools/asterism_msggen.rb
4
- from the ROS 2 Jazzy definition it names (packages std_msgs,
5
- geometry_msgs, sensor_msgs, builtin_interfaces, service_msgs,
6
- example_interfaces). The definitions are licensed under the Apache
7
- License, Version 2.0 (LICENSE-Apache-2.0.txt), and so are these files.
8
- Copyright in the definitions belongs to their authors (Open Source
9
- Robotics Foundation, Inc. and the ROS 2 contributors).
4
+ from the ROS 2 Jazzy definition it names. Each file states its package and
5
+ the license of that package at its top, and is under the same license as
6
+ the definition it was made from:
10
7
 
11
- The definitions come from https://github.com/ros2/common_interfaces
12
- (std_msgs, geometry_msgs, sensor_msgs), https://github.com/ros2/rcl_interfaces
13
- (builtin_interfaces, service_msgs) and https://github.com/ros2/example_interfaces,
14
- as distributed with ROS 2 Jazzy. Each file states its package and license at
15
- its top. The asterism repository (https://github.com/ruby-asterism/asterism)
16
- keeps the definitions themselves (tools/ros2_jazzy) and the generator; its
17
- own code is under the MIT License.
8
+ - Apache License, Version 2.0 (LICENSE-Apache-2.0.txt): std_msgs,
9
+ geometry_msgs, sensor_msgs, nav_msgs, diagnostic_msgs,
10
+ visualization_msgs (https://github.com/ros2/common_interfaces),
11
+ builtin_interfaces, service_msgs, rcl_interfaces
12
+ (https://github.com/ros2/rcl_interfaces) and example_interfaces
13
+ (https://github.com/ros2/example_interfaces). Copyright in these
14
+ definitions belongs to their authors (Open Source Robotics Foundation,
15
+ Inc. and the ROS 2 contributors).
16
+ - BSD 3-Clause License (LICENSE-BSD-3-Clause-tf2_msgs.txt, "BSD" in its
17
+ package.xml): tf2_msgs (https://github.com/ros2/geometry2).
18
+ Copyright (c) 2008, Willow Garage, Inc.
19
+
20
+ The definitions are as distributed with ROS 2 Jazzy. The asterism
21
+ repository (https://github.com/ruby-asterism/asterism) keeps the
22
+ definitions themselves (tools/ros2_jazzy) and the generator; its own code
23
+ is under the MIT License.
@@ -11,6 +11,10 @@ class ::Asterism::ROS::BuiltinInterfaces::Duration < ::Asterism::ROS::Message
11
11
  TYPE_NAME = "builtin_interfaces::msg::dds_::Duration_"
12
12
  TYPE_HASH = "RIHS01_e8d009f659816f758b75334ee1a9ca5b5c0b859843261f14c7f937349599d93b"
13
13
  FIELDS = [:sec, :nanosec]
14
+ FIELD_TYPES = [
15
+ ["sec", "int32", "scalar", nil, nil, nil],
16
+ ["nanosec", "uint32", "scalar", nil, nil, nil]
17
+ ]
14
18
 
15
19
  attr_accessor :sec, :nanosec
16
20
 
@@ -11,6 +11,10 @@ class ::Asterism::ROS::BuiltinInterfaces::Time < ::Asterism::ROS::Message
11
11
  TYPE_NAME = "builtin_interfaces::msg::dds_::Time_"
12
12
  TYPE_HASH = "RIHS01_b106235e25a4c5ed35098aa0a61a3ee9c9b18d197f398b0e4206cea9acf9c197"
13
13
  FIELDS = [:sec, :nanosec]
14
+ FIELD_TYPES = [
15
+ ["sec", "int32", "scalar", nil, nil, nil],
16
+ ["nanosec", "uint32", "scalar", nil, nil, nil]
17
+ ]
14
18
 
15
19
  attr_accessor :sec, :nanosec
16
20
 
@@ -0,0 +1,40 @@
1
+ # diagnostic_msgs/msg/DiagnosticArray (ROS 2 jazzy), generated by asterism_msggen.rb from
2
+ # DiagnosticArray.msg of the package diagnostic_msgs.
3
+ # License: Apache License 2.0, as the definition (package.xml of diagnostic_msgs).
4
+ # Do not edit; regenerate instead.
5
+
6
+ ::Asterism::ROS.require_type("diagnostic_msgs/msg/DiagnosticStatus")
7
+ ::Asterism::ROS.require_type("std_msgs/msg/Header")
8
+
9
+ module ::Asterism::ROS::DiagnosticMsgs
10
+ end
11
+
12
+ class ::Asterism::ROS::DiagnosticMsgs::DiagnosticArray < ::Asterism::ROS::Message
13
+ ROS_NAME = "diagnostic_msgs/msg/DiagnosticArray"
14
+ TYPE_NAME = "diagnostic_msgs::msg::dds_::DiagnosticArray_"
15
+ TYPE_HASH = "RIHS01_5a8a36efb05fb25070fa0fb3810290c0e6cd4862b54a8fb975a1ee8dc55a333e"
16
+ FIELDS = [:header, :status]
17
+ FIELD_TYPES = [
18
+ ["header", "std_msgs/msg/Header", "scalar", "std_msgs/msg/Header", nil, nil],
19
+ ["status", "diagnostic_msgs/msg/DiagnosticStatus", "sequence", "diagnostic_msgs/msg/DiagnosticStatus", nil, nil]
20
+ ]
21
+
22
+ attr_accessor :header, :status
23
+
24
+ def initialize(header: nil, status: nil)
25
+ @header = ::Asterism::ROS::StdMsgs::Header.from(header)
26
+ @status = status.nil? ? [] : status.map { |e| ::Asterism::ROS::DiagnosticMsgs::DiagnosticStatus.from(e) }
27
+ end
28
+
29
+ def self.write(w, m)
30
+ ::Asterism::ROS::StdMsgs::Header.write(w, ::Asterism::ROS::StdMsgs::Header.from(m.header))
31
+ w.structs(::Asterism::ROS::DiagnosticMsgs::DiagnosticStatus, m.status, nil, nil)
32
+ end
33
+
34
+ def self.read(r)
35
+ m = new
36
+ m.header = ::Asterism::ROS::StdMsgs::Header.read(r)
37
+ m.status = r.structs(::Asterism::ROS::DiagnosticMsgs::DiagnosticStatus, nil)
38
+ m
39
+ end
40
+ end
@@ -0,0 +1,55 @@
1
+ # diagnostic_msgs/msg/DiagnosticStatus (ROS 2 jazzy), generated by asterism_msggen.rb from
2
+ # DiagnosticStatus.msg of the package diagnostic_msgs.
3
+ # License: Apache License 2.0, as the definition (package.xml of diagnostic_msgs).
4
+ # Do not edit; regenerate instead.
5
+
6
+ ::Asterism::ROS.require_type("diagnostic_msgs/msg/KeyValue")
7
+
8
+ module ::Asterism::ROS::DiagnosticMsgs
9
+ end
10
+
11
+ class ::Asterism::ROS::DiagnosticMsgs::DiagnosticStatus < ::Asterism::ROS::Message
12
+ ROS_NAME = "diagnostic_msgs/msg/DiagnosticStatus"
13
+ TYPE_NAME = "diagnostic_msgs::msg::dds_::DiagnosticStatus_"
14
+ TYPE_HASH = "RIHS01_b0e3e692ea2d54a8af2f4ef1930e81556a2db55216b771f8a7d2724ed47bf0e4"
15
+ FIELDS = [:level, :name, :message, :hardware_id, :values]
16
+ FIELD_TYPES = [
17
+ ["level", "byte", "scalar", nil, nil, nil],
18
+ ["name", "string", "scalar", nil, nil, nil],
19
+ ["message", "string", "scalar", nil, nil, nil],
20
+ ["hardware_id", "string", "scalar", nil, nil, nil],
21
+ ["values", "diagnostic_msgs/msg/KeyValue", "sequence", "diagnostic_msgs/msg/KeyValue", nil, nil]
22
+ ]
23
+ OK = 0
24
+ WARN = 1
25
+ ERROR = 2
26
+ STALE = 3
27
+
28
+ attr_accessor :level, :name, :message, :hardware_id, :values
29
+
30
+ def initialize(level: nil, name: nil, message: nil, hardware_id: nil, values: nil)
31
+ @level = level.nil? ? 0 : level
32
+ @name = name.nil? ? "" : name
33
+ @message = message.nil? ? "" : message
34
+ @hardware_id = hardware_id.nil? ? "" : hardware_id
35
+ @values = values.nil? ? [] : values.map { |e| ::Asterism::ROS::DiagnosticMsgs::KeyValue.from(e) }
36
+ end
37
+
38
+ def self.write(w, m)
39
+ w.uint8(m.level)
40
+ w.string(m.name)
41
+ w.string(m.message)
42
+ w.string(m.hardware_id)
43
+ w.structs(::Asterism::ROS::DiagnosticMsgs::KeyValue, m.values, nil, nil)
44
+ end
45
+
46
+ def self.read(r)
47
+ m = new
48
+ m.level = r.uint8
49
+ m.name = r.string
50
+ m.message = r.string
51
+ m.hardware_id = r.string
52
+ m.values = r.structs(::Asterism::ROS::DiagnosticMsgs::KeyValue, nil)
53
+ m
54
+ end
55
+ end
@@ -0,0 +1,37 @@
1
+ # diagnostic_msgs/msg/KeyValue (ROS 2 jazzy), generated by asterism_msggen.rb from
2
+ # KeyValue.msg of the package diagnostic_msgs.
3
+ # License: Apache License 2.0, as the definition (package.xml of diagnostic_msgs).
4
+ # Do not edit; regenerate instead.
5
+
6
+ module ::Asterism::ROS::DiagnosticMsgs
7
+ end
8
+
9
+ class ::Asterism::ROS::DiagnosticMsgs::KeyValue < ::Asterism::ROS::Message
10
+ ROS_NAME = "diagnostic_msgs/msg/KeyValue"
11
+ TYPE_NAME = "diagnostic_msgs::msg::dds_::KeyValue_"
12
+ TYPE_HASH = "RIHS01_d68081eaa540288c5440753baecef0c4e16e81a5f78ad68902ded5100413bb42"
13
+ FIELDS = [:key, :value]
14
+ FIELD_TYPES = [
15
+ ["key", "string", "scalar", nil, nil, nil],
16
+ ["value", "string", "scalar", nil, nil, nil]
17
+ ]
18
+
19
+ attr_accessor :key, :value
20
+
21
+ def initialize(key: nil, value: nil)
22
+ @key = key.nil? ? "" : key
23
+ @value = value.nil? ? "" : value
24
+ end
25
+
26
+ def self.write(w, m)
27
+ w.string(m.key)
28
+ w.string(m.value)
29
+ end
30
+
31
+ def self.read(r)
32
+ m = new
33
+ m.key = r.string
34
+ m.value = r.string
35
+ m
36
+ end
37
+ end