Difference between revisions of "HamsterAPICPP"
Line 319: | Line 319: | ||
− | + | == void switchMode(const HamsterMode & mode) == | |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 336: | Line 336: | ||
|} | |} | ||
− | + | == void navigateTo(const Goal & goal) == | |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 352: | Line 352: | ||
− | + | == void navigateTo(float distance, float angle) == | |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 368: | Line 366: | ||
|} | |} | ||
− | + | == void setInitialPose(const Pose & pose) == | |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 385: | Line 383: | ||
+ | == void stopNavigation() == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 398: | Line 397: | ||
+ | == AgentID getAgentID()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 409: | Line 409: | ||
|} | |} | ||
+ | |||
+ | == float getLidarResolution()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 423: | Line 425: | ||
+ | == bool isConnected()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 438: | Line 441: | ||
− | + | == void cleanBuffers() == | |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 451: | Line 454: | ||
|} | |} | ||
+ | |||
+ | == sendDataMessage == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 476: | Line 481: | ||
+ | == sendBroadcastDataMessage == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 501: | Line 507: | ||
+ | == DataMessage getLatestDataMessage() == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
!Method Name !! | !Method Name !! | ||
− | * 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) | ||
|- | |- | ||
Line 529: | Line 536: | ||
+ | == bool hasDataMessages()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 552: | Line 560: | ||
|} | |} | ||
+ | |||
+ | == uint32_t getDataMessagesAmount()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 575: | Line 585: | ||
|} | |} | ||
+ | |||
+ | == void clearDataMessagesBuffer() == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 597: | Line 609: | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || | ||
|} | |} | ||
− | |||
− | |||
+ | == void setDataMessageBufferSize(uint32_t amount) == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 625: | Line 636: | ||
+ | == uint32_t getDataMessageBufferSize()const == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 650: | Line 662: | ||
− | + | == void reconnect() == | |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 668: | Line 678: | ||
+ | == void disconnect() == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 679: | Line 690: | ||
|Possible Errors (HamsterError) || | |Possible Errors (HamsterError) || | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 10:33, 28 February 2017
Contents
- 1 HamsterAPI Class Documentation
- 2 Constructor: Hamster(const AgentID & agent_id, HamsterClientParameters params = HamsterClientParameters())
- 3 Image getCameraImage() const
- 4 Pose getPose()const
- 5 IMU getIMU()const
- 6 GPS getGPS()const
- 7 LidarScan getLidarScan()const
- 8 ColoredScan getColoredScan()const
- 9 Speed getSpeed()const
- 10 HamsterMode getHamsterMode()const
- 11 OccupancyGrid getSLAMMap()const
- 12 HamsterConnections getConnectedHamsters()const
- 13 BatteryState getBatteryState()const
- 14 NetworkState getNetworkState()const
- 15 NavigationState getNavigationState()const
- 16 void sendSpeed(float velocity, float wheels_angle)
- 17 void sendOccupancyGrid(const OccupancyGrid & grid)
- 18 void switchMode(const HamsterMode & mode)
- 19 void navigateTo(const Goal & goal)
- 20 void navigateTo(float distance, float angle)
- 21 void setInitialPose(const Pose & pose)
- 22 void stopNavigation()
- 23 AgentID getAgentID()const
- 24 float getLidarResolution()const
- 25 bool isConnected()const
- 26 void cleanBuffers()
- 27 sendDataMessage
- 28 sendBroadcastDataMessage
- 29 DataMessage getLatestDataMessage()
- 30 bool hasDataMessages()const
- 31 uint32_t getDataMessagesAmount()const
- 32 void clearDataMessagesBuffer()
- 33 void setDataMessageBufferSize(uint32_t amount)
- 34 uint32_t getDataMessageBufferSize()const
- 35 void reconnect()
- 36 void disconnect()
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.
Constructor: Hamster(const AgentID & agent_id, HamsterClientParameters params = HamsterClientParameters())
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) |
Image getCameraImage() const
Method Name | Image getCameraImage() const |
---|---|
Method Description |
|
Return values | Image |
Possible Errors (HamsterError) |
|
Pose getPose()const
Method Name | Pose getPose()const |
---|---|
Method Description |
|
Return values |
|
Possible Errors (HamsterError) |
|
IMU getIMU()const
Method Name | IMU getIMU()const |
---|---|
Method Description |
|
Return values | IMU |
Possible Errors (HamsterError) |
|
GPS getGPS()const
Method Name | GPS getGPS()const |
---|---|
Method Description |
|
Return values | GPS |
Possible Errors (HamsterError) |
|
LidarScan getLidarScan()const
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) |
|
ColoredScan getColoredScan()const
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) |
|
Speed getSpeed()const
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) |
|
HamsterMode getHamsterMode()const
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) |
|
OccupancyGrid getSLAMMap()const
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) |
|
HamsterConnections getConnectedHamsters()const
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) |
|
BatteryState getBatteryState()const
Method Name |
BatteryState getBatteryState()const |
---|---|
Method Description |
Retrieves the current battery state of the hamster. Buffer Size - 1. |
Return values |
BatteryState |
Possible Errors (HamsterError) |
|
NetworkState getNetworkState()const
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) |
|
void sendSpeed(float velocity, float wheels_angle)
Method Name |
void sendSpeed(float velocity, float wheels_angle) |
---|---|
Method Description |
* This method is based on ackermann speed. |
Return values | |
Possible Errors (HamsterError) |
|
void sendOccupancyGrid(const OccupancyGrid & grid)
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) |
|
void switchMode(const HamsterMode & mode)
Method Name |
void switchMode(const HamsterMode & mode) |
---|---|
Method Description |
Switches hamster mode to one of the following:
|
Return values | |
Possible Errors (HamsterError) |
|
Method Name | void navigateTo(const Goal & goal) |
---|---|
Method Description |
|
Return values | |
Possible Errors (HamsterError) |
|
Method Name | void navigateTo(float distance, float angle) |
---|---|
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) |
|
void setInitialPose(const Pose & pose)
Method Name |
void setInitialPose(const Pose & pose) |
---|---|
Method Description |
|
Return values | |
Possible Errors (HamsterError) |
|
Method Name | void stopNavigation() |
---|---|
Method Description | Stops the navigation if there is an active goal. |
Return values | |
Possible Errors (HamsterError) |
|
AgentID getAgentID()const
Method Name | AgentID getAgentID()const |
---|---|
Method Description | Getter for the current Agent ID. |
Return values | AgentID |
Possible Errors | (HamsterError) |
float getLidarResolution()const
Method Name |
float getLidarResolution()const |
---|---|
Method Description
Getter for the lidar resolution | |
Return values | float |
Possible Errors (HamsterError) |
bool isConnected()const
Method Name | bool isConnected()const |
---|---|
Method Description |
|
Return values |
bool |
Possible Errors (HamsterError) |
void cleanBuffers()
Method Name | void cleanBuffers() |
---|---|
Method Description |
|
Return values | |
Possible Errors (HamsterError) |
sendDataMessage
Method Name |
|
---|---|
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:
|
Return values | |
Possible Errors (HamsterError) |
|
sendBroadcastDataMessage
Method Name |
|
---|---|
Method Description |
Sends a data message to all the hamsters on the network. Every hamster that see's the message will pick it up. The following API can be used for messages:
|
Return values | |
Possible Errors (HamsterError) |
|
DataMessage getLatestDataMessage()
Method Name |
|
---|---|
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:
Buffer Size - Determined by setDataMessageBufferSize, Defaults to 1000. |
Return values |
DataMessage, std::vector<DataMessage> |
Possible Errors (HamsterError) |
|
bool hasDataMessages()const
Method Name |
bool hasDataMessages()const |
---|---|
Method Description |
Checks whether there are any messages. The following API can be used for messages:
|
Return values |
bool |
Possible Errors |
uint32_t getDataMessagesAmount()const
Method Name |
uint32_t getDataMessagesAmount()const |
---|---|
Method Description |
Getter for the amount of data messages. The following API can be used for messages:
|
Return values |
uint32_t |
Possible Errors (HamsterError) |
void clearDataMessagesBuffer()
Method Name |
void clearDataMessagesBuffer() |
---|---|
Method Description |
Cleans the data message buffer completely. The following API can be used for messages:
|
Return values | |
Possible Errors (HamsterError) |
void setDataMessageBufferSize(uint32_t amount)
Method Name |
void setDataMessageBufferSize(uint32_t amount) |
---|---|
Method Description |
Setter for the size of the data message buffer. The following API can be used for messages:
|
Return values | |
Possible Errors (HamsterError) |
uint32_t getDataMessageBufferSize()const
Method Name |
uint32_t getDataMessageBufferSize()const |
---|---|
Method Description |
Getter for the size of the data message buffer.The following API can be used for messages:
|
Return values |
uint32_t |
Possible Errors (HamsterError) |
void reconnect()
Method Name |
void reconnect() |
---|---|
Method Description |
Tries to reconnect to the server. |
Return values | |
Possible Errors (HamsterError) |
|
void disconnect()
Method Name | void disconnect() |
---|---|
Method Description | Disconnects from the server. |
Return values | |
Possible Errors (HamsterError) |