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

mise au point de DefinePosition

parent 21465079
No related branches found
No related tags found
No related merge requests found
static const char *RcsId = "$Id: XPSGroup.cpp,v 1.7 2011-06-20 07:17:34 jean_coquet Exp $";
static const char *RcsId = "$Id: XPSGroup.cpp,v 1.8 2011-06-24 09:42:05 jean_coquet Exp $";
//+=============================================================================
//
// file : XPSGroup.cpp
......@@ -13,10 +13,10 @@ static const char *RcsId = "$Id: XPSGroup.cpp,v 1.7 2011-06-20 07:17:34 jean_coq
//
// $Author: jean_coquet $
//
// $Revision: 1.7 $
// $Revision: 1.8 $
//
// $Revision: 1.7 $
// $Date: 2011-06-20 07:17:34 $
// $Revision: 1.8 $
// $Date: 2011-06-24 09:42:05 $
//
// SVN only:
// $HeadURL: $
......@@ -24,6 +24,10 @@ static const char *RcsId = "$Id: XPSGroup.cpp,v 1.7 2011-06-20 07:17:34 jean_coq
// CVS only:
// $Source: /users/chaize/newsvn/cvsroot/Motion/Axis/XPSGroup/src/XPSGroup.cpp,v $
// $Log: not supported by cvs2svn $
// Revision 1.7 2011/06/20 07:17:34 jean_coquet
// minor change (ajout DefinePosition)
// To be tested
//
// Revision 1.6 2011/06/17 14:51:05 jean_coquet
// added DefinePosition support
//
......@@ -692,7 +696,7 @@ void XPSGroup::write_trajectory(Tango::WAttribute &attr)
Tango::Except::throw_exception (
(const char *)"DATA_OUT_OF_RANGE",
(const char *)"must give the all positions of the group in 1 shot",
(const char *)"XPSGroup4Axes::go_to_position");
(const char *)"XPSGroup::go_to_position");
}
xpsg::positions_t pos;
......@@ -764,11 +768,15 @@ void XPSGroup::write_trajectory(Tango::WAttribute &attr)
size_t len = argin->length();
if (len != attr_names.size ())
{
ERROR_STREAM << "DATA_OUT_OF_RANGE must give all positions of the group in 1 shot" << endl;
ERROR_STREAM << "DATA_OUT_OF_RANGE must give all positions of the group in 1 shot argin|nb_axes ["
<< len
<< "|"
<< attr_names.size ()
<< endl;
Tango::Except::throw_exception (
(const char *)"DATA_OUT_OF_RANGE",
(const char *)"must give the all positions of the group in 1 shot",
(const char *)"XPSGroup4Axes::define_position");
(const char *)"XPSGroup::define_position");
}
xpsg::positions_t pos;
......
......@@ -285,14 +285,18 @@ namespace xpsg
{
DEBUG_STREAM << "HWProxy::handle_message handling GROUP_INITIALIZE msg" << std::endl;
std::string cmd = "GroupInitialize(" + conf.group_name + ")";
this->write (cmd);
std::string resp;
this->write_read (cmd, resp);
INFO_STREAM << "HWProxy::handle_message handling GROUP_INITIALIZE response = " << resp << std::endl;
}
break;
case GROUP_KILL:
{
DEBUG_STREAM << "HWProxy::handle_message handling GROUP_KILL msg" << std::endl;
std::string cmd = "GroupKill(" + conf.group_name + ")";
this->write (cmd);
std::string resp;
this->write_read (cmd, resp);
INFO_STREAM << "HWProxy::handle_message handling GROUP_KILL response = " << resp << std::endl;
}
break;
case GROUP_HOME_SEARCH:
......@@ -346,18 +350,16 @@ namespace xpsg
std::string cmd = "GroupReferencingStart(" + conf.group_name + ")";
std::string response;
this->write_read (cmd, response);
INFO_STREAM << "HWProxy::handle_message handling GROUP_REFERENCING_START reponse = " << response << std::endl;
}
break;
case GROUP_REFERENCING_EXEC:
case GROUP_REFERENCING_STOP:
{
//- TODO : check if it it usefull, suppress it if not
DEBUG_STREAM << "HWProxy::handle_message handling GROUP_REFERENCING_EXEC msg" << std::endl;
//- get msg data...
positions_t * pos = 0;
_msg.detach_data (pos);
std::string cmd = "GroupReferencingStart(" + conf.group_name + ")";
DEBUG_STREAM << "HWProxy::handle_message handling GROUP_REFERENCING_STOP msg" << std::endl;
std::string cmd = "GroupReferencingStop(" + conf.group_name + ")";
std::string response;
this->write_read (cmd, response);
std::cout << "HWProxy::handle_message handling GROUP_REFERENCING_STOP reponse = " << response << std::endl;
}
break;
case GROUP_DEFINE_POSITION:
......@@ -366,12 +368,36 @@ namespace xpsg
//- get msg data...
positions_t * pos = 0;
_msg.detach_data (pos);
std::string cmd;
std::string resp;
if (pos)
{
post_msg(*this, GROUP_KILL, 1000, true);
post_msg(*this, GROUP_INITIALIZE, 1000, true);
post_msg(*this, GROUP_REFERENCING_START, 1000, true);
post_msg(*this, GROUP_REFERENCING_EXEC, 1000, true, pos);
cmd = "GroupKill(" + conf.group_name + ")";
this->write_read (cmd, resp);
INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << " returned " << resp << std::endl;
cmd = "GroupInitialize(" + conf.group_name + ")";
this->write_read (cmd, resp);
INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << " returned " << resp << std::endl;
cmd = "GroupReferencingStart(" + conf.group_name + ")";
this->write_read (cmd, resp);
INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << " returned " << resp << std::endl;
std::stringstream s;
for (size_t i = 0;i < hw_data.size ();i++)
{
s.str ("");
s << "GroupReferencingActionExecute("
<< conf.group_name
<< "."
<< hw_data[i].posit_name
<< ",SetPosition,None,"
<< pos->positions [i]
<< ")"
<< std::endl;
this->write_read (s.str (), resp);
INFO_STREAM << "HWProxy::handle_message handling GROUP_DEFINE_POSITION cmd " << s.str () << " returned " << resp << std::endl;
}
post_msg (*this, GROUP_REFERENCING_STOP, 1000, false);
INFO_STREAM << "HWProxy::handle_message::GROUP_DEFINE_POSITION cmd " << cmd << " returned " << resp << std::endl;
delete pos;
}
}
......
......@@ -103,7 +103,7 @@ namespace xpsg
const size_t GROUP_KILL = yat::FIRST_USER_MSG + 1014;
const size_t GROUP_DEFINE_POSITION = yat::FIRST_USER_MSG + 1015;
const size_t GROUP_REFERENCING_START = yat::FIRST_USER_MSG + 1016;
const size_t GROUP_REFERENCING_EXEC = yat::FIRST_USER_MSG + 1017;
const size_t GROUP_REFERENCING_STOP = yat::FIRST_USER_MSG + 1018;
//- trajectory messages
const size_t TRAJECTORY_LOAD = yat::FIRST_USER_MSG + 1020;
const size_t TRAJECTORY_GOTO_ORIGIN = yat::FIRST_USER_MSG + 1021;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment