Skip to content

Commit

Permalink
Merge pull request #15 from tiiuae/microxrce-migrate
Browse files Browse the repository at this point in the history
MicroXRCE migrate
  • Loading branch information
Jari Nippula authored Sep 27, 2022
2 parents da1658f + ba971d9 commit 0be09ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/mocap_pose/mocap_pose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <rclcpp/rclcpp.hpp>
//#include <std_msgs/msg/string.hpp>

const std::string kGpsSensorTopic = "/fmu/in/SensorGps";

/// ROS2 Driver for Qualisys Motion Capture (Mocap) system
/// Provides "fake GPS" messages for selected Mocap object (set up with ROS2 parameters)
class MocapPose : public rclcpp::Node
Expand Down
4 changes: 2 additions & 2 deletions src/mocap_pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ MocapPose::MocapPose() : Node("MocapPose"), impl_(new MocapPose::Impl()), minTim
impl_->cb_handle_lon = impl_->param_subscriber->add_parameter_callback("home_lon", callback);
impl_->cb_handle_alt = impl_->param_subscriber->add_parameter_callback("home_alt", callback);

impl_->publisher = create_publisher<px4_msgs::msg::SensorGps>("fmu/sensor_gps/in", 10);
impl_->publisher = create_publisher<px4_msgs::msg::SensorGps>(kGpsSensorTopic, 10);
impl_->worker_thread_running = true;
impl_->worker_thread = std::thread(&MocapPose::WorkerThread, this);
}
Expand Down Expand Up @@ -354,7 +354,7 @@ void MocapPose::WorkerThread()
#endif
const auto timestamp = rclcpp::Clock().now();
const auto gps_timestamp = QualisysToRosTimestamp(rtPacket->GetTimeStamp());
const auto gps_msg = impl_->PrepareGpsMessage(Pos, Q, gps_timestamp, timestamp);
const auto gps_msg = impl_->PrepareGpsMessage(Pos, Q, timestamp, timestamp);
const bool time_to_publish = (impl_->last_published_timestamp.seconds() +
impl_->publishing_timestep) <= timestamp.seconds();

Expand Down

0 comments on commit 0be09ff

Please sign in to comment.