-
Notifications
You must be signed in to change notification settings - Fork 54
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
New heading
command
#955
New heading
command
#955
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
@@ -104,6 +107,9 @@ instance ToJSONKey AbsoluteDir where | |||
instance FromJSONKey AbsoluteDir where | |||
fromJSONKey = genericFromJSONKey defaultJSONKeyOptions | |||
|
|||
-- | A relative direction is one which is defined with respect to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this definition, it makes sense to have DDown
relative this way. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was confused about DDown
so I added these comments after I figured it out. 😄
-- for players in the vast majority of cases. We rather choose | ||
-- to just return the direction 'down' in any case where we don't | ||
-- otherwise have anything reasonable to return. | ||
return $ Out (VDir (fromMaybe (DRelative DDown) $ mh >>= toDirection)) s k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use maybe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you use it, exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, I thought this was maybe (DRelative Down) toDirection mh
but I see now its two Maybe
s. 👍
Add a new `GPS receiver` device which enables the `senseloc` capability (and hence the `whereami` command). Towards #26 . - My immediate motivation is that I want to be able to define `excursion : cmd unit -> cmd unit` which executes the given command and then returns to the same location and orientation as before. Being able to use the `whereami` command is one of the last missing pieces of machinery necessary to be able to do this in classic mode (the other is a `heading` command, see #955). - The proposed recipe for `GPS receiver` is `antenna + circuit + clock + compass`, which is a somewhat difficult recipe (`antenna` requires `silver` which requires a `deep mine`; a `clock` requires `quartz` + a bunch of `iron gears`, etc.). One might wonder whether we should make the recipe easier since finding out where you are seems like a kind of fundamental operation. However, consider that in order to even be able to make use of the result of `whereami` you need at least (1) an `ADT calculator` to deal with the pair (which transitively requires `typewriter` -> `circuit` -> `silicon` -> `quartz`) (2) probably things like `comparator` and `calculator` to do anything useful with the coordinates. By the time you have those things you can definitely already build `circuit` + `clock` + `compass`, and you're probably not that far away from getting some `silver` for an `antenna`. Also, in practice it's an interesting/fun constraint to build up machinery that has to work entirely based on *relative* position without being able to find out your absolute coordinates. - For some reason this is causing `Testing/508-capability-subset` to fail. I think perhaps it is due to #397 ? I will investigate. *EDIT*: unfortunately, that wasn't it!
Define a new command
heading : cmd dir
which returns the robot's current heading (ordown
if it doesn't have one, or if the heading is some weird vector).My immediate motivation is that I want to be able to define
excursion : cmd unit -> cmd unit
which executes the given command and then returns to the same location and orientation as before. Theheading
command is one of the last missing pieces of machinery necessary to be able to implement this.