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 
10 namespace rm_control
11 {
13 {
14 public:
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 
45 private:
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
rm_control::TofRadarHandle::getDistance
double getDistance() const
Definition: tof_radar_interface.h:33
rm_control::TofRadarHandle::TofRadarHandle
TofRadarHandle()=default
rm_control
Definition: actuator_extra_interface.h:43
rm_control::TofRadarHandle::name_
std::string name_
Definition: tof_radar_interface.h:46
rm_control::TofRadarHandle::strength_
double * strength_
Definition: tof_radar_interface.h:48
rm_control::TofRadarHandle
Definition: tof_radar_interface.h:12
std
rm_control::TofRadarInterface
Definition: tof_radar_interface.h:51
rm_control::TofRadarHandle::getStrength
double getStrength() const
Definition: tof_radar_interface.h:39
rm_control::TofRadarHandle::TofRadarHandle
TofRadarHandle(std::string name, double *distance, double *strength)
Definition: tof_radar_interface.h:17
rm_control::TofRadarHandle::getName
std::string getName() const
Definition: tof_radar_interface.h:28
rm_control::TofRadarHandle::distance_
double * distance_
Definition: tof_radar_interface.h:47


rm_common
Author(s):
autogenerated on Sun Apr 6 2025 02:22:01