chrono::ros::ChROSMessage Class Reference

Description

A mutable, schema-backed ROS 2 message (see file header).

Copyable like a lightweight handle: copies share the same underlying message.

#include <ChROSMessage.h>

Public Member Functions

void SetBool (const std::string &path, bool value)
 Set a bool-typed field.
 
void SetInt (const std::string &path, int64_t value)
 Set a signed-integer field (any int width; range-checked against the schema type).
 
void SetUInt (const std::string &path, uint64_t value)
 Set an unsigned-integer field (any width; range-checked against the schema type).
 
void SetDouble (const std::string &path, double value)
 Set a floating-point field (float32 or float64).
 
void SetString (const std::string &path, const std::string &value)
 Set a string field.
 
void SetBlob (const std::string &path, const void *data, size_t count)
 Primitive array/sequence from raw little-endian elements ('count' is the element count). More...
 
void SetBlobCopy (const std::string &path, const void *data, size_t count)
 As SetBlob, but copies the elements immediately (no lifetime requirement on 'data').
 
void SetBlobBytes (const std::string &path, const void *data, size_t nbytes)
 As SetBlobCopy, but sized in bytes (element count = nbytes / element_size, which must divide evenly). More...
 
void SetStringArray (const std::string &path, const std::vector< std::string > &value)
 Set a string array/sequence field.
 
ChROSMessage Nested (const std::string &path)
 Handle to a singular nested message field.
 
ChROSMessage AppendMessage (const std::string &path)
 Append an element to a message array/sequence and return its handle.
 
void SetTime (const std::string &path, double time_seconds)
 Fill a builtin_interfaces/Time-shaped field ("<path>.sec"/".nanosec") from seconds.
 
void Clear ()
 Remove all values set so far.
 
std::string DescribeType () const
 Pretty-print the message type's full field layout.
 

Friends

class ChROSPublisher
 
class ChROSBridge
 

Member Function Documentation

◆ SetBlob()

void chrono::ros::ChROSMessage::SetBlob ( const std::string &  path,
const void *  data,
size_t  count 
)

Primitive array/sequence from raw little-endian elements ('count' is the element count).

Zero-copy: the memory must stay valid until Publish() returns. Use SetBlobCopy when that is inconvenient.

◆ SetBlobBytes()

void chrono::ros::ChROSMessage::SetBlobBytes ( const std::string &  path,
const void *  data,
size_t  nbytes 
)

As SetBlobCopy, but sized in bytes (element count = nbytes / element_size, which must divide evenly).

For byte-oriented sources such as Python buffer-protocol objects, where only the byte length is known.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_ros/ChROSMessage.h
  • /builds/uwsbel/chrono/src/chrono_ros/ChROSMessage.cpp