ROS Serial C client library
ros/include/ros.h File Reference

ROS Serial C client library header. More...

#include "ros_std.h"
#include "ros_config.h"
#include "ros_types.h"
#include "ros_time.h"
#include "ros_packet.h"
#include "ros_spinner.h"
#include "ros_hardware.h"
#include "ros_os.h"
#include "TopicInfoC.h"
#include "TimeC.h"
Include dependency graph for ros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void rosInit (char *private_namespace)
 Initializes ROS.
rosNodeHandle_trosNodeHandle (char *device_id)
 Get pointer to global nodehandle.
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 rosShutdown ()
 Shutdown ROS.
rosReturnCode_t rosPublish (void *message)
 Nodehandle publish implementation.
rosPublisher_trosAdvertise (rosMessageHandle_t *messagehandle, char *topic, uint16_t buffer_size)
 Nodehandle advertise implementation.
rosSubscriber_trosSubscribe (rosMessageHandle_t *messagehandle, char *topic, uint16_t buffer_size, void(*callback)(void *message))
 Nodehandle subscribe implementation.

Detailed Description

ROS Serial C client library header.

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:

rosNodeHandle_t* rosNodeHandle ( char *  device_id)

Get pointer to global nodehandle.

Returns:
pointer to global nodehandle

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 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