Closed eleboss closed 5 years ago
UPDATE: I accidently make the setpoint_raw/target_local worked, when the drone is flying the data comes out! I force the drone the takeoff, and accidently saw the data comes out.
and the bitmask is 0
header:
seq: 2071
stamp:
secs: 1534590628
nsecs: 342651136
frame_id: ''
coordinate_frame: 1
type_mask: 0
position:
x: -0.048215713352
y: -0.488790094852
z: 0.120928458869
velocity:
x: -0.945887446404
y: -4.90971517563
z: 0.391148298979
acceleration_or_force:
x: 0.0
y: 0.0
z: 0.0
yaw: -0.0
yaw_rate: -0.0
The target_local topic is a feedback of the multicopter, not just a loopback and the type_mask is not filled in.
The two masks I use are the following:
@AlexisTM Hi! Thanks for the very useful suggestions, I am currently using the velocity control, It works well, and the position control also work well in simulation environment.
But when use the combined mask, It just not working.
The implementation for combined commands is a bit a spaghetti in the backend (PX4 Firmware).
NOTE: The Position setpoints in the PX4 Firmware are handled as a simple P controller. I have good results with an offboard PD controller.
@AlexisTM Yes maybe the spaghetti implementation intorduced these bugs. Hope someone can solve it.
As you mentioned in the NOTE, the init parameter of Position setpoint actually not working well in my drone, My drone is a bit heavy. The drone swinged heavely when use the setpoint_raw/local in position control mode. The RANGEFINDERhttps://github.com/PX4/Firmware/issues/10264 bug may be the reason, I heven't done further test.
So, I implenent a cascade PID control by myself. First loop control the speed (setpoint_raw/local in speed mode), sencond loop control position, and with some pid tunning, It works well.
You mean you are sending one velocity setpoint then a position setpoint? The new setpoint erases the precedent one, more likely the position control is not aggressive enough compared to the velocity control.
The Offboard mode is in rework, you can participate :)
I just using the setpoint velocity, fully give up position. the cascade is implement in my code.
Perfect ;)
Sorry if I'm necroing (a very minor one), but I had a setpoint_raw position script that was working fine, switching the type mask to velocity only, and now it won't respond to any of the published velocity set_points, UNLESS I very specifically manually arm, initiate takeoff via mavcmd and then switch to offboard, all via terminal. It will then follow the velocity setpoints. Before, it arms, switches to offboard, and then sits on the ground until it disarms.
Whereas with the other script (that only differs with respect to the type mask and the published setpoints being position rather than velocity) the drone would automatically take off. It would arm, switch to offboard, and then after a short wait would start following the setpoints.
I'm at my wits end at this point and I have no idea what I need to do to my script to get it to consistently follow the velocity commands.
Is there any progress? I encountered the same problem when I use setpoint_raw/local to send a Vx Vy z cmd.
This was 2 year ago, PX4 developed a lot in between.
Take a look at the Mavlink receiver part, I believe it should be able to do Vx, Vy and Z commands.
If you really can't make it work, you can simply do a P controller over the altitude. That should be enough in the meantime.
Issue details
Dear team,
I am currently using
setpoint_raw/local
to control my drone indoor with a tfmini rangefinder. But when usingsetpoint_raw/local
to control the VX VY and PZ with bitmask4067, strange things happen: I can switch to OFFBOARD mode and ARM the drone, however, the drone just stay on the ground with no movement and the propeller keep static(Usually, when ARMED, the propellers should rotate)In the real world I done the following test: control vx, vy, z, y -> 3043 (0xBE3):stay on the ground, propeller rotate control vx, vy, z -> 4067 (0xFE3): stay on the ground, propeller keep static control vx, vy, z, y_rate -> 2019 (0x7E3):stay on the ground, propeller rotate control vx, vy, vz, y -> 3015 (0xBC7):working properly
and I also check basically all issues in google and github, but still couldn't figure out why this happened.
In order the further confirm the problem, I try the simulation SILT in gazebo.with same code. and same thing happen, but this time I get more information, control vx, vy, z, y -> 3043 (0xBE3):stay on the ground, propeller rotate with :WARN [mavlink] force setpoint not supported control vx, vy, z -> 4067 (0xFE3): stay on the ground, propeller keep static with WARN [mavlink] force setpoint not supported control vx, vy, z, y_rate -> 2019 (0x7E3):stay on the ground, propeller rotate with WARN [mavlink] force setpoint not supported control vx, vy, vz, y -> 3015 (0xBC7):working properly with no WARN
I am using the latest(1.8.0) version of PX4. From my viewpoint, It should work. and the https://github.com/PX4/Firmware/issues/7068 comfirmed that. An I wrong about something?
My real world setup:
DJIF550 + pixhawk4 + benewake TFmini rangefinder + GPS
I am doing a indoor test, so the GPS can't provide position feedback, but the rangefinder can provide the Z axis feedback, and I can directly check that by usingrostopic echo /mavros/local_position/odom
the position of z is accurately changed with z movement.BTW, many references mentioned that setpoint_raw/target_local is a loop back topic, while my setpoint_raw/target_local never return anything at anytime, It this normal?
I really can't figure out this by myself, please help me to debug this. If any information is needed, please let me know.
Best regard!
MY code
I change the
PositionTarget.IGNORE_*
to test multiple bitmask.I use
rostopic echo /mavros/setpoint_raw/local
to check the output, usually it looks like:The offboard code is very simple code,just keep calling the mode set service and keep arming.
MAVROS version and platform
Mavros: 0.24.0 ROS: Kinetic 1.12.13 Ubuntu: 16.04
Autopilot type and version
[ ] ArduPilot [this!] PX4
Version: In the real world: Pixhawk4 with 1.8.0 version In simulation: git clone from the latest Firmware of PX4 github and use:
make posix_sitl_default gazebo
to init the simulation.Node logs
in the simulation
Diagnostics
In the simulation:
SIMULATION TERMINAL
I am not sure weather it is suitable to ask this question at here or the PX4 stack, If it not suitable please tell me and I will switch to PX4 stack.