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

Rover land detection #13769

Merged
merged 7 commits into from
Apr 28, 2020
Merged

Rover land detection #13769

merged 7 commits into from
Apr 28, 2020

Conversation

ealdaz-seesai
Copy link
Contributor

Describe problem solved by this pull request
In the current implementation when Land is requested the rover never lands but circles continuosly around the position where land was requested.
This is due to the fact that the RoveLandDetector currently returns the arm status, and once the Rover is armed it remains armed and hence land is never achieved.

Describe your solution
In the proposed implementation if landing is requested the Land detector detects that vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND
and then simply returns true.

Test data / coverage
This was tested with both px4_sitl gazebo_rover and a pixhawk4 rover running the Aion RObotics R1 UGV (Tank type/Differential drive)

Current Behaviour
Rover circles continously around landing position and landing is never detected
image

Proposed Behaviour.
Rover stops and landing is detected.
image

@ealdaz-seesai ealdaz-seesai changed the title Rover land Rover land detection Dec 20, 2019
private:
// Program crashes when Subscriptor declared here
//uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
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 revert this change and we'll work through whatever issue you hit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello dagar, apologies for delay, was away for Xmas.
Have just reverted the changes on my branch.
Please let me know if there is anything else I can help with

uORB::Subscription vehicle_status_sub{ORB_ID(vehicle_status)};
vehicle_status_s vehicle_status{}; /**< vehicle status */

vehicle_status_sub.update(&vehicle_status);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vehicle_status_sub.update(&vehicle_status);
_vehicle_status_sub.update(&_vehicle_status);


// I need to do the uORB subscription here, can't do it in the .hpp file (SIGSEGV if I do... but no idea why)
uORB::Subscription vehicle_status_sub{ORB_ID(vehicle_status)};
vehicle_status_s vehicle_status{}; /**< vehicle status */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vehicle_status_s vehicle_status{}; /**< vehicle status */

return !_actuator_armed.armed;

// I need to do the uORB subscription here, can't do it in the .hpp file (SIGSEGV if I do... but no idea why)
uORB::Subscription vehicle_status_sub{ORB_ID(vehicle_status)};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
uORB::Subscription vehicle_status_sub{ORB_ID(vehicle_status)};

}
else
{
return !_actuator_armed.armed; // If we are armed we are not landed
Copy link
Member

Choose a reason for hiding this comment

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

The system being disarmed should probably be checked first to override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello dagar, I don't really follow what you mean. This part of the code is unchanged.

Copy link
Member

Choose a reason for hiding this comment

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

I mean you can check _actuator_armed.armed before updating vehicle_status and checking the nav_state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I think my comment in the code might be confusing things. The system works perfectly as it is currently.

The original part of the code (which is now part of the else) is what didn't work properly

 else {
		return !_actuator_armed.armed;  // If we are armed we are not landed
		// This doesn't work very well because once it's armed it will stay armed
		// so when requesting land it never detects it has landed.

I'll remove those comments, as they are confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

In the header it caused SIGSEGV in my machine so that's why it was moved
to .cpp
@dagar
Copy link
Member

dagar commented Jan 6, 2020

@julianoes
Copy link
Contributor

@ealdaz-seesai I'm curious. How does your rover "land" 😄 ? Or what is the use-case to use land with a rover?

@julianoes
Copy link
Contributor

@ItsTimmy would be great if you could review this one, thanks!

@ealdaz-seesai
Copy link
Contributor Author

ealdaz-seesai commented Feb 15, 2020 via email

AmeliaEScott
AmeliaEScott previously approved these changes Feb 20, 2020
Copy link
Contributor

@AmeliaEScott AmeliaEScott left a comment

Choose a reason for hiding this comment

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

I think this is a good solution. The rover needs some way to indicate that it is done with a mission, just like a drone does, so it makes sense to reuse the same concept of "landing", even though the drone isn't really landing.

One thing that could be improved is to check whether the speed of the rover is 0 (or close to 0) before "landing", but I think this would fall under a separate PR. So this one is good as is.

julianoes
julianoes previously approved these changes Feb 20, 2020
@ealdaz-seesai
Copy link
Contributor Author

Is there anything else required to merge this?

@julianoes
Copy link
Contributor

Thanks @ealdaz-seesai!

@julianoes julianoes merged commit efa0e1b into PX4:master Apr 28, 2020
@ealdaz-seesai
Copy link
Contributor Author

A pleasure, thank you!

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.

4 participants