You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+6-13Lines changed: 6 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ From Julia, you can do:
20
20
Pkg.add("LCMCore")
21
21
```
22
22
23
-
Installing LCMCore.jl will automatically download and build a new copy of the LCM library for you.
23
+
Installing LCMCore.jl will automatically download and build a new copy of the LCM library for you.
24
24
25
25
# Usage
26
26
@@ -118,11 +118,9 @@ decode(data::Vector{UInt8}, ::Type{MyMessageType}) = <return an instance of MyMe
118
118
119
119
## Complex Message Types
120
120
121
-
Manually defining `encode()` and `decode()` functions is annoying, so we provide two more convenient ways of automating the process:
121
+
Manually defining `encode()` and `decode()` functions is annoying, so we provide a convenient way to automate the process:
122
122
123
-
### Pure Julia: LCMType and @lcmtypesetup()
124
-
125
-
LCMCore.jl provides the `LCMType` abstract type and the `@lcmtypesetup` macro to make it easy to describe LCM message types in pure Julia. To use this approach, simply create a `mutable struct` which is a subtype of `LCMType`, and make sure that struct's field names and types match the LCM type definition. For a real-world example, check out CaesarLCMTypes.jl:
123
+
LCMCore.jl provides the `LCMType` abstract type and the `@lcmtypesetup` macro to make it easy to describe LCM message types in pure Julia. To use this approach, simply create a `mutable struct` which is a subtype of `LCMType`, and make sure that struct's field names and types match the LCM type definition. For a real-world example, check out CaesarLCMTypes.jl:
126
124
127
125
* Type definition: [example_t.jl](https://github.com/JuliaRobotics/CaesarLCMTypes.jl/blob/bb26d44b1b04ba777049ec7f62f070e8ff2df5c5/src/example_t.jl)
The call to `@lcmtypesetup(example_t)` analyzes the field names and types of our Julia struct to generate efficient `encode()` and `decode()` methods. Note the use of SVectors from StaticArrays.jl to represent the fixed-length `position` array in the LCM type.
153
+
The call to `@lcmtypesetup(example_t)` analyzes the field names and types of our Julia struct to generate efficient `encode()` and `decode()` methods. Note the use of SVectors from StaticArrays.jl to represent the fixed-length `position` array in the LCM type.
156
154
157
155
LCM types frequently contain variable-length vectors of primitives or other LCM types. For example, if we have the following LCM type definition:
158
156
@@ -166,7 +164,7 @@ struct example_vector_t {
166
164
}
167
165
```
168
166
169
-
then we simply need to pass two additional arguments to `@lcmtypesetup`:
167
+
then we simply need to pass two additional arguments to `@lcmtypesetup`:
170
168
171
169
```julia
172
170
mutable struct example_vector_t <:LCMType
@@ -183,7 +181,7 @@ end
183
181
)
184
182
```
185
183
186
-
The format of each additional argument to `@lcmtypesetup` is `field_name => tuple_of_size_fields`.
184
+
The format of each additional argument to `@lcmtypesetup` is `field_name => tuple_of_size_fields`.
187
185
188
186
Multi-dimensional arrays are also supported, including arrays with some fixed dimensions and some variable dimensions:
189
187
@@ -216,11 +214,6 @@ end
216
214
)
217
215
```
218
216
219
-
### PyLCM: Automatic encoding and decoding through Python
220
-
221
-
If you don't want to bother with re-defining your LCM types in Julia, then there is an even simpler approach. The [PyLCM.jl](https://github.com/rdeits/PyLCM.jl) uses LCMCore.jl under the hood, and it also allows you to also encode and decode any Python LCM type automatically. Performance of PyLCM will be significantly worse than the pure-Julia approach, but it can be very convenient.
222
-
223
-
224
217
## Reading LCM log files directly
225
218
226
219
LCM log files can also be read directly, without the UDP multicasting events.
0 commit comments