Cannot publish in vehicle attitude from "Writing your first application" in PX4 User Guide

I’m trying to control the actuators and move the quad around in JMavSim. So far I’ve completed writing my first application from the Development section of the PX4 User guide. However I cannot send messages to the vehicle attitude topic to control the actuators. I tried publishing to the actuator control topic but had no success.
Reference to my code- Final code at the end. What should I do to be able to actually control the actuators?


At first uou make mistake thinking that "Final code at the end " controled actuator. This code just get vehicle’s sensors data and publish it out from vehicle.

If you want get direct actuator control… hmm… you can look this. Don’t know can it help…

But anyway, I think directly control actuators is a badway, and make onboard app is a badway too.

But if you want, have fun!

With best regrets.

Hey! Thank you for your reply. I don’t really want actuator control, I just want to be able to move the quad around with the C code I tried using the vehicle_attitude_setpoint message but that didn’t do anything. Here’s the code-

    struct vehicle_attitude_setpoint_s att;
	memset(&att, 0, sizeof(att));
	orb_advert_t att_pub = orb_advertise(ORB_ID(vehicle_attitude_setpoint), &att);

    att.q_d[0] = 1.5;
	att.q_d[1] = 2.6;
	att.q_d[3] = 2.7;
    att.q_d[4] = 1.7;

	orb_publish(ORB_ID(vehicle_attitude_setpoint), att_pub, &att);