You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.8 KiB
48 lines
1.8 KiB
package IndoorNavigationWaypointTracing.MultiAgentSystem;
|
|
|
|
import IndoorNavigationWaypointTracing.Launch;
|
|
import agentBehaviourPrototype.ExecutionBehaviour;
|
|
import agentBehaviourPrototype.ReceiveDataFromAgentBehaviour;
|
|
import agentBehaviourPrototype.SendDataToAgentBehaviour;
|
|
import agentEntityPrototype.RobotAgent;
|
|
import edu.wpi.rail.jrosbridge.services.std.Empty.Request;
|
|
import jade.core.AID;
|
|
|
|
public class PlannerAgent extends RobotAgent
|
|
{
|
|
|
|
Request planRequest = new Request();
|
|
Request problemGeRequest = new Request();
|
|
|
|
private AID PlanDispatchAgent = new AID("PlanDispatchAgent", false);
|
|
|
|
protected void setup() {
|
|
//automatically generated
|
|
this.controller.addService(Launch.problemGenerationServiceName, Launch.problemGenerationServiceType);
|
|
//this.controller.addService(Launch.problemGenerationServiceName, Launch.problemGenerationServiceType);
|
|
this.controller.addService(Launch.planServiceName, Launch.planServiceType);
|
|
this.controller.getService(Launch.problemGenerationServiceName).callServiceAndWait(problemGeRequest);
|
|
try {
|
|
Thread.sleep(10000);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
this.controller.getService(Launch.planServiceName).callServiceAndWait(planRequest);
|
|
|
|
this.controller.addTopic(Launch.planTopicName, Launch.planType);
|
|
|
|
try {
|
|
Thread.sleep(2000);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
//agent communication
|
|
//PostiveRelatedElementsWithRelation
|
|
this.behList.addElement(new SendDataToAgentBehaviour(this, controller, PlanDispatchAgent, Launch.planDispatchDataKey));
|
|
this.behList.addElement(new ReceiveDataFromAgentBehaviour(this, controller, PlanDispatchAgent, Launch.planFeedbackDataKey));
|
|
|
|
addBehaviour(tbf.wrap(new ExecutionBehaviour(this, ds, this.behList)));
|
|
|
|
}
|
|
} |