-
Notifications
You must be signed in to change notification settings - Fork 19.7k
autotest: reimplement -P functionality for SITL #31413
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
base: master
Are you sure you want to change the base?
Conversation
59407ed to
053f077
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.
This doesn't work:
pbarker@crun:~/rc/ardupilot((HEAD detached at ohyaiamhere/pCommand))$ ./Tools/autotest/sim_vehicle.py -v Plane --gdb --debug -P LOG_DISARMED=16 -P LOG_REPLAY=17,LOG_MAX_FILES=78^C
pbarker@crun:~/rc/ardupilot((HEAD detached at ohyaiamhere/pCommand))$ cat build/new.parm
LOG_REPLAY 17,LOG_MAX_FILES 78pbarker@crun:~/rc/ardupilot((HEAD detached at ohyaiamhere/pCommand))$
Please split on commas to allow a csl.... need a newline for neatness in that file.
A small autotest which customises the SITL command-line as I have there and makes sure that the values come up correctly will make sure this behaviour doesn't break (again).
Thanks for working on this, will be useful.
30ac584 to
127e579
Compare
Happy to help. I had an idea for implementing this. Essentially, a loop where the new params get appended to the file instead of being written all in one go. I will try to see if I can get it to work next week. |
|
Hello, That doesn't address that issue as this just add -P on sim_vehicle.py which isn't sitl . as we are in python, we could probably use a tmpfile feature to not polute the workspace and garantee to not load those parameter if they aren't passed on cmdline ! |
f3c22d3 to
37ee17c
Compare
e540b37 to
53d8c20
Compare
Hello Pierre, A temporary file was tried for this purpose, as used for
Where the value of |
| if opts.param: | ||
| param = str(opts.param) | ||
| param_file = tempfile.NamedTemporaryFile(mode='w', delete=False) | ||
| atexit.register(os.unlink, param_file.name) |
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.
probably not need as those files will be cleaned up on /tmp and the creation guarantee they won't be reused
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.
Pardon me, I don't follow which line is verbose. The delete parameter has been set to false (line 818), and at exit, this file can be deleted by the line 819 (atexit called at line 1446). File creating and deletion flow created to be similar to other temporary files in the script.
Is there something here that we can perhaps do without?
To solve the old issue #6114 , the file sim_vehicle.py was modified to also take
-Pas a parameter to pass one parameter and its value to SITL.It does this by creating a new.parm file in the build folder, and using the same logical flow as the
add_param_fileoption, to append it to the parameter files list. The parameter, tested with single vehicle SITL, is succcessfully passed into the simulation. This is similar to what has been suggested at the end of pull request #6040Example commands:
sim_vehicle.py -v Plane -P SIM_SPEEDUP=8 -D -G -B _set_param_defaultsim_vehicle.py -v Plane -P SIM_RC_FAIL=1 -D -G -B _set_param_defaultThe command must not have any spaces in the param or around the
=sign, else it throws an error.