Calling Actions in Agents

From SIMboxWiki
Revision as of 19:30, 25 April 2013 by Tarah Schmidt (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

When calling an action in an agent, you are changing the behavior of the entity in some way. Actions are used to change the behavior in a single entity. Examples include setting the autopilot to on, setting the landing gear down, making the aircraft turn to a certain heading, etc. Below we will briefly outline how to call and action in an agent to change the behavior of an entity.



1. Create a new session with a controlled Cessna. Right click in the Knowledge Center white space > New > Session. Once in Scenario Editor, right click on the map > New > Cessna.



Landing1.png



2. Create a new agent for the Cessna. Right click in the white space under the Agents Tab > New > Virtual Instructor.



Focal1.png



For this lesson we will have the aircraft perform specific tasks by calling certain actions such as lowering and raising the flaps, switching autopilot on, turning to follow a heading, and decreasing speed.



Lowering and Raising the Flaps



It should be noted that VI Guidance and Timeouts can be added to enhance agent flow and function where they are necessary.



3. To call an action within the agent, right click and select Advanced > Call Action.



ActionAgent1.png



4. Select an action that will lower the flaps for you. Type “flaps” in the search text box at the top of the window. Next, make sure that the Show hidden tokens checkbox is marked. Finally, locate the action that will set the flaps down. Select the action and click Add at the bottom of the window.



ActionAgent2.png



5. Next, a Do an Action window will appear. For this we don’t have to enter anything in the index or value boxes. Simply press the OK button.



ActionAgent3.png



To lower the flaps all the way down, copy and paste this action two more times in the agent. Your agent should look something like this (to add a timeout as shown below right click > Timeout > change duration to a specified time in seconds):



ActionAgent4.png



6. Next, to raise the flaps go back to the Select an Action window and select the action to raise the flaps up one step. (Note: “flaps” should already be in the search box, so you won’t have to repeat that step again.)



ActionAgent5.png



Again, to raise the flaps all the way up, just copy and paste this action two more times within the agent. It should look something like this:



ActionAgent6.png



You can choose to put timeouts between actions, like we have done here, for a smoother transition into the next action. Sometimes the aircraft requires some time to perform the action and a timeout is necessary.



Turn Autopilot On



Next, we would like to turn autopilot on.



7. First, go to the “Select an Action” window and type “ap” in the search box. This will search for all autopilot actions. Make sure that “Show hidden tokens” check box is marked.



8. Locate the action to switch the autopilot on, select it, and click Add at the bottom of the window.



ActionAgent7.png



9. When Do an Action window appears, type 1 in the Value box. This is telling the agent to turn the autopilot to True or On. Select OK.



ActionAgent8a.png



Make the Aircraft Follow a Specific Heading



Now we want to have the aircraft turn toward a specified heading. To do this, first we must know what direction the aircraft is already flying. To view, click on the Entity Settings tab at the bottom of the Agent Editor window, then click on the General tab at the top of the Entity Settings window. Locate the heading information.



ActionAgent8.png



To go back to the Agent Editor page, click the tab at the bottom of the window.



10. To make the aircraft follow a certain heading, the autopilot must be set to on (which we have done in the previous steps). Go to the Select and Action window and search for “ap”, making sure the Show hidden tokens check box is marked (however, the window should already have your previous search information saved).



11. Select the action for the autopilot to set the heading. Click Add.



ActionAgent9.png



12. In the Do an Action window type your desired heading into the Value box. Let’s have the aircraft turn 180 degrees.



ActionAgent10.png



13. Now we have to tell the autopilot to engage in a heading hold. Go back to Select an Action window and select the appropriate action. Again, previous search information should already be entered for you.



ActionAgent11.png



14. When the Do an Action window appears, type in 1 in the Value box. This is telling the autopilot to engage in the heading hold. Your agent should look something like this now:




Your agent should look something like this now:



ActionAgent12.png



Increasing Speed



To increase speed with an action, the aircraft must be on autopilot (we have turned this on in the previous steps).



15. Go to Select an Action window, and select the action for the autopilot to set the speed. Again, the window should have your search preferences saved for “ap”.



ActionAgent13.png



16. In the Do an Action window, enter the desired speed for the aircraft. From the entity settings we saw earlier, we know we are traveling at 100 knots.



ActionAgent14.png



We would like to increase our speed to 110 knots. Enter this in the Value box.



ActionAgent15.png



17. Then, as with the heading hold, we want the autopilot to engage in a speed hold. Select the appropriate action from the list and type 1 in the Value box to engage the autopilot in a speed hold.



ActionAgent16.png



Your agent should look something like this:

ActionAgent17.png



Remember, we only added arbitrary timeouts in between actions. You can choose where to place timeouts and their duration depending on your scenario (for instance, in this scenario, the aircraft will take a long time to reach a speed of 110 knots so we added a long timeout).



18. The final step should be to test your agent by playing it in the Scenario Editor.



ActionAgent18.png