Skip to content

Conversation

@ricard-inho
Copy link

This code is to arm with the px4 and test a single solenoid valve with code.

@Pedro-Roque
Copy link
Member

@E-Krantz can you test this file one of these days?

@ricard-inho ricard-inho closed this May 5, 2025
@ricard-inho
Copy link
Author

I'll add different code

@Pedro-Roque
Copy link
Member

you can push different code to the same PR Ricard, if it is related with the same topic. Should I re-open?

@ricard-inho ricard-inho reopened this May 5, 2025
@ricard-inho
Copy link
Author

sure, @E-Krantz wait to check the code.

- Fix arming issue by publishing actuator messages before arming and setting all parameters in the VehicleCommand message
- Add optional `namespace` argument
- Add entry point to `setup.py`
@E-Krantz
Copy link
Contributor

The PX4 didn't accept the request to arm and change to offboard mode.

I pushed a commit that:

  • Fixes the arming sequence by ensuring actuator outputs are published once before arming
  • Sets all parameters in the VehicleCommand message, which is also required for arming
  • Added an optional namespace argument
  • Added entry point in setup.py

I've tested these changes in PX4 SITL.

@Pedro-Roque
Copy link
Member

@ricard-inho can you test in your HW the changes proposed by @E-Krantz ?

@ricard-inho
Copy link
Author

Couple of things:
The code only sets QGC from "Not Ready" to "Ready to Fly" but does not automatically arm it. Once we arm it from the QGC we can hear the thrusters firing, we are still checking, but is not firing the thruster connected at the indicated pins and it's also firing when sending 0 u_command. After killing the ros pub node, the solenoid valve stills firing, it only stops when we disarm the px4 on QGC.
Screenshot 2025-05-15 192306

@E-Krantz
Copy link
Contributor

Does it have a local position estimate when you arm it? It can be that due to PX4 safety, it rejects offboard mode if EKF2 has not converged.

Concerning still firing with 0 u_command; is it in offboard with direct_actuator mode when sending this command?

When you kill the offboard node, it stops receiving offboard_control_mode messages and should automatically switch to an armed failsafe mode. Can it be that it keeps firing from inputs from this mode? I think this would be position mode. I have code for safely shutting down the node (offboard -> manual -> disarm). I could add this to the PR if you like.

@ricard-inho
Copy link
Author

When we put it in "position" mode we have an error message that doesn't allow us to arm
No valid local position estimate
But we don't see any error message when we switch to "offboard" mode, I this mode we can arm it when we start sending offboard messages.
Screenshot from 2025-05-16 12-54-28
Not sure where to check the local position estimate

Yes, it is in offboard with direct_actuator mode when sending 0

When we kill the offboard node, it goes into arm failsafe activated:
Vehicle Error. Autopilot disengaged, switching to stabilezed mode. No offboard signal.

If you can share the code, we can run it also and check.

Press enter to shutdown (offboard -> manual -> disarm)
@E-Krantz
Copy link
Contributor

Pushed a commit for safe shutdown. Pressing enter will have the PX4 change to manual followed by disarming.

@Pedro-Roque
Copy link
Member

@ricard-inho can you send us a log or a bag file?

Firing issues: if it fires at 0, please check what the ros2 topic of /fmu/out/actuator_motors is.
Position mode: if you don't have mocap data integrated / you are not feeding the estimator, I don't think Position mode will work.
Offboard mode: you should use either QGC or Remote ideally, not code-based offboard mode (for safety). In any case, if the arming fails, please check the message in QGC. Probably you are not in the right mode / it is waiting for some data to converge.

@ricard-inho
Copy link
Author

@E-Krantz The safe shutdown does disarm the px4 correctly but the it goes into safefail activated stabilized mode and arms it again.
@Pedro-Roque we only have /fmu/in/actuator_motors not out, but we don't see any message on the topic.
We also tried to activate the thrusters when receiving a dummy Twist command but doesn't seem to have any effect. I put the code on this PR

@Pedro-Roque
Copy link
Member

@ricard-inho is this PR in working state? I think you have further changes to integrate here. If yes, I'll then merge :)

@Pedro-Roque
Copy link
Member

@ricard-inho is this still WIP or should I close the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants