Greetings!
I am using MAVROS to control a quadcopter drone with a companion computer under OFFBOARD mode. I am able to establish the mavros communication between Pixhawk (PX4 1.15 firmware) and companion computer (Jetson device). When I tried to send GPS location target using GlobalPositionTarget mavros publisher, the drone is moving to the correct GPS location (Lat, Long), stops at the location correctly and continues to hover. However, the altitude is dropping drastically along the way while it moves from the initial location to the target location. I tried setting the altitude values to 0m, 1m, 2m, however it does not make any difference. Sharing the portion of code I am using currently below:
def construct_global_position_target(lat, lon, alt):
target_raw_globalpose = GlobalPositionTarget()
target_raw_globalpose.header.stamp = rospy.Time.now()
target_raw_globalpose.coordinate_frame = 6 #FRAME_GLOBAL_REL_ALT
target_raw_globalpose.type_mask = 4088
target_raw_globalpose.latitude= lat
target_raw_globalpose.longitude = lon
target_raw_globalpose.altitude = alt
return target_raw_globalpose
global_target_pub = rospy.Publisher('mavros/setpoint_raw/global', GlobalPositionTarget, queue_size=10)
cur_global_pos_target = construct_global_position_target(lat, lon, alt)
global_target_pub.publish(cur_global_pos_target)
I would be happy to provide more details regarding this.
Thanks in advance!