ROS Serial C client library
ros/src/ros.c File Reference

ROS Serial C library implementation. More...

#include "ros.h"
Include dependency graph for ros.c:

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

Detailed Description

ROS Serial C library implementation.

Date:
04/19/2013
Author:
Peter Rudolph

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.

License:
This library is released under LGPLv3.

Function Documentation

void rosInit ( char *  private_namespace)

Initializes ROS.

Parameters:
private_namespacethe 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"

Here is the call graph for this function:

Checks if nodehandle is still alive.

Return values:
ROS_NOT_OKcomparable with false
ROS_OKcomparable with true

Example Usage:

    while(rosOk())
    {
      // Do something here.
    }

Here is the caller graph for this function:

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

Here is the call graph for this function:

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();

Here is the call graph for this function:

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();
    }

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines