stroke_converter_base.h
Go to the documentation of this file.
1 #ifndef _STROKE_CONVERTER_H_
2 #define _STROKE_CONVERTER_H_
3 
4 #include <iostream>
5 #include <string>
6 #include <vector>
7 #include <fstream>
8 #include <sstream>
9 #include <algorithm>
10 #include <cmath>
11 #include <ros/ros.h>
12 
13 
14 namespace seed_converter
15 {
16 
17 struct StrokeMap
18 {
19  float angle;
20  float stroke;
21  float range;
22 };
23 
25 {
26  std::vector<StrokeMap> table;
27  std::vector<StrokeMap> inv_table;
28 };
29 
30 struct DiffJoint
31 {
32  float one;
33  float two;
34 };
35 
37 {
38 public:
40  ~StrokeConverter();
41 
42  bool initialize(ros::NodeHandle& _nh);
43  virtual void makeTables()=0;
44  virtual void Angle2Stroke(std::vector<int16_t>& _strokes, const std::vector<double>& _angles)=0;
45  virtual void Stroke2Angle(std::vector<double>& _angles, const std::vector<int16_t>& _strokes)=0;
46 
47 protected:
48  bool makeTable(std::vector<StrokeMap>& _table, const std::string _file_name);
49  void makeInvTable(std::vector<StrokeMap>& _inv_table, const std::vector<StrokeMap>& _table);
50  float setAngleToStroke(const float _angle, const std::vector<StrokeMap>& _table);
51  float setStrokeToAngle(const float _stroke, const std::vector<StrokeMap>& _inv_table);
52 
53  DiffJoint setDualAngleToStroke
54  (const float _r_angle, const float _p_angle,
55  const std::vector<StrokeMap>& _r_table, const std::vector<StrokeMap>& _p_table,
56  const bool _is_pitch=false);
57 
58  std::string file_path_;
59 };
60 
61 }
62 
63 #endif
std::vector< StrokeMap > table
ROSCONSOLE_DECL void initialize()
std::vector< StrokeMap > inv_table


seed_r7_ros_controller
Author(s): Yohei Kakiuchi
autogenerated on Sun Apr 18 2021 02:40:34