forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drake_lcm.h
61 lines (48 loc) · 1.37 KB
/
drake_lcm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <memory>
#include <string>
#include "lcm/lcm-cpp.hpp"
#include "drake/common/drake_copyable.h"
#include "drake/lcm/drake_lcm_interface.h"
namespace drake {
namespace lcm {
/**
* A wrapper around a *real* LCM instance.
*/
class DrakeLcm : public DrakeLcmInterface {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(DrakeLcm);
/**
* Constructs using LCM's default URL (either the default hard-coded URL, or
* else LCM_DEFAULT_URL environment variable if it is set).
*/
DrakeLcm();
/**
* Constructs using the given URL. If empty, it will use the default URL as
* per the no-argument constructor.
*/
explicit DrakeLcm(std::string lcm_url);
/**
* A destructor that forces the receive thread to be stopped.
*/
~DrakeLcm() override;
/**
* (Advanced.) An accessor to the underlying LCM instance. The returned
* pointer is guaranteed to be valid for the duration of this object's
* lifetime.
*/
::lcm::LCM* get_lcm_instance();
/**
* Returns the LCM URL.
*/
std::string get_lcm_url() const;
void Publish(const std::string&, const void*, int, optional<double>) override;
std::shared_ptr<DrakeSubscriptionInterface> Subscribe(
const std::string&, HandlerFunction) override;
int HandleSubscriptions(int) override;
private:
class Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace lcm
} // namespace drake