Problems using the TaskBrowser

Hi all,

for some days, I experience strange thing with the TaskBrowser. Until now I
thought I had a compilation problem so I just re-clone the git repo and
build again orocos_toolchain. But problems still happens. I have issues
with Port introspection. One exemple of what's happening is this :

The taskbrowser shows :
Out(C) bool outBit1 => *false*
Out(U) bool outBit2 => *false*

And if I ask in command line for the connected() statement i have a
different result :
WoodheadIn [U]> outBit1.connected ()
= *true *
WoodheadIn [U]> outBit2.connected ()
= *true *

(The rigth one should be the taskbrowser info)

Another issue was with :
HmlMonitor.RearDriving.outEnable.connected() => *true*
cd HmlMonitor;
RearDriving.outEnable.connected() = *false*;

Another issue is the taskbrowser not showing correct value of output ports :
Deployer [S]> cd HmlMonitor.RearDriving
TaskBrowser connects to all data ports of RearDriving
Switched to : RearDriving
RearDriving [U]> ls
Listing TaskContext RearDriving[U] :
[...]
Out(C) float64 outMeasuredPosition => 5.22397e+257
Out(C) float64 outMeasuredPositionTime => 5.22397e+257
Out(C) float64 outMeasuredTorque => 5.22397e+257
Out(C) float64 outComputedSpeed => *5.22397e+257*
Out(C) int32 outLastSentCommand =>* 3407922*
Out(C) float64 outLastSentCommandParam => 5.22397e+257
Out(C) int32 outLastSentCommandReturn => 3407922
[...]

RearDriving [U]> outLastSentCommand.last
= *0*
RearDriving [U]> outComputedSpeed.last
= *0 *

I did not used the .hex command.
I use some Lua in the deployment.
Here is the version :
root@beta(8.2):/opt/ard/arp_hml# rosrun ocl deployer-gnulinux --version
OROCOS Toolchain version '2.5.0' ( GCC 4.4.5 ) -- GNU/Linux.

Does anyone have an idea of what's going on ?

Problems using the TaskBrowser

Hi,

I was abble to reproduce this on a very simple case. I create a
package with the orocos create package macros. I modify the
xxx-omponent.hpp to contains some ports that are incremented every
updateHook so I can "ls" component and check "port.last()" to compare.
I use a very slow period of 10s to be abble to see a snapshoot
correctly.

The issue is that the taskbrowser is not showing the value
incrementing whereas the "A.outZZZ.last()" request provide a good
result. Could it be a taskbrowser problem ?

Deployer [S]>
Deployer [S]> Port_test executes updateHook !
ls A

Listing TaskContext A[R] :

[...]
Data Flow Ports:
In(U) bool inXXX <= ( use 'inXXX.read(sample)' to
read a sample from this port)
In(U) double inYYY <= ( use 'inYYY.read(sample)' to
read a sample from this port)
In(U) int inZZZ <= ( use 'inZZZ.read(sample)' to
read a sample from this port)
Out(C) bool outXXX => false
Out(U) double outYYY => 5.61871e-310
Out(U) int outZZZ => 25964
[...]

Peers : (none)
Deployer [S]> A.outZZZ.last()
= 3

Deployer [S]> Port_test executes updateHook !

Here is the component code :

class Port_test
: public RTT::TaskContext
{
public:
Port_test(string const& name)
: TaskContext(name)
{
addPort("inXXX", inXXX);
addPort("inYYY", inYYY);
addPort("inZZZ", inZZZ);

addPort("outXXX", outXXX);
addPort("outYYY", outYYY);
addPort("outZZZ", outZZZ);

std::cout << "Port_test constructed !" <<std::endl;
}

bool configureHook() {
std::cout << "Port_test configured !" < return true;
}

bool startHook() {
std::cout << "Port_test started !" < return true;
}

void updateHook() {
std::cout << "Port_test executes updateHook !" < outXXX.write(!outXXX.getLastWrittenValue());
outYYY.write(outYYY.getLastWrittenValue()+1);
outZZZ.write(outZZZ.getLastWrittenValue()+1);
}

void stopHook() {
std::cout << "Port_test executes stopping !" < }

void cleanupHook() {
std::cout << "Port_test cleaning up !" < }

RTT::InputPort RTT::InputPort<double> inYYY ;
RTT::InputPort<int> inZZZ ;

RTT::OutputPort<bool> outXXX ;
RTT::OutputPort<double> outYYY ;
RTT::OutputPort<int> outZZZ ;
//
};

Here is the deployment "ops" file :
import("port_test")
loadComponent("A","Port_test")
loadComponent("B","Port_test")
connect ("A.outXXX","B.inXXX", ConnPolicy())
A.setPeriod(10.0)
A.configure()
A.start()

2012/1/16 Willy Lambert <lambert [dot] willy [..] ...>:
> Hi all,
>
> for some days, I experience strange thing with the TaskBrowser. Until now I
> thought I had a compilation problem so I just re-clone the git repo and
> build again orocos_toolchain. But problems still happens. I have issues with
> Port introspection. One exemple of what's happening is this :
>
> The taskbrowser shows :
>  Out(C)        bool outBit1        => false
>  Out(U)        bool outBit2        => false
>
> And if I ask in command line for the connected() statement i have a
> different result :
> WoodheadIn [U]> outBit1.connected ()
>  = true
> WoodheadIn [U]> outBit2.connected ()
>  = true
>
> (The rigth one should be the taskbrowser info)
>
>
>
> Another issue was with :
> HmlMonitor.RearDriving.outEnable.connected() => true
> cd HmlMonitor;
> RearDriving.outEnable.connected() = false;
>
>
>
> Another issue is the taskbrowser not showing correct value of output ports :
> Deployer [S]> cd HmlMonitor.RearDriving
> TaskBrowser connects to all data ports of RearDriving
>    Switched to : RearDriving
> RearDriving [U]> ls
>  Listing TaskContext RearDriving[U] :
> [...]
> Out(C)     float64 outMeasuredPosition => 5.22397e+257
>  Out(C)     float64 outMeasuredPositionTime => 5.22397e+257
>  Out(C)     float64 outMeasuredTorque => 5.22397e+257
>  Out(C)     float64 outComputedSpeed => 5.22397e+257
>  Out(C)       int32 outLastSentCommand => 3407922
>  Out(C)     float64 outLastSentCommandParam => 5.22397e+257
>  Out(C)       int32 outLastSentCommandReturn => 3407922
> [...]
>
> RearDriving [U]> outLastSentCommand.last
>  = 0
> RearDriving [U]> outComputedSpeed.last
>  = 0
>
>
> I did not used the .hex command.
> I use some Lua in the deployment.
> Here is the version :
> root@beta(8.2):/opt/ard/arp_hml# rosrun ocl deployer-gnulinux --version
>  OROCOS Toolchain version '2.5.0' ( GCC 4.4.5 ) -- GNU/Linux.
>
>
>
> Does anyone have an idea of what's going on ?

Problems using the TaskBrowser

Worse, if I modify the code to add logs when reading the inputs ports,
the logs doesn't appear whereas "cd B; enter;" shows :

B [R]> inZZZ.read(i)
= OldData

B [R]> Port_test executes updateHook !
inZZZ.read(i)
= NewData

B [R]> inZZZ.read(i)
= OldData

So it seems that it is the "port mecanism" that is no more working on
my computer. Does anyone of you have an idea ? Do you experience such
kind on problem with 2.5 ?

2012/1/21 Willy Lambert <lambert [dot] willy [..] ...>:
> Hi,
>
> I  was abble to reproduce this on a very simple case. I create a
> package with the orocos create package macros. I modify the
> xxx-omponent.hpp to contains some ports that are incremented every
> updateHook so I can "ls" component and check "port.last()" to compare.
> I use a very slow period of 10s to be abble to see a snapshoot
> correctly.
>
> The issue is that the taskbrowser is not showing the value
> incrementing whereas the "A.outZZZ.last()" request provide a good
> result. Could it be a taskbrowser problem ?
>
>
> Deployer [S]>
> Deployer [S]> Port_test executes updateHook !
> ls A
>
>  Listing TaskContext A[R] :
>
> [...]
>  Data Flow Ports:
>  In(U)        bool inXXX          <= ( use 'inXXX.read(sample)' to
> read a sample from this port)
>  In(U)      double inYYY          <= ( use 'inYYY.read(sample)' to
> read a sample from this port)
>  In(U)         int inZZZ          <= ( use 'inZZZ.read(sample)' to
> read a sample from this port)
>  Out(C)        bool outXXX         => false
>  Out(U)      double outYYY         => 5.61871e-310
>  Out(U)         int outZZZ         => 25964
> [...]
>
>  Peers        : (none)
> Deployer [S]> A.outZZZ.last()
>  = 3
>
> Deployer [S]> Port_test executes updateHook !
>
>
>
>
> Here is the component code :
>
> class Port_test
>    : public RTT::TaskContext
> {
>  public:
>    Port_test(string const& name)
>        : TaskContext(name)
>    {
>        addPort("inXXX", inXXX);
>        addPort("inYYY", inYYY);
>        addPort("inZZZ", inZZZ);
>
>        addPort("outXXX", outXXX);
>        addPort("outYYY", outYYY);
>        addPort("outZZZ", outZZZ);
>
>        std::cout << "Port_test constructed !" <<std::endl;
>    }
>
>    bool configureHook() {
>        std::cout << "Port_test configured !" <<std::endl;
>        return true;
>    }
>
>    bool startHook() {
>        std::cout << "Port_test started !" <<std::endl;
>        return true;
>    }
>
>    void updateHook() {
>        std::cout << "Port_test executes updateHook !" <<std::endl;
>        outXXX.write(!outXXX.getLastWrittenValue());
>        outYYY.write(outYYY.getLastWrittenValue()+1);
>        outZZZ.write(outZZZ.getLastWrittenValue()+1);
>    }
>
>    void stopHook() {
>        std::cout << "Port_test executes stopping !" <<std::endl;
>    }
>
>    void cleanupHook() {
>        std::cout << "Port_test cleaning up !" <<std::endl;
>    }
>
>    RTT::InputPort<bool> inXXX ;
>    RTT::InputPort<double> inYYY ;
>    RTT::InputPort<int> inZZZ ;
>
>    RTT::OutputPort<bool> outXXX ;
>    RTT::OutputPort<double> outYYY ;
>    RTT::OutputPort<int> outZZZ ;
> //
> };
>
>
> Here is the deployment "ops"  file :
> import("port_test")
> loadComponent("A","Port_test")
> loadComponent("B","Port_test")
> connect ("A.outXXX","B.inXXX", ConnPolicy())
> A.setPeriod(10.0)
> A.configure()
> A.start()
>
>
>
>
> 2012/1/16 Willy Lambert <lambert [dot] willy [..] ...>:
>> Hi all,
>>
>> for some days, I experience strange thing with the TaskBrowser. Until now I
>> thought I had a compilation problem so I just re-clone the git repo and
>> build again orocos_toolchain. But problems still happens. I have issues with
>> Port introspection. One exemple of what's happening is this :
>>
>> The taskbrowser shows :
>>  Out(C)        bool outBit1        => false
>>  Out(U)        bool outBit2        => false
>>
>> And if I ask in command line for the connected() statement i have a
>> different result :
>> WoodheadIn [U]> outBit1.connected ()
>>  = true
>> WoodheadIn [U]> outBit2.connected ()
>>  = true
>>
>> (The rigth one should be the taskbrowser info)
>>
>>
>>
>> Another issue was with :
>> HmlMonitor.RearDriving.outEnable.connected() => true
>> cd HmlMonitor;
>> RearDriving.outEnable.connected() = false;
>>
>>
>>
>> Another issue is the taskbrowser not showing correct value of output ports :
>> Deployer [S]> cd HmlMonitor.RearDriving
>> TaskBrowser connects to all data ports of RearDriving
>>    Switched to : RearDriving
>> RearDriving [U]> ls
>>  Listing TaskContext RearDriving[U] :
>> [...]
>> Out(C)     float64 outMeasuredPosition => 5.22397e+257
>>  Out(C)     float64 outMeasuredPositionTime => 5.22397e+257
>>  Out(C)     float64 outMeasuredTorque => 5.22397e+257
>>  Out(C)     float64 outComputedSpeed => 5.22397e+257
>>  Out(C)       int32 outLastSentCommand => 3407922
>>  Out(C)     float64 outLastSentCommandParam => 5.22397e+257
>>  Out(C)       int32 outLastSentCommandReturn => 3407922
>> [...]
>>
>> RearDriving [U]> outLastSentCommand.last
>>  = 0
>> RearDriving [U]> outComputedSpeed.last
>>  = 0
>>
>>
>> I did not used the .hex command.
>> I use some Lua in the deployment.
>> Here is the version :
>> root@beta(8.2):/opt/ard/arp_hml# rosrun ocl deployer-gnulinux --version
>>  OROCOS Toolchain version '2.5.0' ( GCC 4.4.5 ) -- GNU/Linux.
>>
>>
>>
>> Does anyone have an idea of what's going on ?

Problems using the TaskBrowser

On Sat, Jan 21, 2012 at 7:37 PM, Willy Lambert <lambert [dot] willy [..] ...>wrote:

> Worse, if I modify the code to add logs when reading the inputs ports,
> the logs doesn't appear whereas "cd B; enter;" shows :
>
> B [R]> inZZZ.read(i)
> = OldData
>
> B [R]> Port_test executes updateHook !
> inZZZ.read(i)
> = NewData
>
> B [R]> inZZZ.read(i)
> = OldData
>

B might be running but non periodic ?

>
> So it seems that it is the "port mecanism" that is no more working on
> my computer. Does anyone of you have an idea ? Do you experience such
> kind on problem with 2.5 ?
>

Not here. As your trials suggest, there is at least an issue with the
taskbrowser prompt, or with the taskbrowser auto-connecting to output
ports, which has had its problems in the past as well. The ports without
the taskbrowser interfering should really just work.

Peter

Problems using the TaskBrowser

2012/1/23 Peter Soetens <peter [..] ...>:
> On Sat, Jan 21, 2012 at 7:37 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
>>
>> Worse, if I modify the code to add logs when reading the inputs ports,
>> the logs doesn't appear whereas "cd B; enter;" shows :
>>
>> B [R]> inZZZ.read(i)
>>  = OldData
>>
>> B [R]> Port_test executes updateHook !
>> inZZZ.read(i)
>>  = NewData
>>
>> B [R]> inZZZ.read(i)
>>  = OldData
>
>
> B might be running but non periodic ?

arg right. Everything is Ok now. Even with a peer "transfer" from
Deployer to another component :
addPeer ("host","B")
removePeer ("B")
(that is what I wanted to test for creating manager components)

FYI, this call fail :
connect ("A.outZZZ","host.B.inZZZ", ConnPolicy())
(But I am not using it)

>
>>
>>
>> So it seems that it is the "port mecanism" that is no more working on
>> my computer. Does anyone of you have an idea ? Do you experience such
>> kind on problem with 2.5 ?
>
>
> Not here. As your trials suggest, there is at least an issue with the
> taskbrowser prompt, or with the taskbrowser auto-connecting to output ports,
> which has had its problems in the past as well.

Arg, I think the problem is new with 2.5, because I didn't had such
kind of issue before. Is there any planned work on it ? To be honest,
working with Orocos without the taskbrowser is really painfull when
you get use to it ^^.
I don't mind having a quick look at the code but in this case, I think
you'll need to give me hints of where to look at to succeed.

The ports without the
> taskbrowser interfering should really just work.

My test case is working now, I'll switch back to my complete code
which had issues.

>
> Peter
>

Problems using the TaskBrowser

2012/1/23 Willy Lambert <lambert [dot] willy [..] ...>

> 2012/1/23 Peter Soetens <peter [..] ...>:
> > On Sat, Jan 21, 2012 at 7:37 PM, Willy Lambert <lambert [dot] willy [..] ...>
> > wrote:
> >>
> >> Worse, if I modify the code to add logs when reading the inputs ports,
> >> the logs doesn't appear whereas "cd B; enter;" shows :
> >>
> >> B [R]> inZZZ.read(i)
> >> = OldData
> >>
> >> B [R]> Port_test executes updateHook !
> >> inZZZ.read(i)
> >> = NewData
> >>
> >> B [R]> inZZZ.read(i)
> >> = OldData
> >
> >
> > B might be running but non periodic ?
>
> arg right. Everything is Ok now. Even with a peer "transfer" from
> Deployer to another component :
> addPeer ("host","B")
> removePeer ("B")
> (that is what I wanted to test for creating manager components)
>
> FYI, this call fail :
> connect ("A.outZZZ","host.B.inZZZ", ConnPolicy())
> (But I am not using it)
>
>
> >
> >>
> >>
> >> So it seems that it is the "port mecanism" that is no more working on
> >> my computer. Does anyone of you have an idea ? Do you experience such
> >> kind on problem with 2.5 ?
> >
> >
> > Not here. As your trials suggest, there is at least an issue with the
> > taskbrowser prompt, or with the taskbrowser auto-connecting to output
> ports,
> > which has had its problems in the past as well.
>
> Arg, I think the problem is new with 2.5, because I didn't had such
> kind of issue before. Is there any planned work on it ? To be honest,
> working with Orocos without the taskbrowser is really painfull when
> you get use to it ^^.
> I don't mind having a quick look at the code but in this case, I think
> you'll need to give me hints of where to look at to succeed.
>

I have a bit of time to look at it, could you help me a bit to begin the
investigation ?

>
> The ports without the
> > taskbrowser interfering should really just work.
>
> My test case is working now, I'll switch back to my complete code
> which had issues.
>
> >
> > Peter
> >
>

Problems using the TaskBrowser

2012/2/1 Willy Lambert <lambert [dot] willy [..] ...>

>
>
> 2012/1/23 Willy Lambert <lambert [dot] willy [..] ...>
>
>> 2012/1/23 Peter Soetens <peter [..] ...>:
>> > On Sat, Jan 21, 2012 at 7:37 PM, Willy Lambert <lambert [dot] willy [..] ...
>> >
>> > wrote:
>> >>
>> >> Worse, if I modify the code to add logs when reading the inputs ports,
>> >> the logs doesn't appear whereas "cd B; enter;" shows :
>> >>
>> >> B [R]> inZZZ.read(i)
>> >> = OldData
>> >>
>> >> B [R]> Port_test executes updateHook !
>> >> inZZZ.read(i)
>> >> = NewData
>> >>
>> >> B [R]> inZZZ.read(i)
>> >> = OldData
>> >
>> >
>> > B might be running but non periodic ?
>>
>> arg right. Everything is Ok now. Even with a peer "transfer" from
>> Deployer to another component :
>> addPeer ("host","B")
>> removePeer ("B")
>> (that is what I wanted to test for creating manager components)
>>
>> FYI, this call fail :
>> connect ("A.outZZZ","host.B.inZZZ", ConnPolicy())
>> (But I am not using it)
>>
>>
>> >
>> >>
>> >>
>> >> So it seems that it is the "port mecanism" that is no more working on
>> >> my computer. Does anyone of you have an idea ? Do you experience such
>> >> kind on problem with 2.5 ?
>> >
>> >
>> > Not here. As your trials suggest, there is at least an issue with the
>> > taskbrowser prompt, or with the taskbrowser auto-connecting to output
>> ports,
>> > which has had its problems in the past as well.
>>
>> Arg, I think the problem is new with 2.5, because I didn't had such
>> kind of issue before. Is there any planned work on it ? To be honest,
>> working with Orocos without the taskbrowser is really painfull when
>> you get use to it ^^.
>> I don't mind having a quick look at the code but in this case, I think
>> you'll need to give me hints of where to look at to succeed.
>>
>
> I have a bit of time to look at it, could you help me a bit to begin the
> investigation ?
>

I think the problem is line 1963 in ocl/taskbrowser/taskbrowser.cpp :
"oport->getDataSource()" is not returning something correct

OutputPortInterface* oport =
dynamic_cast<OutputPortInterface*>(port);
if (oport) {
if ( oport->keepsLastWrittenValue())
sresult << " => " << oport->getDataSource();

the getDataSource is maybe incorrect line 215 of rtt/OutputPort.hpp :

virtual base::DataSourceBase::shared_ptr getDataSource() const
{
// we create this on the fly.
return new internal::DataObjectDataSource<T>( sample );
}

But FYI, if I catch the sample directly with the getLastWrittenValue

bool getLastWrittenValue(T& sample) const
{
if (has_last_written_value)
{
this->sample->Get(sample);
return true;
}
return false;
}

The value is correct. The outXXX.last() taskbrowser command is also correct
since the OutputPort declares in the createObject function :
LastSample last_m = &OutputPort::getLastWrittenValue;
object->addSynchronousOperation("last", last_m,
this).doc("Returns last written value to this port.");

I need help to go on to understand what
are DataObjectDataSource, DataSourceBase, DataObjectInterface, etc, ... I
read the APIs :
http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...
http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...
http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...
but it's a bit tricky for me. As far as I understand it is related to the
internal data sharing beetween threads.

>
>>
>> The ports without the
>> > taskbrowser interfering should really just work.
>>
>> My test case is working now, I'll switch back to my complete code
>> which had issues.
>>
>> >
>> > Peter
>> >
>>
>
>