[Rock-dev] Syskit: change behaciour of syskit shell

Matthias Goldhoorn matthias.goldhoorn at dfki.de
Thu Jan 23 13:39:00 CET 2014


On 23.01.2014 11:57, Sylvain Joyeux wrote:
> On Thursday, January 23, 2014 08:26:04 AM Matthias Goldhoorn wrote:
>> On 22.01.2014 17:00, Sylvain Joyeux wrote:
>>> On 01/22/2014 04:31 PM, Matthias Goldhoorn wrote:
>>>> I had in my controllerscript a method like this:
>>>>      40 module Robot
>>>>      41     def set_state(state, substate)
>>>>      42         State.lowlevel_state = state
>>>>      43         State.lowlevel_substate = substate
>>>>      44     end
>>>>      45 end
>>>>
>>>> As far as i remember i could call the method directly from the
>>>> commandline.
>>>> Is this not possible anymore, what's the way to do this?
>>> The only this feature could have ever worked is if you had
>>>
>>>      def self.set_state(...)
>>>      end
>> Even this does not work anymore...
> OK ... Sorry for the change.
>
> Reimplementing it is not really possible neither really nice. There is however
> a way to extend the shell interface with custom commands. See e.g.
> lib/syskit/shell.rb for an example.
I implemented my extension like:

module Avalon
     class ShellInterface < Roby::Interface::CommandLibrary

         def set_state(state, substate)
             State.lowlevel_state = state
             State.lowlevel_substate = substate
         end
         command :set_state, "set the current runstate for Avalon as 
state,substate pair",
             :state => "The given State (0=> off, 3=> autonomous)",
             :substate => "The given substate"

         def tester
             STDOUT.puts "hallo test funktion"
         end
         command :tester, "This tests this module"
     end
end
module Robot
     def self.avalon
         STDOUT.puts "Loading the new avalon interface"
         @avalon_interface_internal ||= Avalon::ShellInterface.new(Roby.app)
     end
end

Roby::Interface::Interface.subcommand 'avalon', Avalon::ShellInterface, 
'Commands specific to Avalon'

Unfortunatly it seems it does not get loaded.

localhost:48902 > avalon.class
=> NilClass

localhost:48902 > help

Commands
--------
actions(): lists a summary of the available actions
describe(action): gives details about the given action
disable_notifications(): disables the forwarding of notifications
enable_notifications(): enables the forwarding of notifications
jobs(): returns the list of non-finished jobs
kill_job(job_id): kills the given job
reload_actions(): reloads the files in models/actions/

Subcommands (use help <subcommand name> for more details)
-----------
syskit: Commands specific to Syskit
=>


What's missing here?

Matthias



-- 
  Dipl.-Inf. Matthias Goldhoorn
  Space and Underwater Robotic

  Universität Bremen
  FB 3 - Mathematik und Informatik
  AG Robotik
  Robert-Hooke-Straße 1
  28359 Bremen, Germany
  
  Zentrale: +49 421 178 45-6611
  
  Besuchsadresse der Nebengeschäftstelle:
  Robert-Hooke-Straße 5
  28359 Bremen, Germany
  
  Tel.:    +49 421 178 45-4193
  Empfang: +49 421 178 45-6600
  Fax:     +49 421 178 45-4150
  E-Mail:  matthias.goldhoorn at informatik.uni-bremen.de

  Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



More information about the Rock-dev mailing list