Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00024 #include <stdint.h>
00025 #include "sr_ronex_external_protocol/Ronex_Protocol_0x02000001_GIO_00.h"
00026 #include <ros_ethercat_hardware/ethercat_hardware.h>
00027 #include "sr_ronex_drivers/ronex_utils.hpp"
00028 #include "sr_ronex_drivers/sr_board_mk2_gio.hpp"
00029 #include "sr_ronex_hardware_interface/mk2_gio_hardware_interface.hpp"
00030 #include <ros_ethercat_model/robot_state.hpp>
00031 #include <ros/ros.h>
00032 #include <gtest/gtest.h>
00033 #include <tinyxml.h>
00034
00035 using namespace std;
00036 using namespace ronex;
00037
00038 TEST(RonexEthercatDrivers, build_name )
00039 {
00040 string expected = "/ronex/general_io/beautiful_ronex";
00041 string result = build_name("general_io", "beautiful_ronex");
00042 int res = expected.compare(result);
00043 ASSERT_EQ(0, res);
00044 }
00045
00046 TEST(RonexEthercatDrivers, constructor )
00047 {
00048 const uint32_t serial = 55662211;
00049
00050 EtherCAT_FMMU_Config fmmu(0);
00051 EtherCAT_PD_Config pdcfg(0);
00052 EtherCAT_SlaveHandler sh(0, 0, 0, serial,EC_FixedStationAddress( (uint16_t) 0 ), &fmmu, &pdcfg, 0);
00053
00054 SrBoardMk2GIO sbm;
00055
00056 int add = 0;
00057 sbm.construct( &sh, add );
00058
00059 ros::NodeHandle nh;
00060 string xml_string;
00061 nh.getParam("robot_description", xml_string);
00062 TiXmlDocument urdf_xml;
00063 urdf_xml.Parse(xml_string.c_str());
00064 TiXmlElement *root = urdf_xml.FirstChildElement("robot");
00065 ros_ethercat_model::RobotState hw(root);
00066
00067 int retsbm = sbm.initialize( static_cast<hardware_interface::HardwareInterface*>(&hw) );
00068 ASSERT_EQ(0, retsbm);
00069 }
00070
00071 int main(int argc, char **argv)
00072 {
00073 ros::init(argc, argv, "test_ethercat_drivers_test");
00074 testing::InitGoogleTest(&argc, argv);
00075 return RUN_ALL_TESTS();
00076 }
00077
00078
00079
00080
00081
00082