00001 /* 00002 * Copyright (c) 2016, Shadow Robot Company, All rights reserved. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 3.0 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library. 00016 */ 00017 00025 #ifndef _DC_MOTOR_SMALL_HARDWARE_HARDWARE_INTERFACE_H 00026 #define _DC_MOTOR_SMALL_HARDWARE_HARDWARE_INTERFACE_H 00027 00028 #include <ros_ethercat_model/hardware_interface.hpp> 00029 #include <sr_ronex_external_protocol/Ronex_Protocol_0x02000009_DC_Motor_Small_00.h> 00030 #include <vector> 00031 00032 namespace ronex 00033 { 00034 class DCMotorCommand 00035 { 00036 public: 00037 uint16_t command_type_; 00038 std::vector<bool> digital_; 00039 00040 struct MotorPacketCommand 00041 { 00042 uint16_t period; 00043 uint16_t on_time; 00044 uint16_t flags; 00045 }; 00046 00047 std::vector<MotorPacketCommand> motor_packet_command_; 00048 }; 00049 00050 class DCMotorState 00051 { 00052 public: 00053 uint16_t command_type_; 00054 00055 std::vector<bool> digital_; 00056 std::vector<uint16_t> analogue_; 00057 00058 struct MotorPacketStatus 00059 { 00060 int16_t quadrature; 00061 int16_t flags; 00062 }; 00063 std::vector<MotorPacketStatus> motor_packet_status_; 00064 }; 00065 00076 class DCMotor 00077 : public ros_ethercat_model::CustomHW 00078 { 00079 public: 00080 DCMotorState state_; 00081 DCMotorCommand command_; 00082 }; 00083 } // namespace ronex 00084 /* For the emacs weenies in the crowd. 00085 Local Variables: 00086 c-basic-offset: 2 00087 End: 00088 */ 00089 00090 #endif /* _DC_MOTOR_SMALL_HARDWARE_HARDWARE_INTERFACE_H */