Skip to content

Commit

Permalink
distanceGround() and direct TrajectorySetpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dakejahl committed Jul 23, 2024
1 parent bfebd82 commit 2d460ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class TrajectorySetpointType : public SetpointBase
std::optional<float> yaw_ned_rad = {},
std::optional<float> yaw_rate_ned_rad_s = {});

void update(const px4_msgs::msg::TrajectorySetpoint& setpoint);

private:
rclcpp::Node & _node;
rclcpp::Publisher<px4_msgs::msg::TrajectorySetpoint>::SharedPtr _trajectory_setpoint_pub;
Expand Down
6 changes: 6 additions & 0 deletions px4_ros2_cpp/include/px4_ros2/odometry/local_position.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class OdometryLocalPosition : public Subscription<px4_msgs::msg::VehicleLocalPos
const px4_msgs::msg::VehicleLocalPosition & pos = last();
return pos.heading;
}

float distanceGround() const
{
const px4_msgs::msg::VehicleLocalPosition& pos = last();
return pos.dist_bottom;
}
};

/** @}*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ void TrajectorySetpointType::update(

}

void TrajectorySetpointType::update(const px4_msgs::msg::TrajectorySetpoint& setpoint)
{
onUpdate();
_trajectory_setpoint_pub->publish(setpoint);
}

SetpointBase::Configuration TrajectorySetpointType::getConfiguration()
{
Configuration config{};
Expand Down

0 comments on commit 2d460ad

Please sign in to comment.