import os
from ament_index_python.packages import get_package_share_directory
import rclpy
import csv
from rclpy.node import Node
from rclpy.qos import QoSProfile, QoSReliabilityPolicy, QoSHistoryPolicy, QoSDurabilityPolicy
from geometry_msgs.msg import Twist, PoseStamped, Vector3, Quaternion
from std_msgs.msg import Bool
from px4_msgs.msg import VehicleCommand
import time
import math
def __init__(self):
super().__init__('mission_one')
qos_profile = QoSProfile(
reliability=QoSReliabilityPolicy.BEST_EFFORT,
durability=QoSDurabilityPolicy.TRANSIENT_LOCAL,
history=QoSHistoryPolicy.KEEP_LAST,
depth=10
)
# Subscriptions
self.position_subscriber = self.create_subscription(
PoseStamped,
'/px4_visualizer/vehicle_pose',
self.position_callback,
10
) #should be fixed to local position
# Publishers
self.velocity_publisher = self.create_publisher(
Twist,
'/offboard_velocity_cmd',
qos_profile
)
self.position_publisher = self.create_publisher(
PoseStamped,
'/offboard_position_cmd',
qos_profile
)
self.arm_publisher = self.create_publisher(
Bool,
'/arm_message',
qos_profile
)
self.vtol_publisher_fw = self.create_publisher(
Bool,
'/vtol_message_fw',
qos_profile
)
self.vtol_publisher_mc = self.create_publisher(
Bool,
'/vtol_message_mc',
qos_profile
)
self.create_subscription(msg_type, topic_name, callback, qos_profile)
self.create_publisher(msg_type, topic_name, qos_profile)