Skip to content
Snippets Groups Projects
Commit 647cd7f2 authored by DESGRANGES's avatar DESGRANGES
Browse files

[ICATHALES-415] - Inform user if the axis is initialized or not

parent 10f4b622
No related branches found
No related tags found
1 merge request!3[PIController] Add PIAxis commands and attributes
......@@ -60,7 +60,6 @@ void AxisController::compute_state_status()
{
try
{
Serializer::pull_from_server(&m_is_initialized); //Test
if (get_state() == Tango::FAULT)
{
return;
......@@ -83,6 +82,12 @@ void AxisController::compute_state_status()
set_state(Tango::OFF);
set_status("Motor off");
}
Serializer::pull_from_server(&m_is_initialized); //Test
if (m_is_initialized.get_value() == 0)
{
set_state(Tango::INIT);
set_status("Axis need to be initialized");
}
}
catch(Tango::DevFailed& df)
{
......@@ -309,7 +314,7 @@ void AxisController::auto_zero()
void AxisController::initialise_reference_position()
{
yat::Message* msg = yat::Message::allocate(CTRL_RON_MSG, DEFAULT_MSG_PRIORITY, true);
msg->attach_data(0);
msg->attach_data<bool>(false);
post(msg);
m_velocity.set_value(m_init_velocity);
msg = yat::Message::allocate(CTRL_SETVELOCITY_MSG, DEFAULT_MSG_PRIORITY, true);
......@@ -330,13 +335,13 @@ void AxisController::initialise_reference_position()
else if (m_model.get_value() == "E-754")
{
yat::Message* msg = yat::Message::allocate(CTRL_AUTO_ZERO_MSG, DEFAULT_MSG_PRIORITY, true);
wait_msg_handled(msg, 5000);
post(msg, 5000);
}
m_pos.set_value(m_init_position);
msg = yat::Message::allocate(CTRL_POS_MSG, DEFAULT_MSG_PRIORITY, true);
post(msg);
msg->attach_data(1);
msg = yat::Message::allocate(CTRL_RON_MSG, DEFAULT_MSG_PRIORITY, true);
msg->attach_data<bool>(true);
post(msg);
}
//----------------------------------------------------
......@@ -532,7 +537,7 @@ void AxisController::process_message(yat::Message& msg)
case CTRL_RON_MSG:
{
m_ron.set_value(msg.get_data<int>());
m_ron.set_value(msg.get_data<bool>());
Serializer::push_to_server(&m_ron);
}
break;
......
......@@ -450,9 +450,11 @@ void PIAxis::read_acceleration(Tango::Attribute &attr)
DEBUG_STREAM << "PIAxis::read_acceleration(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(PIAxis::read_acceleration) ENABLED START -----*/
// Set the attribute value
if (m_axis_controller->get_model() == "C-884" || m_axis_controller->get_model() == "SIMULATOR")
{
*attr_acceleration_read = m_axis_controller->read_acceleration();
attr.set_value(attr_acceleration_read);
}
/*----- PROTECTED REGION END -----*/ // PIAxis::read_acceleration
}
......@@ -472,7 +474,10 @@ void PIAxis::write_acceleration(Tango::WAttribute &attr)
Tango::DevDouble w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(PIAxis::write_acceleration) ENABLED START -----*/
if (m_axis_controller->get_model() == "C-884" || m_axis_controller->get_model() == "SIMULATOR")
{
m_axis_controller->write_acceleration(w_val);
}
/*----- PROTECTED REGION END -----*/ // PIAxis::write_acceleration
}
......@@ -490,8 +495,12 @@ void PIAxis::read_deceleration(Tango::Attribute &attr)
DEBUG_STREAM << "PIAxis::read_deceleration(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(PIAxis::read_deceleration) ENABLED START -----*/
// Set the attribute value
if (m_axis_controller->get_model() == "C-884" || m_axis_controller->get_model() == "SIMULATOR")
{
*attr_deceleration_read = m_axis_controller->read_deceleration();
attr.set_value(attr_deceleration_read);
}
/*----- PROTECTED REGION END -----*/ // PIAxis::read_deceleration
}
......@@ -511,7 +520,10 @@ void PIAxis::write_deceleration(Tango::WAttribute &attr)
Tango::DevDouble w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(PIAxis::write_deceleration) ENABLED START -----*/
if (m_axis_controller->get_model() == "C-884" || m_axis_controller->get_model() == "SIMULATOR")
{
m_axis_controller->write_deceleration(w_val);
}
/*----- PROTECTED REGION END -----*/ // PIAxis::write_deceleration
}
......
......@@ -193,7 +193,7 @@ int Off::get_value()
//----------------------------------------------------
yat::String IsMoving::pull_request()
{
if (m_model == "SIMULATOR")
if (m_model == "SIMULATOR" || m_model == "E-754")
{
return "#5"; //Command for the MockServer
}
......
......@@ -23,14 +23,14 @@
#this i a special section to declare user variables, the syntaxe is xxx=yyy
model=(c)MOCK, SIMULATOR, 111111111, 1.0.0.0
servo=1
ERR?
ERR?
pos=2.000000
pos=10
vel=0.500000
ERR?
accel=1.000000
decel=1.000000
moving=0
ron=1
ERR?
err=0
limit_switch=0x9002
is_initialized=1
......@@ -69,6 +69,7 @@ verbose=True
[FNL]
globals()['write_vars']('moving', command.split(" ")[1])
globals()['write_vars']('pos', '0')
globals()['write_vars']('is_initialized', '1')
def callback():
globals()['write_vars']('moving','0')
timer = threading.Timer(3.0, callback)
......@@ -80,6 +81,7 @@ verbose = True
[FPL]
globals()['write_vars']('moving', command.split(" ")[1])
globals()['write_vars']('pos', '10')
globals()['write_vars']('is_initialized', '1')
def callback():
globals()['write_vars']('moving','0')
timer = threading.Timer(3.0, callback)
......@@ -169,3 +171,13 @@ my_var = globals()['read_vars']('is_initialized')
reply = command.split(" ")[1] + str("=") + str(my_var)
verbose = True
[END]
[ATZ?]
reply="toto"
verbose = True
[END]
[ATZ]
reply="????"
verbose = True
[END]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment