[Rock-dev] test on connected port fails in startHook
gprizzi at tin.it
gprizzi at tin.it
Mon Feb 21 17:23:31 CET 2011
Dear sirs,
I prepared the following simple system:
name 'testcon'
version '0.1'
task_context "Task1" do
# output ports
output_port("port1", "int").
doc("simple output port")
end
task_context "Task2" do
# input ports
input_port("port1", "int").
doc("simple input port")
# task is activated by new data on input port
port_driven "port1"
end
deployment "test1" do
task1 = task("T1", "Task1").
realtime.
periodic(2.0).
start
task2 = task("T2", "Task2").
start
# connections beetwen tasks
connect(task1.port1, task2.port1)
end
then I modified stratHook of task2 in order to test if all ports where correctly connected before
starting component.
The code I write is listed below:
bool Task2::startHook()
{
bool result;
if (! Task2Base::startHook())
return false;
result=_port1.connected();
if(!result )
return false;
else
return true;
}
the test fails, and the component is not started.
The same test in updateHook returns the connections are correctly made.
In the Orocos Componets Builder's manual in paragraph "3.3.4. Using the Data Flow Interface in C++"
the connection test is made in startHook.
Am I doing something wrong in my orogen file or this is the desired behavior of code generated by orgen?
Have I to test all the time in the updateHook the port connections.
Thank you in advance.
Gianpaolo Rizzi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dfki.de/mailman/cgi-bin/private/rock-dev/attachments/20110221/f7b3306b/attachment.htm
More information about the Rock-dev
mailing list