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

coordination: replace Roby::Variable with real values #43

Closed
wants to merge 1 commit into from

Conversation

D-Alex
Copy link
Member

@D-Alex D-Alex commented Dec 7, 2015

I am not sure if this is the right spot and I also do not like to dup the hole object only to not overwrite the Variable for the next call.

This allows to use with_arguments in code blocks given to action_script
or action_state_machine.

describe('...').optional_arg('speed','speed in m/s',0.1)
action_state_machine('move') do
    Compositions::Control::MoveForward.use(odometry_def,control_def).with_arguments(:speed=> speed)
    ...
end

This allows to use with_arguments in code blocks given to action_script
or action_state_machine.

describe('...').optional_arg('speed','speed in m/s',0.1)
action_state_machine('move') do

Compositions::Control::MoveForward.use(odometry_def,control_def).with_arguments(:speed
=> speed)
...
end
@doudou
Copy link
Member

doudou commented Dec 9, 2015

This is wrong at many levels (look at the failed test suite just above this comment)

First of all, even if it would be an OK change, it is also a purely syskit-specific change in Roby. The only constraint on the instanciation objects is that they either answer to #as_plan or #instanciate. Nothing about #arguments.

In the current code, if you want complex argument-based parametrization, create either separate actions or separate definitions for each of your states and then use those in the state machine. It integrates much better in the syskit workflow, as tests can then be automatically run on the definitions, verifying that they are at least (but not only) deployable.

Moreover, it allows you to start each definition separately (in e.g. the syskit IDE), which is great for "human-driven" testing on the real system -- something that unfortunately syskit did not (yet !) remove the need for.

If you truly truly believe that this is a better way (and make a good case for it), the best way forward would be to make sure that Syskit::InstanceRequirement objects are interpreted as actions by the Roby coordination code instead of as #as_plan or #instanciate receivers (calling InstanceRequirement#to_action_model), Actions can have their top-level arguments overriden.

In general, it would obviously be best to ensure that variables can't be used for instance requirements .... but that's another story (and I don't have a solution for it out of the top of my head)

@D-Alex
Copy link
Member Author

D-Alex commented Dec 9, 2015

What I want are roby shell commands for controlling the robot.

  • move!(:speed => 0.1,:distance => 1)
  • rotate!(....)
  • blink!
  • dock!(:speed => 0.2) # start docking

Doing this with roby is simple (see http://rock-robotics.org/stable/api/tools/roby/tutorial/shell.html) but this does not play nice with Compositions.
Doing this with action script is a bit of a pain because you cannot use arguments at the moment.

@D-Alex
Copy link
Member Author

D-Alex commented Dec 9, 2015

Ok the missing piece was that you can set the parameters from the embedded composition when you call the profile xxx_def. This is not documented and the only example uses with_arguments
http://rock-robotics.org/stable/documentation/system_management_tutorials/1100_action_state_machines.html

Therefore, I agree that you do not need it. Why not simple raising in the with_argument from syskit method if someone tries to passes a Roby::Coordination::Models::Variable and telling him he should use profiles?

https://github.com/rock-core/tools-syskit/blob/master/lib/syskit/instance_requirements.rb#L552

@doudou
Copy link
Member

doudou commented Dec 10, 2015

Therefore, I agree that you do not need it. Why not simple raising in the with_argument from syskit method if someone tries to passes a Roby::Coordination::Models::Variable and telling him he should use profiles?

Because that would be an extremely specific check, which I don't like. Arguments can be anything, really, and I don't want to embed in InstanceRequirements something that is specific to coordination.

One thing that could be done right away is to make Variable a delayed argument, that raises when evaluated. One would at least get an error, at least at runtime, in Syskit at deployment time. In the long run, we'll add automated offline testing for action scripts and action state machines. That would be something that would be validated there.

@D-Alex
Copy link
Member Author

D-Alex commented Dec 10, 2015

You get already an error during runtime because Models::Variable are usually not compatible with the poll blocks or other usage. Therefore, we could also simply put it into a FAQ until the automated offline testings is implemented.

@doudou
Copy link
Member

doudou commented Dec 10, 2015

You get already an error during runtime because Models::Variable are usually not compatible with the poll blocks or other usage

At least, with the delayed argument, it would happen before the task gets started or in the case of syskit, while the new network is computed (i.e. before it is applied). Not better in your opinion ?

@D-Alex
Copy link
Member Author

D-Alex commented Dec 11, 2015

Sounds better of course if the effort is not too big.

@doudou
Copy link
Member

doudou commented Dec 18, 2015

I don't have time to do it right now, so created #47 to keep it in mind.

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

Successfully merging this pull request may close these issues.

2 participants