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

Mode relatif :

mise au point avec Y.Garreau SIXS
Mode Relatif :
On ne peut pas bouger simultan�ment une rotation et une translation (requete de Y.G. et signal� dans la doc que le positionnement fait n'importe quoi)
parent 8b0b0e89
Branches
Tags
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Motion/HexapodNewport/src/HexapodNewport.cpp,v 1.11 2011-03-17 15:39:13 jean_coquet Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Motion/HexapodNewport/src/HexapodNewport.cpp,v 1.12 2011-03-21 11:43:31 jean_coquet Exp $";
//+=============================================================================
//
// file : HexapodNewport.cpp
......@@ -13,9 +13,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Motion/Hexapod
//
// $Author: jean_coquet $
//
// $Revision: 1.11 $
// $Revision: 1.12 $
//
// $Log: not supported by cvs2svn $
// Revision 1.11 2011/03/17 15:39:13 jean_coquet
// added a new positionnig scheme : Absolute or Relative
// * added property to select 1 of them
// * added the cmd to the HWP in the task
//
// Revision 1.10 2010/09/15 07:45:59 buteau
// - Passage d'attributs/commandes en mode Expert
//
......@@ -23,10 +28,10 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Motion/Hexapod
// exception thrown when trying to request a move and hexapod already moving
//
// Revision 1.8 2010/03/31 10:55:54 jean_coquet
// passage Tango7 -> write_attributes_4
// passage Tango7 -> write_attributes_4
//
// Revision 1.7 2010/03/30 15:20:36 jean_coquet
// passage Tango7
// passage Tango7
//
// Revision 1.6 2010/03/30 13:13:40 jean_coquet
// passage to Tango7 (Device_4Impl)
......@@ -156,6 +161,7 @@ void HexapodNewport::delete_device()
{
this->hwp->exit ();
}
hwp = 0;
......@@ -242,10 +248,17 @@ void HexapodNewport::init_device()
conf.read_timeout_ms = period;
conf.periodic_timeout_ms = period;
conf.group_name = "HEXAPOD";
INFO_STREAM << "HexapodNewport ::init_device positioning type : " << positioningType << std::endl;
if (positioningType == "Relative")
{
INFO_STREAM << "HexapodNewport ::init_device positioning type RELATIVE detected " << std::endl;
conf.positioning_type = HWP_POSIT_RELATIVE;
}
else if (positioningType == "Absolute")
{
INFO_STREAM << "HexapodNewport ::init_device positioning type ABSOLUTE detected " << std::endl;
conf.positioning_type = HWP_POSIT_ABSOLUTE;
}
else
conf.positioning_type = 0;
......@@ -401,12 +414,14 @@ void HexapodNewport::get_device_property()
property << port;
data_put.push_back(property);
}
if (dev_prop[2].is_empty() == true || positioningType.find ("must be defined") != std::string::npos)
if (dev_prop[2].is_empty() == true ||
positioningType.find ("must be defined") != std::string::npos ||
(positioningType != "Relative" && positioningType != "Absolute"))
{
properties_missing = true;
Tango::DbDatum property("PositioningType");
status_str = "Property PositioningType must be defined - choose between [Absolute|Relative]";
property << positioningType;
property << "must be defined - choose between [Absolute|Relative]";
data_put.push_back(property);
}
if(!data_put.empty())
......@@ -503,7 +518,7 @@ void HexapodNewport::write_freeze(Tango::WAttribute &attr)
if (!init_device_done || properties_missing)
return;
attr.get_write_value (attr_freeze_write);
//- si on crit false freeze on essaye de bouger
//- si on crit false freeze on essaye de bouger
if (!attr_freeze_write)
this->try_to_move ();
}
......@@ -1068,6 +1083,7 @@ Tango::ConstDevString HexapodNewport::dev_status()
status_str.clear ();
this->status_str += "\n" + this->hwp->get_hxp_status ();
this->status_str += "\n" + this->hwp->get_last_error ();
this->status_str += "\n" + this->last_error;
return status_str.c_str ();
......
......@@ -161,6 +161,13 @@ namespace HexapodNewport_ns
}
this->current_cs_name = "Work";
this->group_state = -1;
this->read_positions ();
this->read_hxp_state ();
//- initilalze memorized values to something
for (size_t i = 0; i < NB_VIRTUAL_AXES; i++)
positions_setp[i] = positions_read[i];
}
break;
//- TASK_EXIT =======================
......@@ -355,8 +362,9 @@ namespace HexapodNewport_ns
DEBUG_STREAM << "HWProxy::set_hexapod_positions <-" << std::endl;
std::stringstream cmd;
if (conf.positioning_type = HWP_POSIT_ABSOLUTE)
if (conf.positioning_type == HWP_POSIT_ABSOLUTE)
{
INFO_STREAM << "HWProxy::set_hexapod_positions HWP_POSIT_ABSOLUTE" << std::endl;
//- update the internal setpoints positions_setp
cmd << "HexapodMoveAbsolute("
<< conf.group_name
......@@ -372,16 +380,82 @@ namespace HexapodNewport_ns
}
else
{
//- exception if request for ROTATION AND TRANSLATION
bool translation_request = false;
if ((positions_setp [0] != pos.positions [0]) ||
(positions_setp [1] != pos.positions [1]) ||
(positions_setp [2] != pos.positions [2]))
{
INFO_STREAM << "HWProxy::set_hexapod_positions TRANSLATION_REQUEST" << std::endl;
INFO_STREAM << "[" << positions_setp [0] << " : " << pos.positions [0] << "]";
INFO_STREAM << "[" << positions_setp [1] << " : " << pos.positions [1] << "]";
INFO_STREAM << "[" << positions_setp [2] << " : " << pos.positions [2] << "]" << std::endl;
translation_request = true;
}
bool rotation_request = false;
if ((positions_setp [3] != pos.positions [3]) ||
(positions_setp [4] != pos.positions [4]) ||
(positions_setp [5] != pos.positions [5]))
{
INFO_STREAM << "HWProxy::set_hexapod_positions ROTATION_REQUEST" << std::endl;
INFO_STREAM << "[" << positions_setp [3] << " : " << pos.positions [3] << "]";
INFO_STREAM << "[" << positions_setp [4] << " : " << pos.positions [4] << "]";
INFO_STREAM << "[" << positions_setp [5] << " : " << pos.positions [5] << "]" << std::endl;
rotation_request = true;
}
if (translation_request && rotation_request)
{
this->last_error = "Error : In Relative Move cannot request simultaneous Rotation AND Rotation\n";
Tango::Except::throw_exception("OPERATION_NOT_ALLOWED",
"In Relative Move cannot request simultaneous Rotation AND Rotation",
"HWProxy::set_hexapod_positions");
}
double incremental_move [6];
if (translation_request)
{
positions_setp [0] = pos.positions [0];
incremental_move [0] = pos.positions [0] - positions_read [0];
positions_setp [1] = pos.positions [1];
incremental_move [1] = pos.positions [1] - positions_read [1];
positions_setp [2] = pos.positions [2];
incremental_move [2] = pos.positions [2] - positions_read [2];
positions_setp [3] = pos.positions [3];
incremental_move [3] = 0.;
positions_setp [4] = pos.positions [4];
incremental_move [4] = 0.;
positions_setp [5] = pos.positions [5];
incremental_move [5] = 0.;
}
if (rotation_request)
{
positions_setp [0] = pos.positions [0];
incremental_move [0] = 0.;
positions_setp [1] = pos.positions [1];
incremental_move [1] = 0.;
positions_setp [2] = pos.positions [2];
incremental_move [2] = 0.;
positions_setp [3] = pos.positions [3];
incremental_move [3] = pos.positions [3] - positions_read [3];
positions_setp [4] = pos.positions [4];
incremental_move [4] = pos.positions [4] - positions_read [4];
positions_setp [5] = pos.positions [5];
incremental_move [5] = pos.positions [5] - positions_read [5];
}
INFO_STREAM << "HWProxy::set_hexapod_positions HWP_POSIT_RELATIVE" << std::endl;
double tmp ;
cmd << "HexapodMoveRelative("
cmd << "HexapodMoveIncremental("
<< conf.group_name
<< ","
<< current_cs_name;
<< current_cs_name
<< std::setprecision (6)
<< std::fixed;
for (size_t i = 0; i < NB_VIRTUAL_AXES; i++)
{
positions_setp [i] = pos.positions [i];
tmp = pos.positions [i] - positions_read [i];
cmd << "," << tmp;
cmd << "," << incremental_move [i];
}
cmd << ")"
<< std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment