-
Notifications
You must be signed in to change notification settings - Fork 52
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
require
commands to artificially require devices or supplies
#201
Comments
The |
Could users not define it themselves (or copy from the tutorial) using install after the build? def build_with = \name.\program.\needs\.
x <- build name program;
install x needs;
return x;
end I usually define robots for scouting/fetching entities, so the name and necessary devices are always the same and I only change the program. Is there a use case for |
Yes,
I am all for having users define things themselves, but in this case I don't think they have the tools to actually build the abstraction they would really want. |
Thanks for the added clarification @byorgey, now I sorely miss |
Tried starting on implementing this (in the require branch) and it seems to be a bit trickier than I thought, so writing down what I've learned so far and some current thoughts.
|
However, unsure how to determine capabilities for it. See comments on the issue: #201 (comment)
Actually with the new I do not think the |
Yes, agreed.
I don't understand why this would be a problem, can you give an example? |
require
command to artificially require a specific devicerequire
command to artificially require devices or supplies
require
command to artificially require devices or suppliesrequire
commands to artificially require devices or supplies
The other day I was programming a robot to clear an area of trees, by moving in a grid pattern, and upon encountering a
(
The point is, the same issue occurs with any kind of needed supplies, not just devices that need to be installed. Concretely, I think I would now propose having two separate commands:
I think something like the above discussed |
Perhaps we could use a more general synchronization primitive, e.g.
|
I like the idea of a |
Started on this in the |
Add new special syntactic forms `require <string literal>` to require a device to be installed, and `require <int literal> <string literal>` to require a certain number of a given entity in the inventory. - Replace `Set Capability` with a new `Requirements` type which records various types of requirement. - Refactor requirements checking into a new function `checkRequirements` which also does device set minimization (#508). - `reprogram` will now install extra devices or transfer extra inventory as necessary. - Add a bunch of tests. - Add new `installed` command, similar to `has`, which checks whether a given device is installed. Closes #201. Closes #508.
[Edited to add: I have realized that this issue is even more general, and is not specifically about devices per se, but about requiring any kind of needed supplies. See the comments later in the issue.]
In certain situations, it's possible you might want a robot to have a certain device installed even though its program does not require the capabilities provided by that device. For example, this can happen with
logger
s: if the robot might crash and you want it to be able to log its failure. Or you might be planning toreprogram
the robot later and know the later program will require a certain capability that it does not require at first. We should add a commandrequire
which artificially creates a demand for a specific device, so thebuild
command will install it. For example,will build a robot
x
with alogger
installed.Of course
require
is a no-op at runtime.I think there is actually a question here whether the argument to
require
should name a capability or a device. In general I think we need to clarify the relationship between capabilities and devices.The text was updated successfully, but these errors were encountered: