Skip to content
Snippets Groups Projects
Commit c8484cfe authored by Jean Coquet's avatar Jean Coquet
Browse files

amelioration de la gestion des etats de trajectoire

parent 90c64787
No related branches found
No related tags found
No related merge requests found
......@@ -436,10 +436,12 @@ INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << "
case TRAJECTORY_GOTO_ORIGIN:
{
DEBUG_STREAM << "HWProxy::handle_message handling TRAJECTORY_GOTO_ORIGIN msg" << std::endl;
if (trajectory_stuff.state == TRAJ_LOADED)
if (trajectory_stuff.state == TRAJ_LOADED ||
trajectory_stuff.state == TRAJ_DONE)
{
//- if trajectory is processed, all ok to go to origin point
this->force_state_moving ();
trajectory_stuff.state = TRAJ_GOING_TO_START_POINT;
this->set_positions (trajectory_stuff.origin_point);
}
else
......@@ -915,6 +917,9 @@ INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << "
return tango_state;
}
//- request_for_moving management
if (this->request_for_moving)
{
......@@ -973,6 +978,10 @@ INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << "
this->group_state <= 17 &&
this->request_for_moving == 0)
{
if (trajectory_stuff.state == TRAJ_GOING_TO_START_POINT)
trajectory_stuff.state = TRAJ_AT_START_POINT;
if (trajectory_stuff.state == TRAJ_RUNNING_TRAJ)
trajectory_stuff.state = TRAJ_DONE;
return Tango::STANDBY;
}
//- DISABLE
......@@ -1356,6 +1365,7 @@ std::cout << "nb_lignes = " << nb_lignes << " taille ligne = " << taille_ligne
std::string resp;
s << "MultipleAxesPVTResetInMemory(" << conf.group_name << ")" << std::endl;
this->write_read (s.str (),resp);
trajectory_stuff.state = TRAJ_NOT_INITIALIZED;
std::cout << "HWProxy::trajectory_clear () cmd " << s.str () << " returned " << resp << std::endl;
}
......@@ -1386,12 +1396,103 @@ std::cout << "nb_lignes = " << nb_lignes << " taille ligne = " << taille_ligne
<< conf.group_name
<< ",FromMemory)";
this->write_read (cmd.str (),resp);
//- check the error returned by MultipleAxesPVTVerification
if (resp.find ("Error") == std::string::npos)
{
trajectory_stuff.state = TRAJ_CHECK_OK;
return true;
}
trajectory_stuff.state = TRAJ_CHECK_ERROR;
size_t end_idx = resp.find_first_of (":");
std::string err_code_str;
err_code_str = resp.substr (8,end_idx - 8);
std::cout << "HWProxy::trajectory_check_hw () err_code = " << err_code_str << std::endl;
int err_code = yat::XString<int>::to_num (err_code_str);
std::string error_txt;
if (err_code != 0)
{
switch (err_code)
{
case ERR_BASE_VELOCITY :
error_txt = "ERR_BASE_VELOCITY";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_FATAL_INIT :
error_txt = "ERR_FATAL_INIT";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_IN_INITIALIZATION :
error_txt = "ERR_IN_INITIALIZATION";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_POSITIONER_NAME :
error_txt = "ERR_POSITIONER_NAME";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_READ_FILE :
error_txt = "ERR_READ_FILE";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_STRING_TOO_LONG :
error_txt = "ERR_STRING_TOO_LONG";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_EMPTY :
error_txt = "ERR_TRAJ_EMPTY";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_ACC_LIMIT :
error_txt = "ERR_TRAJ_ACC_LIMIT";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_FINAL_VELOCITY :
error_txt = "ERR_TRAJ_FINAL_VELOCITY";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_INITIALIZATION :
error_txt = "ERR_TRAJ_INITIALIZATION";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_TIME :
error_txt = "ERR_TRAJ_TIME";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_TRAJ_VEL_LIMIT :
error_txt = "ERR_TRAJ_VEL_LIMIT";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_WRONG_FORMAT :
error_txt = "ERR_WRONG_FORMAT";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_WRONG_OBJECT_TYPE :
error_txt = "ERR_WRONG_OBJECT_TYPE";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
case ERR_WRONG_PARAMETERS_NUMBER :
error_txt = "ERR_WRONG_PARAMETERS_NUMBER";
ERROR_STREAM << "trajectory_check_hw () " << error_txt << std::endl;
break;
}
this->last_error = error_txt;
Tango::Except::throw_exception("OPERATION_NOT_ALLOWED",
error_txt.c_str (),
"HWProxy::trajectory_check_hw");
}
INFO_STREAM << "HWProxy::trajectory_check_hw trajectory check success" << std::endl;
//- now check positioner by positioner
for (size_t i = 0; i < hw_data.size (); i++)
{
if (this->trajectory_check_hw_i (hw_data [i].posit_name) == false)
return false;
}
std::cout << "HWProxy::trajectory_check_hw commande <"
<< cmd.str ()
<< "> retourne ["
......@@ -1441,11 +1542,12 @@ std::cout << "nb_lignes = " << nb_lignes << " taille ligne = " << taille_ligne
{
DEBUG_STREAM << "HWProxy::trajectory_start () <-" << std::endl;
this->trajectory_stuff.state = TRAJ_RUNNING_TRAJ;
std::stringstream cmd;
//- MultipleAxesPVTExecution (GroupName, "FromMemory", n) (n is the number of times to be sequentially executed) }
cmd << "MultipleAxesPVTExecution("
<< conf.group_name
<< ",\"FromMemory\",1)";
<< ",FromMemory,1)";
this->write (cmd.str ());
}
......
......@@ -66,6 +66,8 @@ namespace xpsg
TRAJ_AT_START_POINT,
TRAJ_CHECKING,
TRAJ_CHECK_OK,
TRAJ_RUNNING_TRAJ,
TRAJ_DONE,
TRAJ_CHECK_ERROR
} TrajState;
......@@ -86,6 +88,24 @@ namespace xpsg
};
//- TRAJECTORY STUFF
#define ERR_BASE_VELOCITY -48
#define ERR_FATAL_INIT -20
#define ERR_IN_INITIALIZATION -21
#define ERR_POSITIONER_NAME -18
#define ERR_READ_FILE -61
#define ERR_STRING_TOO_LONG -3
#define ERR_TRAJ_EMPTY -66
#define ERR_TRAJ_ACC_LIMIT -69
#define ERR_TRAJ_FINAL_VELOCITY -70
#define ERR_TRAJ_INITIALIZATION -72
#define ERR_TRAJ_TIME -75
#define ERR_TRAJ_VEL_LIMIT -68
#define ERR_WRONG_FORMAT -7
#define ERR_WRONG_OBJECT_TYPE -8
#define ERR_WRONG_PARAMETERS_NUMBER -9
// ========================================================
//---------------------------------------------------------
//- the YAT user messages
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment