Open reyes73a opened 4 years ago
you can set type_mask to ignore certain components IGNORE_ATTITUDE, IGNORE_PITCH_RATE, IGNORE_THRUST. According to
uint8 IGNORE_ROLL_RATE = 1 # body_rate.x
uint8 IGNORE_PITCH_RATE = 2 # body_rate.y
uint8 IGNORE_YAW_RATE = 4 # body_rate.z
uint8 IGNORE_THRUST = 64
uint8 IGNORE_ATTITUDE = 128 # orientation field
you can set the last bit of type_mask to enable IGNORE_ROLL_RATE. And if you want to enable GNORE_ROLL_RATE and IGNORE_PITCH_RATE you can set the last 2 bits of type_mask to 011(binary) i.e. 3(decimal). The others are the same.
And you can set your drone to offboard mode to make it follow your commands.
I have not used Arducopter firmware much, but I believe your issue is that /mavros/setpoint_raw/target_attitude
is feedback from the FCU. This tells you how the FCU is interpreting your commands. You should be sending commands to: /mavros/setpoint_raw/attitude
.
PX4 has limits on what the firmware will accept as a valid input, otherwise it will just ignore you (off the top of my head):
type_mask = IGNORE_ROLL_RATE | IGNORE_PITCH_RATE | IGNORE_YAW_RATE
type_mask = IGNORE_ROLL_RATE | IGNORE_PITCH_RATE
type_mask = IGNORE_ATTITUDE
I believe in all cases, you need to provide a thrust input, but I haven't double checked this, and ArduCopter may be different.
In addition - always update header.stamp, keep updates frequent.
Also you need to set GUIDED mode for APM. https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html#copter-commands-in-guided-mode-set-attitude-target
@reyes73a were you able to solve this problem? I am developing a project and i need to send yaw, pitch and roll commands to a fixed wing, could you help me?
I have not used Arducopter firmware much, but I believe your issue is that
/mavros/setpoint_raw/target_attitude
is feedback from the FCU. This tells you how the FCU is interpreting your commands. You should be sending commands to:/mavros/setpoint_raw/attitude
.PX4 has limits on what the firmware will accept as a valid input, otherwise it will just ignore you (off the top of my head):
* To get attitude control: `type_mask = IGNORE_ROLL_RATE | IGNORE_PITCH_RATE | IGNORE_YAW_RATE` * To get "normal RC" control: `type_mask = IGNORE_ROLL_RATE | IGNORE_PITCH_RATE` * To get acro control: `type_mask = IGNORE_ATTITUDE`
I believe in all cases, you need to provide a thrust input, but I haven't double checked this, and ArduCopter may be different.
Hi @pryre , did you try attitude control in PX4 fixed wing ? i am trying for a few days with setpoint_raw/attitude command to make the aircraft turn to a specific heading with the quarterion coordinates but it does not respond. The aircraft turns to OFFBOARD mode but just mantain its previous heading
Hi all, i was using /mavros/setpoint_raw/attitude topic to control attititude kept type_mask to 128 so that i can do attitude and thrust cntrol. I was able to do thrust control using PID but I have doubt in doing attitude control since i am trying to do global navigation along with attitude control. I am publishing global setpoints to mavros/setpoint_raw/global topic. Anyone have idea how to control attitude while doing global navigation also? Thanks in advance
@rrajnidhi may I ask you how do you use PID to control thrust
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
do you try to control drone's attitude by pitch,roll,yaw and thrust
joaoalves10 @.***> 於 2022年9月8日 週四 下午5:27寫道:
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240462311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYXSRTSLWJF3VZOEUW7G7PTV5GWQZANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
Only fixed wing drones.
Em qui., 8 de set. de 2022 às 10:36, Thomas000001 @.***> escreveu:
do you try to control drone's attitude by pitch,roll,yaw and thrust
joaoalves10 @.***> 於 2022年9月8日 週四 下午5:27寫道:
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub <https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240462311, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AYXSRTSLWJF3VZOEUW7G7PTV5GWQZANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240472268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMLLBMMU7GY2ZQU3LVYQZ3V5GXTTANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
Thank you. Do you try to control quadrotor aircraft’s attitude by pitch, roll and thrust, or have you used body rate to control attitude
joaoalves10 @.***>於 2022年9月8日 週四,下午9:45寫道:
Only fixed wing drones.
Em qui., 8 de set. de 2022 às 10:36, Thomas000001 @.***> escreveu:
do you try to control drone's attitude by pitch,roll,yaw and thrust
joaoalves10 @.***> 於 2022年9月8日 週四 下午5:27寫道:
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub <https://github.com/mavlink/mavros/issues/1356#issuecomment-1240462311 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AYXSRTSLWJF3VZOEUW7G7PTV5GWQZANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240472268, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AVMLLBMMU7GY2ZQU3LVYQZ3V5GXTTANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240739589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYXSRTUG4PHRETDVRGYCP4TV5HUXBANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
I did not work with quadcopters, only with fixed wings.
Em sex., 9 de set. de 2022 às 00:54, Thomas000001 @.***> escreveu:
Thank you. Do you try to control quadrotor aircraft’s attitude by pitch, roll and thrust, or have you used body rate to control attitude
joaoalves10 @.***>於 2022年9月8日 週四,下午9:45寫道:
Only fixed wing drones.
Em qui., 8 de set. de 2022 às 10:36, Thomas000001 @.***> escreveu:
do you try to control drone's attitude by pitch,roll,yaw and thrust
joaoalves10 @.***> 於 2022年9月8日 週四 下午5:27寫道:
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240462311 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AYXSRTSLWJF3VZOEUW7G7PTV5GWQZANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub <https://github.com/mavlink/mavros/issues/1356#issuecomment-1240472268 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBMMU7GY2ZQU3LVYQZ3V5GXTTANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1240739589, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AYXSRTUG4PHRETDVRGYCP4TV5HUXBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1241347099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMLLBNY2RUW4IESM4ATRK3V5J4DLANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
I got it. Thank you very much. You help me understand the things that I confused
joaoalves10 @.***>於 2022年9月9日 週五,下午5:11寫道:
I did not work with quadcopters, only with fixed wings.
Em sex., 9 de set. de 2022 às 00:54, Thomas000001 @.***> escreveu:
Thank you. Do you try to control quadrotor aircraft’s attitude by pitch, roll and thrust, or have you used body rate to control attitude
joaoalves10 @.***>於 2022年9月8日 週四,下午9:45寫道:
Only fixed wing drones.
Em qui., 8 de set. de 2022 às 10:36, Thomas000001 @.***> escreveu:
do you try to control drone's attitude by pitch,roll,yaw and thrust
joaoalves10 @.***> 於 2022年9月8日 週四 下午5:27寫道:
Hi
In my project i used a PI to control thrust. I used the velocity measurement and velocity setpoint (airspeed that i aimed to reach) to calculate the thrust.
A quinta, 8/09/2022, 08:55, Thomas000001 @.***> escreveu:
@rrajnidhi https://github.com/rrajnidhi may I ask you how do you use PID to control thrust
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240360681 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBJYVTAUNCVF27PJQGTV5GLYBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240462311 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AYXSRTSLWJF3VZOEUW7G7PTV5GWQZANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub < https://github.com/mavlink/mavros/issues/1356#issuecomment-1240472268 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AVMLLBMMU7GY2ZQU3LVYQZ3V5GXTTANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub <https://github.com/mavlink/mavros/issues/1356#issuecomment-1240739589 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AYXSRTUG4PHRETDVRGYCP4TV5HUXBANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1241347099, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AVMLLBNY2RUW4IESM4ATRK3V5J4DLANCNFSM4JQE4HPA
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1241714634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYXSRTXNPNIJ6WRJHUJG4X3V5L5MJANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
Hi,
I was able to do attitude control using setpoint_raw_attitude. I used quartenion coordinates
A terça, 9/08/2022, 20:13, Nidhi raj R @.***> escreveu:
Hi all, i was using /mavros/setpoint_raw/attitude topic to control attititude kept type_mask to 128 so that i can do attitude and thrust cntrol. I was able to do thrust control using PID but I have doubt in doing attitude control since i am trying to do global navigation along with attitude control. I am publishing global setpoints to mavros/setpoint_raw/global topic. Anyone have idea how to control attitude while doing global navigation also? Thanks in advance
— Reply to this email directly, view it on GitHub https://github.com/mavlink/mavros/issues/1356#issuecomment-1209775675, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMLLBOYFFJ7UMV5URD6SUTVYKUV7ANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.***>
i'm having a similar issue, if I set the bitmask to 128 to ignore attitude and only use rates i get no response, only throttle works. if i add a quaternion, regardless of the value, the vehicle will constantly yaw in the SIL. Can you post a code snippet of your working result?
Hi, I was able to do attitude control using setpoint_raw_attitude. I used quartenion coordinates A terça, 9/08/2022, 20:13, Nidhi raj R @.> escreveu: … Hi all, i was using /mavros/setpoint_raw/attitude topic to control attititude kept type_mask to 128 so that i can do attitude and thrust cntrol. I was able to do thrust control using PID but I have doubt in doing attitude control since i am trying to do global navigation along with attitude control. I am publishing global setpoints to mavros/setpoint_raw/global topic. Anyone have idea how to control attitude while doing global navigation also? Thanks in advance — Reply to this email directly, view it on GitHub <#1356 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMLLBOYFFJ7UMV5URD6SUTVYKUV7ANCNFSM4JQE4HPA . You are receiving this because you commented.Message ID: @.> Can you share the code for how you control attitude? Thank you very much!
Hey guys,
I would like to learn how to properly use /mavros/setpoint_raw/target_attitude messages to command the FCU to a particular orientation angle.
Right now I create a mavros_msgs.AttitudeTarget and publish it to /mavros/setpoint_raw/target_attitude. Inside mavros_msgs.AttitudeTarget i specify a quaternion that defines roll,pitch and yaw. The message is publishing correctly and if I do rostopic echo /mavros/setpoint_raw/target_attitude i can see the values changing accordingly, but I do not see the aircraft reacting to these commands. What I am doing wrong/missing?
I got a few questions about this that could suggest why it is not working:
Will this firmware support this functionality?
Any help is greatly appreciated! Thanks!!!