ROS Serial C client library
|
ROS Serial C library implementation. More...
#include "ros.h"
Functions | |
void | rosInit (char *private_namespace) |
Initializes ROS. | |
rosReturnCode_t | rosOk (rosNodeHandle_t *nodehandle) |
Checks if nodehandle is still alive. | |
void | rosSpin (rosNodeHandle_t *nodehandle) |
Spins global nodehandle continously. | |
void | rosSpinOnce (rosNodeHandle_t *nodehandle) |
Spins global nodehandle once. | |
void | rosSleep (uint32_t milliseconds) |
Sleep given duration. | |
void | rosShutdown () |
Shutdown ROS. | |
Variables | |
char * | g_namespace |
ROS Serial C library implementation.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
void rosInit | ( | char * | private_namespace | ) |
Initializes ROS.
private_namespace | the namespace all topics are published or subscribed in |
Example Usage:
// init ROS rosInit(NULL); // Nothing is prepended befor topic name
or
// init ROS rosInit("my_namespace"); // topics are published as "/my_namespace/topic_name"
rosReturnCode_t rosOk | ( | rosNodeHandle_t * | nodehandle | ) |
Checks if nodehandle is still alive.
ROS_NOT_OK | comparable with false |
ROS_OK | comparable with true |
Example Usage:
while(rosOk()) { // Do something here. }
void rosShutdown | ( | ) |
Shutdown ROS.
Kills global nodehandle and powers down the board if desired.
void rosSleep | ( | uint32_t | milliseconds | ) |
Sleep given duration.
Used for achieving a desired timing. If you want to achieve a continous to use rosRate_t
void rosSpin | ( | rosNodeHandle_t * | nodehandle | ) |
Spins global nodehandle continously.
Read continously bytes input buffer and process subscribed callbacks.
Example Usage:
// init ROS rosInit(NULL); // get pointer to global nodehandle rosNodeHandle_t* nh = rosNodeHandle(); // create message MyMessage_t my_message = rosCreateMyMessage_t(); // advertise message rosSubscriber_t* my_message_sub = nh->subscribe(&my_message.messagehandle, "MyMessage", 512, myMessageCallback); // spin ROS continously to process callbacks rosSpin();
void rosSpinOnce | ( | rosNodeHandle_t * | nodehandle | ) |
Spins global nodehandle once.
Reads all current available bytes from input buffer and process subscribed callbacks.
Example Usage:
// init ROS rosInit(NULL); // get pointer to global nodehandle rosNodeHandle_t* nh = rosNodeHandle(); // create message MyMessage_t my_message = rosCreateMyMessage_t(); // advertise message rosSubscriber_t* my_message_sub = nh->subscribe(&my_message.messagehandle, "MyMessage", 512, myMessageCallback); // enter loop while(rosOk()) { // Do something here. // spin nodehandle once to process callbacks rosSpinOnce(); }