-
Notifications
You must be signed in to change notification settings - Fork 280
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
ardupilot: added NAV_SCRIPT_TIME mission item #228
Conversation
8f6d42a
to
37e8309
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In many ways this seems the same as NAV_GUIDED_ENABLE so as discussed on the main flight code PR I'd like to discuss why we need both before this is merged.
there are key differences:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the timeout is useful.
It is too linked to the other feilds. For example, I use a script to re-implement loiter turns. I use arg 1 as a radius and arg 2 as a number of turns. I then have to go and workout how long that should take in order to set the the timeout correctly.
A timeout offers no protection against the script crashing. The vehicle will just carry on doing whatever the last thing it was asked to until the timer runs out. If the expected maneuver is more than a few 10's of seconds the timout results in a large distance the vehicle could potentially cover before being 'saved' by the timeout.
Instead I suggest using the existing guided functionality. The user could optionally use MAV_CMD_DO_GUIDED_LIMITS
to set limits, these could either be set once at the start or several times throughout the mission. This gives possibility both a timeout and a geo-fence from the start of the command.
We implement GUID_TIMEOUT
param on plane. Rather than a time out for the whole maneuver this is a timeout on the guided command callback. This means you timeout in the case that the script dies. For scripting guided in the past I have set this to 0.1 seconds with the script running at 100hz. This gives a very fast recovery from a script crash.
This command does not give any method to hand back to mission control either. It has a timeout, but Maybe a command long, |
I generally agree with your comments but looking at the flight code PR the "nav_scripting_update()" allows the script to return a "done" boolean. That same method also allows the script to return other controls but this is where you and I agree that instead the script should use the existing controls:
|
Right, but that is specific to the implementation. It is not a factor of the proposed mavlink message. We could just as easily implement that method for |
I suppose but how would we know if the mission command is to be sent to an offboard computer or a script? .. or maybe you're suggesting that the vehicle code doesn't need to know? It's separate from this PR but if we were to implement NAV_GUIDED_COMPLETE we would need to send a dynamic magic number to the offboard computer within the NAV_GUIDED_ENABLE command and then have the offboard computer return that magic nuimber in the NAV_GUIDED_COMPLETE reply to avoid race conditions. For me, I don't mind adding a new set of NAV_SCRIPT_xxx mission commands but I think the implementation should be closer to the NAV_GUIDED_ENABLE feature than this PR is. |
I don't think that is that use-full unless you also start gate keeping that all the guided commands also come from the same place. For the moment anyway, I think we have to assume that there is only one thing sending guided commands at a time, either scripting or companion. |
this allows for scripts that execute arbitrary navigation commands before handing back control
37e8309
to
86e41b0
Compare
I discussed with @rmackay9 and agreed on NAV_SCRIPT_TIME name and fields |
using this in practice the timeout has been useful. You can also set it to zero for no timeout. For distance limits I want to use the geofence, or pilot takeover |
this allows for scripts that execute arbitrary navigation commands
before handing back control
link to related flight code PR: ArduPilot/ardupilot#19039