Struct lcm::Lcm [] [src]

pub struct Lcm { /* fields omitted */ }

An LCM instance that handles publishing and subscribing, as well as encoding and decoding messages.

Methods

impl Lcm
[src]

Creates a new Lcm instance.

use lcm::Lcm;
let mut lcm = Lcm::new().unwrap();

Subscribes a callback to a particular topic.

let mut lcm = Lcm::new().unwrap();
lcm.subscribe("GREETINGS", |name: String| println!("Hello, {}!", name) );

Unsubscribes a message handler.

let handler = lcm.subscribe("GREETINGS", handler_function);
// ...
lcm.unsubscribe(handler);

Publishes a message on the specified channel.

let mut lcm = Lcm::new().unwrap();
lcm.publish("GREETINGS", &"Charles".to_string()).unwrap();

Waits for and dispatches the next incoming message.

let mut lcm = Lcm::new().unwrap();
lcm.subscribe("POSITION", handler_function);
loop {
    lcm.handle().unwrap();
}

Waits for and dispatches the next incoming message, up to a time limit.

let mut lcm = Lcm::new().unwrap();
lcm.subscribe("POSITION", handler_function);
let wait_dur = Duration::from_millis(100);
loop {
    lcm.handle_timeout(Duration::from_millis(1000)).unwrap();
}

Adjusts the maximum number of received messages that can be queued up for a subscription. The default is 30.

let handler = lcm.subscribe("POSITION", handler_function);
lcm.subscription_set_queue_capacity(handler, 30);

Trait Implementations

impl Drop for Lcm
[src]

A method called when the value goes out of scope. Read more