Difference between revisions of "HamsterAPICPP"
Line 371: | Line 371: | ||
* Navigates to a given goal. | * Navigates to a given goal. | ||
* The goal can be either local goal or global goal. | * The goal can be either local goal or global goal. | ||
− | |||
|- | |- | ||
| Return values || | | Return values || | ||
− | |||
|- | |- | ||
| Possible Errors (HamsterError) || | | Possible Errors (HamsterError) || | ||
Line 387: | Line 385: | ||
|- | |- | ||
!Method Name !! void navigateTo(float distance, float angle) | !Method Name !! void navigateTo(float distance, float angle) | ||
− | |||
|- | |- | ||
| Method Description || | | 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. | 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 || | | Return values || | ||
Line 404: | Line 400: | ||
!Method Name !! | !Method Name !! | ||
void setInitialPose(const Pose & pose) | void setInitialPose(const Pose & pose) | ||
− | |||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
* Sets the initial position of the agent on the global map. | * 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. | * This is useful for a starting 0,0 position for mapping or if an agent needs to reposition to a starting position. | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
Line 417: | Line 410: | ||
* Connection Issue. | * Connection Issue. | ||
|} | |} | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 429: | Line 423: | ||
* Connection Issue. | * Connection Issue. | ||
|} | |} | ||
− | |||
− | |||
− | |||
Line 441: | Line 432: | ||
|- | |- | ||
| Return values || AgentID | | Return values || AgentID | ||
− | |||
|- | |- | ||
|Possible Errors || (HamsterError) | |Possible Errors || (HamsterError) | ||
Line 453: | Line 443: | ||
|Method Description | |Method Description | ||
Getter for the lidar resolution | Getter for the lidar resolution | ||
− | |||
|- | |- | ||
|Return values || float | |Return values || float | ||
− | |||
|- | |- | ||
|Possible Errors || (HamsterError) | |Possible Errors || (HamsterError) | ||
|} | |} | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 465: | Line 454: | ||
!Method Name !! | !Method Name !! | ||
bool isConnected()const | bool isConnected()const | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
* Checks whether the client is still connected to the server. | * 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. | * A connection problem can arise from heartbeat failure or from FIN from the server side. | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
bool | bool | ||
− | |||
|- | |- | ||
− | |Possible Errors | + | |Possible Errors (HamsterError) || |
|} | |} | ||
Line 485: | Line 471: | ||
!Method Name !! | !Method Name !! | ||
void cleanBuffers() | void cleanBuffers() | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
* Cleans all the buffers for all the messages (this includes the text messages). | * Cleans all the buffers for all the messages (this includes the text messages). | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
− | |||
|- | |- | ||
− | |Possible Errors | + | |Possible Errors (HamsterError) || |
|} | |} | ||
Line 513: | Line 496: | ||
* getDataMessageBufferSize(). | * getDataMessageBufferSize(). | ||
* sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). | * sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
Line 519: | Line 501: | ||
|Possible Errors || (HamsterError) | |Possible Errors || (HamsterError) | ||
* Connection Issue. | * Connection Issue. | ||
− | | | + | |} |
+ | |||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
!Method Name !! | !Method Name !! | ||
* void sendBroadcastDataMessage(const DataMessage & message) | * void sendBroadcastDataMessage(const DataMessage & message) | ||
− | * void sendBroadcastDataMessage(const std::string & message) | + | * void sendBroadcastDataMessage(const std::string & message) |
− | |||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Line 539: | Line 521: | ||
* sendDataMessage(Agent, DataMessage). | * sendDataMessage(Agent, DataMessage). | ||
* sendBroadcastDataMessage(DataMessage) | * sendBroadcastDataMessage(DataMessage) | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
|- | |- | ||
− | |Possible Errors | + | |Possible Errors (HamsterError) || |
* Connection Issue. | * Connection Issue. | ||
|} | |} | ||
Line 553: | Line 534: | ||
* DataMessage getLatestDataMessage()const std::vector<DataMessage> getLatestDataMessages(uint32_t amount)const | * DataMessage getLatestDataMessage()const std::vector<DataMessage> getLatestDataMessages(uint32_t amount)const | ||
* DataMessage popLatestDataMessage() std::vector<DataMessage> popLatestDataMessages(uint32_t amount) | * DataMessage popLatestDataMessage() std::vector<DataMessage> popLatestDataMessages(uint32_t amount) | ||
− | |||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Line 568: | Line 547: | ||
* sendBroadcastDataMessage(DataMessage). | * sendBroadcastDataMessage(DataMessage). | ||
Buffer Size - Determined by setDataMessageBufferSize, Defaults to 1000. | Buffer Size - Determined by setDataMessageBufferSize, Defaults to 1000. | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
DataMessage, std::vector<DataMessage> | DataMessage, std::vector<DataMessage> | ||
− | |||
|- | |- | ||
− | |Possible Errors | + | |Possible Errors (HamsterError) || |
* Empty Buffer. | * Empty Buffer. | ||
* Connection Issue. | * Connection Issue. | ||
Line 584: | Line 561: | ||
!Method Name !! | !Method Name !! | ||
bool hasDataMessages()const | bool hasDataMessages()const | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Line 596: | Line 572: | ||
- getDataMessageBufferSize(). | - getDataMessageBufferSize(). | ||
- sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). | - sendDataMessage(Agent, DataMessage). -sendBroadcastDataMessage(DataMessage). | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
Line 608: | Line 583: | ||
!Method Name !! | !Method Name !! | ||
uint32_t getDataMessagesAmount()const | uint32_t getDataMessagesAmount()const | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Line 620: | Line 594: | ||
- getDataMessageBufferSize(). | - getDataMessageBufferSize(). | ||
- sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | - sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
uint32_t | uint32_t | ||
− | |||
|- | |- | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || | ||
− | + | |} | |
{| class="wikitable" | {| class="wikitable" | ||
Line 633: | Line 605: | ||
!Method Name !! | !Method Name !! | ||
void clearDataMessagesBuffer() | void clearDataMessagesBuffer() | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Line 646: | Line 617: | ||
* getDataMessageBufferSize(). | * getDataMessageBufferSize(). | ||
* sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | * sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
Line 657: | Line 627: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
− | !Method Name !! | + | !Method Name !! |
− | |||
void setDataMessageBufferSize(uint32_t amount) | void setDataMessageBufferSize(uint32_t amount) | ||
− | |||
|- | |- | ||
− | |Method Description || | + | |Method Description || |
− | |||
Setter for the size of the data message buffer. | Setter for the size of the data message buffer. | ||
The following API can be used for messages: | The following API can be used for messages: | ||
Line 674: | Line 641: | ||
* getDataMessageBufferSize(). | * getDataMessageBufferSize(). | ||
* sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | * sendDataMessage(Agent, DataMessage). - sendBroadcastDataMessage(DataMessage) | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
− | |||
|- | |- | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || | ||
Line 702: | Line 667: | ||
|Return values || | |Return values || | ||
uint32_t | uint32_t | ||
− | |||
|- | |- | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || | ||
Line 715: | Line 679: | ||
!Method Name !! | !Method Name !! | ||
void reconnect() | void reconnect() | ||
− | |||
|- | |- | ||
|Method Description || | |Method Description || | ||
Tries to reconnect to the server. | Tries to reconnect to the server. | ||
− | |||
|- | |- | ||
|Return values || | |Return values || | ||
− | |||
|- | |- | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || |
Revision as of 10:14, 28 February 2017
HamsterAPI Class Documentation
Hamster class File Description All methods below belong to the namespace HamsterAPI:: and are a part of the Hamster class HamsterAPIClientCPP/Hamster.h The hamster class is the main interface to the Hamster robot.
Method Name | Constructor: Hamster(const AgentID & agent_id, HamsterClientParameters params = HamsterClientParameters())! |
---|---|
Method Description |
The client parameters contain the following:
- if the address is 127.0.0 then the connection will always go to loopback - 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) |
Method Name | Image getCameraImage() const |
---|---|
Method Description |
|
Return values | Image |
Possible Errors (HamsterError) |
|
Method Name | Pose getPose()const |
---|---|
Method Description |
|
Return values |
|
Possible Errors (HamsterError) |
|
Method Name | IMU getIMU()const |
---|---|
Method Description |
|
Return values | IMU |
Possible Errors (HamsterError) |
|
Method Name | GPS getGPS()const |
---|---|
Method Description |
|
Return values | GPS |
Possible Errors (HamsterError) |
|
Method Name | LidarScan getLidarScan()const |
---|---|
Method Description |
Retrieves the 360 degree lidar scan from the hamster. Buffer Size - 1. |
Return values |
LidarScan |
Possible Errors (HamsterError) |
|
Method Name |
ColoredScan getColoredScan()const |
---|---|
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) |
|
Method Name | Speed getSpeed()const |
---|---|
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) |
|
Method Name |
HamsterMode getHamsterMode()const |
---|---|
Method Description |
Retrieves the current mode of the hamster. The available modes are:
Buffer Size - 1. |
Return values |
HamsterMode |
Possible Errors (HamsterError) |
|
Method Name |
OccupancyGrid getSLAMMap()const |
---|---|
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) |
|
Method Name |
HamsterConnections getConnectedHamsters()const |
---|---|
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 an heartbeat from all the others, there will be 3 connections on the list. Buffer Size - 1. |
Return values |
HamsterConnections |
Possible Errors (HamsterError) |
|
Method Name |
BatteryState getBatteryState()const |
---|---|
Method Description |
Retrieves the current battery state of the hamster. Buffer Size - 1. |
Return values |
BatteryState |
Possible Errors (HamsterError) |
|
Method Name |
NetworkState getNetworkState()const |
---|---|
Method Description |
Retrieves the current network state of the hamster with the network. Buffer Size - 1. |
Return values |
NetworkState |
Possible Errors (HamsterError) |
|
Method Name |
NavigationState getNavigationState()const |
---|---|
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:
Buffer Size - 1. |
Return values |
NavigationState |
Possible Errors (HamsterError) |
|
Method Name |
void sendSpeed(float velocity, float wheels_angle) |
---|---|
Method Description |
* This method is based on ackermann speed.
|
Return values | |
Possible Errors (HamsterError) |
|
Method Name |
void sendOccupancyGrid(const OccupancyGrid & grid) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Method Description |
Sends an Occupancy Grid to the server to be published. Can be viewed via RViz. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return values | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Possible Errors (HamsterError)
-Connection issue
|