Difference between revisions of "HamsterAPIJava"
Line 30: | Line 30: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
public Image getCameraImage() throws HamsterError | public Image getCameraImage() throws HamsterError | ||
− | + | |- | |
− | Method Description | + | |Method Description || |
Retrieves the camera image from the hamster. | Retrieves the camera image from the hamster. | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | + | |- | |
− | Return values | + | |Return values || |
Image. | Image. | ||
+ | |- | ||
+ | |Possible Errors (HamsterError) || | ||
+ | *Empty Buffer. | ||
+ | *Connection Issue. | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
+ | !Method Name !! | ||
public Pose getPose() throws HamsterError | public Pose getPose() throws HamsterError | ||
+ | |- | ||
+ | | Method Description || | ||
+ | * Retrieves the global pose of the hamster. | ||
+ | * The global pose is associated with the SLAM part of the hamster. | ||
+ | * Buffer Size - 1. | ||
+ | |- | ||
+ | | Return values || | ||
+ | * Pose (Global) | ||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Empty Buffer. | ||
+ | * Connection Issue. | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | + | |- | |
− | + | !Method Name !! | |
− | |||
− | - | ||
− | |||
− | |||
− | |||
− | Method Name | ||
public IMU getIMU() throws HamsterError | public IMU getIMU() throws HamsterError | ||
− | + | |- | |
− | Method Description | + | | Method Description || |
− | Retrieves the IMU information from the hamster if an IMU exists. | + | * Retrieves the IMU information from the hamster if an IMU exists. |
− | Buffer Size - 1. | + | * Buffer Size - 1. |
− | + | |- | |
− | + | | Return values || | |
− | Return values | ||
IMU | IMU | ||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Empty Buffer. | ||
+ | * Connection Issue. | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
+ | !Method Name !! | ||
public GPS getGPS() throws HamsterError | public GPS getGPS() throws HamsterError | ||
− | + | |- | |
− | Method Description | + | | Method Description || |
− | Retrieves the GPS information from the hamster is a GPS exists. | + | * Retrieves the GPS information from the hamster is a GPS exists. |
− | Buffer Size - 1. | + | * Buffer Size - 1. |
− | + | |- | |
− | Return values | + | | Return values || |
GPS | GPS | ||
− | + | |- | |
− | Possible Errors (HamsterError) | + | | Possible Errors (HamsterError) || |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
− | + | |} | |
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
public LidarScan getLidarScan() throws HamsterError | public LidarScan getLidarScan() throws HamsterError | ||
− | + | |- | |
− | Method Description | + | | Method Description || |
Retrieves the 360 degree lidar scan from the hamster. | Retrieves the 360 degree lidar scan from the hamster. | ||
Buffer Size - 1. | Buffer Size - 1. |
Revision as of 13:02, 28 February 2017
HamsterAPI Class Documentation
Hamster class File Description All methods below belong to the module HamsterAPI and are a part of the Hamster class HamsterAPIClientJava/Hamster.java The hamster class is the main interface to the Hamster robot.
Constructor
Method Name |
Constructor:
|
---|---|
Method Description |
The client parameters contain the following:
Otherwise it will go to base_adress.agent_id For example : base_address = 10.0.2 agent_id = 1 so it will connect to 10.0.2.1:port
|
Return values | |
Possible Errors (HamsterError) | * Connection Issue. |
Method Name |
public Image getCameraImage() throws HamsterError |
---|---|
Method Description |
Retrieves the camera image from the hamster. Buffer Size - 1. |
Return values |
Image. |
Possible Errors (HamsterError) |
|
Method Name |
public Pose getPose() throws HamsterError |
---|---|
Method Description |
|
Return values |
|
Possible Errors (HamsterError) |
|
Method Name |
public IMU getIMU() throws HamsterError |
---|---|
Method Description |
|
Return values |
IMU |
Possible Errors (HamsterError) |
|
Method Name |
public GPS getGPS() throws HamsterError |
---|---|
Method Description |
|
Return values |
GPS |
Possible Errors (HamsterError) |
|
Method Name |
public LidarScan getLidarScan() throws HamsterError |
---|---|
Method Description |
Retrieves the 360 degree lidar scan from the hamster. Buffer Size - 1. Return values LidarScan Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves a ColoredScan. ColoredScan is a combination of the hamster lidar and camera synchronized. It contains the raw lidar scan and the associated pixels RGB color of the image. Buffer Size - 1 Return values ColoredScan Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the current speed of the hamster. The is usually the speed given by the latest speed command or from the wandering / navigation. Buffer Size - 1. Return values Speed Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the current mode of the hamster. The available modes are: - Localization. - Mapping. Buffer Size - 1. Return values HamsterMode Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the current SLAM map that was loaded or created by the hamster as an occupancy grid. Buffer Size - 1. Return values OccupancyGrid Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the currently living hamsters on the network. Meaning that for example there are 3 hamsters on the same network {agent1, agent2, agent3}. If the current hamster got a heartbeat from all the others, there will be 3 connections on the list. Buffer Size - 1. Return values HamsterConnections Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the current battery state of the hamster. Buffer Size - 1. Return values BatteryState Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the current network state of the hamster with the network. Buffer Size - 1. Return values NetworkState Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Description Retrieves the navigation state of the hamster. The navigation state depends whether there was a goal request or not. There are four types of states: - Offline. - In Progress. - Reached Goal. - Failure. Buffer Size - 1. Return values NavigationState Possible Errors (HamsterError) - Empty Buffer. - Connection Issue.
Method Description Sends a speed request to the hamster. If there is an active goal, the speed request will be ignored and a HamsterError will be thrown. This method is based on ackermann speed.
Method Description Sends an Occupancy Grid to the server to be published. Can be viewed via RViz. Return values Possible Errors (HamsterError) -Connection issue
Method Description Switches hamster mode to one of the following: - Mapping. - Localization. Return values Possible Errors (HamsterError) - Connection Issue.
public void navigateTo(Goal goal) throws HamsterError Method Description Navigates to a given goal. The goal can be either local goal or global goal. Return values Possible Errors (HamsterError) - Connection Issue.
Method Description Navigates to a given distance and angle. This is simillar to giving a local goal with distance and angle calculated to X and Y. Return values Possible Errors (HamsterError) - Connection Issue.
Method Description Sets the initial position of the agent on the global map. This is useful for a starting 0,0 position for mapping or if an agent needs to reposition to a starting position. Return values Possible Errors (HamsterError) - Connection Issue.
Method Name public void stopNavigation() throws HamsterError Method Description Stops the navigation if there is an active goal. Return values Possible Errors (HamsterError) - Connection Issue.
Return values AgentID (Integer) Possible Errors (HamsterError)
Return values float Possible Errors (HamsterError)
Method Description Checks whether the client is still connected to the server. A connection problem can arise from heartbeat failure or from FIN from the server side. Return values boolean Possible Errors (HamsterError)
Method Description Cleans all the buffers for all the messages (this includes the text messages). Return values Possible Errors (HamsterError)
public void sendDataMessage(DataMessage message) throws HamsterError Method Description Sends a data message to another hamster. This will be published on the network with the current agent id and the target agent id. If the target is in the network, it will receive it. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount) - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). Return values Possible Errors (HamsterError) - Connection Issue.
public void sendBroadcastDataMessage(String message) throws HamsterError
Return values Possible Errors (HamsterError) - Connection Issue.
public List<DataMessage> getLatestDataMessages(Integer amount) throws HamsterError public DataMessage popLatestDataMessage() throws HamsterError public List<DataMessage> popLatestDataMessages(Integer amount) throws HamsterError Method Description Gets/Pops the data messages that were received from the other agents. Will try to get the max possible messages untill the given amount. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount). - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage). Buffer Size - Determined by setDataMessageBufferSize, Defaults to 1000. Return values DataMessage, List<DataMessage> Possible Errors (HamsterError) -Empty Buffer. -Connection Issue.
Method Name public boolean hasDataMessages() Method Description Checks whether there are any messages. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount). - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). Return values boolean Possible Errors
Method Name public Integer getDataMessagesAmount() Method Description Getter for the amount of data messages. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount). - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) Return values Integer Possible Errors (HamsterError)
Method Description Cleans the data message buffer completely. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount). - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) Return values Possible Errors (HamsterError)
public void setDataMessageBufferSize(Integer size)
Setter for the size of the data message buffer. The following API can be used for messages: - hasDataMessages(). - getLatestDataMessage(). - getLatestDataMessages(Amount). - getDataMessagesAmount(). - clearDataMessagesBuffer(). - setDataMessageBufferSize(Amount). - getDataMessageBufferSize(). - sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage)
Return values Possible Errors (HamsterError)
Method Description Tries to reconnect to the server. Return values Possible Errors (HamsterError) - Connection Issue.
Method Name public void disconnect() Method Description Disconnects from the server. Return values Possible Errors (HamsterError) |