File converters.hpp
↰ Parent directory (include/soar_ros/msg)
Umbrella header for ROS 2 ↔ Soar WME message converters.
Definition (include/soar_ros/msg/converters.hpp)
Detailed Description
Provides two free-function families in the soar_ros::msg namespace:
toSoar — ROS 2 message → Soar working memory sml::Identifier*toSoar(sml::Identifier*parent, constchar*attr, constMsgType&msg);
Creates a child ID WME under
parentwith attributeattrand recursively populates it to mirror the ROS 2 message field hierarchy. Returns the newly createdsml::Identifier*.
Typical use inside a soar_ros::Subscriber<T>::parse() override: voidparse(geometry_msgs::msg::PoseStampedmsg)override
{
soar_ros::msg::toSoar(m_pAgent->GetInputLink(),m_topic.c_str(),msg);
//ResultingWMEtree:
//<input-link>
//+–<topic>(ID)
//+–header(ID)
//|+–frame_id(string)
//|+–stamp(ID)
//|+–sec(int)
//|+–nanosec(int)
//+–pose(ID)
//+–position(ID)
//|+–x(float)y(float)z(float)
//+–orientation(ID)
//+–x(float)y(float)z(float)w(float)
}
fromSoar — Soar working memory → ROS 2 message TfromSoar<T>(sml::Identifier*id);
Reads the WME subtree rooted at
idand returns the corresponding ROS 2 message of typeT.
Typical use inside a soar_ros::Publisher<T>::parse() override: geometry_msgs::msg::Twistparse(sml::Identifier*id)override
{
//Soarrulewrites:
//(<output-link>^cmd<c>)
//(<c>^linear<l>^angular<a>)
//(<l>^x1.0^y0.0^z0.0)
//(<a>^x0.0^y0.0^z0.5)
returnsoar_ros::msg::fromSoar<geometry_msgs::msg::Twist>(id);
}
Supported message types
std_msgs : Bool, Int8/16/32/64, UInt8/16/32/64, Float32/64, String, Header
geometry_msgs : Vector3, Point, Point32, Quaternion, Pose, PoseStamped, PoseWithCovariance, Twist, TwistStamped, Accel, Transform, TransformStamped
WME attribute naming
Attribute names match the ROS 2 field names exactly, including underscores (e.g. frame_id, child_frame_id, nanosec). Nested message fields become child ID WMEs. The PoseWithCovariance covariance matrix is stored as 36 flat float attributes named covariance_0 … covariance_35.
Includes
soar_ros/msg/geometry_msgs_converters.hpp(File geometry_msgs_converters.hpp)soar_ros/msg/std_msgs_converters.hpp(File std_msgs_converters.hpp)