Mavros angular velocity
Hello Dear community.
I am running a simple code to flight the drone in off-board mode. The drone reach an altitude of 1.6 meters without problems. Now I would like to rotate the drone over the Z axes. I am able to do that with the below code but rotation of the drone in the real life is to fast and I want to decrease that angular velocity. How can I rotate over the Z axis with slow angular velocity?
This is my code:
import rospy
import ast
import mavros
from std_msgs.msg import String
from geometry_msgs.msg import Point
from geometry_msgs.msg import Pose
from time import sleep
import re
from tf.transformations import quaternion_from_euler
import numpy as np
from time import sleep
mavros.set_namespace()
class data_processing():
def __init__(self):
self.yawVal = 0
self.sub = rospy.Subscriber("/Face_recognition/Searching", String, self.callback)
def callback(self, data):
two_pi = 2*3.14159265359
pose = Pose()
#velocity_msg = Twist()
if data.data =="Searching"and self.yawVal<two_pi:
X = 0
Y = 0
Z = 1.6
rVal = 0
pVal = 0
self.yawVal += 0.1
print("Yaw value: ", self.yawVal)
pose.position.x = X
pose.position.y = Y
pose.position.z = Z
quat = quaternion_from_euler(rVal, pVal, self.yawVal)
pose.orientation.x = quat[0]
pose.orientation.y = quat[1]
pose.orientation.z = quat[2]
pose.orientation.w = quat[3]
#print("position: ", pose.orientation)
pub.publish(pose)
else:
self.yawVal = 0
if __name__ == "__main__":
print("Searching node ready")
rospy.init_node('Searching_node', anonymous=True)
pub = rospy.Publisher('/Face_recognition/coordinates', Pose, queue_size=10)
rate = rospy.Rate(10) # 10hz
drone_data = data_processing()
rospy.spin()
The topic /Face_recognition/coordinates
publish to one node who publish to mavros.
Should I use /mavros/local_position/pose
and /mavros/local_position/velocity
?
I need help please.