Is there a concise way to initialize a message with specific values?
Whenever I need to instantiate a message with specific values (in test code, for example), I end up writing something like this:
geometry_msgs::msg::Pose my_pose;
my_pose.position.x = 0.1;
my_pose.position.y = 0.2;
my_pose.position.z = 0.3;
my_pose.orientation.x = 0.5;
my_pose.orientation.y = 0.5;
my_pose.orientation.z = 0.5;
my_pose.orientation.w = 0.5;
Is there a more concise way to do this? I was hoping for something closer to a uniform initialization approach like below, but it doesn't seem to play nicely with how the message classes are implemented.
geometry_msgs::msg::Pose my_pose{ geometry_msgs::msg::Point { 0.1, 0.2, 0.3 }, geometry_msgs::msg::Quaternion { 0.5, 0.5, 0.5, 0.5 } };