Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to control uavcan hardpoint by MAV_CMD_DO_GRIPPER #19124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PonomarevDA
Copy link
Contributor

Describe problem solved by this pull request
This PR allow to control a gripper based on uavcan via mavlink MAV_CMD_DO_GRIPPER command in both mission (as waypoint) and manual (by just sending the command) modes.
The old version of uavcan/hardpoint was supposed to be used via mavlink console that in my opinion was not user-friendly. It was even removed from uavcan_main.cpp recently.

Describe your solution
I extended navigator a little bit. Now uavcan/hardpoint periodically checks vehicle_command. If it is VEHICLE_CMD_DO_GRIPPER, it starts sending uavcan/hardpoint message with a small rate.

Besides changes in PX4-Autopilot firmware it is also necessary to ublock Gripper waypoint in QGC. It might be fine to implement some additional widget to manually control a gripper (I attached an example of such widget in the video below).

Describe possible alternatives
During the real tests it was found out that it's a bit uncomfortable to manually add delays before and after each of the gripper command. As I see, the next step might be:

  1. Wait for hardpoint feedback on PX4 side while the gripper is ready
  2. Add a parameter with delay duration and wait for it before and after each gripper command on PX4 side
  3. Somehow make the gripper waypoint in QGC to be a comlex item that contains 3 waypoints (delay before, gripper cmd, delay after) or even extend MAV_CMD_DO_GRIPPER parameters.
    But as for me, current solution is enough for the beginning.

Test data / coverage
Manual control was tested on this branch: video.
Mission was tested in the uavcan simulator based on cuav v5+ on test branch: video illustration and log.
We also have several real tests on v1.12.1 with this feature.

@junwoo091400
Copy link
Contributor

Wow totally missed this! Gripper support was added in #19963

@PonomarevDA

@PonomarevDA
Copy link
Contributor Author

@junwoo091400 Thanks that you notified about it. Probably, I could leave only dronecan related part in this PR.

@benjinne
Copy link
Contributor

benjinne commented May 8, 2024

Hey @junwoo091400 does gripper support uavcan control or does that still need to be added? I couldn't find documentation on canbus with gripper

@junwoo091400
Copy link
Contributor

Hey @junwoo091400 does gripper support uavcan control or does that still need to be added? I couldn't find documentation on canbus with gripper

It only responds to MAV_CMD_DO_GRIPPER as vehicle command. Not sure when related UAVCAN message is received, it gets translated into that vehicle command. If that's not the case it isn't supported yet.

…ring mission and removed send_command() dedicated for usage via mavlink console
@PonomarevDA
Copy link
Contributor Author

Hi, @benjinne. I've rebased the branch.
I've sent MAV_CMD_DO_GRIPPER and it seems to be working fine because an autopilot starts broadcasting the hardpoint message as I expected.

image

I don't have an EPM v3 device, but I have a node that can subscribe on the hardpoint message and control a servo. I uploaded this branch to cuav v5+ and reset everything to default. It works as I expected as well. On this video I send commands to release and to grab: https://youtu.be/1npnHknUpq8.

Can you please give a try to this branch with your device? Is it what you need?

@PonomarevDA
Copy link
Contributor Author

@mrpollo mrpollo requested a review from dagar May 14, 2024 15:39
@hamishwillee
Copy link
Contributor

hamishwillee commented May 15, 2024

@PonomarevDA When this goes in, can you please add a docs update?

Docs affected by gripper are:

We'd also add specific hardware to this list: https://docs.px4.io/main/en/dronecan/#supported-hardware

And last of all, a line to https://docs.px4.io/main/en/releases/main.html to record the change

Ideally you might have a topic like https://docs.px4.io/main/en/peripherals/gripper_servo.html - but what I'm mostly after is making sure that we make it clear how you configure a uavcan gripper for use via MAVLink and in a package delivery context. If it can't be used in package delivery we need to make that clear.

@PonomarevDA
Copy link
Contributor Author

@hamishwillee Sure, I can add it. First, I will improve the docs of the mentioned device (the device itself is just a CAN-PWM converter, and a gripper is one of the ways how we can use it). Then I will add it to the PX4 docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants