Hi. I’m using gazebo offboard mode for controlling px4 via opencv.
I have some problem in this simulation
As Below, I set the publisher to the topic mavros/setpoint_position/local and configured the message type as PoseStamped.
The Iris model is started, and position commands and yaw angle commands are functioning properly. However, quaternion angle commands in the y-direction and x-direction are not working. When observing the setpoint commands via rostopic, commands are being sent in the x and y directions, but they are not functioning properly.Also, when attempting quaternion angle control, yaw angle control works.
I would appreciate it if you could provide an answer to this.
#! /usr/bin/env python3
import rospy
from geometry_msgs.msg import PoseStamped
from mavros_msgs.msg import State
from mavros_msgs.srv import CommandBool, CommandBoolRequest, SetMode, SetModeRequest
import math
current_state = State()
def state_cb(msg):
global current_state
current_state = msg
if __name__ == "__main__":
rospy.init_node("offb_node_py")
state_sub = rospy.Subscriber("mavros/state", State, callback = state_cb)
local_pos_pub = rospy.Publisher("mavros/setpoint_position/local", PoseStamped, queue_size=10)
rospy.wait_for_service("/mavros/cmd/arming")
arming_client = rospy.ServiceProxy("mavros/cmd/arming", CommandBool)
rospy.wait_for_service("/mavros/set_mode")
set_mode_client = rospy.ServiceProxy("mavros/set_mode", SetMode)
# Setpoint publishing MUST be faster than 2Hz
rate = rospy.Rate(20)
# Wait for Flight Controller connection
while(not rospy.is_shutdown() and not current_state.connected):
rate.sleep()