forked from jsk-ros-pkg/jsk_robot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from k-okada/add_test
add tests in jsk_fetch_gazebo_demo
- Loading branch information
Showing
9 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
jsk_fetch_robot/jsk_fetch_gazebo_demo/test/grasping_objects.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<launch> | ||
<group ns="grasp_objects_test" > | ||
<node pkg="rosbag" type="play" name="play_grasping_objects_msg" | ||
args="-l $(find jsk_fetch_gazebo_demo)/test/grasping_objects.bag" /> | ||
</group> | ||
|
||
<test test-name="demo_test" pkg="roseus" type="roseus" name="demo_test" args="$(find jsk_fetch_gazebo_demo)/test/test-grasping-objects.l" /> | ||
</launch> | ||
|
20 changes: 20 additions & 0 deletions
20
jsk_fetch_robot/jsk_fetch_gazebo_demo/test/jsk_fetch_gazebo_demo.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<launch> | ||
<include file="$(find jsk_fetch_gazebo_demo)/launch/demo.launch" > | ||
<arg name="run_demo_script" value="false" /> | ||
<arg name="rviz" value="false" /> | ||
</include> | ||
|
||
<group ns="grasp_objects_test" > | ||
<node pkg="rosbag" type="play" name="play_grasping_objects_msg" | ||
args="-l $(find jsk_fetch_gazebo_demo)/test/grasping_objects.bag" /> | ||
</group> | ||
|
||
<param name="joint_states_hz_test/topic" value="joint_states" /> | ||
<param name="joint_states_hz_test/hz" value="100.0" /> | ||
<param name="joint_states_hz_test/hzerror" value="25.0" /> | ||
<param name="joint_states_hz_test/test_duration" value="5.0" /> | ||
<atest test-name="joint_states_test" pkg="rostest" type="hztest" name="joint_states_hz_test" /> | ||
|
||
<test test-name="demo_test" pkg="roseus" type="roseus" name="demo_test" args="$(find jsk_fetch_gazebo_demo)/test/test-demo.l" /> | ||
</launch> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env roseus | ||
|
||
(require :unittest "lib/llib/unittest.l") | ||
(init-unit-test) | ||
|
||
(load "package://jsk_fetch_gazebo_demo/euslisp/demo.l") | ||
|
||
(deftest init-and-move () | ||
(let ((pos0 #f(2250 3118 0)) pos1) | ||
;; Create *ri* to use fetch with MoveIt! and Navigation stack | ||
(fetch-init) | ||
|
||
;; Move the base to be in front of the table | ||
;; Demonstrates the use of the navigation stack | ||
(setq pos1 (send (send *ri* :state :worldcoords "map") :worldpos)) | ||
(ros::ros-warn " goal position: ~A (diff:~A)" pos1 (norm (v- pos1 pos0))) | ||
(ros::ros-warn "Moving to table...") | ||
;; first time | ||
(send *ri* :move-to (make-coords :pos pos0) :frame-id "map") | ||
(setq pos1 (send (send *ri* :state :worldcoords "map") :worldpos)) | ||
(ros::ros-warn " goal position: ~A (diff:~A)" pos1 (norm (v- pos1 pos0))) | ||
(assert (< (norm (v- pos1 pos0)) 500) | ||
(format nil "go-pos moves incorrectly : ~A" (norm (v- pos0 pos1)))) | ||
;; second time | ||
(send *ri* :move-to (make-coords :pos pos0) :frame-id "map") | ||
(setq pos1 (send (send *ri* :state :worldcoords "map") :worldpos)) | ||
(ros::ros-warn " goal position: ~A (diff:~A)" pos1 (norm (v- pos1 pos0))) | ||
(assert (< (norm (v- pos1 pos0)) 500) | ||
(format nil "go-pos moves incorrectly : ~A" (norm (v- pos0 pos1)))) | ||
)) | ||
|
||
(run-all-tests) | ||
(exit) | ||
|
||
|
49 changes: 49 additions & 0 deletions
49
jsk_fetch_robot/jsk_fetch_gazebo_demo/test/test-grasping-objects.l
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env roseus | ||
|
||
(require :unittest "lib/llib/unittest.l") | ||
(init-unit-test) | ||
|
||
;; force set *co* to aovid loading (instance collision-object-publisher :init))) that wait for '/apply_planning_scene' serice | ||
(defclass dummy-collision-object-publisher :super propertied-object) | ||
(defmethod dummy-collision-object-publisher | ||
(:init () self) | ||
(:wipe-all () t) | ||
) | ||
(setq *co* (instance dummy-collision-object-publisher :init)) | ||
;; fake action goal/result id, skip wait-for-server | ||
(in-package "ROS") | ||
(defmethod ros::simple-action-client | ||
(:wait-for-server (&optional (timeout nil)) t) | ||
(defmethod actionlib-comm-state | ||
(:update-result | ||
(msg) | ||
(setq latest-goal-status (send msg :status)) | ||
(setq latest-result msg) | ||
(ros::ros-info "[~A] update-result goal id: ~A ~A~%" (send self :name) (send msg :status :goal_id :id) state) | ||
(if action-goal (send msg :status :goal_id :id (send action-goal :goal_id :id))) | ||
(ros::ros-info "[~A] replaced goal id: ~A ~A~%" (send self :name) (send msg :status :goal_id :id) state) | ||
(send self :update-status | ||
(instance actionlib_msgs::GoalStatusArray :init :status_list (list (send msg :status)))) | ||
(setq state 'ros::*comm-state-done*)) | ||
(ros::ros-info "[~A] update-result state: ~A ~A" (send self :name) (send msg :status :goal_id :id) state) | ||
)) | ||
(in-package "USER") | ||
;; | ||
(load "package://jsk_fetch_gazebo_demo/euslisp/demo.l") | ||
|
||
(deftest grasp-client () | ||
(let (ret cube grasps) | ||
(setq grasping-client (instance grasping-client :init | ||
:find-topic "grasp_objects_test/basic_grasping_perception/find_objects")) | ||
(ros::ros-warn "Picking object...") | ||
(send grasping-client :update-scene) | ||
(setq ret (send grasping-client :get-graspable-cube)) | ||
(ros::ros-warn "Graspable object results: ~A" ret) | ||
(setq cube (car ret)) | ||
(setq grasps (cadr ret)) | ||
(ros::ros-warn "Graspable cube ~A / grasps" cube grasps) | ||
)) | ||
|
||
(run-all-tests) | ||
(exit) | ||
|