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

Added Zero Turn Lawnmower model #22717

Merged
merged 6 commits into from
Feb 22, 2024
Merged

Added Zero Turn Lawnmower model #22717

merged 6 commits into from
Feb 22, 2024

Conversation

slgrobotics
Copy link
Contributor

Solved Problem

This PR contributes full-size Zero Turm Lawnmower model to existing collection of Gazebo Ignition models. While crude visually, it tries to simulate masses, inertia and friction of an actual full-size machine.

Used Husqvarna Z254 dimensions.

This model works fine with current Differential Drive Controller (#22402) and my own fork (https://github.com/slgrobotics/PX4-Autopilot). It can be driven manually.

Please see PX4/PX4-gazebo-models#27 for actual SDF file

Testing:

mkdir src21
cd src21
git clone https://github.com/slgrobotics/PX4-Autopilot.git --single-branch --recursive -b gz-lawnmower
cd PX4-Autopilot/
ls -al Tools/simulation/gz/models/
git tag v1.15.0-alpha1
make px4_sitl gz_lawnmower

You may need to repeat the "make" command twice, if the GZ SIM doesn't show the model (common problem)

At this point you can arm the robot in QGroundControl and drive it manually.

Note:
My robot has PCA9685 PWM driver and all functions are controlled now by directly publishing actuator_servos message. Wheels are 0 and 1, then goes cutter deck clutch (2), gas engine throttle (3), "mission strobe" (4), alarm horn (5) and two extra channels. Model works for me without any changes, as is, and is helpful in tuning and debugging.

I was not sure about naming logic in airframes folder, so 5005_gz_lawnmower can be changed to fit common practices. I think that having a 5* naming group for agricultural machines (or even all rovers) makes sense.

@dagar @PerFrivik - please take a look, as discussed earlier.

@slgrobotics slgrobotics changed the title Added Zero Turm Lawnmower model Added Zero Turn Lawnmower model Feb 2, 2024
@PerFrivik
Copy link
Contributor

Hey I will take a look! Thanks for the contribution :).

@slgrobotics
Copy link
Contributor Author

I updated .gitmodules and gz submodule to reflect latest changes there (pointed it to "main" in PX4/PX4-gazebo-models).

@frede791 @dagar @PerFrivik - now when PX4/PX4-gazebo-models#27 is merged, this one needs a review and a push.

@frede791
Copy link
Contributor

frede791 commented Feb 9, 2024

@slgrobotics @dagar @PerFrivik The PX4/PX4-gazebo-models#27 PR has been merged so this is ready for review.

@slgrobotics
Copy link
Contributor Author

Waiting for PX4/PX4-gazebo-models#30 to be completed.

@PerFrivik
Copy link
Contributor

I will take a look at this on Friday (16.02).

@PerFrivik
Copy link
Contributor

PerFrivik commented Feb 19, 2024

Seems to be working fine 👍, but I am wondering a bit about the servos, I did not quite understand what they are doing in the sim. Regarding the naming convention, I will talk with Matthias.

Mission also works well.

@slgrobotics
Copy link
Contributor Author

slgrobotics commented Feb 19, 2024

@PerFrivik - about the servos, I explained their function in this PR above and in the setup script comments. Let me know if this is not clear/sufficient.

"Note:
My robot has PCA9685 PWM driver and all functions are controlled now by directly publishing actuator_servos message. Wheels are 0 and 1, then goes cutter deck clutch (2), gas engine throttle (3), "mission strobe" (4), alarm horn (5) and two extra channels."

And when it comes to the sim, real lawnmowers have cutter decks and maybe other actuators, so the suggested sim configuration makes at least some available to users who will take DD Guidance code and will start modifying it to their needs.

@PerFrivik
Copy link
Contributor

Wheels are 0 and 1, then goes cutter deck clutch (2), gas engine throttle (3), "mission strobe" (4), alarm horn (5) and two extra channels.

Hey @slgrobotics I was just a bit confused, because when I ran the sim only 2 servos showed up, but you mentioned 4 separate things that should be controlled that are not wheels.

@slgrobotics
Copy link
Contributor Author

@PerFrivik - well, I wouldn't expect generic Differential Drive Guidance control output anything beyond the two wheels values.

The servos/actuators are there:

  1. in the 5000_gz_lawnmower to help the future users understand how to enable modeled actuators
  2. in the model.sdf they are functional visual components that reflect actuators signals, if enabled in (1).

Overall, planting a hint or example code in a component that serves as a baseline for future extension by users is a way to complement documentation (which is always lacking).

To me, the goal of this PR is to contribute a useful model and to help you further debug/tune your Guidance control. I am fine with whatever changes make sense to the Team, no worries.

@slgrobotics
Copy link
Contributor Author

To reiterate: I was not sure about naming logic in airframes folder, so 5005_gz_lawnmower can be changed to fit common practices. I think that having a 5* naming group for agricultural machines (or even all rovers) makes sense.

Please come to an agreement and state the name you want here - I will do the renaming then. Thanks!

@PerFrivik
Copy link
Contributor

@slgrobotics I will take another look at it today, then I think we would be ready to merge 👍

Copy link
Contributor

@PerFrivik PerFrivik left a comment

Choose a reason for hiding this comment

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

Except the airframe number and a small comment for clarity, I think this is a nice addition to PX4!

@PerFrivik PerFrivik self-assigned this Feb 21, 2024
@PerFrivik
Copy link
Contributor

To reiterate: I was not sure about naming logic in airframes folder, so 5005_gz_lawnmower can be changed to fit common practices. I think that having a 5* naming group for agricultural machines (or even all rovers) makes sense.

Please come to an agreement and state the name you want here - I will do the renaming then. Thanks!

I think if we want to change the convention, we should do it for all of them.

@slgrobotics
Copy link
Contributor Author

slgrobotics commented Feb 21, 2024

@PerFrivik - I accepted your changes and did all the renaming. I also pulled the latest hash of gz_models (fixes the "pose>" issue in R1 model). The tree builds (as described initially).

There's still unresolved issue #22767 - for testing just add back param set-default SENS_IMU_MODE 0 to ROMFS/px4fmu_common/init.d-posix/rcS around line 209.

A couple pending PRs should not interfere with testing or merging - https://github.com/PX4/PX4-gazebo-models/pulls

@PerFrivik
Copy link
Contributor

@slgrobotics perfect! I will approve this PR as soon as the CI is done running.

@slgrobotics
Copy link
Contributor Author

slgrobotics commented Feb 21, 2024

BTW, I tried it in "Go There" mode, it seems to work. It starts moving very slowly, then accelerates OK, and when reaching the destination WP - moves around in "Hold" state.

When running a mission, the rover turns well towards the waypoint, but fails to move. Here is a simple plan I used:

lawnmower_test.plan.txt

@PerFrivik
Copy link
Contributor

BTW, I tried it in "Go There" mode, it seems to work. It starts moving very slowly, then accelerates OK, and when reaching the destination WP - moves around in "Hold" state.

When running a mission, the rover turns well towards the waypoint, but fails to move. Here is a simple plan I used:

lawnmower_test.plan.txt

Let me test and see what the issue is.

@PerFrivik
Copy link
Contributor

Okay, so mission does work, the issue is that with my current waypoint logic, the rover needs to go below a certain angle threshold to start driving, but since the vehicle angular rate that gets commanded its proportional to the angle error, towards the end the rover gets quite slow. This is something I need to fix, maybe I can introduce a minimal angular rate for the turning state, I will think about it, thank you!

Either way, this is unrelated to your PR and I think we can merge it now.

image

slgrobotics and others added 6 commits February 22, 2024 14:26
RDD_WHL_SPEED has new name: RDD_WHEEL_SPEED
Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>
Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>
also pulled latest GZ models hash
@MaEtUgR
Copy link
Member

MaEtUgR commented Feb 22, 2024

Merging was not possible because of conflicts. I allowed myself to clean up the history such that it's linear.
Lawnmower still works. Thanks for the addition.
image

@MaEtUgR MaEtUgR merged commit b405d75 into PX4:main Feb 22, 2024
87 of 89 checks passed
@slgrobotics slgrobotics deleted the gz-lawnmower branch February 22, 2024 17:02
jwwaite pushed a commit to AIVS-Inc/PX4-Autopilot that referenced this pull request Feb 24, 2024
* Added Lawnmower airframe

* Update 5005_gz_lawnmower

Works all right

* Update 5005_gz_lawnmower

RDD_WHL_SPEED has new name: RDD_WHEEL_SPEED

* Update ROMFS/px4fmu_common/init.d-posix/airframes/5005_gz_lawnmower

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Update ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Renamed 5005_gz_lawnmower to 4011_gz_lawnmower

also pulled latest GZ models hash

---------

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>
avcuenes pushed a commit to avcuenes/PX4-Autopilot that referenced this pull request Feb 28, 2024
* Added Lawnmower airframe

* Update 5005_gz_lawnmower

Works all right

* Update 5005_gz_lawnmower

RDD_WHL_SPEED has new name: RDD_WHEEL_SPEED

* Update ROMFS/px4fmu_common/init.d-posix/airframes/5005_gz_lawnmower

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Update ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Renamed 5005_gz_lawnmower to 4011_gz_lawnmower

also pulled latest GZ models hash

---------

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>
Peize-Liu pushed a commit to Peize-Liu/PX4-Autopilot that referenced this pull request Mar 24, 2024
* Added Lawnmower airframe

* Update 5005_gz_lawnmower

Works all right

* Update 5005_gz_lawnmower

RDD_WHL_SPEED has new name: RDD_WHEEL_SPEED

* Update ROMFS/px4fmu_common/init.d-posix/airframes/5005_gz_lawnmower

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Update ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>

* Renamed 5005_gz_lawnmower to 4011_gz_lawnmower

also pulled latest GZ models hash

---------

Co-authored-by: Per Frivik <94360401+PerFrivik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants