-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathacting_agent.asl
59 lines (48 loc) · 2.89 KB
/
acting_agent.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// acting agent
// The agent has a belief about the location of the W3C Web of Thing (WoT) Thing Description (TD)
// that describes a Thing of type https://ci.mines-stetienne.fr/kg/ontology#PhantomX
robot_td("https://raw.githubusercontent.com/Interactions-HSG/example-tds/main/tds/leubot1.ttl").
/* Initial goals */
!start. // the agent has the goal to start
/*
* Plan for reacting to the addition of the goal !start
* Triggering event: addition of goal !start
* Context: the agent believes that it can manage a group and a scheme in an organization
* Body: greets the user
*/
@start_plan
+!start : true <-
.print("Hello world").
/*
* Plan for reacting to the addition of the goal !manifest_temperature
* Triggering event: addition of goal !manifest_temperature
* Context: the agent believes that there is a temperature in Celcius and
* that a WoT TD of an onto:PhantomX is located at Location
* Body: converts the temperature from Celcius to binary degrees that are compatible with the
* movement of the robotic arm. Then, manifests the temperature with the robotic arm
*/
@manifest_temperature_plan
+!manifest_temperature : temperature(Celcius) & robot_td(Location) <-
.print("I will manifest the temperature: ", Celcius);
makeArtifact("covnerter", "tools.Converter", [], ConverterId); // creates a converter artifact
convert(Celcius, -20.00, 20.00, 200.00, 830.00, Degrees)[artifact_id(ConverterId)]; // converts Celcius to binary degress based on the input scale
.print("Temperature Manifesting (moving robotic arm to): ", Degrees);
/*
* If you want to test with the real robotic arm,
* follow the instructions here: https://github.com/HSG-WAS-SS24/exercise-8/blob/main/README.md#test-with-the-real-phantomx-reactor-robot-arm
*/
// creates a ThingArtifact based on the TD of the robotic arm
makeArtifact("leubot1", "org.hyperagents.jacamo.artifacts.wot.ThingArtifact", [Location, true], Leubot1Id);
// sets the API key for controlling the robotic arm as an authenticated user
//setAPIKey("77d7a2250abbdb59c6f6324bf1dcddb5")[artifact_id(Leubot1Id)];
// invokes the action onto:SetWristAngle for manifesting the temperature with the wrist of the robotic arm
invokeAction("https://ci.mines-stetienne.fr/kg/ontology#SetWristAngle", ["https://www.w3.org/2019/wot/json-schema#IntegerSchema"], [Degrees])[artifact_id(Leubot1Id)].
/* Import behavior of agents that work in CArtAgO environments */
{ include("$jacamoJar/templates/common-cartago.asl") }
/* Import behavior of agents that work in MOISE organizations */
{ include("$jacamoJar/templates/common-moise.asl") }
/* Import behavior of agents that reason on MOISE organizations */
{ include("$moiseJar/asl/org-rules.asl") }
/* Import behavior of agents that react to organizational events
(if observing, i.e. being focused on the appropriate organization artifacts) */
{ include("inc/skills.asl") }