I have a very strange problem.
When I do this, client side :
std::vector<Tango::DevLong> vec;
auto data = device->read_attribute(attributeName);
data >> vec;
I have twice the datas in “vec”. For example if an attribute “attributeName” has the following values : “1, 2, 3”. The values in vec are : “1, 2, 3, 1, 2, 3”. If the attribute “attributeName” is read only, I have not this problem.
If the datas are pushed, I have an another problem :
void SomeClass::push_event(Tango::EventData * ed)
{
std::vectorTango::DevLong vec;
(*ed->attr_value) >> vec;
}
In this case, the values in vec are : “1, 2, 3, 0” (one 0 is added).
So, have you encountered a problem that looks like this ?
I just discovered the read and the set parts and I was just going to answer myself. Thank you very much for the confirmation.
I have a stupid question though : I don’t really understand the difference between the read values and the set values. Can you, please, enlighten me on this point ?
Another thing : It seems ok to extract a Tango::DevLong scalar in a Tango::DevLong variable (not an array). In this case, we get the read part, I think ?
[quote=“Olivier Neveu”]
I have a stupid question though : I don’t really understand the difference between the read values and the set values. Can you, please, enlighten me on this point ? [/quote]
There are no stupid questions ;-).
The set value can be seen as the target value.
For example, if you have an attribute named Position which corresponds to the Position of an equipment controlled by a motor. The read point will correspond to the position read from the sensors (encoders for instance) and will give you the current position of the element controlled by your motor.
The set value will be updated when you write your attribute. It corresponds to the target position of the equipment. It is the position you want to reach. During the move, if you read this Position attribute, you will get a read value corresponding to the current position read on the sensors/encoders and the set value will stay at the last value you’ve written successfully in this attribute (the target position value). During the move, the read and set values will be different. They might also be slightly different at the end of the move, depending on the precision/resolution of your position sensors.
[quote=“Olivier Neveu”]
Another thing : It seems ok to extract a Tango::DevLong scalar in a Tango::DevLong variable (not an array). In this case, we get the read part, I think ?[/quote]
Indeed. in this use case, you get only the read part.
If you extract a scalar attribute in an array/vector, you will get the read value and the set value.