Merge mg_wheel_interface with magrob

This commit is contained in:
2025-02-22 15:48:08 +01:00
parent 9b051d2103
commit b5d474ff01
10 changed files with 487 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#ifndef MG_WHEEL_INTERFACE_HPP_
#define MG_WHEEL_INTERFACE_HPP_
#include <vector>
#include <string>
#include "libserial/SerialPort.h"
#include "hardware_interface/handle.hpp"
#include "hardware_interface/system_interface.hpp"
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "pluginlib/class_list_macros.hpp"
namespace mg {
class MgStepperInterface : public hardware_interface::SystemInterface {
public:
CallbackReturn on_init(const hardware_interface::HardwareInfo &info) override;
CallbackReturn on_configure(const rclcpp_lifecycle::State &) override;
CallbackReturn on_shutdown(const rclcpp_lifecycle::State &) override;
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
hardware_interface::return_type read(const rclcpp::Time &time, const rclcpp::Duration &period) override;
hardware_interface::return_type write(const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) override;
private:
std::string serial_port_name;
LibSerial::SerialPort odrive_serial_interface;
double left_wheel_vel_cmd;
double left_wheel_pos_state;
double right_wheel_vel_cmd;
double right_wheel_pos_state;
};
}
PLUGINLIB_EXPORT_CLASS(mg::MgStepperInterface, hardware_interface::SystemInterface)
#endif