ForceTorqueFilter.cpp
Go to the documentation of this file.
2 
3 namespace rokubimini
4 {
5 namespace configuration
6 {
7 ForceTorqueFilter::ForceTorqueFilter(const uint16_t sincFilterSize, const uint8_t chopEnable, const uint8_t skipEnable,
8  const uint8_t fastEnable)
9  : sincFilterSize_(sincFilterSize), chopEnable_(chopEnable), skipEnable_(skipEnable), fastEnable_(fastEnable)
10 {
11 }
12 
13 bool ForceTorqueFilter::load(const std::string& key, NodeHandlePtr nh)
14 {
15  bool success = false;
16  std::string local_key;
17  local_key = key + "/sinc_filter_size";
18  if (nh->hasParam(local_key))
19  {
20  int sinc_filter_size;
21  nh->getParam(local_key, sinc_filter_size);
22  sincFilterSize_ = static_cast<uint16_t>(sinc_filter_size);
23  success = true;
24  }
25  local_key = key + "/chop_enable";
26  if (nh->hasParam(local_key))
27  {
28  bool chop_enable;
29  nh->getParam(local_key, chop_enable);
30  chopEnable_ = static_cast<uint8_t>(chop_enable);
31  success = true;
32  }
33  local_key = key + "/fir_disable";
34  if (nh->hasParam(local_key))
35  {
36  bool skip_enable;
37  nh->getParam(local_key, skip_enable);
38  skipEnable_ = static_cast<uint8_t>(skip_enable);
39  success = true;
40  }
41  local_key = key + "/fast_enable";
42  if (nh->hasParam(local_key))
43  {
44  bool fast_enable;
45  nh->getParam(local_key, fast_enable);
46  fastEnable_ = static_cast<uint8_t>(fast_enable);
47  success = true;
48  }
49  return success;
50 }
51 
53 {
54  ROS_INFO_STREAM("sinc_filter_size_: " << static_cast<unsigned int>(sincFilterSize_));
55  ROS_INFO_STREAM("chopEnable_: " << static_cast<unsigned int>(chopEnable_));
56  ROS_INFO_STREAM("skipEnable_: " << static_cast<unsigned int>(skipEnable_));
57  ROS_INFO_STREAM("fastEnable_: " << static_cast<unsigned int>(fastEnable_));
58 }
59 
60 } // namespace configuration
61 } // namespace rokubimini
ForceTorqueFilter()=default
Default constructor.
uint16_t sincFilterSize_
The sincFilterSize variable.
std::shared_ptr< ros::NodeHandle > NodeHandlePtr
void print() const
Prints the existing Filter settings.
#define ROS_INFO_STREAM(args)
bool load(const std::string &key, NodeHandlePtr nh)
Loads the force torque filter from the parameter server.
Tests Configuration.


rokubimini
Author(s):
autogenerated on Wed Mar 3 2021 03:09:12