19 #include <gtest/gtest.h>
22 "<?xml version='1.0' ?>"
23 "<robot name='maxwell'>"
24 " <link name='base_link'/>"
25 " <joint name='torso_joint' type='fixed'>"
26 " <origin rpy='0 0 0' xyz='-0.00635 0 0.7914'/>"
27 " <parent link='base_link'/>"
28 " <child link='torso_link'/>"
30 " <link name='torso_link'/>"
31 " <joint name='torso_actuator_joint' type='fixed'>"
32 " <origin rpy='0 0 0' xyz='0 0 0'/>"
33 " <parent link='torso_link'/>"
34 " <child link='torso_actuator_link'/>"
36 " <link name='torso_actuator_link'/>"
37 " <joint name='arm_lift_joint' type='prismatic'>"
38 " <axis xyz='0 0 1'/>"
39 " <limit effort='30' lower='-0.464' upper='0' velocity='0.0508'/>"
40 " <origin rpy='0 0 0' xyz='0 0 0'/>"
41 " <parent link='torso_link'/>"
42 " <child link='arm_lift_link'/>"
44 " <link name='arm_lift_link'/>"
45 " <joint name='arm_base_joint' type='fixed'>"
46 " <origin rpy='0 0 0' xyz='0.0611 0 0'/>"
47 " <parent link='arm_lift_link'/>"
48 " <child link='arm_link'/>"
50 " <link name='arm_link'/>"
51 " <joint name='arm_shoulder_pan_servo_joint' type='fixed'>"
52 " <origin rpy='0 0 0' xyz='0 0 0'/>"
53 " <parent link='arm_link'/>"
54 " <child link='arm_shoulder_pan_servo_link'/>"
56 " <link name='arm_shoulder_pan_servo_link'/>"
57 " <joint name='arm_shoulder_pan_joint' type='revolute'>"
58 " <origin rpy='0 0 0' xyz='0 0 0.0235'/>"
59 " <axis xyz='0 0 1'/>"
60 " <limit effort='30' lower='-1.57' upper='1.57' velocity='0.524'/>"
61 " <parent link='arm_shoulder_pan_servo_link'/>"
62 " <child link='arm_shoulder_pan_link'/>"
64 " <link name='arm_shoulder_pan_link'/>"
65 " <joint name='arm_shoulder_lift_servo_joint' type='fixed'>"
66 " <origin rpy='0 -1.57 0' xyz='0 0 0.0526'/>"
67 " <parent link='arm_shoulder_pan_link'/>"
68 " <child link='arm_shoulder_lift_servo_link'/>"
70 " <link name='arm_shoulder_lift_servo_link'/>"
71 " <joint name='arm_shoulder_lift_joint' type='revolute'>"
72 " <origin rpy='0 1.57 0' xyz='0 0 0'/>"
73 " <axis xyz='0 1 0'/>"
74 " <limit effort='30' lower='-1.77' upper='1.317' velocity='0.524'/>"
75 " <parent link='arm_shoulder_lift_servo_link'/>"
76 " <child link='arm_shoulder_lift_link'/>"
78 " <link name='arm_shoulder_lift_link'/>"
79 " <joint name='arm_upperarm_roll_servo_joint' type='fixed'>"
80 " <origin rpy='1.57 1.57 0' xyz='0.0712978 0 0'/>"
81 " <parent link='arm_shoulder_lift_link'/>"
82 " <child link='arm_upperarm_roll_servo_link'/>"
84 " <link name='arm_upperarm_roll_servo_link'/>"
85 " <joint name='arm_upperarm_roll_joint' type='revolute'>"
86 " <origin rpy='-1.57 0 1.57' xyz='0 0 0'/>"
87 " <axis xyz='1 0 0'/>"
88 " <limit effort='30' lower='-2' upper='2' velocity='0.524'/>"
89 " <parent link='arm_upperarm_roll_servo_link'/>"
90 " <child link='arm_upperarm_roll_link'/>"
92 " <link name='arm_upperarm_roll_link'/>"
93 " <joint name='arm_elbow_flex_joint' type='revolute'>"
94 " <origin rpy='0 0 0' xyz='0.0869955 0 0'/>"
95 " <axis xyz='0 1 0'/>"
96 " <limit effort='30' lower='-1.57' upper='2.617' velocity='0.524'/>"
97 " <parent link='arm_upperarm_roll_link'/>"
98 " <child link='arm_elbow_flex_link'/>"
100 " <link name='arm_elbow_flex_link'/>"
101 " <joint name='arm_forearm_fixed_joint' type='fixed'>"
102 " <origin rpy='0 0 0' xyz='0 0 0'/>"
103 " <parent link='arm_elbow_flex_link'/>"
104 " <child link='arm_forearm_link'/>"
106 " <link name='arm_forearm_link'/>"
107 " <joint name='arm_wrist_flex_servo_joint' type='fixed'>"
108 " <origin rpy='0 0 0' xyz='0.125 0 0'/>"
109 " <parent link='arm_forearm_link'/>"
110 " <child link='arm_wrist_flex_servo_link'/>"
112 " <link name='arm_wrist_flex_servo_link'/>"
113 " <joint name='arm_wrist_flex_joint' type='revolute'>"
114 " <origin rpy='0 0 0' xyz='0 0 0.0'/>"
115 " <axis xyz='0 1 0'/>"
116 " <limit effort='30' lower='-1.57' upper='1.57' velocity='0.785'/>"
117 " <parent link='arm_wrist_flex_servo_link'/>"
118 " <child link='arm_wrist_flex_link'/>"
120 " <link name='arm_wrist_flex_link'/>"
121 " <joint name='arm_wrist_roll_joint' type='revolute'>"
122 " <axis xyz='1 0 0'/>"
123 " <limit effort='30' lower='-2.617' upper='2.617' velocity='0.785'/>"
124 " <origin rpy='0 0 0' xyz='0.031 0 0'/>"
125 " <parent link='arm_wrist_flex_link'/>"
126 " <child link='arm_wrist_roll_link'/>"
128 " <link name='arm_wrist_roll_link'/>"
129 " <joint name='gripper_joint' type='fixed'>"
130 " <axis xyz='0 0 1'/>"
131 " <origin rpy='0 0 0' xyz='0.15 0 -0.015'/>"
132 " <parent link='arm_wrist_roll_link'/>"
133 " <child link='gripper_led_frame'/>"
135 " <link name='gripper_led_frame'/>"
136 " <joint name='head_joint' type='fixed'>"
137 " <origin rpy='0 0 0' xyz='0 0 0.512375'/>"
138 " <parent link='torso_link'/>"
139 " <child link='head_link'/>"
141 " <link name='head_link'/>"
142 " <joint name='head_pan_servo_joint' type='fixed'>"
143 " <origin rpy='0 0 0' xyz='0.010 0 0.0254'/>"
144 " <parent link='head_link'/>"
145 " <child link='head_pan_servo_link'/>"
147 " <link name='head_pan_servo_link'/>"
148 " <joint name='head_pan_joint' type='revolute'>"
149 " <origin rpy='0 0 0' xyz='0 0 0.019'/>"
150 " <axis xyz='0 0 1'/>"
151 " <limit effort='30' lower='-2.617' upper='2.617' velocity='1.0'/>"
152 " <parent link='head_pan_servo_link'/>"
153 " <child link='head_pan_link'/>"
155 " <link name='head_pan_link'/>"
156 " <joint name='head_tilt_servo_joint' type='fixed'>"
157 " <origin rpy='0 0 0' xyz='0 0 0.0415'/>"
158 " <parent link='head_pan_link'/>"
159 " <child link='head_tilt_servo_link'/>"
161 " <link name='head_tilt_servo_link'/>"
162 " <joint name='head_tilt_joint' type='revolute'>"
163 " <origin rpy='0 0 0' xyz='0 0 0'/>"
164 " <axis xyz='0 1 0'/>"
165 " <limit effort='30' lower='-1.57' upper='1.57' velocity='1.0'/>"
166 " <parent link='head_tilt_servo_link'/>"
167 " <child link='head_tilt_link'/>"
169 " <link name='head_tilt_link'/>"
170 " <joint name='head_camera_frame_joint' type='fixed'>"
171 " <origin rpy='0 0 0' xyz='0 0 0.026'/>"
172 " <parent link='head_tilt_link'/>"
173 " <child link='head_camera_frame'/>"
175 " <link name='head_camera_frame'/>"
176 " <joint name='head_camera_ir_joint' type='fixed'>"
177 " <origin rpy='0 0 0' xyz='0.01905 -0.0269875 0.032075'/>"
178 " <parent link='head_camera_frame'/>"
179 " <child link='head_camera_ir_link'/>"
181 " <link name='head_camera_ir_link'/>"
182 " <joint name='head_camera_ir_optical_frame_joint' type='fixed'>"
183 " <origin rpy='-1.57 0.0 -1.57' xyz='0 0 0'/>"
184 " <parent link='head_camera_ir_link'/>"
185 " <child link='head_camera_ir_optical_frame'/>"
187 " <link name='head_camera_ir_optical_frame'/>"
188 " <joint name='head_camera_rgb_joint' type='fixed'>"
189 " <origin rpy='0 -0.08 0' xyz='0 0.0552875 0'/>"
190 " <parent link='head_camera_ir_link'/>"
191 " <child link='head_camera_rgb_link'/>"
193 " <link name='head_camera_rgb_link'/>"
194 " <joint name='head_camera_rgb_optical_frame_joint' type='fixed'>"
195 " <origin rpy='-1.57 0.0 -1.57' xyz='0 0 0'/>"
196 " <parent link='head_camera_rgb_link'/>"
197 " <child link='head_camera_rgb_optical_frame'/>"
199 " <link name='head_camera_rgb_optical_frame'/>"
202 TEST(ErrorBlockTests, error_blocks_maxwell)
208 std::vector<robot_calibration_msgs::CalibrationData> data;
209 robot_calibration_msgs::CalibrationData msg;
212 msg.joint_states.name.resize(10);
213 msg.joint_states.name[0] =
"arm_lift_joint";
214 msg.joint_states.name[1] =
"arm_shoulder_pan_joint";
215 msg.joint_states.name[2] =
"arm_shoulder_lift_joint";
216 msg.joint_states.name[3] =
"arm_upperarm_roll_joint";
217 msg.joint_states.name[4] =
"arm_elbow_flex_joint";
218 msg.joint_states.name[5] =
"arm_wrist_flex_joint";
219 msg.joint_states.name[6] =
"arm_wrist_roll_joint";
220 msg.joint_states.name[7] =
"head_pan_joint";
221 msg.joint_states.name[8] =
"head_tilt_joint";
222 msg.joint_states.name[9] =
"arm_lift_joint";
223 msg.joint_states.position.resize(10);
224 msg.joint_states.position[0] = -0.05;
225 msg.joint_states.position[1] = -0.814830;
226 msg.joint_states.position[2] = -0.00022290000000002586;
227 msg.joint_states.position[3] = 0.0;
228 msg.joint_states.position[4] = -0.7087341;
229 msg.joint_states.position[5] = 0.0;
230 msg.joint_states.position[6] = 0.0;
231 msg.joint_states.position[7] = -0.8280187999999999;
232 msg.joint_states.position[8] = 0.6358500000000002;
233 msg.joint_states.position[9] = 0.0;
236 msg.observations.resize(2);
237 msg.observations[0].sensor_name =
"camera";
238 msg.observations[1].sensor_name =
"arm";
240 msg.observations[0].features.resize(1);
241 msg.observations[0].features[0].header.frame_id =
"head_camera_rgb_optical_frame";
242 msg.observations[0].features[0].point.x = -0.0143163670728;
243 msg.observations[0].features[0].point.y = 0.111304592065;
244 msg.observations[0].features[0].point.z = 0.522079317365;
246 msg.observations[0].ext_camera_info.camera_info.P[0] = 100.0;
247 msg.observations[0].ext_camera_info.camera_info.P[5] = 100.0;
248 msg.observations[0].ext_camera_info.camera_info.P[2] = 320.0;
249 msg.observations[0].ext_camera_info.camera_info.P[6] = 240.0;
250 msg.observations[0].ext_camera_info.parameters.resize(2);
251 msg.observations[0].ext_camera_info.parameters[0].name =
"z_offset";
252 msg.observations[0].ext_camera_info.parameters[0].value = 0.0;
253 msg.observations[0].ext_camera_info.parameters[1].name =
"z_scaling";
254 msg.observations[0].ext_camera_info.parameters[1].value = 1.0;
256 msg.observations[1].features.resize(1);
257 msg.observations[1].features[0].header.frame_id =
"gripper_led_frame";
258 msg.observations[1].features[0].point.x = 0.0;
259 msg.observations[1].features[0].point.y = 0.0;
260 msg.observations[1].features[0].point.z = 0.0;
266 msg.joint_states.position[1] = -0.019781999999999966;
267 msg.joint_states.position[7] = 0.0;
268 msg.observations[0].features[0].point.x = 0.0365330705881;
269 msg.observations[0].features[0].point.y = 0.102609552493;
270 msg.observations[0].features[0].point.z = 0.536061220027;
274 msg.joint_states.position[1] = 0.883596;
275 msg.joint_states.position[7] = 0.9442135999999999;
276 msg.observations[0].features[0].point.x = 0.0942445346646;
277 msg.observations[0].features[0].point.y = 0.11409172323;
278 msg.observations[0].features[0].point.z = 0.517497963716;
287 EXPECT_GT(opt.
summary()->initial_cost, 0.001);
288 EXPECT_LT(opt.
summary()->final_cost, 1e-18);
289 EXPECT_GT(opt.
summary()->iterations.size(),
static_cast<size_t>(1));
291 EXPECT_LT(fabs(0.05 - opt.
getOffsets()->get(
"arm_lift_joint")), 0.001);
298 int main(
int argc,
char** argv)
300 ros::init(argc, argv,
"error_block_tests");
301 testing::InitGoogleTest(&argc, argv);
302 return RUN_ALL_TESTS();