31 std::string base_topic_name, std::string frame_id)
33 _impl(
std::make_shared<
Impl>()) {
38 ok &=
_impl->pose_with_covariance.Init(
41 log_error(
"AutowareGNSSPublisher: failed to initialise writers for",
50 std::uint32_t nanoseconds,
51 float tx,
float ty,
float tz,
52 float pitch_deg,
float yaw_deg,
float roll_deg,
53 double mgrs_offset_x,
double mgrs_offset_y,
double mgrs_offset_z) {
59 auto *pose =
_impl->pose.GetMessage();
60 pose->position.x =
static_cast<double>(tq.
translation[0]) + mgrs_offset_x;
61 pose->position.y =
static_cast<double>(tq.
translation[1]) + mgrs_offset_y;
62 pose->position.z =
static_cast<double>(tq.
translation[2]) + mgrs_offset_z;
63 pose->orientation.w = tq.
rotation[0];
64 pose->orientation.x = tq.
rotation[1];
65 pose->orientation.y = tq.
rotation[2];
66 pose->orientation.z = tq.
rotation[3];
68 auto *pwcs =
_impl->pose_with_covariance.GetMessage();
69 pwcs->header.stamp.sec = seconds;
70 pwcs->header.stamp.nanosec = nanoseconds;
72 pwcs->pose.pose = *pose;
73 pwcs->pose.covariance = {};
79 ok &=
_impl->pose.Publish();
80 ok &=
_impl->pose_with_covariance.Publish();
PublisherImpl< AutowareGnssPoseTraits > pose
PublisherImpl< AutowareGnssPoseWithCovarianceTraits > pose_with_covariance
AutowareGNSSPublisher(std::string base_topic_name, std::string frame_id)
std::shared_ptr< Impl > _impl
bool Publish() override
Publishes both topics.
~AutowareGNSSPublisher() override
bool Write(std::int32_t seconds, std::uint32_t nanoseconds, float tx, float ty, float tz, float pitch_deg, float yaw_deg, float roll_deg, double mgrs_offset_x, double mgrs_offset_y, double mgrs_offset_z)
Fill both pose messages from the sensor's CARLA world transform (translation in meters,...
const std::string & GetBaseTopicName() const noexcept
const std::string & GetFrameId() const noexcept
TransformQuaternion TransformFromCarlaRotation(float tx, float ty, float tz, float pitch_deg, float yaw_deg, float roll_deg) noexcept
This file contains definitions of common data structures used in traffic manager.
static void log_error(Args &&... args)
Middleware-neutral QoS profile passed to IPublisherMiddleware::Init / ISubscriberMiddleware::Init whe...
static QosProfile ReliableVolatile()
RELIABLE / VOLATILE / KEEP_LAST depth 1 — the profile tier4 uses for the Autoware report publishers.