Getting string property of peer

Hi,

I'm trying to get a property called "parameterFile" from a peer called
"Camera1". The property in question has type string.

So I try the following:
Property<std::string> fileprop =
this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");

In the property-file of Camera1, it says:
<simple name="parameterFile" type="string"><description>The property
file containing the parameters of the
camera<description><value>/home/planepower/Desktop/SVN/orocos/properties/cameras/cameraCalibratedParameters1.cpf<value><simple>

The code compiles, but when I run it, fileprop.ready() returns 0, and
consequently, getting the value of the property also doesn't work.

To test the code, I tried the same thing, but in stead of reading a
string, I read a double, and that works fine.

I also tried to get a string property called cameraFile from the
component itself with
Property<std::string> fileprop =
this->properties()->getProperty<std::string>("cameraFile");
and that also works fine.

Anybody any ideas what could be wrong?

Thanks,
Kurt

Getting string property of peer

2011/4/20 Kurt Geebelen <kurt [dot] geebelen [..] ...>:
> Hi,
>
> I'm trying to get a property called "parameterFile" from a peer called
> "Camera1". The property in question has type string.
>
> So I try the following:
> Property<std::string> fileprop =
> this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");

Did you consider turning the Property into a Port? Or making the
property part of the component in which you actually need it? This
kind of hard-coding component / property names is something you must
try to avoid at all costs :)

Steven

>
> In the property-file of Camera1, it says:
> <simple name="parameterFile" type="string"><description>The property
> file containing the parameters of the
> camera<description><value>/home/planepower/Desktop/SVN/orocos/properties/cameras/cameraCalibratedParameters1.cpf<value><simple>
>
> The code compiles, but when I run it, fileprop.ready() returns 0, and
> consequently, getting the value of the property also doesn't work.
>
> To test the code, I tried the same thing, but in stead of reading a
> string, I read a double, and that works fine.
>
> I also tried to get a string property called cameraFile from the
> component itself with
> Property<std::string> fileprop =
> this->properties()->getProperty<std::string>("cameraFile");
> and that also works fine.
>
> Anybody any ideas what could be wrong?
>
> Thanks,
> Kurt
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Getting string property of peer

Ok, I've moved the property to the component that uses it, although it
is not really a property of this component..

If anybody knows why what I tried to do doesn't work, please let me know.

Thanks,
Kurt

Op 20/04/2011 15:37, Steven Bellens schreef:
> 2011/4/20 Kurt Geebelen<kurt [dot] geebelen [..] ...>:
>> Hi,
>>
>> I'm trying to get a property called "parameterFile" from a peer called
>> "Camera1". The property in question has type string.
>>
>> So I try the following:
>> Property<std::string> fileprop =
>> this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");
>
> Did you consider turning the Property into a Port? Or making the
> property part of the component in which you actually need it? This
> kind of hard-coding component / property names is something you must
> try to avoid at all costs :)
>
> Steven
>
>> In the property-file of Camera1, it says:
>> <simple name="parameterFile" type="string"><description>The property
>> file containing the parameters of the
>> camera<description><value>/home/planepower/Desktop/SVN/orocos/properties/cameras/cameraCalibratedParameters1.cpf<value><simple>
>>
>> The code compiles, but when I run it, fileprop.ready() returns 0, and
>> consequently, getting the value of the property also doesn't work.
>>
>> To test the code, I tried the same thing, but in stead of reading a
>> string, I read a double, and that works fine.
>>
>> I also tried to get a string property called cameraFile from the
>> component itself with
>> Property<std::string> fileprop =
>> this->properties()->getProperty<std::string>("cameraFile");
>> and that also works fine.
>>
>> Anybody any ideas what could be wrong?
>>
>> Thanks,
>> Kurt
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ...
>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>>

Getting string property of peer

2011/4/20 Kurt Geebelen <kurt [dot] geebelen [..] ...>:
> Ok, I've moved the property to the component that uses it, although it
> is not really a property of this component..

Could you explain a bit more in detail what you are trying to program? e.g.

Which different components do you have to fullfill which functions?
What properties do they have?
How are they connected to each other?

Steven

>
> If anybody knows why what I tried to do doesn't work, please let me know.
>
> Thanks,
> Kurt
>
> Op 20/04/2011 15:37, Steven Bellens schreef:
>> 2011/4/20 Kurt Geebelen<kurt [dot] geebelen [..] ...>:
>>> Hi,
>>>
>>> I'm trying to get a property called "parameterFile" from a peer called
>>> "Camera1". The property in question has type string.
>>>
>>> So I try the following:
>>> Property<std::string>  fileprop =
>>> this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");
>>
>> Did you consider turning the Property into a Port? Or making the
>> property part of the component in which you actually need it? This
>> kind of hard-coding component / property names is something you must
>> try to avoid at all costs :)
>>
>> Steven
>>
>>> In the property-file of Camera1, it says:
>>> <simple name="parameterFile" type="string"><description>The property
>>> file containing the parameters of the
>>> camera<description><value>/home/planepower/Desktop/SVN/orocos/properties/cameras/cameraCalibratedParameters1.cpf<value><simple>
>>>
>>> The code compiles, but when I run it, fileprop.ready() returns 0, and
>>> consequently, getting the value of the property also doesn't work.
>>>
>>> To test the code, I tried the same thing, but in stead of reading a
>>> string, I read a double, and that works fine.
>>>
>>> I also tried to get a string property called cameraFile from the
>>> component itself with
>>> Property<std::string>  fileprop =
>>> this->properties()->getProperty<std::string>("cameraFile");
>>> and that also works fine.
>>>
>>> Anybody any ideas what could be wrong?
>>>
>>> Thanks,
>>> Kurt
>>> --
>>> Orocos-Users mailing list
>>> Orocos-Users [..] ...
>>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>>>
>

Getting string property of peer

My component is an estimator, and has Camera components as peers. The
number camera components can change (or I at least want to program in
such a matter that I can easily change it). Each camera-component is
calibrated, and the calibrated parameters are in the file, of which the
property 'parameterFile' gives the location. I wanted to put this
property 'parameterFile' in the property-file of each camera-component,
so that my estimator-component can read the location of the calibrated
parameters, and than use them. But being able to read the location of
the calibrated parameters seems to be the problem.

My idea is that this is not a property of the estimator, but of the
cameras, and that is why I tried to do it this way.

I am now putting the 'parameterFile'-properties directly in the
propertyfile of my estimator, and that works.

Kurt

Op 20/04/2011 15:58, Steven Bellens schreef:
> 2011/4/20 Kurt Geebelen<kurt [dot] geebelen [..] ...>:
>> Ok, I've moved the property to the component that uses it, although it
>> is not really a property of this component..
> Could you explain a bit more in detail what you are trying to program? e.g.
>
> Which different components do you have to fullfill which functions?
> What properties do they have?
> How are they connected to each other?
>
> Steven
>
>> If anybody knows why what I tried to do doesn't work, please let me know.
>>
>> Thanks,
>> Kurt
>>
>> Op 20/04/2011 15:37, Steven Bellens schreef:
>>> 2011/4/20 Kurt Geebelen<kurt [dot] geebelen [..] ...>:
>>>> Hi,
>>>>
>>>> I'm trying to get a property called "parameterFile" from a peer called
>>>> "Camera1". The property in question has type string.
>>>>
>>>> So I try the following:
>>>> Property<std::string> fileprop =
>>>> this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");
>>> Did you consider turning the Property into a Port? Or making the
>>> property part of the component in which you actually need it? This
>>> kind of hard-coding component / property names is something you must
>>> try to avoid at all costs :)
>>>
>>> Steven
>>>
>>>> In the property-file of Camera1, it says:
>>>> <simple name="parameterFile" type="string"><description>The property
>>>> file containing the parameters of the
>>>> camera<description><value>/home/planepower/Desktop/SVN/orocos/properties/cameras/cameraCalibratedParameters1.cpf<value><simple>
>>>>
>>>> The code compiles, but when I run it, fileprop.ready() returns 0, and
>>>> consequently, getting the value of the property also doesn't work.
>>>>
>>>> To test the code, I tried the same thing, but in stead of reading a
>>>> string, I read a double, and that works fine.
>>>>
>>>> I also tried to get a string property called cameraFile from the
>>>> component itself with
>>>> Property<std::string> fileprop =
>>>> this->properties()->getProperty<std::string>("cameraFile");
>>>> and that also works fine.
>>>>
>>>> Anybody any ideas what could be wrong?
>>>>
>>>> Thanks,
>>>> Kurt
>>>> --
>>>> Orocos-Users mailing list
>>>> Orocos-Users [..] ...
>>>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>>>>

Getting string property of peer

On Apr 20, 2011, at 10:46 , Kurt Geebelen wrote:

> My component is an estimator, and has Camera components as peers. The
> number camera components can change (or I at least want to program in
> such a matter that I can easily change it). Each camera-component is
> calibrated, and the calibrated parameters are in the file, of which the
> property 'parameterFile' gives the location. I wanted to put this
> property 'parameterFile' in the property-file of each camera-component,
> so that my estimator-component can read the location of the calibrated
> parameters, and than use them. But being able to read the location of
> the calibrated parameters seems to be the problem.
>
> My idea is that this is not a property of the estimator, but of the
> cameras, and that is why I tried to do it this way.
>
> I am now putting the 'parameterFile'-properties directly in the
> propertyfile of my estimator, and that works.
>
> Kurt

Don't the calibration parameters "belong" to the camera? So why not have the camera component load and store them, and then make the parameters available on a port for any other component to use (ie the estimator).

Otherwise you couple the estimator to the cameras ... bad ...
S

Getting string property of peer

On Wednesday 20 April 2011 16:52:28 S Roderick wrote:
> On Apr 20, 2011, at 10:46 , Kurt Geebelen wrote:
> > My component is an estimator, and has Camera components as peers. The
> > number camera components can change (or I at least want to program in
> > such a matter that I can easily change it). Each camera-component is
> > calibrated, and the calibrated parameters are in the file, of which the
> > property 'parameterFile' gives the location. I wanted to put this
> > property 'parameterFile' in the property-file of each camera-component,
> > so that my estimator-component can read the location of the calibrated
> > parameters, and than use them. But being able to read the location of
> > the calibrated parameters seems to be the problem.
> >
> > My idea is that this is not a property of the estimator, but of the
> > cameras, and that is why I tried to do it this way.
> >
> > I am now putting the 'parameterFile'-properties directly in the
> > propertyfile of my estimator, and that works.
> >
> > Kurt
>
> Don't the calibration parameters "belong" to the camera? So why not have
> the camera component load and store them, and then make the parameters
> available on a port for any other component to use (ie the estimator).
>
> Otherwise you couple the estimator to the cameras ... bad ...

Another solution to this decoupling problem is to use a central parameter
server (component). ros_param uses this mechanism. They scope properties in
logical groups, and each node (component) can query the server if a given
parameter is present, or add parameters.

The ros_param tool that Ruben wrote synchronises component properties with the
ros parameter server.

Peter

Getting string property of peer

On Apr 20, 2011, at 09:37 , Steven Bellens wrote:

> 2011/4/20 Kurt Geebelen <kurt [dot] geebelen [..] ...>:
>> Hi,
>>
>> I'm trying to get a property called "parameterFile" from a peer called
>> "Camera1". The property in question has type string.
>>
>> So I try the following:
>> Property<std::string> fileprop =
>> this->getPeer("Camera1")->properties()->getProperty<std::string>("parameterFile");
>
>
> Did you consider turning the Property into a Port? Or making the
> property part of the component in which you actually need it? This
> kind of hard-coding component / property names is something you must
> try to avoid at all costs :)
>
> Steven

+1

We extensively use what Herman has previously called "persistent ports", which we currently implement by putting properties onto ports. We've found this the best way to push property values between components.
S