75 typedef std::vector<double>
DVEC;
76 typedef std::vector<DVEC>
DMAT;
127 #define INIT_VEC(name, num) name, name+num 128 #define VEC_COPY(from, to, N1, N2) for (int i = 0; i < N1; ++i) for (int j = 0; j < N2; ++j)to[i][j] = from[i][j]; 131 POSITIONS_LARM_DEG_UP(
INIT_VEC(positions_larm_deg_up, 6)),
132 POSITIONS_LARM_DEG_DOWN(
INIT_VEC(positions_larm_deg_down, 6)),
133 POSITIONS_RARM_DEG_DOWN(
INIT_VEC(positions_rarm_deg_down, 6)),
134 POSITIONS_LARM_DEG_UP_SYNC(
INIT_VEC(positions_larm_deg_up_sync, 6)),
135 POSITIONS_RARM_DEG_UP_SYNC(
INIT_VEC(positions_rarm_deg_up_sync, 6)),
137 ROTATION_ANGLES_HEAD_1(2, DVEC(2)), ROTATION_ANGLES_HEAD_2(2, DVEC(2)), POSITIONS_TORSO_DEG(2, DVEC(1)),
140 POS_L_X_NEAR_Y_FAR(
INIT_VEC(pos_l_x_near_y_far, 3)), RPY_L_X_NEAR_Y_FAR(
INIT_VEC(rpy_l_x_near_y_far, 3)),
141 POS_R_X_NEAR_Y_FAR(
INIT_VEC(pos_r_x_near_y_far, 3)), RPY_R_X_NEAR_Y_FAR(
INIT_VEC(rpy_r_x_near_y_far, 3)),
143 POS_L_X_FAR_Y_FAR(
INIT_VEC(pos_l_x_far_y_far, 3)), RPY_L_X_FAR_Y_FAR(
INIT_VEC(rpy_l_x_far_y_far, 3)),
144 POS_R_X_FAR_Y_FAR(
INIT_VEC(pos_r_x_far_y_far, 3)), RPY_R_X_FAR_Y_FAR(
INIT_VEC(rpy_r_x_far_y_far, 3))
146 VEC_COPY(rotation_angles_head_1, ROTATION_ANGLES_HEAD_1, 2, 2)
147 VEC_COPY(rotation_angles_head_2, ROTATION_ANGLES_HEAD_2, 2, 2)
148 VEC_COPY(positions_torso_deg, POSITIONS_TORSO_DEG, 2, 1)
165 msg =
"\n" + msg +
"= ";
179 ROS_INFO(
"********RUN_TEST_ROS************");
185 std::string msg_type_client =
"";
187 msg_type_client =
"(ROS) ";
190 std::string msg = msg_type_client;
194 std::string msg_task =
"TASK-1. Move each arm separately to the given pose by passing joint space.";
195 msg = msg_type_client + msg_task;
200 "TASK-1. Move each arm separately to the given pose by passing pose in hand space " 201 "(i.e. orthogonal coordinate of eef).";
203 msg = msg_type_client + msg_task;
207 msg_task =
"TASK-2. Move both arms at the same time using relative distance and angle from the current pose.";
209 msg = msg_type_client + msg_task;
213 msg_task =
"TASK-3. Move arm with very small increment (0.1mm/sec).\n\tRight hand 3 cm upward over 30 seconds.";
214 msg = msg_type_client + msg_task;
218 msg_task =
"In the beginning you\"ll see the displacement of the previous task." 219 "\nTASK-4. Move head using Joint angles in degree.";
221 msg = msg_type_client + msg_task;
225 msg_task =
"TASK-5. Rotate torso to the left and right 130 degree.";
227 msg = msg_type_client + msg_task;
231 msg_task = std::string(
"TASK-6. Overwrite ongoing action.\n\t6-1." 232 "While rotating torso toward left, it getscanceled and rotate toward " 233 "right.\n\t6-2. While lifting left hand, right hand also tries to reach " 234 "the same height that gets cancelled so that it stays lower than the left hand.");
236 msg = msg_type_client + msg_task;
242 msg_task =
"TASK-7. Show the capable workspace on front side of the robot.";
243 msg = msg_type_client + msg_task;
264 ROS_INFO(
"** _move_armbyarm_pose isn\"t yet implemented");
288 int total_increment = t_total_sec / t;
289 std::string msg_1 =
"Right arm is moving upward with " +
to_string(delta) +
"mm increment per " +
to_string(t)
291 std::string msg_2 =
" (Total " +
to_string(delta * total_increment) +
"cm over " +
to_string(t_total_sec) +
"s).";
292 ROS_INFO(
"%s", (msg_1 + msg_2).c_str());
293 for (
int i = 0;
i < total_increment; ++
i)
296 msg_eachloop +=
"th loop;";
305 for (std::vector<std::vector<double> >::iterator positions = ROTATION_ANGLES_HEAD_1.begin();
306 positions != ROTATION_ANGLES_HEAD_1.end(); ++positions)
310 for (std::vector<std::vector<double> >::iterator positions = ROTATION_ANGLES_HEAD_2.begin();
311 positions != ROTATION_ANGLES_HEAD_2.end(); ++positions)
320 for (std::vector<std::vector<double> >::iterator positions = POSITIONS_TORSO_DEG.begin();
321 positions != POSITIONS_TORSO_DEG.end(); ++positions)
345 TASK_DURATION_DEFAULT,
false);
348 POSITIONS_RARM_DEG_UP_SYNC,
349 std::string(
"(2) begins. Overwrite previous arm command.\n\t" 350 "In the beginning both arm starts to move to the\n\tsame height" 351 "but to the left arm interrupting\ncommand is sent and it goes downward."),
352 TASK_DURATION_DEFAULT,
false);
357 TASK_DURATION_DEFAULT,
false);
365 std::string msg =
"; ";
370 test_client.
set_pose(larm, POS_L_X_NEAR_Y_FAR, RPY_L_X_NEAR_Y_FAR, msg +
to_string(larm), TASK_DURATION_DEFAULT,
372 test_client.
set_pose(rarm, POS_R_X_NEAR_Y_FAR, RPY_R_X_NEAR_Y_FAR, msg +
to_string(rarm), TASK_DURATION_DEFAULT,
375 test_client.
set_pose(larm, POS_L_X_FAR_Y_FAR, RPY_L_X_FAR_Y_FAR, msg +
to_string(larm), TASK_DURATION_DEFAULT,
377 test_client.
set_pose(rarm, POS_R_X_FAR_Y_FAR, RPY_R_X_FAR_Y_FAR, msg +
to_string(rarm), TASK_DURATION_DEFAULT,
419 int main(
int argc,
char* argv[])
422 ros::init(argc, argv,
"hironx_ros_client");
static const double pos_l_x_near_y_far[3]
#define INIT_VEC(name, num)
void move_torso(AbstAcceptanceTest &test_client)
static const double positions_larm_deg_up[6]
void overwrite_arm(AbstAcceptanceTest &test_client)
DMAT ROTATION_ANGLES_HEAD_2
virtual void set_pose_relative(std::string joint_group, int dx=0, int dy=0, int dz=0, int dr=0, int dp=0, int dw=0, std::string msg_tasktitle="", double task_duration=7.0, bool do_wait=true)
static std::string GRNAME_HEAD
static std::string GRNAME_LEFT_ARM
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static const double rpy_r_x_far_y_far[3]
DVEC POSITIONS_RARM_DEG_DOWN
const std::string rtm_robotname
static const double pos_r_x_far_y_far[3]
static const double DURATION_EACH_SMALLINCREMENT
void wait_input(std::string msg, bool do_wait_input=false)
DVEC POSITIONS_LARM_DEG_DOWN
static const double TASK_DURATION_DEFAULT
std::string to_string(T a)
static const double rotation_angles_head_2[2][2]
static const double TASK_DURATION_TORSO
static const double rpy_l_x_far_y_far[3]
DVEC POSITIONS_LARM_DEG_UP
AcceptanceTest_Hiro(std::string name="Hironx(Robot)0", std::string url="")
virtual void set_pose(std::string joint_group, std::vector< double > pose, std::vector< double > rpy, std::string msg_tasktitle="", double task_duration=7.0, bool do_wait=true, std::string ref_frame_name="")
void move_armbyarm_jointangles(AbstAcceptanceTest &test_client)
#define VEC_COPY(from, to, N1, N2)
const std::string rtm_url
static const double pos_r_x_near_y_far[3]
void set_pose_relative(AbstAcceptanceTest &test_client)
static const double rpy_l_x_near_y_far[3]
void move_head(AbstAcceptanceTest &test_client)
static const double pos_l_x_far_y_far[3]
static const double rpy_r_x_near_y_far[3]
static const double rotation_angles_head_1[2][2]
static const int SLEEP_OVERWRITE
DMAT ROTATION_ANGLES_HEAD_1
static const double R_Z_SMALLINCREMENT
void run_tests(AbstAcceptanceTest &test_client, bool do_wait_input=false)
std::vector< double > DVEC
static const double positions_torso_deg[2][1]
virtual void set_joint_angles(std::string joint_group, std::vector< double > joint_angles, std::string msg_tasktitle="", double task_duration=7.0, bool do_wait=true)
void run_test_ros(bool do_wait_input=false)
static const int DURATION_TOTAL_SMALLINCREMENT
static const double positions_larm_deg_down[6]
static const double positions_rarm_deg_up_sync[6]
static const double TASK_DURATION_HEAD
AcceptanceTestRos acceptance_ros_client
static std::string GRNAME_RIGHT_ARM
void movearms_together(AbstAcceptanceTest &test_client)
virtual void go_initpos(double dtaskduration=7.0)
static const double positions_larm_deg_up_sync[6]
DVEC POSITIONS_LARM_DEG_UP_SYNC
static std::string GRNAME_TORSO
void move_armbyarm_pose(AbstAcceptanceTest &test_client)
void show_workspace(AbstAcceptanceTest &test_client)
int main(int argc, char *argv[])
static const int SLEEP_TIME
static const double positions_rarm_deg_down[6]
DVEC POSITIONS_RARM_DEG_UP_SYNC
void overwrite_torso(AbstAcceptanceTest &test_client)