Hi everyone
I am a beginner in ardupilot projects
I have a question which is about Guided mode(Offboard mode in px4)
this is part of my code that is wroking well with px4 but when I use it with ardupilot it is not working and it remains at its place
I tried to change cordinate frame and type_mask but I didn’t get any resualts.
mavros node is working well cuz I can get data from mavros topics
part of my code:
def construct_target(x, y, z, yaw, yaw_rate = 1):
target_raw_pose = PositionTarget()
target_raw_pose.header.stamp = rospy.Time.now()
target_raw_pose.coordinate_frame = 1
target_raw_pose.position.x = x
target_raw_pose.position.y = y
target_raw_pose.position.z = z
target_raw_pose.type_mask = PositionTarget.IGNORE_VX + PositionTarget.IGNORE_VY + PositionTarget.IGNORE_VZ \
+ PositionTarget.IGNORE_AFX + PositionTarget.IGNORE_AFY + PositionTarget.IGNORE_AFZ \
+ PositionTarget.FORCE
print(target_raw_pose.type_mask)
target_raw_pose.yaw = yaw
target_raw_pose.yaw_rate = yaw_rate
return target_raw_pose
local_target_pub = rospy.Publisher('mavros/setpoint_raw/local', PositionTarget, queue_size=10)
cur_target_pose = construct_target(0, 0, 3.2, current_heading)
while(True):
local_target_pub.publish(cur_target_pose)
time.sleep(0.1)
and data is published well too:
I publish mavrs.msgs.PositionTarget data to mavros/setpoint_raw/local and this is output of “rostopic echo mavros/setpoint_raw/local” command
header:
seq: 92
stamp:
secs: 4325
nsecs: 601000000
frame_id: ‘’
coordinate_frame: 1
type_mask: 1016
position:
x: 0.0
y: 0.0
z: 3.2
velocity:
x: 0.0
y: 0.0
z: 0.0
acceleration_or_force:
x: 0.0
y: 0.0
z: 0.0
yaw: 7.470011041732505e-05
yaw_rate: 1.0
keep in your mind same code is working perfectly with px4 in offboard mode but with ardupilot in Guided mode is not working
I’m working with a simulator and not a real copter.
OS : Ubuntu20.4
Simulator: Gazebo
I hope you guys can help me to solve this weird problem