Actuator Control and Mixer Definition

Dear All, Hope you are all well.

I am working on Autonomous Drones using Mavros and PX4 both in SITL and real time.

For now, I am writing the controller which will give me the forces and torques. However, I have developed the control allocation matrix to get relationship between F/torques and motor angular velocities.

I have seen some useful discussions about control the drone using /mavros/actuator_control or /mavros/target_actuator_control. I have some confusion so please help me.

  1. It is mentioned that the ā€œcontrolsā€ in /mavros/actuator_control topics are servo raw outputs, however they are actually responsible for thrust and torques (roll-pitch-yaw). I have a question, when we command on roll-pitch-yaw and thrust in /mavros/actuator_control topic, do they pass through the Mixer File in Firmware?
    In Offboard mode, when we command to actuator topics so only [Mixer].mix file is used or MulticopterMixer.cpp is also used. I am confused here.

Could some one link me how the flow will actually work after I command on /mavros_actuator control.

Thanks

I am also dealing with the same problem. I am trying to implement a simple version of px4 controller but I am confused with the mixer stuff.

Let see, if we get some expert opinion.

I asked my question in detail in here, could you please help it can be seen by replying?

Hi, I have read your questions. You are somewhat confusing yourself

Let say you already have the Effectiveness matrix ā€˜Gā€™ from geometry. Lets keep it for a while.

Now go the control structure of drone.

  1. what we have PD type position control that will give us error in position and velocity.
  2. Then we normally try to compute the drone desired attitude usually Rotation matrix or quaternion.
  3. This will help us to develop attitude control.

Basically position control gives us commulative thrust and desired attitude. The attitude control gives us desired body torques. Now you have a 4x1 vector like (F, taux, tauy, tauz).transpose().

Find B from effectivess matrix.

Get your u.

I have one question from you. If you are using this. How did you manage the default mixing strategy of PX4 because that is different.

I noted that px4 mixing matrices are constant ones for each special config and not related to momentum arms. However, I still donā€™t know how to define delta_T_sp using the acceleration setpoints coming from the velocity control part. I would apprecaite your help.

Hi @Jawad-RoboLearn. Iā€™m trying to control the actuators of quadcopter in both SITL and real-time using torque and thrust inputs. Based on what you said about "controlsā€ in /mavros/actuator_control topics being responsible for thrust and torques, I want to ask if it is possible to control the motors with these commands because Iā€™m not able to do so with the following code:

#!/usr/bin/env python3
import rospy
from mavros_msgs.msg import ActuatorControl

def talker():
	rospy.init_node('actuator_controller', anonymous=True)

	pub = rospy.Publisher('/mavros/actuator_control', ActuatorControl, queue_size=10)

	rate = rospy.Rate(100)

	msg_out = ActuatorControl()
	msg_out.group_mix = 2 # Use group 2 (auxilary controls)
	msg_out.header.frame_id = 'base_link'
	msg_out.controls = [1.0, -1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0]

	while not rospy.is_shutdown():
		msg_out.controls = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

		rospy.loginfo("Set servos high")

		msg_out.header.stamp = rospy.Time.now()
		pub.publish(msg_out)
		rate.sleep()

if __name__ == '__main__':
	try:
		talker()
	except rospy.ROSInterruptException:
		pass

Before running the above script, Iā€™m running a script which first sets the drone in offboard mode using the ā€˜mavros/set_modeā€™ service and the drone moves to an altitude of 1m.

After running the second script, I stop the first one(which sets the drone in offboard mode) to observe if the motor commands are observable. But it is not working as desired. Iā€™m implementing this using PX4-Autopilot v1.11.2 in gazebo-sitl. Any idea where Iā€™m going wrong?

TIA