-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Description
I have a native dds application that communicates with ROS2, for the most part it works perfectly fine. However I just added a publisher for some joint trajectories, which now fails with the InvalidArgumentError.
The C++ snippet:
trajectory_msgs::msg::dds_::JointTrajectory_ msg{};
SetHeader(msg.header(), "base_link");
std::vector<std::string> joint_names;
joint_names.reserve(joint_targets.size());
std::vector<double> positions;
positions.reserve(joint_targets.size());
for (const auto& [name, position] : joint_targets) {
joint_names.push_back(name);
positions.push_back(static_cast<double>(position));
}
msg.joint_names(joint_names);
msg.points({trajectory_msgs::msg::dds_::JointTrajectoryPoint_{positions, {}, {}, {}, builtin_interfaces::msg::dds_::Duration_{0, 0}}});
// Small abstraction calls write on the DataWriter
const auto res = right_joint_publisher_->Write(msg);If I don't put the positions into the trajectory_msgs::msg::dds_::JointTrajectoryPoint_ struct it sends fine, but as it is above it throws the error.
#ifndef __trajectory_msgs__msg__JointTrajectory__idl
#define __trajectory_msgs__msg__JointTrajectory__idl
#include "std_msgs/msg/Header.idl"
#include "trajectory_msgs/msg/JointTrajectoryPoint.idl"
module trajectory_msgs {
module msg {
module dds_ {
@final @topic struct JointTrajectory_ {
std_msgs::msg::dds_::Header_ header;
sequence<string> joint_names;
sequence<trajectory_msgs::msg::dds_::JointTrajectoryPoint_> points;
};
};
};
};
#endif // __trajectory_msgs__msg__JointTrajectory__idl#ifndef __trajectory_msgs__msg__JointTrajectoryPoint__idl
#define __trajectory_msgs__msg__JointTrajectoryPoint__idl
#include "builtin_interfaces/msg/Duration.idl"
module trajectory_msgs {
module msg {
module dds_ {
@final struct JointTrajectoryPoint_ {
sequence<double> positions;
sequence<double> velocities;
sequence<double> accelerations;
sequence<double> effort;
builtin_interfaces::msg::dds_::Duration_ time_from_start;
};
};
};
};
#endif // __trajectory_msgs__msg__JointTrajectoryPoint__idl
Error:
terminate called after throwing an instance of 'dds::core::InvalidArgumentError'
what(): Error Bad Parameter - write failed.
===============================================================================
Context : void org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::write
Node : UnknownNode
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels