Skip to content

Commit

Permalink
wait_for_task_termination: interface cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ptroja committed Feb 9, 2012
1 parent 7c5fa05 commit 13cd887
Show file tree
Hide file tree
Showing 24 changed files with 131 additions and 165 deletions.
8 changes: 4 additions & 4 deletions src/application/ball/mp_t_ball.cc
Expand Up @@ -73,11 +73,11 @@ void ball::configure_edp_force_sensor(bool configure_track, bool configure_postu
}

if ((configure_track) && (!configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6ot_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6ot_m::ROBOT_NAME);
} else if ((!configure_track) && (configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);
} else if ((configure_track) && (configure_postument)) {
wait_for_task_termination(false, 2, lib::irp6ot_m::ROBOT_NAME.c_str(), lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, {lib::irp6ot_m::ROBOT_NAME, lib::irp6p_m::ROBOT_NAME});
}
}

Expand All @@ -90,7 +90,7 @@ void ball::main_task_algorithm(void)
//set_next_ecp_state(ecp_mp::generator::ECP_GEN_SMOOTH, (int) ecp_mp::task::ABSOLUTE, "src/application/ball/irp6ot_init.trj", 0, lib::irp6ot_m::ROBOT_NAME);
//set_next_ecp_state(ecp_mp::generator::ECP_GEN_SMOOTH, (int) ecp_mp::task::ABSOLUTE, "src/application/ball/irp6p_init.trj", 0, lib::irp6p_m::ROBOT_NAME);

wait_for_task_termination(false, 2, lib::irp6ot_m::ROBOT_NAME.c_str(), lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, {lib::irp6ot_m::ROBOT_NAME, lib::irp6p_m::ROBOT_NAME});

sr_ecp_msg->message("New series");
// wlaczenie generatora do konfiguracji czujnika w EDP w obydwu robotach
Expand Down
10 changes: 5 additions & 5 deletions src/application/bclikeregions/bclike_mp_i.cc
Expand Up @@ -66,7 +66,7 @@ void bclike_mp_i::main_task_algorithm(void){

set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
sr_ecp_msg->message("MOVE left");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);

//Setup end position
vec.clear();
Expand All @@ -76,7 +76,7 @@ void bclike_mp_i::main_task_algorithm(void){
//Start moving
set_next_ecp_state (ecp_mp::task::ECP_ST_SCAN_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
sr_ecp_msg->message("MOVE right");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);


std::vector<std::pair<ecp::common::task::mrrocpp_regions, bool> >::iterator it;
Expand All @@ -97,18 +97,18 @@ void bclike_mp_i::main_task_algorithm(void){
//Go to code
tmp = msg.robotPositionToString(vec);
set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tmp, lib::ECP_2_MP_STRING_SIZE, actual_robot);
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);

//Get back to previous position
tmp = msg.robotPositionToString(pos);
set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tmp, lib::ECP_2_MP_STRING_SIZE, actual_robot);
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);
}
}

set_next_ecp_state (ecp_mp::task::ECP_ST_SCAN_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
sr_ecp_msg->message("MOVE right");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);
}

sr_ecp_msg->message("KONIEC");
Expand Down
4 changes: 2 additions & 2 deletions src/application/bclikeregions/bclike_mp_test.cc
Expand Up @@ -64,7 +64,7 @@ void bclike_mp_test::main_task_algorithm(void){

set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
sr_ecp_msg->message("MOVE left");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);


int i = 0;
Expand Down Expand Up @@ -97,7 +97,7 @@ void bclike_mp_test::main_task_algorithm(void){
i = i % 3;

set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);

sr_ecp_msg->message("MP end loop");

Expand Down
8 changes: 4 additions & 4 deletions src/application/bclikeregions/bclike_mp_ui.cc
Expand Up @@ -65,7 +65,7 @@ void bclike_mp_ui::main_task_algorithm(void){

set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, actual_robot);
sr_ecp_msg->message("MOVE left");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);

//Setup end position
vec.clear();
Expand All @@ -75,7 +75,7 @@ void bclike_mp_ui::main_task_algorithm(void){
//Start moving
set_next_ecp_state (ecp_mp::task::ECP_ST_SCAN_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, 1, actual_robot.c_str());
sr_ecp_msg->message("MOVE right");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);


while(strcmp(robot_m[actual_robot]->ecp_reply_package.recognized_command, "KONIEC") != 0){
Expand All @@ -86,7 +86,7 @@ void bclike_mp_ui::main_task_algorithm(void){

set_next_ecp_state (ecp_mp::task::ECP_ST_SCAN_MOVE, 0, tab, lib::ECP_2_MP_STRING_SIZE, 1, actual_robot.c_str());
sr_ecp_msg->message("MOVE right");
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);
}
sr_ecp_msg->message("KONIEC RUCHU");
std::vector<std::pair<ecp::common::task::mrrocpp_regions, bool> >::iterator it;
Expand All @@ -105,7 +105,7 @@ void bclike_mp_ui::main_task_algorithm(void){
//Move to code position
tmp = msg.robotPositionToString(vec);
set_next_ecp_state (ecp_mp::task::ECP_ST_POSITION_MOVE, 0, tmp, lib::ECP_2_MP_STRING_SIZE, 1, actual_robot.c_str());
wait_for_task_termination(false, 1, actual_robot.c_str());
wait_for_task_termination(false, actual_robot);

//TODO: przelaczyc zadanie FrDIA
//TODO: wywolac subtaks Marcina
Expand Down
2 changes: 1 addition & 1 deletion src/application/bird_hand_test/mp_t_bird_hand_test.cc
Expand Up @@ -63,7 +63,7 @@ void bird_hand_test::main_task_algorithm(void)

set_next_ecp_state(ecp_mp::bird_hand::generator::ECP_GEN_BIRD_HAND_TEST, (int) 5, "", lib::bird_hand::ROBOT_NAME);
sr_ecp_msg->message("5");
wait_for_task_termination(false, 1, lib::bird_hand::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::bird_hand::ROBOT_NAME);

sr_ecp_msg->message("END");

Expand Down
18 changes: 9 additions & 9 deletions src/application/block_move/mp_t_block_move.cc
Expand Up @@ -56,13 +56,13 @@ void block_move::main_task_algorithm(void)

sr_ecp_msg->message("Start position for searching");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_JOINT_FILE_FROM_MP, 5, "../../src/application/block_move/pos_search_area_start.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

wait_ms(4000);

sr_ecp_msg->message("Final position for searching");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_JOINT_FILE_FROM_MP, 5, "../../src/application/block_move/pos_search_area_final.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

//Tutaj powinno być przekazanie parametru i dojście

Expand All @@ -74,7 +74,7 @@ void block_move::main_task_algorithm(void)

sr_ecp_msg->message("Reach the block");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_ANGLE_AXIS_FILE_FROM_MP, 5, "../../src/application/block_move/block_reaching.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

//sr_ecp_msg->message("Zwarcie szczek");
//set_next_ecp_state();
Expand All @@ -84,35 +84,35 @@ void block_move::main_task_algorithm(void)

sr_ecp_msg->message("Get the block");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_ANGLE_AXIS_FILE_FROM_MP, 5, "../../src/application/block_move/up_to_p0.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

wait_ms(4000);

sr_ecp_msg->message("Start position for building");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_JOINT_FILE_FROM_MP, 5, "../../src/application/block_move/pos_build_start.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

//Tutaj powinno byc przekazanie parametru i dojscie - ruch sklada sie z dwoch czesci

wait_ms(4000);

sr_ecp_msg->message("Put the block in its place");
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_ANGLE_AXIS_FILE_FROM_MP, 5, "../../src/application/block_move/build.trj", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

//sr_ecp_msg->message("Rozwarcie szczek");
//set_next_ecp_state(ecp_mp::sub_task::ECP_ST_GRIPPER_OPENING, 0, NULL, 0, lib::irp6p_tfg::ROBOT_NAME);
//wait_for_task_termination(false, 1, lib::irp6p_tfg::ROBOT_NAME.c_str());
//wait_for_task_termination(false, lib::irp6p_tfg::ROBOT_NAME);

//wait_ms(4000);

//sr_ecp_msg->message("Final position for building");
//set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_ANGLE_AXIS_FILE_FROM_MP, 5, "../../src/application/block_move/pos_build_final.trj", 0, lib::irp6p_m::ROBOT_NAME);
//wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
//wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

//sr_ecp_msg->message("Zwarcie szczek");
//set_next_ecp_state();
//wait_for_task_termination(false, 1, lib::irp6p_tfg::ROBOT_NAME.c_str());
//wait_for_task_termination(false, lib::irp6p_tfg::ROBOT_NAME);

wait_ms(4000);

Expand Down
6 changes: 3 additions & 3 deletions src/application/edge_follow/mp_t_edge_follow_mr.cc
Expand Up @@ -110,15 +110,15 @@ void edge_follow_mr::main_task_algorithm(void)
// sekwencja generator na wybranym manipulatorze
set_next_ecp_state(ecp_mp::generator::ECP_GEN_BIAS_EDP_FORCE, (int) 5, "", manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

set_next_ecp_state(ecp_mp::generator::ECP_GEN_TFF_NOSE_RUN, (int) 0, "", manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

set_next_ecp_state(ecp_mp::generator::EDGE_FOLLOW, (int) 0, "", manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

sr_ecp_msg->message("END");

Expand Down
2 changes: 1 addition & 1 deletion src/application/generator_tester/mp_t_gen_test.cc
Expand Up @@ -92,7 +92,7 @@ void gen_test::main_task_algorithm(void)
//------------------- SMOOTH GENERATOR -------------------
set_next_ecp_state(ecp_mp::sub_task::ECP_ST_SMOOTH_GEN_TEST, (int) 5, "", lib::irp6p_m::ROBOT_NAME);

wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);
//------------------- SMOOTH GENERATOR END -------------------

//------------------- SPLINE GENERATOR -------------------
Expand Down
8 changes: 4 additions & 4 deletions src/application/graspit/mp_t_birdhand_graspit.cc
Expand Up @@ -146,11 +146,11 @@ void graspit::main_task_algorithm(void)

set_next_ecp_state(ecp_mp::task::ECP_GEN_BIRD_HAND, (int) 5, tmp_string1, gripper_name);

wait_for_task_termination(false, 1, gripper_name.c_str());
wait_for_task_termination(false, gripper_name);

set_next_ecp_state(ecp_mp::task::ECP_GEN_IRP6, (int) 5, tmp_string2, manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

//last IRp6 position from GraspI
for (int i = 0; i < 6; ++i)
Expand Down Expand Up @@ -181,11 +181,11 @@ void graspit::main_task_algorithm(void)

set_next_ecp_state(ecp_mp::task::ECP_GEN_IRP6, (int) 5, tmp_string2, manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

set_next_ecp_state(ecp_mp::task::ECP_GEN_BIRD_HAND, (int) 5, tmp_string1, gripper_name);

wait_for_task_termination(false, 1, gripper_name.c_str());
wait_for_task_termination(false, gripper_name);

//debugging
// std::stringstream ss(std::stringstream::in | std::stringstream::out);
Expand Down
8 changes: 4 additions & 4 deletions src/application/graspit/mp_t_tfg_graspit.cc
Expand Up @@ -144,11 +144,11 @@ void graspit::main_task_algorithm(void)

set_next_ecp_state(ecp_mp::generator::ECP_GEN_TFG, (int) 5, tmp_string1, gripper_name);

wait_for_task_termination(false, 1, gripper_name.c_str());
wait_for_task_termination(false, gripper_name);

set_next_ecp_state(ecp_mp::task::ECP_GEN_IRP6, (int) 5, tmp_string2, manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

for (int i = 0; i < 6; ++i)
mp_ecp_irp6_command.joint[i] = trgraspit->from_va.grasp_joint[i + 6];
Expand All @@ -159,11 +159,11 @@ void graspit::main_task_algorithm(void)

set_next_ecp_state(ecp_mp::task::ECP_GEN_IRP6, (int) 5, tmp_string2, manipulator_name);

wait_for_task_termination(false, 1, manipulator_name.c_str());
wait_for_task_termination(false, manipulator_name);

set_next_ecp_state(ecp_mp::generator::ECP_GEN_TFG, (int) 5, tmp_string1, gripper_name);

wait_for_task_termination(false, 1, gripper_name.c_str());
wait_for_task_termination(false, gripper_name);

std::stringstream ss(std::stringstream::in | std::stringstream::out);
for (int i = 6; i < 13; ++i)
Expand Down
6 changes: 3 additions & 3 deletions src/application/haptic/mp_t_haptic.cc
Expand Up @@ -58,11 +58,11 @@ void haptic::configure_edp_force_sensor(bool configure_track, bool configure_pos
}

if ((configure_track) && (!configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6ot_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6ot_m::ROBOT_NAME);
} else if ((!configure_track) && (configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);
} else if ((configure_track) && (configure_postument)) {
wait_for_task_termination(false, 2, lib::irp6ot_m::ROBOT_NAME.c_str(), lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, {lib::irp6ot_m::ROBOT_NAME, lib::irp6p_m::ROBOT_NAME});
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/application/haptic_stiffness/mp_t_haptic_stiffness.cc
Expand Up @@ -54,11 +54,11 @@ void haptic_stiffness::configure_edp_force_sensor(bool configure_track, bool con
}

if ((configure_track) && (!configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6ot_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6ot_m::ROBOT_NAME);
} else if ((!configure_track) && (configure_postument)) {
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);
} else if ((configure_track) && (configure_postument)) {
wait_for_task_termination(false, 2, lib::irp6ot_m::ROBOT_NAME.c_str(), lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, {lib::irp6ot_m::ROBOT_NAME, lib::irp6p_m::ROBOT_NAME});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/application/neuron/mp_t_neuron.cc
Expand Up @@ -76,7 +76,7 @@ void neuron::main_task_algorithm(void)
sr_ecp_msg->message("Neuron task initialization");

set_next_ecp_state(ecp_mp::task::ECP_T_NEURON, 5, "", lib::irp6p_m::ROBOT_NAME);
wait_for_task_termination(false, 1, lib::irp6p_m::ROBOT_NAME.c_str());
wait_for_task_termination(false, lib::irp6p_m::ROBOT_NAME);

sr_ecp_msg->message("END");
}
Expand Down
33 changes: 17 additions & 16 deletions src/application/rcsc/ecp_t_rcsc.cc
Expand Up @@ -7,17 +7,29 @@
#include "base/lib/sr/srlib.h"
#include "ecp_mp_t_rcsc.h"
#include "subtask/ecp_st_smooth_file_from_mp.h"

#include "ecp_t_rcsc.h"

#include "generator/ecp/ecp_mp_g_newsmooth.h"
#include "generator/ecp/ecp_mp_g_teach_in.h"
#include "generator/ecp/tff_gripper_approach/ecp_mp_g_tff_gripper_approach.h"
#include "generator/ecp/transparent/ecp_mp_g_transparent.h"
#include "generator/ecp/tff_rubik_face_rotate/ecp_mp_g_tff_rubik_face_rotate.h"

#include "ecp_t_rcsc.h"
#include "generator/ecp/ecp_g_newsmooth.h"
#include "generator/ecp/bias_edp_force/ecp_g_bias_edp_force.h"
#include "generator/ecp/tff_nose_run/ecp_g_tff_nose_run.h"
#include "generator/ecp/sleep/ecp_g_sleep.h"
#include "generator/ecp/transparent/ecp_mp_g_transparent.h"
#include "generator/ecp/ecp_mp_g_newsmooth.h"
#include "generator/ecp/ecp_mp_g_teach_in.h"
#include "generator/ecp/transparent/ecp_g_transparent.h"
#include "generator/ecp/tff_rubik_face_rotate/ecp_g_tff_rubik_face_rotate.h"
#include "generator/ecp/tff_gripper_approach/ecp_g_tff_gripper_approach.h"
#include "generator/ecp/weight_measure/ecp_mp_g_weight_measure.h"
#include "generator/ecp/weight_measure/ecp_g_weight_measure.h"

#include "robot/irp6ot_m/ecp_r_irp6ot_m.h"
#include "robot/irp6p_m/ecp_r_irp6p_m.h"

#include "base/ecp/ecp_task.h"

namespace mrrocpp {
namespace ecp {
Expand All @@ -27,7 +39,6 @@ namespace task {
rcsc::rcsc(lib::configurator &_config) :
common::task::task(_config)
{

// the robot is choose dependently on the section of configuration file sent as argv[4]
if (config.robot_name == lib::irp6ot_m::ROBOT_NAME) {
ecp_m_robot = (boost::shared_ptr <robot_t>) new irp6ot_m::robot(*this);
Expand All @@ -43,11 +54,7 @@ rcsc::rcsc(lib::configurator &_config) :
register_generator(new generator::bias_edp_force(*this));
register_generator(new generator::tff_gripper_approach(*this, 8));
register_generator(new generator::tff_rubik_face_rotate(*this, 8));
{
common::generator::tff_nose_run *ecp_gen = new common::generator::tff_nose_run(*this, 8);
register_generator(ecp_gen);
}

register_generator(new common::generator::tff_nose_run(*this, 8));
register_generator(new generator::weight_measure(*this, 1));

register_subtask(new sub_task::sub_task_smooth_file_from_mp(*this, lib::ECP_JOINT, ecp_mp::sub_task::ECP_ST_SMOOTH_JOINT_FILE_FROM_MP, true));
Expand All @@ -56,11 +63,6 @@ rcsc::rcsc(lib::configurator &_config) :
sr_ecp_msg->message("ecp loaded");
}

rcsc::~rcsc()
{

}

}
} // namespace irp6ot

Expand All @@ -76,4 +78,3 @@ task_base* return_created_ecp_task(lib::configurator &_config)
} // namespace common
} // namespace ecp
} // namespace mrrocpp

0 comments on commit 13cd887

Please sign in to comment.