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 support for unmanned underwater vehicles: #14079

Merged
merged 4 commits into from
Feb 5, 2020

Conversation

DanielDuecker
Copy link
Contributor

@DanielDuecker DanielDuecker commented Jan 31, 2020

Describe problem solved by this pull request
As by now PX4 lacks (convenient/full) support for underwater robots. The currently integrated HippoCampus Underwater Robot implementation originated from a student project in my group. Its main drawback is that it is still based on the MC airframe which comes with high integration effort and several workarounds. Moreover, it lacks a proper attitude controller which makes it easy to use for other.

Please find the corresponding PR in the sitl_gazebo repo PX4/PX4-SITL_gazebo-classic#402

Describe your solution
This PR provides

  1. Airframes/Mixer for unmanned underwater vehicle (UUV) using the correct MAV_Type (=12) etc.... Namely, a generic and a HippoCampus specific airframe. Moreover, I added rc.uuv_defaults/apps for uuv specific parameter and autostarting e.g. ekf2 and uuv_att_control app

  2. mixer for UUVs with X-shaped thruster setup similar to quadcopter

  3. control module "uuv_att_control" for underwater robot attitude control

  4. sitl_gazebo integration (please find the PR in the sitl_gazebo repo)

  5. ...leaves the current uuv controller as an tutorial example

Describe possible alternatives
Update the current hippocampus/uuv implementation. However, as the existing version is a very hard to use (drive in a circle) and still based on MC, I am wondering whether it would be worth the effort in comparison of taking the proposed fresh approach.

Test data / coverage
So far testing took place in Gazebo for simple attitude control tasks / and manual control. Moreover, we tested the on our physical UUV HippoCampus robot (PixRacer+ Companion/RPi) in offboard mode.
https://youtu.be/2w-hT2NBIyE ( UUV Attitude Controller receiving attitude setpoints via mavros)

* airframe uuv_generic + uuv_hippocammpus including mav_type = 12 for submarines

* mixer for UUVs with X-shaped thruster setup similar to quadcopter

* add module  uuv_att_control for underwater robot attitude control

* add rc.uuv_defaults/apps for autostarting e.g. ekf2 and uuv_att_control app
.gitmodules Outdated
@@ -12,8 +12,8 @@
branch = master
[submodule "Tools/sitl_gazebo"]
path = Tools/sitl_gazebo
url = https://github.com/PX4/sitl_gazebo.git
branch = master
url = https://github.com/DanielDuecker/sitl_gazebo.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open a corresponding PX4/sitl_gazebo PR and change this url back?
https://github.com/PX4/sitl_gazebo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, I will update the url

Here is the PR in sitl_gazebo PX4/PX4-SITL_gazebo-classic#402

@Jaeyoung-Lim
Copy link
Member

@DanielDuecker Do you have any logs / videos that show that this is working? Also, please link the corresponding sitl_gazebo PR on this PR


uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};

int _vehicle_attitude_sp_sub{-1}; /**< vehicle attitude setpoint */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine to merge if it's working for you, but you might want to update to the newer uORB c++ api at some point.
Example https://github.com/PX4/Firmware/blob/cfa74b91063251b6d88ac7f65bbe1044ff67ffe6/src/modules/mc_rate_control/MulticopterRateControl.hpp#L96-L104

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think for the moment that's fine but I will update this in an upcoming revision

@@ -64,7 +64,8 @@ set(models none shell
if750a iris iris_opt_flow iris_opt_flow_mockup iris_vision iris_rplidar iris_irlock iris_obs_avoid iris_rtps solo typhoon_h480
plane
standard_vtol tailsitter tiltrotor
hippocampus rover)
hippocampus rover
uuv_hippocampus)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between the hippocampus and the uuv_hippocampus?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hippocampus is the old implementation (which is still based on the MC-airframe) which is still used in the tutorial with an example app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hamishwillee Would it make sense to deprecate the previous tutorial and switch to the new one? I believe the previous module was not really well maintianed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jaeyoung-Lim @DanielDuecker

I would completely delete the old support. The fact that you've "done this right" in this version is awesome, and what we want people to learn from.

Daniel, as far as I know the only docs for this is the launch command in http://dev.px4.io/master/en/simulation/gazebo.html#uuv

  1. Can you update that with the new launch command?

It would be great to have some documentation to help others extend this work. Our docs currently make it pretty easy to set up an MC, VTOL and FW. However it is hard to set up a rover, boat or helicopter because there isn't much supporting material. I'd hate for that to be the case for this.

Generally we need "whatever you think would make it possible for someone to learn from and extend your work". Some ideas:

  1. Dev: Explain the mixer and how it might be extended: http://dev.px4.io/master/en/concept/mixing.html
  2. Dev: If there is a geometry file, explain how that works.
  3. Explain the controller. E.g. like these diagrams: http://dev.px4.io/master/en/flight_stack/controller_diagrams.html
  4. User: Explain any general considerations for assembly: http://docs.px4.io/master/en/assembly/
  5. User: Explain how to set up a real vehicle http://docs.px4.io/master/en/airframes/
  6. Explain special configuration: http://docs.px4.io/master/en/config/

Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I will remove the the old uuv-files.
@hamishwillee are you referring to the stil_gazebo part with "geometry file"?

We have quite some docs (so far internal) for assembly etc, I will see which parts would be helpful to others and add the to the docs.

It absolutely makes sense to pave to way to others who are interested in extending the framework with their own ideas.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Daniel,

Re geometry file I am referring to an undocumented part of the definition of PX4. Unfortunately I can't say anything else because I haven't ever been able to get any useful information on it. I was being opportunistic - and hoping you might :-)

We have quite some docs (so far internal) for assembly etc, I will see which parts would be helpful to others and add the to the docs.

Thank you. That will be excellent!

* updated copyright year in cmakelist 2017->2020
DanielDuecker added a commit to DanielDuecker/Devguide that referenced this pull request Feb 3, 2020
According to: PX4/PX4-Autopilot#14079

make px4_sitl gazebo_hippocampus
should be changed to
make px4_sitl gazebo_uuv_hippocampus
@DanielDuecker
Copy link
Contributor Author

DanielDuecker commented Feb 3, 2020

@DanielDuecker Do you have any logs / videos that show that this is working? Also, please link the corresponding sitl_gazebo PR on this PR

@Jaeyoung-Lim
Here is a short youtube demo (uuv_att_control app receiving attitude setpoint via mavros)
https://youtu.be/2w-hT2NBIyE
is that sufficient?
Maybe a video is more helpful thatn the actual flight logs, what do you think?

…k thrust commands

* removed old hippocampus version from sitl_target.cmake  + old uuv_quad_x mixer

* commenting in uuv mixers
#
# Start UUV Land Detector.
#
land_detector start rover
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like we need another vehicle type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree!
afaik rover landdetector is basically just a dummy, right?
what do you recommend?


if [ $AUTOCNF = yes ]
then
param set PWM_MAX 1950
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these PWM params make sense as UUV defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I agree with you on min/max - but doesn't it make sense to have the disarmed pwm at 1500? Better ways of doing this are welcomed =)

@dagar dagar merged commit 36f836b into PX4:master Feb 5, 2020
hamishwillee pushed a commit to PX4/PX4-Devguide that referenced this pull request Feb 5, 2020
According to: PX4/PX4-Autopilot#14079

make px4_sitl gazebo_hippocampus
should be changed to
make px4_sitl gazebo_uuv_hippocampus
@mrpollo mrpollo mentioned this pull request Mar 16, 2020
@hanyang2013212
Copy link
Contributor

Hi,
I am trying to use the hippocampus uuv for some simulations. However, when I tried the uuv example app script, I found the uuv can only travel less than 1 meter in any direction no matter how I set the input to the four actuators. I have also tried to use mavros to publish position and attitude setpoint for the uuv. But the results are similar. Also attitude control is ok, the uuv cannot travel far. I wonder what is the reason for that. Thanks!

@DanielDuecker
Copy link
Contributor Author

Hi Hanyang,
what exactly did you try?
did you try the old uuv_example_app?
please give the new uuv_app a try
--> Firmware/src/modules/uuv_att_control/
Keep me updated whether it worked out

@hanyang2013212
Copy link
Contributor

Hi Daniel,
Thanks for your reply.

Since I'm quite new to the PX4 and Gazebo, I have tried some basic examples provided in the PX4 mavros folder and also the old uuv_example_app(didn't see the circle trajectory stated in the example).

I have tried the mavros_offboard_attctl_test.py and mavros_offboard_posctl_test.py to send attitude and position control topics to the uuv_att_control. I noticed that the uuv_att_control module was turned on once the hippocampus uuv was made. However, I only found attitude change from the log review but no position change in the mavros_offboard_attctl_test.py(apart from the returning home process) and no reaction in the mavros_offboard_posctl_test.py. I have some confusions on this problem:

  1. Both the mavros_offboard_attctl_test and mavros_offboard_posctl_test worked on the OFFBOARD mode. Since the current uuv_att_control was modified from the fw_att_control, is it true that the uuv model doesn't work under the OFFBOARD mode like the fixed wing model?
  2. Should there be a position control module like fw_pos_control for the uuv? Or the uuv_att_control is enough for both attitude and position control ( I have noticed that all the four actuators are used in the uuv_att_control)
  3. I'm quite confused about how is the uuv_att_control triggered when the hippocampus uuv model was made. Is that configured in some file? ( I have checked the sdf and configure file in the hippocampus folder but didn't see uuv_att_control related configuration). And also I found that the uuv_att_control can't be stopped once it was started. Is there an example script for the youtube demo to show how the uuv_att_control works to control the attitude and position?
  4. I have also tried to use mavsdk to give mission (use the missionItem) to the uuv. It works on other drones but not uuv.

Thanks a lot!

@DanielDuecker
Copy link
Contributor Author

Hi Hanyang,

Maybe we should finally remove the old(2017) uuv_example_app. Unfortunately, it is not well maintained and outdated. The idea of the new uuv_att_control app is to fully replace the old approach which was (too) tightly coupled with the MC airframes, which doesn't make sense anymore.

For the moment, there is no position control module for UUVs.
As a first shot the uuv_att_control app supports only attitude control and a feedthrough mode in which you can send roll/pitch/yaw/thrust commands directly to the mixer. Thus, I doubt that the pos_control test script can work here.

On our side, we use the system almost exclusively in OFFBOARD mode for attitude control with the setpoints coming via mavros. The position control etc is done in ROS and computes the required attitude setpoints.

For the youtube video we used a simple ROS path tracking controller which generated the corresponding attitude setpoints.

What exactly do you mean with "is doesn't work in offboard like the fw-module"?

Maybe we should move this discussion to a new thread on discuss.px4.io?

Cheers

@hanyang2013212
Copy link
Contributor

Hi Daniel,

Thanks for your quick response.

I have started a new thread on discuss.px4.io. I think we could go there for further discussion since I'm still quite confused at some points.

For "it doesn't work in offboard like the fw-module", I just meant that before your explanation I thought the uuv can't work in the OFFBOARD mode just like the fixed wing models, because I saw it on the PX4 website that some functions in the OFFBOARD mode can't be applied to the fixed wing models. But your explanation has dispelled my guess.

Cheers

@hanyang2013212
Copy link
Contributor

Hi,
I think I have found the reason of the weird behavior that I mentioned before. It was because of this line of code: thrust_u = _param_direct_thrust.get(); in the uuv_att_control module. I haven't noticed before that the thrust was set by the parameter and the default value in the parameter file sets thrust to 0. That's why uuv can't move. I have changed it to the value published by the attitude setpoint topic, which works fine now.

@Jaeyoung-Lim
Copy link
Member

@hanyang2013212 Could you make a pull request so that we can also have it fixed in upstream?

@Jaeyoung-Lim Jaeyoung-Lim added the UUV Unmanned Underwater Vehicle label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UUV Unmanned Underwater Vehicle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants