Difference between revisions of "HamsterAPICPP"
Line 42: | Line 42: | ||
|} | |} | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | !Method Name !! Pose getPose()const | ||
+ | |- | ||
+ | | 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 || | ||
+ | * Global Pose | ||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Empty Buffer. | ||
+ | * Connection Issue. | ||
+ | |} | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Method Name !! IMU getIMU()const | ||
+ | |- | ||
+ | | Method Description | ||
+ | * Retrieves the IMU information from the hamster if an IMU exists. | ||
+ | * Buffer Size - 1. | ||
+ | |- | ||
+ | | Return values || IMU | ||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Empty Buffer. | ||
+ | * Connection Issue. | ||
+ | |} | ||
− | + | {| class="wikitable" | |
− | + | |- | |
− | + | ! Method Name !! GPS getGPS()const | |
− | + | |- | |
− | + | | Method Description || | |
− | + | * Retrieves the GPS information from the hamster is a GPS exists. | |
− | + | * Buffer Size - 1. | |
− | + | |- | |
− | + | | Return values ||GPS | |
− | + | |- | |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | - | ||
− | |||
− | |||
− | Method Name | ||
− | GPS getGPS()const | ||
− | |||
− | Method Description | ||
− | Retrieves the GPS information from the hamster is a GPS exists. | ||
− | Buffer Size - 1. | ||
− | |||
− | Return values | ||
− | GPS | ||
− | |||
− | Possible Errors (HamsterError) | ||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
− | LidarScan getLidarScan()const | + | !Method Name!! LidarScan getLidarScan()const |
− | + | |- | |
− | 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. | ||
− | + | |- | |
− | Return values | + | | Return values || |
LidarScan | LidarScan | ||
+ | |- | ||
+ | | Possible Errors (HamsterError)|| | ||
+ | *Empty Buffer. | ||
+ | *Connection Issue. | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | + | |- | |
− | Method Name | + | !Method Name !! |
ColoredScan getColoredScan()const | ColoredScan getColoredScan()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves a ColoredScan. ColoredScan is a combination of the hamster lidar and camera synchronized. | 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. | It contains the raw lidar scan and the associated pixels RGB color of the image. | ||
Buffer Size - 1 | Buffer Size - 1 | ||
− | Return values | + | |- |
+ | | Return values || | ||
ColoredScan | ColoredScan | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
+ | |} | ||
Line 131: | Line 132: | ||
− | Method Name | + | {| class="wikitable" |
− | Speed getSpeed()const | + | |- |
+ | !Method Name !! Speed getSpeed()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves the current speed of the hamster. | Retrieves the current speed of the hamster. | ||
The is usually the speed given by the latest speed command or from the wandering / navigation. | The is usually the speed given by the latest speed command or from the wandering / navigation. | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
Speed | Speed | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
+ | * Connection Issue. | ||
+ | |} | ||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
+ | !Method Name !! | ||
HamsterMode getHamsterMode()const | HamsterMode getHamsterMode()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves the current mode of the hamster. | Retrieves the current mode of the hamster. | ||
The available modes are: | The available modes are: | ||
− | + | * Localization. | |
− | + | * Mapping. | |
Buffer Size - 1. | Buffer Size - 1. | ||
− | + | |- | |
− | Return values | + | | Return values || |
HamsterMode | HamsterMode | ||
− | + | |- | |
− | Possible Errors (HamsterError) | + | | Possible Errors (HamsterError) || |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
− | + | |} | |
Line 171: | Line 179: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
OccupancyGrid getSLAMMap()const | OccupancyGrid getSLAMMap()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves the current SLAM map that was loaded or created by the hamster as an occupancy grid. | Retrieves the current SLAM map that was loaded or created by the hamster as an occupancy grid. | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
OccupancyGrid | OccupancyGrid | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
+ | |} | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
HamsterConnections getConnectedHamsters()const | HamsterConnections getConnectedHamsters()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves the currently living hamsters on the network. | Retrieves the currently living hamsters on the network. | ||
Meaning that for example there are 3 hamsters on the same network | Meaning that for example there are 3 hamsters on the same network | ||
Line 198: | Line 214: | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
HamsterConnections | HamsterConnections | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
+ | |} | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
BatteryState getBatteryState()const | BatteryState getBatteryState()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
+ | |||
Retrieves the current battery state of the hamster. | Retrieves the current battery state of the hamster. | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
BatteryState | BatteryState | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
+ | * Connection Issue. | ||
+ | |} | ||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
+ | !Method Name !! | ||
NetworkState getNetworkState()const | NetworkState getNetworkState()const | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Retrieves the current network state of the hamster with the network. | Retrieves the current network state of the hamster with the network. | ||
Buffer Size - 1. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
NetworkState | NetworkState | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
− | + | * Connection Issue. | |
+ | |} | ||
Line 246: | Line 275: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
NavigationState getNavigationState()const | NavigationState getNavigationState()const | ||
− | Method Description | + | |- |
+ | | 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: | 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. | Buffer Size - 1. | ||
− | Return values | + | |- |
+ | | Return values || | ||
NavigationState | NavigationState | ||
− | Possible Errors (HamsterError) | + | |- |
− | + | | Possible Errors (HamsterError) || | |
− | + | * Empty Buffer. | |
+ | * Connection Issue. | ||
+ | |} | ||
− | + | {| class="wikitable" | |
− | Method Name | + | |- |
+ | !Method Name !! | ||
void sendSpeed(float velocity, float wheels_angle) | void sendSpeed(float velocity, float wheels_angle) | ||
− | Method Description | + | |- |
− | Sends a speed request to the hamster. | + | | Method Description || |
− | If there is an active goal, the speed request will be ignored and an HamsterError will be thrown. | + | * Sends a speed request to the hamster. |
− | + | * If there is an active goal, the speed request will be ignored and an HamsterError will be thrown. | |
− | This method is based on ackermann speed. | + | * This method is based on ackermann speed. |
− | Return values | + | |- |
− | + | | Return values || | |
− | |||
− | |||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Connection Issue. | ||
+ | * Running Goal. | ||
+ | |} | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void sendOccupancyGrid(const OccupancyGrid & grid) | void sendOccupancyGrid(const OccupancyGrid & grid) | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Sends an Occupancy Grid to the server to be published. | Sends an Occupancy Grid to the server to be published. | ||
Can be viewed via RViz. | Can be viewed via RViz. | ||
− | Return values | + | |- |
− | Possible Errors (HamsterError) | + | | Return values || |
+ | |- | ||
+ | | Possible Errors (HamsterError) | ||
-Connection issue | -Connection issue | ||
Line 301: | Line 345: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void switchMode(const HamsterMode & mode) | void switchMode(const HamsterMode & mode) | ||
− | Method Description | + | |- |
+ | | Method Description || | ||
Switches hamster mode to one of the following: | Switches hamster mode to one of the following: | ||
− | + | * Mapping. | |
− | + | * Localization. | |
− | |||
− | |||
− | |||
− | |||
+ | |- | ||
+ | | Return values || | ||
+ | |- | ||
+ | | Possible Errors (HamsterError) || | ||
+ | * Connection Issue. | ||
+ | |} | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void navigateTo(const Goal & goal) | void navigateTo(const Goal & goal) | ||
Line 331: | Line 382: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void navigateTo(float distance, float angle) | void navigateTo(float distance, float angle) | ||
Line 355: | Line 408: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void stopNavigation() | void stopNavigation() | ||
Line 370: | Line 425: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
AgentID getAgentID()const | AgentID getAgentID()const | ||
Method Description | Method Description | ||
Line 381: | Line 438: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
float getLidarResolution()const | float getLidarResolution()const | ||
Method Description | Method Description | ||
Line 392: | Line 451: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
bool isConnected()const | bool isConnected()const | ||
Line 407: | Line 468: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void cleanBuffers() | void cleanBuffers() | ||
Line 417: | Line 480: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
● -void sendDataMessage(const AgentID & target_agent_id, const std::string & message) | ● -void sendDataMessage(const AgentID & target_agent_id, const std::string & message) | ||
Line 447: | Line 512: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
-void sendBroadcastDataMessage(const DataMessage & message) | -void sendBroadcastDataMessage(const DataMessage & message) | ||
Line 497: | Line 564: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
DataMessage getLatestDataMessage()const | DataMessage getLatestDataMessage()const | ||
Line 529: | Line 598: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
bool hasDataMessages()const | bool hasDataMessages()const | ||
Method Description | Method Description | ||
Line 546: | Line 617: | ||
Possible Errors | Possible Errors | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
uint32_t getDataMessagesAmount()const | uint32_t getDataMessagesAmount()const | ||
Line 566: | Line 639: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void clearDataMessagesBuffer() | void clearDataMessagesBuffer() | ||
Line 587: | Line 662: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void setDataMessageBufferSize(uint32_t amount) | void setDataMessageBufferSize(uint32_t amount) | ||
Line 612: | Line 689: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
uint32_t getDataMessageBufferSize()const | uint32_t getDataMessageBufferSize()const | ||
Method Description | Method Description | ||
Line 635: | Line 714: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name !! | ||
void reconnect() | void reconnect() | ||
Line 647: | Line 728: | ||
− | Method Name | + | {| class="wikitable" |
+ | |- | ||
+ | !Method Name | ||
void disconnect() | void disconnect() | ||
Revision as of 09:52, 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
|