View Javadoc

1   package cz.cuni.amis.pogamut.usar2004.agent.module.configuration;
2   
3   import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.ConfigType;
4   
5   /**
6    * Configuration message representative for Mission packages.
7    *
8    * @author vejmanm
9    */
10  public class ConfigMissionPackage extends SuperConfiguration
11  {
12      public static final ConfigType type = ConfigType.MISSION_PACKAGE;
13  
14      /**
15       * Ctor. Configuration type describes particular subject about which
16       * we want to know about. It is used to distinguish incoming message from
17       * the server.
18       */
19      public ConfigMissionPackage()
20      {
21          super(type);
22      }
23  
24      /**
25       *
26       * Each value is the mission package’s link number(or index) that is
27       * described further by JoinType, Max/Min Torque, Max/Min Speed and Max/Min
28       * Range.
29       *
30       * @param index
31       * @return Returns link value at given index.
32       */
33      public int getLinkAt(int index)
34      {
35          return lastMessage.getLinks().get(index);
36      }
37  
38      /**
39       *
40       * Each value can either be “Revolute” or “Prismatic”, as determined by the
41       * type of joint being described.
42       *
43       * @param index
44       * @return Returns joint type value at given index.
45       */
46      public String getJointTypeAt(int index)
47      {
48          return lastMessage.getJointTypes().get(index);
49      }
50  
51      /**
52       *
53       * Each value describes the joint’s maximum speed, in rad/s.
54       *
55       * @param index
56       * @return Returns joint max speed at given index.
57       */
58      public double getMaxSpeedAt(int index)
59      {
60          if(index < getLinksLength())
61          {
62              return lastMessage.getMaxSpeeds().get(index);
63          }
64          return -1;
65      }
66  
67      /**
68       *
69       * Each value describes the joint’s maximum torque.
70       *
71       * @param index
72       * @return Returns joint max torque at given index.
73       */
74      public double getMaxTorqueAt(int index)
75      {
76          if(index < getLinksLength())
77          {
78              return lastMessage.getMaxTorques().get(index);
79          }
80          return -1;
81      }
82  
83      /**
84       * For a revolute joint, Each value is the minimum absolute angle that the
85       * joint can rotate to. For a prismatic joint, Each value is the minimum
86       * distance that the joint can move to.
87       *
88       * @param index
89       * @return Returns joint min range at given index.
90       */
91      public double getMinRangeAt(int index)
92      {
93          if(index < getLinksLength())
94          {
95              return lastMessage.getMinRanges().get(index);
96          }
97          return -1;
98      }
99  
100     /**
101      * For a revolute joint, Each value is the maximum absolute angle that the
102      * joint can rotate to. For a prismatic joint, Each value is the maximum
103      * distance that the joint can move to.
104      *
105      * @param index
106      * @return Returns joint max range at given index.
107      */
108     public double getMaxRangeAt(int index)
109     {
110         if(index < getLinksLength())
111         {
112             return lastMessage.getMaxRanges().get(index);
113         }
114         return -1;
115     }
116 
117     /**
118      * Returns length of link list.
119      * @return Returns length of link list.
120      */
121     public int getLinksLength()
122     {
123         return lastMessage.getLinks().size();
124     }
125 }