-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding LTL patterns and creating new worlds
- Loading branch information
1 parent
a6b5e6a
commit 35b3c84
Showing
50 changed files
with
59,887 additions
and
135 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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
43 changes: 43 additions & 0 deletions
43
JvmClient/src/jvmTest/java/uuspaceagent/Coba_Identify_Id.java
This file contains 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,43 @@ | ||
package uuspaceagent; | ||
|
||
import eu.iv4xr.framework.mainConcepts.WorldEntity; | ||
|
||
import static uuspaceagent.TestUtils.loadSE; | ||
import eu.iv4xr.framework.mainConcepts.WorldEntity; | ||
import eu.iv4xr.framework.mainConcepts.WorldModel; | ||
import org.junit.jupiter.api.Test; | ||
import spaceEngineers.model.*; | ||
import static uuspaceagent.TestUtils.loadSE; | ||
|
||
|
||
public class Coba_Identify_Id { | ||
@Test | ||
public void test() throws InterruptedException { | ||
var state = loadSE("world-3 blocks").snd; | ||
|
||
state.updateState(state.agentId); | ||
|
||
System.out.println("** find the id of blocks"); | ||
|
||
state.updateState(state.agentId); | ||
|
||
WorldEntity agentInfo = state.wom.elements.get(state.agentId); | ||
System.out.println("** Agent's info: " + PrintInfos.showWorldEntity(agentInfo)); | ||
|
||
System.out.println("** Agent's info: " + PrintInfos.showWOMElements(state.wom)); | ||
|
||
/* | ||
System.out.println("======"); | ||
CharacterObservation cobs = state.env().getController().getObserver().observe() ; | ||
if(cobs.getTargetBlock() != null) { | ||
System.out.println("=== target block: " + cobs.getTargetBlock().getId()); | ||
} | ||
*/ | ||
|
||
WorldEntity target = SEBlockFunctions.findClosestBlock(state.wom, "BasicAssembler", 10); | ||
String batteryId = target.id; | ||
System.out.println("** target state: " + PrintInfos.showWorldEntity(target)); | ||
|
||
TestUtils.closeConnectionToSE(state); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
JvmClient/src/jvmTest/java/uuspaceagent/Test_GrindingNearest.java
This file contains 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,79 @@ | ||
package uuspaceagent; | ||
|
||
import eu.iv4xr.framework.mainConcepts.TestAgent; | ||
import eu.iv4xr.framework.mainConcepts.TestDataCollector; | ||
import nl.uu.cs.aplib.mainConcepts.GoalStructure; | ||
import nl.uu.cs.aplib.utils.Pair; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static nl.uu.cs.aplib.AplibEDSL.DEPLOYonce; | ||
import static nl.uu.cs.aplib.AplibEDSL.SEQ; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static uuspaceagent.PrintInfos.showWOMAgent; | ||
import static uuspaceagent.TestUtils.console; | ||
import static uuspaceagent.TestUtils.loadSE; | ||
|
||
public class Test_GrindingNearest { | ||
|
||
public Pair<TestAgent, UUSeAgentState> deployAgent() throws InterruptedException { | ||
var agentAndState = loadSE("world-4 blocks") ; // loadSE("myworld-3") ; | ||
TestAgent agent = agentAndState.fst ; | ||
UUSeAgentState state = agentAndState.snd ; | ||
Thread.sleep(1000); | ||
state.updateState(state.agentId); | ||
// agent start location should be around:<10.22475,-5.0025,53.75382>, | ||
// orientationForward: <-0.08024501,7.549446E-5,0.99677515> ... so looking towards z-axis | ||
console(showWOMAgent(state.wom)); | ||
return new Pair<TestAgent, UUSeAgentState>(agent,state) ; | ||
} | ||
|
||
public void test_Goal(TestAgent agent, UUSeAgentState state, GoalStructure G) throws InterruptedException { | ||
agent.setGoal(G) ; | ||
int turn= 0 ; | ||
while(G.getStatus().inProgress()) { | ||
//console(">> [" + turn + "] " + showWOMAgent(state.wom)); | ||
agent.update(); | ||
//Thread.sleep(50); | ||
turn++ ; | ||
if (turn >= 1400) break ; | ||
} | ||
//closeIfCloseable(state.env().getController()); | ||
TestUtils.closeConnectionToSE(state); | ||
} | ||
|
||
@Test | ||
public void test_navigate_and_grind() throws InterruptedException { | ||
// This is a position that is unreachable, so this goal should abort | ||
console("*** start test...") ; | ||
var agentAndState = deployAgent(); | ||
TestAgent agent = agentAndState.fst ; | ||
agent.setTestDataCollector(new TestDataCollector()) ; | ||
|
||
// GoalStructure G = SEQ(DEPLOYonce(agent, UUGoalLib.closeTo(new Vec3(2.5f,-3.75f,-3f))), | ||
GoalStructure G = SEQ( | ||
DEPLOYonce(agent, UUGoalLib.closeTo(agent, | ||
"BasicAssembler", | ||
SEBlockFunctions.BlockSides.FRONT, | ||
20f, | ||
0.5f)), | ||
UUGoalLib.targetBlockOK(agent, e -> | ||
"BasicAssembler".equals(e.getStringProperty("blockType")) | ||
&& (float) e.getProperty("integrity") == (float) e.getProperty("maxIntegrity"), | ||
false | ||
), | ||
// UUGoalLib.photo("C:\\workshop\\projects\\iv4xr\\Screenshots\\LargeBlockBatteryBlock.png"), | ||
UUGoalLib.grinded(agent,0.5f), | ||
UUGoalLib.targetBlockOK(agent, e -> | ||
(float) e.getProperty("integrity") <= 0.5f * (float) e.getProperty("maxIntegrity"), | ||
false | ||
) | ||
//, | ||
// UUGoalLib.photo("C:\\workshop\\projects\\iv4xr\\Screenshots\\LargeBlockBatteryBlock_at_50.png") | ||
); | ||
Thread.sleep(5000); | ||
test_Goal(agent, agentAndState.snd, G) ; | ||
G.printGoalStructureStatus(); | ||
assertTrue(G.getStatus().success()); | ||
assertTrue(agent.getTestDataCollector().getNumberOfPassVerdictsSeen() == 2) ; | ||
} | ||
} |
Oops, something went wrong.