Skip to content

Commit

Permalink
publish_raw function
Browse files Browse the repository at this point in the history
  • Loading branch information
Karsten1987 committed Oct 23, 2017
1 parent 38d3725 commit 6854cd3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rcl/include/rcl/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ RCL_WARN_UNUSED
rcl_ret_t
rcl_publish(const rcl_publisher_t * publisher, const void * ros_message);

RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publish_raw(const rcl_publisher_t * publisher, const rcl_message_raw_t * raw_message);

/// Get the topic name for the publisher.
/**
* This function returns the publisher's internal topic name string.
Expand Down
3 changes: 3 additions & 0 deletions rcl/include/rcl/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ typedef rmw_ret_t rcl_ret_t;
/// Given rcl_wait_set_t is full return code.
#define RCL_RET_WAIT_SET_FULL 902

/// typedef for rmw_message_raw_t;
typedef rmw_message_raw_t rcl_message_raw_t;

#endif // RCL__TYPES_H_
13 changes: 13 additions & 0 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ rcl_publish(const rcl_publisher_t * publisher, const void * ros_message)
return RCL_RET_OK;
}

rcl_ret_t
rcl_publish_raw(const rcl_publisher_t * publisher, const rcl_message_raw_t * raw_message)
{
if (!rcl_publisher_is_valid(publisher)) {
return RCL_RET_PUBLISHER_INVALID;
}
if (rmw_publish_raw(publisher->impl->rmw_handle, raw_message) != RMW_RET_OK) {
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), rcl_get_default_allocator());
return RCL_RET_ERROR;
}
return RCL_RET_OK;
}

const char *
rcl_publisher_get_topic_name(const rcl_publisher_t * publisher)
{
Expand Down

0 comments on commit 6854cd3

Please sign in to comment.