-
Notifications
You must be signed in to change notification settings - Fork 0
Headlamp #8
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
Open
schmerl
wants to merge
25
commits into
energy-quality
Choose a base branch
from
headlamp
base: energy-quality
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Headlamp #8
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
56d2ee7
Added headlamp state and action.
schmerl db47b29
Hooked Headlamp into the model
schmerl 63e4fc3
Added headlamp on precondition for move in dark corridors
schmerl e00cc90
Added toString
schmerl d09ff20
Added darkness to the environment and loading
schmerl 30d168f
Set up initial state for headlamp.
schmerl c52dca3
Parsing of darkness
schmerl 918fc8b
Added some dark corridors and a preference for number of headlamp
schmerl a9b5e4b
Added headlamp domain and event
schmerl faa951e
Added rendering of dark places on the map
schmerl ef1e4eb
Added action for headlamp turning on
schmerl f903724
Added output of dark places on the map
schmerl 412433c
Removed change headlamp from list of qualities.
schmerl cd5fc42
Removed change headlamp from list of qualities.
schmerl cf0b50c
Removed change headlamp from list of qualities.
schmerl 200ed9a
Added all the places for considering headlamps and moves.
schmerl feadda8
Merge pull request #9 from cmu-able/headlamp-wo-qualities
schmerl 39fd939
Updated mission file to change weightings
schmerl 2f354d1
Updated mission file to change weightings
schmerl 4113bc6
Merge branch 'headlamp' of https://github.com/cmu-able/explainable-pl…
schmerl c77e9a3
Updated mission file to change weightings
schmerl 013646b
Changes to line spacing.
schmerl c8c46c6
Removed dead code
schmerl 491f0e6
Added headlamp to legend.
schmerl 0829979
Reverted to previous
schmerl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
XPlanning/src/examples/mobilerobot/dsm/parser/DarknessParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package examples.mobilerobot.dsm.parser; | ||
|
|
||
| import org.json.simple.JSONObject; | ||
|
|
||
| import examples.mobilerobot.models.Darkness; | ||
|
|
||
| public class DarknessParser implements IEdgeAttributeParser<Darkness> { | ||
|
|
||
| @Override | ||
| public String getAttributeName() { | ||
| return "lighting"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getJSONObjectKey() { | ||
| return "lighting"; | ||
| } | ||
|
|
||
| @Override | ||
| public Darkness parseAttribute(JSONObject edgeObject) { | ||
| Boolean dark = (Boolean )edgeObject.getOrDefault("dark", false); | ||
| return dark ? Darkness.DARK : Darkness.LIGHT; | ||
| } | ||
|
|
||
| } |
26 changes: 17 additions & 9 deletions
26
XPlanning/src/examples/mobilerobot/metrics/EnergyConsumptionDomain.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,52 @@ | ||
| package examples.mobilerobot.metrics; | ||
|
|
||
| import examples.mobilerobot.models.HeadlampState; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EnergyConsumption now depends on headlamp state, so add that here. |
||
| import examples.mobilerobot.models.Location; | ||
| import examples.mobilerobot.models.MoveToAction; | ||
| import examples.mobilerobot.models.RobotSpeed; | ||
| import language.domain.metrics.TransitionStructure; | ||
| import language.domain.models.ActionDefinition; | ||
| import language.domain.models.StateVarDefinition; | ||
|
|
||
| /** | ||
| * Defines the domain for the energy quality domain | ||
| * | ||
| * The energy consumption quality is calculated based on the robot's location and speed, | ||
| * gets information from the MoveToAction, and effects the robot's location (because MoveToAction does) | ||
| * The energy consumption quality is calculated based on the robot's location and speed, gets information from the | ||
| * MoveToAction, and effects the robot's location (because MoveToAction does) | ||
| * | ||
| * | ||
| */ | ||
| public class EnergyConsumptionDomain extends TransitionStructure<MoveToAction> { | ||
|
|
||
|
|
||
| private StateVarDefinition<Location> mrLocDef; | ||
| private StateVarDefinition<RobotSpeed> mrSpeedDef; | ||
| private StateVarDefinition<HeadlampState> mrHeadlampDef; | ||
|
|
||
| public EnergyConsumptionDomain(StateVarDefinition<Location> rLocDef, StateVarDefinition<RobotSpeed> rSpeedDef, | ||
| ActionDefinition<MoveToAction> moveToDef) { | ||
| StateVarDefinition<HeadlampState> rHeadlampDef, ActionDefinition<MoveToAction> moveToDef) { | ||
|
|
||
| this.mrLocDef = rLocDef; | ||
| this.mrSpeedDef = rSpeedDef; | ||
| this.mrHeadlampDef = rHeadlampDef; | ||
| addSrcStateVarDef(rLocDef); | ||
| addSrcStateVarDef(rSpeedDef); | ||
|
|
||
| addSrcStateVarDef(rHeadlampDef); | ||
|
|
||
| setActionDef(moveToDef); | ||
|
|
||
| addDestStateVarDef(rLocDef); | ||
| } | ||
|
|
||
| public StateVarDefinition<Location> getLocationStateVar() { | ||
| return mrLocDef; | ||
| } | ||
|
|
||
| public StateVarDefinition<RobotSpeed> getSpeedStateVar() { | ||
| return mrSpeedDef; | ||
| } | ||
|
|
||
| public StateVarDefinition<HeadlampState> getHeadlampStateVar() { | ||
| return mrHeadlampDef; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package examples.mobilerobot.models; | ||
|
|
||
| import examples.mobilerobot.dsm.IEdgeAttribute; | ||
| import language.domain.models.IActionAttribute; | ||
|
|
||
| public enum Darkness implements IEdgeAttribute, IActionAttribute { | ||
| LIGHT, DARK | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This needs to change to cater for added energy along the longest path if the headlamp was turned on.