catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers servo_manager.h Source File

servo_manager.h

00001 #pragma once
00002 
00003 #include "catchrobo_sim/motor_manager.h"
00004 #include "motor_driver_bridge/motor_driver_struct.h"
00005 
00006 class ServoManager : public MotorManager
00007 {
00008     // float ONE_ACTION_S_;
00009 
00010 public:
00011     // using MotorManager::MotorManager; //C++11の機能
00012 
00013     ServoManager(){};
00014 
00015     // dt間隔で呼ばれる
00016     virtual void getCmd(ControlStruct &command, ControlResult::ControlResult &finished)
00017     {
00018         MotorManager::getCmd(command, finished);
00019 
00020         // catchrobo_msgs::MyRosCmd ros_cmd;
00021         // getRosCmd(ros_cmd);
00022         // command.p_des = ros_cmd.position;
00023         StateStruct current_state;
00024         current_state.position = command.p_des;
00025         current_state.velocity = command.v_des;
00026         current_state.torque = command.torque_feed_forward;
00027         MotorManager::setCurrentState(current_state);
00028         // finished = ControlResult::RUNNING;
00029         // if (t_ > ONE_ACTION_S_)
00030         // {
00031         //     finished = ControlResult::FINISH;
00032         // }
00033     };
00034 };