rm_control
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tof_radar_interface.h
Go to the documentation of this file.
1//
2// Created by luotinkai on 2022/6/12.
3//
4
5#pragma once
6
7#include <utility>
8#include <hardware_interface/internal/hardware_resource_manager.h>
9
10namespace rm_control
11{
13{
14public:
15 TofRadarHandle() = default;
16
17 TofRadarHandle(std::string name, double* distance, double* strength)
18 : name_(std::move(name)), distance_(distance), strength_(strength)
19 {
20 if (!distance_)
21 throw hardware_interface::HardwareInterfaceException("Cannot create handle '" + name +
22 "'. distance_ pointer is null.");
23 if (!strength_)
24 throw hardware_interface::HardwareInterfaceException("Cannot create handle '" + name +
25 "'. strength_ pointer is null.");
26 }
27
28 std::string getName() const
29 {
30 return name_;
31 }
32
33 double getDistance() const
34 {
35 assert(distance_);
36 return *distance_;
37 }
38
39 double getStrength() const
40 {
41 assert(strength_);
42 return *strength_;
43 }
44
45private:
46 std::string name_;
47 double* distance_;
48 double* strength_;
49};
50
52 : public hardware_interface::HardwareResourceManager<TofRadarHandle, hardware_interface::DontClaimResources>
53{
54};
55
56} // namespace rm_control
Definition tof_radar_interface.h:13
double getStrength() const
Definition tof_radar_interface.h:39
TofRadarHandle(std::string name, double *distance, double *strength)
Definition tof_radar_interface.h:17
double getDistance() const
Definition tof_radar_interface.h:33
std::string getName() const
Definition tof_radar_interface.h:28
Definition tof_radar_interface.h:53
Definition actuator_extra_interface.h:44