Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit b307b3e

Browse files
author
Olav de Haas
committed
Merge branch 'develop' into fix/ethercat-grant
2 parents f78e73d + 0c47326 commit b307b3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+345
-10839
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ catkin build --no-deps --verbose march_hardware_builder --no-notify --catkin-mak
3636
catkin build --no-deps --verbose march_hardware_interface --no-notify --catkin-make-args roslint || build_failed "Roslint failed in march_hardware_interface"
3737
catkin build --no-deps --verbose march_temperature_sensor_controller --no-notify --catkin-make-args roslint || build_failed "Roslint failed in march_temperature_sensor_controller"
3838
catkin build --no-deps --verbose march_hardware_state_controller --no-notify --catkin-make-args roslint || build_failed "Roslint failed in march_hardware_state_controller"
39+
catkin build --no-deps --verbose march_pdb_state_controller --no-notify --catkin-make-args roslint || build_failed "Roslint failed in march_hardware_state_controller"
3940

4041
# Run all tests in the workspace, including roslaunch-checks if they exist
4142
catkin build --summarize --catkin-make-args run_tests && catkin_test_results build/ --verbose || build_failed "Tests failed"

march_hardware/CMakeLists.txt

Lines changed: 88 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,129 @@
11
cmake_minimum_required(VERSION 2.8.3)
22
project(march_hardware)
33

4-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
4+
add_compile_options(-std=c++11)
55

66
find_package(catkin REQUIRED COMPONENTS
7-
code_coverage
8-
roscpp
9-
roslint
10-
rostest
11-
)
7+
code_coverage
8+
roscpp
9+
roslint
10+
rostest
11+
soem
12+
)
1213

1314
catkin_package(
14-
INCLUDE_DIRS
15-
include
16-
CATKIN_DEPENDS
17-
roscpp
18-
LIBRARIES
19-
march_hardware
15+
INCLUDE_DIRS include
16+
CATKIN_DEPENDS
17+
roscpp
18+
soem
19+
LIBRARIES ${PROJECT_NAME}
2020
)
2121

22-
# Roslinter
2322
set(ROSLINT_CPP_OPTS "--filter=-build/include,-build/header_guard,-runtime/references" "--linelength=120")
2423

2524
file(GLOB_RECURSE lintfiles
26-
"src/*.cpp"
27-
"include/*.h"
28-
)
25+
"src/*.cpp"
26+
"include/*.h"
27+
)
2928

3029
roslint_cpp(${lintfiles})
3130

3231

3332
include_directories(
34-
include
35-
soem
36-
${catkin_INCLUDE_DIRS}
33+
include
34+
${catkin_INCLUDE_DIRS}
35+
${soem_INCLUDE_DIRS}/soem
3736
)
3837

3938
install(DIRECTORY include/${PROJECT_NAME}/
40-
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
41-
FILES_MATCHING PATTERN "*.h"
42-
PATTERN ".svn" EXCLUDE)
43-
44-
45-
file(GLOB SOEM_SRC
46-
soem/*.h
47-
soem/*.c
48-
)
39+
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
40+
)
4941

50-
add_library(march_hardware
51-
${SOEM_SRC}
52-
include/${PROJECT_NAME}/ActuationMode.h
53-
include/${PROJECT_NAME}/PowerDistributionBoard.h
54-
include/${PROJECT_NAME}/IMotionCubeTargetState.h
55-
include/${PROJECT_NAME}/EtherCAT/EthercatIO.h
56-
include/${PROJECT_NAME}/EtherCAT/EthercatMaster.h
57-
include/${PROJECT_NAME}/EtherCAT/EthercatSDO.h
58-
include/${PROJECT_NAME}/AngleConversions.h
59-
include/${PROJECT_NAME}/Encoder.h
60-
include/${PROJECT_NAME}/IMotionCube.h
61-
include/${PROJECT_NAME}/IMotionCubeState.h
62-
include/${PROJECT_NAME}/Joint.h
63-
include/${PROJECT_NAME}/MarchRobot.h
64-
include/${PROJECT_NAME}/NetDriverOffsets.h
65-
include/${PROJECT_NAME}/Slave.h
66-
include/${PROJECT_NAME}/TemperatureGES.h
67-
include/${PROJECT_NAME}/TemperatureSensor.h
68-
include/${PROJECT_NAME}/LowVoltage.h
69-
include/${PROJECT_NAME}/HighVoltage.h
70-
include/${PROJECT_NAME}/BootShutdownOffsets.h
71-
include/${PROJECT_NAME}/PDOmap.h
72-
src/PowerDistributionBoard.cpp
73-
src/EtherCAT/EthercatIO.cpp
74-
src/EtherCAT/EthercatMaster.cpp
75-
src/EtherCAT/EthercatSDO.cpp
76-
src/LowVoltage.cpp
77-
src/HighVoltage.cpp
78-
src/Encoder.cpp
79-
src/IMotionCube.cpp
80-
src/Joint.cpp
81-
src/IMotionCubeTargetState.cpp
82-
src/MarchRobot.cpp
83-
src/TemperatureGES.cpp
84-
src/PDOmap.cpp
85-
)
42+
add_library(${PROJECT_NAME}
43+
include/${PROJECT_NAME}/ActuationMode.h
44+
include/${PROJECT_NAME}/AngleConversions.h
45+
include/${PROJECT_NAME}/BootShutdownOffsets.h
46+
include/${PROJECT_NAME}/Encoder.h
47+
include/${PROJECT_NAME}/EtherCAT/EthercatIO.h
48+
include/${PROJECT_NAME}/EtherCAT/EthercatMaster.h
49+
include/${PROJECT_NAME}/EtherCAT/EthercatSDO.h
50+
include/${PROJECT_NAME}/HighVoltage.h
51+
include/${PROJECT_NAME}/IMotionCube.h
52+
include/${PROJECT_NAME}/IMotionCubeState.h
53+
include/${PROJECT_NAME}/IMotionCubeTargetState.h
54+
include/${PROJECT_NAME}/Joint.h
55+
include/${PROJECT_NAME}/LowVoltage.h
56+
include/${PROJECT_NAME}/MarchRobot.h
57+
include/${PROJECT_NAME}/NetDriverOffsets.h
58+
include/${PROJECT_NAME}/PDOmap.h
59+
include/${PROJECT_NAME}/PowerDistributionBoard.h
60+
include/${PROJECT_NAME}/Slave.h
61+
include/${PROJECT_NAME}/TemperatureGES.h
62+
include/${PROJECT_NAME}/TemperatureSensor.h
63+
src/Encoder.cpp
64+
src/EtherCAT/EthercatIO.cpp
65+
src/EtherCAT/EthercatMaster.cpp
66+
src/EtherCAT/EthercatSDO.cpp
67+
src/HighVoltage.cpp
68+
src/IMotionCube.cpp
69+
src/IMotionCubeTargetState.cpp
70+
src/Joint.cpp
71+
src/LowVoltage.cpp
72+
src/MarchRobot.cpp
73+
src/PDOmap.cpp
74+
src/PowerDistributionBoard.cpp
75+
src/TemperatureGES.cpp
76+
)
8677

87-
target_link_libraries(march_hardware ${catkin_LIBRARIES})
78+
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
8879

8980
add_executable(slave_count_check check/SlaveCount.cpp)
90-
target_link_libraries(slave_count_check march_hardware)
81+
target_link_libraries(slave_count_check ${PROJECT_NAME})
9182

92-
install(TARGETS march_hardware
93-
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
94-
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
95-
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
83+
install(TARGETS ${PROJECT_NAME}
84+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
85+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
86+
)
87+
88+
install(TARGETS slave_count_check
89+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
90+
)
9691

9792
## Add gtest based cpp test target and link libraries
9893
if (CATKIN_ENABLE_TESTING)
9994

10095
if(ENABLE_COVERAGE_TESTING)
10196
include(CodeCoverage)
102-
APPEND_COVERAGE_COMPILER_FLAGS()
97+
append_coverage_compiler_flags()
10398
endif()
10499

105100
add_rostest_gmock(${PROJECT_NAME}-test
106-
test/march4cpp.test
107-
test/TestRunner.cpp
108-
test/TestEncoder.cpp
109-
test/TestIMotionCube.cpp
110-
test/TestTemperatureGES.cpp
111-
test/TestJoint.cpp
112-
test/TestPDOmap.cpp
113-
test/TestBootShutdownOffsets.cpp
114-
test/TestNetDriverOffsets.cpp
115-
test/TestNetMonitorOffsets.cpp
116-
test/TestLowVoltage.cpp
117-
test/TestHighVoltage.cpp
118-
test/TestPowerDistributionBoard.cpp
119-
test/mocks/MockTemperatureGES.cpp
120-
test/mocks/MockTemperatureSensor.cpp
121-
test/mocks/MockEncoder.cpp
122-
test/mocks/MockIMotionCube.cpp
123-
test/mocks/MockJoint.cpp
124-
)
125-
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES} march_hardware gtest)
101+
test/march4cpp.test
102+
test/TestRunner.cpp
103+
test/TestEncoder.cpp
104+
test/TestIMotionCube.cpp
105+
test/TestTemperatureGES.cpp
106+
test/TestJoint.cpp
107+
test/TestPDOmap.cpp
108+
test/TestBootShutdownOffsets.cpp
109+
test/TestNetDriverOffsets.cpp
110+
test/TestNetMonitorOffsets.cpp
111+
test/TestLowVoltage.cpp
112+
test/TestHighVoltage.cpp
113+
test/TestPowerDistributionBoard.cpp
114+
test/mocks/MockTemperatureGES.cpp
115+
test/mocks/MockTemperatureSensor.cpp
116+
test/mocks/MockEncoder.cpp
117+
test/mocks/MockIMotionCube.cpp
118+
test/mocks/MockJoint.cpp
119+
)
120+
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES} ${PROJECT_NAME} gtest)
126121

127122
if(ENABLE_COVERAGE_TESTING)
128123
set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/soem*")
129124
add_code_coverage(
130-
NAME ${PROJECT_NAME}_coverage
131-
DEPENDS tests
125+
NAME ${PROJECT_NAME}_coverage
126+
DEPENDS tests
132127
)
133128
endif()
134129
endif ()

march_hardware/check/SlaveCount.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
#include <ros/ros.h>
44

5-
extern "C"
6-
{
7-
#include "ethercat.h"
8-
}
5+
#include <soem/ethercattype.h>
6+
#include <soem/nicdrv.h>
7+
#include <soem/ethercatbase.h>
8+
#include <soem/ethercatmain.h>
9+
#include <soem/ethercatdc.h>
10+
#include <soem/ethercatcoe.h>
11+
#include <soem/ethercatfoe.h>
12+
#include <soem/ethercatconfig.h>
13+
#include <soem/ethercatprint.h>
914

1015
int main(int argc, char** argv)
1116
{
@@ -16,7 +21,7 @@ int main(int argc, char** argv)
1621
std::string ifname = "enp2s0";
1722

1823
// Initialise SOEM, bind socket to ifname
19-
if (!ec_init(ifname.c_str()))
24+
if (!ec_init(&ifname[0]))
2025
{
2126
ROS_FATAL("No socket connection on %s. Confirm that you have selected the right ifname", ifname.c_str());
2227
nh.setParam("/check/slave_count", 0);

march_hardware/include/march_hardware/EtherCAT/EthercatIO.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
#include <stdint.h>
66
#include <stdio.h>
77

8-
extern "C"
9-
{
10-
#include "../../../soem/ethercat.h"
11-
}
8+
#include <soem/ethercattype.h>
9+
#include <soem/nicdrv.h>
10+
#include <soem/ethercatbase.h>
11+
#include <soem/ethercatmain.h>
12+
#include <soem/ethercatdc.h>
13+
#include <soem/ethercatcoe.h>
14+
#include <soem/ethercatfoe.h>
15+
#include <soem/ethercatconfig.h>
16+
#include <soem/ethercatprint.h>
1217

1318
namespace march4cpp
1419
{

march_hardware/package.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>march_hardware</name>
44
<version>0.0.0</version>
55
<description>
6-
C++ library to interface with the March4 hardware.
6+
Communicates with the March4 hardware.
77
</description>
88

99
<maintainer email="software@projectmarch.nl">Project March</maintainer>
@@ -12,19 +12,16 @@
1212

1313
<buildtool_depend>catkin</buildtool_depend>
1414

15-
1615
<build_depend>roscpp</build_depend>
16+
<build_depend>soem</build_depend>
1717
<build_depend>code_coverage</build_depend>
1818
<build_depend>roslint</build_depend>
1919
<build_depend>rostest</build_depend>
2020

2121
<build_export_depend>roscpp</build_export_depend>
22-
<build_depend>roslint</build_depend>
22+
<build_export_depend>soem</build_export_depend>
2323
<build_export_depend>rostest</build_export_depend>
2424

2525
<exec_depend>roscpp</exec_depend>
26-
27-
<export>
28-
29-
</export>
30-
</package>
26+
<exec_depend>soem</exec_depend>
27+
</package>

march_hardware/soem/ethercat.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)