Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.0 #151

Open
pierrewillenbrockdfki opened this issue Jun 14, 2023 · 1 comment
Open

Ruby 3.0 #151

pierrewillenbrockdfki opened this issue Jun 14, 2023 · 1 comment

Comments

@pierrewillenbrockdfki
Copy link
Contributor

The change from potentially converting the last hash in the argument list to keyword arguments to not doing that at all breaks some pieces of orocos.rb. This becomes visible when trying to pass keyword arguments through the new method of the TaskContext and NameServer, and when calling the get method of the ruby side of the nameserver.

The exact errors are:

/home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:61:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:45:in `new'
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:45:in `new'
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/base.rb:304:in `initialize'
        from /home/pierre/autoproj-dev/workspace/base/scripts/lib/rock/bundles.rb:440:in `initialize'
        from /home/pierre/autoproj-dev/workspace/gui/vizkit/bin/rock-display:65:in `<main>'

when starting rock-display

/home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/name_service.rb:606:in `get': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/async/name_service.rb:332:in `get'
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/name_service.rb:317:in `block in get'
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/name_service.rb:314:in `each'
        from /home/pierre/autoproj-dev/workspace/tools/orocos.rb/lib/orocos/name_service.rb:314:in `get'
        from /home/pierre/autoproj-dev/workspace/tools/utilrb/lib/utilrb/thread_pool.rb:444:in `sync'
        from /home/pierre/autoproj-dev/workspace/tools/utilrb/lib/utilrb/thread_pool.rb:191:in `execute'
        from /home/pierre/autoproj-dev/workspace/tools/utilrb/lib/utilrb/thread_pool.rb:594:in `block in spawn_thread'
        from /home/pierre/autoproj-dev/workspace/tools/utilrb/lib/utilrb/event_loop.rb:623:in `step'
        from /usr/lib/ruby/3.0.0/forwardable.rb:238:in `step'
        from /home/pierre/autoproj-dev/workspace/gui/vizkit/lib/vizkit/vizkit.rb:142:in `block in exec'
        from /home/pierre/.local/share/autoproj/gems/ruby/3.0.0/bundler/gems/rock-qtbindings-9f5d2abc9a54/lib/Qt/qtruby4.rb:2470:in `invoke'
        from /home/pierre/.local/share/autoproj/gems/ruby/3.0.0/bundler/gems/rock-qtbindings-9f5d2abc9a54/lib/Qt/qtruby4.rb:479:in `qt_metacall'
        from /home/pierre/.local/share/autoproj/gems/ruby/3.0.0/bundler/gems/rock-qtbindings-9f5d2abc9a54/lib/Qt/qtruby4.rb:479:in `method_missing'
        from /home/pierre/.local/share/autoproj/gems/ruby/3.0.0/bundler/gems/rock-qtbindings-9f5d2abc9a54/lib/Qt/qtruby4.rb:479:in `exec'
        from /home/pierre/autoproj-dev/workspace/gui/vizkit/lib/vizkit/vizkit.rb:146:in `exec'
        from /home/pierre/autoproj-dev/workspace/gui/vizkit/bin/rock-display:108:in `<main>'

when trying to create a vizkit3d widget

Compare also two commits that work around the issues:
master...pierrewillenbrockdfki:tools-orocosrb:master

On the bright side: the qt4 rock-display works on ubuntu 22.04, with this and the change to the qtbindings.

@doudou i did not want to do a PR with this because i barely have an idea what is going on here, and the changeset above may or may not be appropriate. It working may also be a fluke. Also, no idea if that is actually working with ruby 2.7 or before, i only tried with ruby 3.0.

@pierrewillenbrockdfki
Copy link
Contributor Author

pierrewillenbrockdfki commented Dec 13, 2023

We made a ruby run-script somewhat work, result for orocos.rb can be found https://github.com/pierrewillenbrockdfki/tools-orocosrb/tree/fix-ruby3

We managed to get into the block passed to Orocos.run, find and start configuring tasks, where things stopped working for issues with the tasks.

Similar changes were needed for drivers/orogen/transformer/rock/runtime.rb and base/scripts/lib/rock/bundles.rb that i did not push anywhere. I can do that if there is interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant