rm_control
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*******************************************************************************
2 * BSD 3-Clause License
3 *
4 * Copyright (c) 2021, Qiayuan Liao
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * * Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33
34//
35// Created by qiayuan on 1/20/21.
36//
37
38#pragma once
39
40#include <string>
43#include <unordered_map>
44
45namespace rm_hw
46{
52
53struct ActData
54{
55 std::string name;
56 std::string type;
57 ros::Time stamp;
58 uint64_t seq;
59 bool halted = false, need_calibration = false, calibrated = false, calibration_reading = false;
60 uint16_t q_raw;
61 int16_t qd_raw;
62 uint8_t temp;
63 int64_t q_circle;
64 uint16_t q_last;
65 double frequency;
66 double pos, vel, effort;
68 double offset;
69 // For multiple cycle under absolute encoder (RoboMaster motor)
71};
72
86
87struct TofData
88{
89 double strength;
90 double distance;
91};
92
94{
95 std::unordered_map<std::string, ActCoeff>* type2act_coeffs_;
96 std::unordered_map<int, ActData>* id2act_data_;
97 std::unordered_map<int, ImuData>* id2imu_data_;
98 std::unordered_map<int, TofData>* id2tof_data_;
99};
100} // namespace rm_hw
Definition lp_filter.h:45
Definition imu_filter_base.h:16
Definition control_loop.h:49
Definition types.h:48
double act2effort
Definition types.h:49
double vel2act
Definition types.h:49
double kp2act
Definition types.h:50
double pos2act
Definition types.h:49
double act2pos_offset
Definition types.h:49
double kd2act
Definition types.h:50
double effort2act
Definition types.h:49
double act2vel_offset
Definition types.h:49
double max_out
Definition types.h:49
double act2pos
Definition types.h:49
double act2effort_offset
Definition types.h:50
double act2vel
Definition types.h:49
Definition types.h:54
std::string name
Definition types.h:55
LowPassFilter * lp_filter
Definition types.h:70
bool calibration_reading
Definition types.h:59
double frequency
Definition types.h:65
std::string type
Definition types.h:56
double effort
Definition types.h:66
uint64_t seq
Definition types.h:58
double exe_effort
Definition types.h:67
double cmd_vel
Definition types.h:67
double cmd_pos
Definition types.h:67
bool calibrated
Definition types.h:59
bool need_calibration
Definition types.h:59
double pos
Definition types.h:66
uint8_t temp
Definition types.h:62
int16_t qd_raw
Definition types.h:61
double vel
Definition types.h:66
double offset
Definition types.h:68
bool halted
Definition types.h:59
ros::Time stamp
Definition types.h:57
uint16_t q_last
Definition types.h:64
double cmd_effort
Definition types.h:67
int64_t q_circle
Definition types.h:63
uint16_t q_raw
Definition types.h:60
Definition types.h:94
std::unordered_map< int, ImuData > * id2imu_data_
Definition types.h:97
std::unordered_map< int, ActData > * id2act_data_
Definition types.h:96
std::unordered_map< int, TofData > * id2tof_data_
Definition types.h:98
std::unordered_map< std::string, ActCoeff > * type2act_coeffs_
Definition types.h:95
Definition types.h:74
double ori_cov[9]
Definition types.h:80
bool enabled_trigger
Definition types.h:83
double temp_offset
Definition types.h:81
double linear_acc_cov[9]
Definition types.h:80
double temp_coeff
Definition types.h:81
bool camera_trigger
Definition types.h:82
rm_common::ImuFilterBase * imu_filter
Definition types.h:84
std::string imu_name
Definition types.h:76
double angular_vel_cov[9]
Definition types.h:80
double temperature
Definition types.h:81
ros::Time time_stamp
Definition types.h:75
double accel_coeff
Definition types.h:81
bool accel_updated
Definition types.h:82
double angular_vel[3]
Definition types.h:78
double angular_vel_coeff
Definition types.h:81
double linear_acc[3]
Definition types.h:78
bool gyro_updated
Definition types.h:82
double angular_vel_offset[3]
Definition types.h:79
double ori[4]
Definition types.h:77
Definition types.h:88
double strength
Definition types.h:89
double distance
Definition types.h:90