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

Start px4_sitl_default jmavsim simulation from within Python Script #141

Open
Kathik-R opened this issue May 4, 2020 · 0 comments
Open

Comments

@Kathik-R
Copy link

Kathik-R commented May 4, 2020

Hello!

I have built a Pixhawk quadcopter with PX4 installed on it and I wish to create a virtual copy of it.
I have installed dronekit and dronekit-sitl on my Python3 (Ubuntu 20.04).
The PX4 Toolchain has been installed and it works as expected. When I use the terminal to launch a simulation using the command make px4_sitl_default jmavsim the virtual drone is created.
However, I want to do this through a python script. Is there a way to mimic the following terminal command in python using dronekit_sitl package?

I ran the following code but it creates an APM Copter V3.3.

connection_string = '127.0.0.1:14540'
try:
        #### connect to px4 drone if simulation already triggered
	vehicle = connect(connection_string, wait_ready=True)
except:
        #### trigger new px4 sitl jmavsim simulation
	import dronekit_sitl
	sitl = dronekit_sitl.start_default()
	vehicle = connect(sitl.connection_string(), wait_ready=True)

How can I give it the input to use px4_sitl_default and jmavsim instead of Arducopter?

Thank you for your time :)

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

No branches or pull requests

1 participant