Skip to content

Commit

Permalink
Merge pull request #40 from JuliaRobotics/documentation/fixreadmeread…
Browse files Browse the repository at this point in the history
…logwhile

fix readlog example
  • Loading branch information
rdeits authored Apr 30, 2018
2 parents 2be8992 + f7638a6 commit 3d10f74
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,24 @@ Events are read from file one at a time and use a similar API as the UDP traffic
```julia
function callback(channel, msgdata)
msg = decode(MsgType, msgdata) # slower, fresh memory allocation -- consider typedcallback(...) with decode! instead
@show msg
# ...
nothing
end

function typed_callback(channel, msg::MsgType)
@show msg
# ...
nothing
end

lcm = LCMLog("log.lcm")
subscribe(lcm, "CHANNEL", callback )
#subscribe(lcm, "CHANNEL", typedcallback, MsgType )
#subscribe(lcm, "CHANNEL", callback )
subscribe(lcm, "CHANNEL", typed_callback, MsgType )

while handle(lcm); end
while true
handle(lcm)
end
```

See the `test` folder for a more detailed example.

0 comments on commit 3d10f74

Please sign in to comment.