[Rock-dev] Problem with connect to

Alexander Duda Alexander.Duda at dfki.de
Mon Apr 29 17:27:08 CEST 2013


Hi,

connect_to is not supported for task proxies. Have a look at
http://www.rock-robotics.org/master/documentation/graphical_user_interface/200_simple_gui.html 
for an overview how to use the async API.

In the particular case use either

task.port("odometry_samples").on_data do |data|
     widget.orientationView.update(data,"odometry_samples")
end

or the connect logic:
l = lambda do |sample|
     widget.orientationView.update(sample,"odometry_samples")
end
connect PORT(:odometry_samples),l

Alex

On 04/29/2013 05:13 PM, "Raúl Domínguez" wrote:
> Hello,
> I am working with the master branch just updated.
> Running this script:
> """
> require 'vizkit'
>
> Orocos::CORBA.name_service.ip = "seekurjr"
> Orocos.initialize
>
> # load GUI created with the Qt Designer
> widget = Vizkit.load "gui/heading.ui"
> widget.show
>
> # connect the widget with the task "simple_task"
> widget.connect_to_task "seekurjr/seekur_odometry" do |task|
>
>
>     task.port("odometry_samples").connect_to do |data,port_name|
>         widget.orientationView.update(data,port_name)
>     end
>
> end
>
> widget.connect_to_task "seekurjr/seekur_corridor_servoing" do |task|
>
>     # generate a new sample each time the button is clicked
>     # and show a message box if there is a connection error
>     g = lambda{widget.headingSpinBox.value}
>     c = lambda{|msg| Qt::MessageBox.warning(widget,"ComErr",msg) if 
> msg != "OK"}
>     headingSendButton.connect SIGNAL(:clicked), PORT(:heading),:getter 
> => g,:callback => c
>
>     # disable the GUI until the task is reachable
>     task.on_reachable {widget.setEnabled(true)}
>     task.on_unreachable {widget.setEnabled(false)}
> end
>
> #run qt main loop
> Vizkit.exec
> """
> Gives the following error when clicking the headingSendButton:
> """
> /home/virgo/virgo_rock/tools/orocos.rb/lib/orocos/async/ports.rb:374:in `connect_to': 
> wrong number of arguments (0 for 2) (ArgumentError)
>         from 
> /home/virgo/virgo_rock/tools/orocos.rb/lib/orocos/async/ports.rb:374:in `call' 
>
>         from 
> /home/virgo/virgo_rock/tools/orocos.rb/lib/orocos/async/ports.rb:374:in `write' 
>
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:313:in 
> `call'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:313:in 
> `defer'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:161:in 
> `call'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:161:in 
> `call'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:612:in 
> `step'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:700:in 
> `call'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:700:in 
> `handle_errors'
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:612:in 
> `step'
>         from 
> /home/virgo/virgo_rock/gui/vizkit/ruby/lib/vizkit/vizkit.rb:125:in `exec'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2427:in `call'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2427:in `invoke'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `qt_metacall'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `method_missing'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `exec'
>         from 
> /home/virgo/virgo_rock/gui/vizkit/ruby/lib/vizkit/vizkit.rb:129:in `exec'
>         from heading_viz.rb:36
>         from 
> /home/virgo/virgo_rock/tools/utilrb/lib/utilrb/event_loop.rb:619:in 
> `step'
>         from 
> /home/virgo/virgo_rock/gui/vizkit/ruby/lib/vizkit/vizkit.rb:125:in `exec'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2427:in `call'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2427:in `invoke'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `qt_metacall'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `method_missing'
>         from /usr/lib/ruby/1.8/Qt/qtruby4.rb:469:in `exec'
>         from 
> /home/virgo/virgo_rock/gui/vizkit/ruby/lib/vizkit/vizkit.rb:129:in `exec'
>         from heading_viz.rb:36
> """
> Thanks,
> Raúl
>
>
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev


-- 
Dipl.-Ing. Alexander Duda
Unterwasserrobotik

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Phone: +49 (0)421 178-456620
Fax:   +49 (0)421 178-454150
E-Mail: alexander.duda at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20130429/5485e683/attachment.htm 


More information about the Rock-dev mailing list