Skip to content

Commit

Permalink
Add
Browse files Browse the repository at this point in the history
  • Loading branch information
iory committed Jan 8, 2024
1 parent 47859dd commit aee7175
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ros/kxr_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,18 @@ target_link_libraries(kxr_controller
install(TARGETS kxr_controller
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
find_package(roslaunch REQUIRED)
if(roslaunch_VERSION VERSION_LESS "1.11.1")
message(WARNING "roslaunch_add_file check fails with unsupported doc attributes ${roslaunch_VERSION}")
else()
file(GLOB LAUNCH_FILES launch/*.launch)
foreach(LAUNCH_FILE ${LAUNCH_FILES})
roslaunch_add_file_check(${LAUNCH_FILE})
endforeach()
endif()
add_rostest(test/kxr_controller.test ARGS namespace:="")
add_rostest(test/kxr_controller.test ARGS namespace:="robot_a")
endif()
3 changes: 3 additions & 0 deletions ros/kxr_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<exec_depend>cmake_modules</exec_depend>
<exec_depend>kxr_models</exec_depend>

<test_depend>roslaunch</test_depend>
<test_depend>rostest</test_depend>

<export>
</export>
</package>
42 changes: 42 additions & 0 deletions ros/kxr_controller/test/kxr_controller.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,51 @@
<launch>

<arg name="namespace" default="" />

<include file="$(find kxr_controller)/launch/kxr_controller.launch">
<arg name="urdf_path" value="$(find kxr_models)/urdf/kxr_test_head.urdf" />
<arg name="servo_config_path" value="$(find kxr_models)/config/kxr_test_head_servo_config.yaml" />
<arg name="namespace" value="robot_a" />
</include>

<group if="$(eval len(arg('namespace')) > 0)" ns="$(arg namespace)" >
<test test-name="test_ros_topics"
name="test_ros_topics"
pkg="jsk_tools" type="test_topic_published.py"
retry="3" >
<rosparam>
topic_0: current_joint_states
timeout_0: 30
topic_1: joint_states
timeout_1: 30
topic_2: kxr_fullbody_controller/follow_joint_trajectory/status
timeout_2: 30
topic_3: kxr_fullbody_controller/servo_on_off_real_interface/status
timeout_3: 30
topic_4: kxr_fullbody_controller/servo_on_off/status
timeout_4: 30
</rosparam>
</test>
</group>

<group unless="$(eval len(arg('namespace')) > 0)">
<test test-name="test_ros_topics"
name="test_ros_topics"
pkg="jsk_tools" type="test_topic_published.py"
retry="3" >
<rosparam>
topic_0: current_joint_states
timeout_0: 30
topic_1: joint_states
timeout_1: 30
topic_2: kxr_fullbody_controller/follow_joint_trajectory/status
timeout_2: 30
topic_3: kxr_fullbody_controller/servo_on_off_real_interface/status
timeout_3: 30
topic_4: kxr_fullbody_controller/servo_on_off/status
timeout_4: 30
</rosparam>
</test>
</group>

</launch>

0 comments on commit aee7175

Please sign in to comment.