rm_controllers
Loading...
Searching...
No Matches
orientation_controller.h
Go to the documentation of this file.
1//
2// Created by bruce on 2021/5/19.
3//
4
5#pragma once
6
7#include <controller_interface/controller.h>
8#include <controller_interface/multi_interface_controller.h>
9#include <rm_common/hardware_interface/rm_imu_sensor_interface.h>
10#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
11#include <rm_common/hardware_interface/robot_state_interface.h>
12#include <sensor_msgs/Imu.h>
13
15{
16class Controller : public controller_interface::MultiInterfaceController<rm_control::RmImuSensorInterface,
17 rm_control::RobotStateInterface>
18{
19public:
20 Controller() = default;
21 bool init(hardware_interface::RobotHW* robot_hw, ros::NodeHandle& root_nh, ros::NodeHandle& controller_nh) override;
22 void update(const ros::Time& time, const ros::Duration& period) override;
23
24private:
25 bool getTransform(const ros::Time& time, geometry_msgs::TransformStamped& source2target, const double x,
26 const double y, const double z, const double w);
27 void imuDataCallback(const sensor_msgs::Imu::ConstPtr& msg);
28
29 rm_control::RmImuSensorHandle imu_sensor_;
30 rm_control::RobotStateHandle robot_state_;
31
32 ros::Time last_imu_update_time_;
33
34 rm_common::TfRtBroadcaster tf_broadcaster_{};
35 geometry_msgs::TransformStamped source2target_msg_;
36
37 std::string frame_source_;
38 std::string frame_target_;
39
40 ros::Subscriber imu_data_sub_;
41 bool receive_imu_msg_ = false;
42};
43} // namespace rm_orientation_controller
Definition orientation_controller.h:18
bool init(hardware_interface::RobotHW *robot_hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh) override
Definition orientation_controller.cpp:12
void update(const ros::Time &time, const ros::Duration &period) override
Definition orientation_controller.cpp:32
Definition orientation_controller.h:15