castacks / PX4-fully-actuated

PX4 autopilot extended to fully-actuated multirotors
BSD 3-Clause "New" or "Revised" License
33 stars 8 forks source link

How do I control the Gazebo models “hexa_x_tilt”? #8

Closed daydayupcg137 closed 3 years ago

daydayupcg137 commented 3 years ago

image

   Hello,after I  run the command "make px4_sitl gazebo_hexa_x_tilt", the model  was showed in the Gazebo,but, I do not know 

how to control it, the position controller designed by you could control it directly? how to run the controller?

daydayupcg137 commented 3 years ago
  In your official video, you show the following five flight strategies:
  1.a zero-tilt attitude strategy to keep the uav level during the flight
  2.a minimum-tilt strategy to react to external disturbances and high accelerations,while keeping the tilt at minimum
  3.a full-tilt attitude strategy to consume the minimum energy and react to the external disturbances
  4.a fixed-tilt strategy to compensate for external forces while keeping constant tilt
  5.a fixed-attitude strategy to keep the roll,pitch and yaw constant for tasks such as contact inspection

  Q1:Are these five strategies automatically switched during flight according to flight conditions such as flight speed, or can they be manually controlled?How do you demonstrate these five strategies?

  Q2:The fully-actuated uav can realize the decoupling of position control and attitude control.By changing the position of the uav while maintaining the same attitude Angle, the attitude Angle can also be changed while maintaining the same position. According to your official video, when the UAV moves in the horizontal direction, the UAV has zero tilt, which indicates that the UAV maintains the attitude Angle when its position changes. But how to verify that the UAV changes the attitude Angle when its position remains unchanged?

 Q3:How to record Gazebo uav movement data? Is there an official tutorial?

I'm really sorry to bother you again when you are very busy. I just want to understand your control scheme and verify it in practice, so I often bother you
keipour commented 3 years ago

Hello,after I run the command "make px4_sitl gazebo_hexa_x_tilt", the model was showed in the Gazebo, but, I do not know how to control it, the position controller designed by you could control it directly? how to run the controller?

You can run a QGroundControl or any other ground control software to connect to it and make it fly. To control it with your own code (e.g., in ROS), you would need to run MAVROS or MAVSDK and send commands to it through them. There are many example repositories you can find on the internet that can control a PX4 UAV. As mentioned in our paper, our firmware does communicate with other programs exactly in the same way as the original PX4.

P.S.: We are also going to make our ROS code public, but that may not happen until March.

keipour commented 3 years ago

In your official video, you show the following five flight strategies: 1.a zero-tilt attitude strategy to keep the uav level during the flight 2.a minimum-tilt strategy to react to external disturbances and high accelerations,while keeping the tilt at minimum 3.a full-tilt attitude strategy to consume the minimum energy and react to the external disturbances 4.a fixed-tilt strategy to compensate for external forces while keeping constant tilt 5.a fixed-attitude strategy to keep the roll,pitch and yaw constant for tasks such as contact inspection

Q1:Are these five strategies automatically switched during flight according to flight conditions such as flight speed, or can they be manually controlled? How do you demonstrate these five strategies?

These strategies switch using the OMNI_ATT_MODE parameter. You can write a program that monitors the speed and switches between the modes mid-flight by changing the parameter. You can also do it manually in QGroundControl or the PX4 terminal.

Q2:The fully-actuated uav can realize the decoupling of position control and attitude control.By changing the position of the uav while maintaining the same attitude Angle, the attitude Angle can also be changed while maintaining the same position. According to your official video, when the UAV moves in the horizontal direction, the UAV has zero tilt, which indicates that the UAV maintains the attitude Angle when its position changes. But how to verify that the UAV changes the attitude Angle when its position remains unchanged?

You can try that for yourself in the Gazebo SITL simulation. Just run the code, add some wind, start hovering, and switch between zero-tilt (mode 2) and full-tilt (mode 1), for example. You can see that the UAV stays in place but changes its attitude.

Q3:How to record Gazebo uav movement data? Is there an official tutorial?

My Gazebo SITL is publishing some ROS topics that also includes the UAV position, etc. I'm not exactly sure if it does that automatically or some settings in my system enables it. You can try listing topics and see if it includes the Gazebo topics or not.

I'm really sorry to bother you again when you are very busy. I just want to understand your control scheme and verify it in practice, so I often bother you

Happy to help! :)

daydayupcg137 commented 3 years ago
  Hello, thank you very much for your answer.

  In question 2, I tried increasing the wind speed in Gazebo by add the plugin to my world file and replace  **SET_YOUR_WIND_SPEED** with the desired speed[https://docs.px4.io/master/en/simulation/gazebo.html](url).  I hover the UAV after takeoff ,but when I switch **OMNI_ATT_MODE** parameter in the QGroundControl, the UAV's attitude did not change. I don't know if I made a mistake in my operation. Could you be more specific?

 In addition, I simulated UAV flight in Gazebo with OMNI_ATT_MODE =2, I found that in manual mode the UAV was very unstable and would still fly up when the throttle was in the middle. It's more stable in other modes, like position and hold.

   You answered me earlier that takeoff is more comfortable in manual mode,What is the safe and stable take-off mode for beginners?Do you have any other sensors besides M8N-GPS on your autopilot hardware? such as optical flow?

   In the actual flight test, you used a remote control that was something like this or others?

image

   Express gratitude again!
keipour commented 3 years ago

  Hello, thank you very much for your answer.

  In question 2, I tried increasing the wind speed in Gazebo by add the plugin to my world file and replace  **SET_YOUR_WIND_SPEED** with the desired speed[https://docs.px4.io/master/en/simulation/gazebo.html](url).  I hover the UAV after takeoff ,but when I switch **OMNI_ATT_MODE** parameter in the QGroundControl, the UAV's attitude did not change. I don't know if I made a mistake in my operation. Could you be more specific?

This is the PX4 and SITL Gazebo branched out last year from master, so the way you add wind is a bit different than the most recent PX4 and SITL Gazebo. To add wind, go to your firmware folder, open Tools/sitl_gazebo/models/hexa_x_tilt/hexa_x_tilt.sdf and go to the <plugin name='wind_plugin' filename='libgazebo_wind_plugin.so'> tag (at the end of the file). You can control the wind force by changing the windForceMean tag (it's a scalar) and the wind direction by changing the windDirectionMean (it's a unit vector). You can also try adding gusts if you want.

Just note that in this version of SITL Gazebo, the wind is basically a force on the UAV. So, for example, <windForceMean>5</windForceMean> means 5 N force on the UAV instead of 5 m/s wind. They have fixed this issue now in PX4, so when we update our firware to the latest PX4 this will be fixed.

In addition, I simulated UAV flight in Gazebo with OMNI_ATT_MODE =2, I found that in manual mode the UAV was very unstable and would still fly up when the throttle was in the middle. It's more stable in other modes, like position and hold.

MANUAL mode is unaffected and the UAV behaves like the non-modified PX4. We kept it as such for safety purposes in case something goes wrong with our code. As you have noticed already, our attitude modes only work with assisted modes (such as POSITION and HOLD).

You answered me earlier that takeoff is more comfortable in manual mode,What is the safe and stable take-off mode for beginners?Do you have any other sensors besides M8N-GPS on your autopilot hardware? such as optical flow?

You can take off in any mode, just our pilots are more comfortable with MANUAL take-off. Probably for a beginner POSITION would be easier (if the wind is not too strong). If the wind is too strong I wouldn't suggest for a beginner to fly at all.

No, we have tested it with the standard configuration (the pixracer + GPS).

In the actual flight test, you used a remote control that was something like this or others?



![image](https://user-images.githubusercontent.com/66363845/105042509-4d69a080-5a9f-11eb-9846-581e9b5ac64f.png)

These are the controllers we are using on our robots, but any other controller should work the same:

Futaba T8J

Futaba T10J