We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I get the drone's local position such as (x,y,z)?
The text was updated successfully, but these errors were encountered:
@HanXiao485 Hello. Yes you can do it by subscribing to /fmu/out/vehicle_local_position, you can do something like this in your codebase:
/fmu/out/vehicle_local_position
# Imports import rclpy from px4_msgs.msg import VehicleLocalPosition # Subscribe (you can put this in your drone class) self.vehicle_local_position_subscriber = self.create_subscription( VehicleLocalPosition, '/fmu/out/vehicle_local_position', self.vehicle_local_position_callback, qos_profile) self.vehicle_local_position = VehicleLocalPosition() # Callback def vehicle_local_position_callback(self, vehicle_local_position): """Callback function for vehicle_local_position topic subscriber.""" self.vehicle_local_position = vehicle_local_position print(vehicle_local_position.x) print(vehicle_local_position.y) print(vehicle_local_position.z)
Sorry, something went wrong.
No branches or pull requests
Can I get the drone's local position such as (x,y,z)?
The text was updated successfully, but these errors were encountered: