00001 /* 00002 * Copyright (c) 2013, 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 */ 00023 #ifndef _SR_TCAT_HPP_ 00024 #define _SR_TCAT_HPP_ 00025 00026 #include <ros_ethercat_hardware/ethercat_hardware.h> 00027 #include <realtime_tools/realtime_publisher.h> 00028 #include <sr_ronex_msgs/TCATState.h> 00029 00030 #include <sr_ronex_external_protocol/Ronex_Protocol_0x02000003_TCAT_00.h> 00031 00032 #include <boost/ptr_container/ptr_vector.hpp> 00033 #include <vector> 00034 #include <string> 00035 00036 #include <dynamic_reconfigure/server.h> 00037 #include "sr_ronex_drivers/GeneralIOConfig.h" 00038 00039 00040 class SrTCAT : public EthercatDevice 00041 { 00042 public: 00043 virtual void construct(EtherCAT_SlaveHandler *sh, int &start_address); 00044 virtual int initialize(hardware_interface::HardwareInterface *hw, bool allow_unprogrammed = true); 00045 00046 SrTCAT(); 00047 virtual ~SrTCAT(); 00048 00049 protected: 00051 static const std::string product_alias_; 00052 00054 std::string ronex_id_; 00055 00056 string reason_; 00057 int level_; 00058 00059 int command_base_; 00060 int status_base_; 00061 00062 ros::NodeHandle node_; 00063 00068 int16u previous_sequence_number_; 00069 00071 std::string device_name_; 00072 std::string serial_number_; 00073 00075 int device_offset_; 00076 00077 void packCommand(unsigned char *buffer, bool halt, bool reset); 00078 bool unpackState(unsigned char *this_buffer, unsigned char *prev_buffer); 00079 00080 void diagnostics(diagnostic_updater::DiagnosticStatusWrapper &d, unsigned char *buffer); 00081 00083 boost::scoped_ptr<realtime_tools::RealtimePublisher<sr_ronex_msgs::TCATState> > state_publisher_; 00085 sr_ronex_msgs::TCATState state_msg_; 00086 00088 void build_topics_(); 00089 00091 int parameter_id_; 00092 }; 00093 00094 /* For the emacs weenies in the crowd. 00095 Local Variables: 00096 c-basic-offset: 2 00097 End: 00098 */ 00099 00100 #endif /* _SR_TCAT_HPP_ */