1 package cz.cuni.amis.pogamut.usar2004.agent.module.state; 2 3 import cz.cuni.amis.pogamut.usar2004.communication.messages.datatypes.LinkState; 4 import cz.cuni.amis.pogamut.usar2004.communication.messages.usarinfomessages.MissionPackageMessage; 5 import java.util.List; 6 7 /** 8 * State message representative for Mission package. 9 * 10 * @author vejmanm 11 */ 12 public class MissionPackageState 13 { 14 protected MissionPackageMessage lastMessage; 15 16 public MissionPackageState() 17 { 18 } 19 20 /** 21 * Method used for updating the message object that provides particular 22 * properties for given type. Note that this object is created by yylex 23 * parser and contains properties for all configuration subject types. But 24 * only relevat to individual Config Subject are filled. 25 * 26 * @param message Mission package message from server. 27 */ 28 public void updateMessage(MissionPackageMessage message) 29 { 30 lastMessage = message; 31 } 32 33 /** 34 * Timestamp form the UT since server start in seconds. 35 * 36 * @return Returns seconds elapsed from the start of the server. 37 */ 38 public double getTime() 39 { 40 return lastMessage.getTime(); 41 } 42 43 /** 44 * Used to make sure the object is filled. 45 * 46 * @return Returns true if the object is filled with State message. 47 */ 48 public Boolean isReady() 49 { 50 return (lastMessage != null); 51 } 52 53 /** 54 * Name of the mission package 55 * 56 * @return; Returns the name of the mission package 57 */ 58 public String getName() 59 { 60 return lastMessage.getName(); 61 } 62 63 /** 64 * This parameter gives the link number that will be described by the next 65 * two parameters (Value and Torque). Please note that you will have as many 66 * as these parameters as you have links. 67 * 68 * VALUE parameter has two possible meanings. If the link being described is 69 * a prismatic joint, double gives the distance (in meters) from the 70 * original position of the link. If the link being described is a revolute 71 * joint, it gives a sector(probably). 72 * 73 * The TORQUE parameter gives the current torque of the link being 74 * described. * All of the above are collected into one data structure below 75 * this text. 76 * 77 * @return Returns collection of Link States. 78 */ 79 public List<LinkState> GetLinkStateList() 80 { 81 return lastMessage.getLinkStateSet(); 82 } 83 }