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

Problem with GPS home location #3130

Closed
Agm2104 opened this issue Nov 6, 2020 · 16 comments
Closed

Problem with GPS home location #3130

Agm2104 opened this issue Nov 6, 2020 · 16 comments

Comments

@Agm2104
Copy link

Agm2104 commented Nov 6, 2020

Hi everyone!

I'm having a problem when trying to run the hello_drone script, since I'm getting the following error:

msgpackrpc.error.RPCError: rpclib: function 'armDisarm' (called with 2 arg(s)) threw an exception. The exception contained this information: Vehicle does not have a valid GPS home location.

However I think I have implemented the location in the settings.json correctly

image

Also, when linking with PX4 I get the following:

image

Which according with #2647 is a good sign.

However I'm unable to arm the robot and I'm running out of ideas...
What do you think the problem is?

@rajat2004
Copy link
Contributor

The params key should be Parameters I think, or you can try to set the parameters yourself in the PX4 terminal

@Agm2104
Copy link
Author

Agm2104 commented Nov 7, 2020

Hey, thanks for answering!
Changing "params" to parameters doesn't seem to work, nor setting the parameters in the PX4 terminal.
One thing I did't mention is that I don't get the 'home set' message on the UE screen, so maybe is not passing the location properly?

@jonyMarino
Copy link
Collaborator

Hi @Agm2104! Which is the player start's location?

@Agm2104
Copy link
Author

Agm2104 commented Nov 13, 2020

Hi @jonyMarino!

These seem to be the start parameters:
x=5690
y=-100
z=202

image

@ahmed-elsaharti
Copy link
Contributor

@Agm2104 , what version of the px4 firmware are you using here?
Also, do the log messages on the UE environment state that the vehicle is connected to SITL?
image
I don't see anything in the PX4 terminal that confirms that there's a successful connection to the current UE session.
image

I tried replicating the error you're getting using your settings.json but everything seemed to work fine.

@Agm2104
Copy link
Author

Agm2104 commented Nov 16, 2020

@ahmed-elsaharti, sorry I didn't add a screenshot of the UE enviroment, I totally forgot. Here it is.

image

I'm using the 1.11 version of PX4.

As you say, a confirmation message doesn't appear in the PX4 terminal, but given that i can launch missions with QGC and it's reflected in both UE and PX4, I think they are connected. The problem seems to appear whenever I try to arm the drone via Python scripts, where I get the error mentioned in my first post.

@ahmed-elsaharti
Copy link
Contributor

ahmed-elsaharti commented Nov 16, 2020

@Agm2104, I was able to replicate your results when I switched over to PX4 1.11.2. I can also confirm that with this version the params key does not work while Parameters does. Try switching over to the version recommended in the docs (1.10.1) and see if the issue persists?
Edit: if you do switch over, don't forget to replace Parameters with params

Also, at the player location x=5690 y=-100, the vehicle's GPS coordinates will not be those set by OriginGeopoint. The vehicle's GPS position would be offset from OriginGeopoint by 5690 and -100 meters since OriginGeopoint sets the location of the world origin ( see #2588 )

@Agm2104
Copy link
Author

Agm2104 commented Nov 16, 2020

@ahmed-elsaharti hi,a nd thank you very much for your help!

The problem is that everytime I try to build PX4 with the v1.10.1 I get this error.

image

Any ideas about how to fix it?
I'll let you know if the version works the moment it's running :)

@ahmed-elsaharti
Copy link
Contributor

ahmed-elsaharti commented Nov 16, 2020

@Agm2104 No worries.
Which version of the PX4 Windows Toolchain are you using? I used to get all kinds of compiling errors when trying to use 0.9 with PX4 1.10.1 (There was an issue about it where someone pointed out that there was a compiler compatibility issue but I can't find it). Try installing 0.8 and building 1.10.1.
Let us know if it works

https://github.com/PX4/PX4-windows-toolchain/releases/tag/v0.8

@Agm2104
Copy link
Author

Agm2104 commented Nov 16, 2020

@ahmed-elsaharti it's exactly as you say, I was using 0.9 build with 1.11.
I have changed the versions as you suggested and it works way better now, it seems like I really hit the nail with the compatibility.

These are the screens I get now.

image
image

The only thing that still bugs me is that I doesn't seem to get a home set message in the PX4 console, but I'm not entirely sure if that's a problem or not.

Again, thank you very much for your help.

@ahmed-elsaharti
Copy link
Contributor

ahmed-elsaharti commented Nov 16, 2020

@Agm2104 Glad it worked!
As for the home set message, If you give it a couple of seconds and try to run pos in Droneshell (as is suggested in https://microsoft.github.io/AirSim/px4_sitl/) it should report the GPS coordinates its at rather than 0,0,0 (if you issue pos without waiting it will actually report 0,0,0).
What I've seen is that the moment the console reports 'EKF commencing GPS fusion' the position reported by the API (in Droneshell) switches over from 0 to the correct position:
image
Not sure if it's directly related to 'GPS fusion' or not, but you can actually see it performing like expected in https://microsoft.github.io/AirSim/px4_sitl/ without having to report home set

@dayjaby
Copy link
Contributor

dayjaby commented Mar 15, 2021

Seems to be an issue on AirSim side. PX4 confirms that the home position is valid:

pxh> listener vehicle_status_flags
...
	condition_home_position_valid: True

And still AirSim throws the error:

function 'armDisarm' (called with 2 arg(s)) threw an exception. The exception contained this information: Vehicle does not have a valid GPS home location.

Even validated that the mavlink message HOME_POSITION is being sent by checking mavlink status streams:

pxh> mavlink status streams

instance #0:
	Name                Rate Config (current) [Hz] Message Size (if active) [B]
	...
	HOME_POSITION                   0.50 (0.500)    72
	...

instance #1:
	Name                Rate Config (current) [Hz] Message Size (if active) [B]
	...
	HOME_POSITION                   0.50 (0.500)    72
	...

and listener home_position (before and after asking for an update of the home position):

pxh> listener home_position

TOPIC: home_position instance 0 #1
 home_position_s
	timestamp: 21234117  (293.841613 seconds ago)
	lat: 47.641468
	lon: -122.140165
	alt: 119.1647
	x: 0.0075
	y: 0.0112
	z: 0.0143
	yaw: -2.3250
	valid_alt: True
	valid_hpos: True
	manual_home: False

<asking for an update of the home position>

pxh> listener home_position

TOPIC: home_position instance 0 #1
 home_position_s
	timestamp: 17534951  (4.755668 seconds ago)
	lat: 47.641468
	lon: -122.140165
	alt: 119.1847
	x: 0.0052
	y: 0.0065
	z: 0.0691
	yaw: -2.3270
	valid_alt: True
	valid_hpos: True
	manual_home: False

@trungvm
Copy link

trungvm commented Apr 20, 2021

Because of the drone broken before run simulation so you can make the drone can't be broken in the unreal simulator for fix this problem. It in Player start config. Hope this may help you bro.

@jonyMarino
Copy link
Collaborator

Try with the latest version, please

@lovettchris
Copy link
Member

Right, the latest bits should help especially if you also use the latest settings from here. Notice I added this block:

            "Sensors":{
                "Barometer":{
                    "SensorType": 1,
                    "Enabled": true,
                    "PressureFactorSigma": 0.0001825
                }
            },

which causes the GPS lock to happen a lot more quickly. The problem because was that PX4 was confused by the random variations in pressure being generated by AirSim barometric pressure simulation. These new sensor settings clamp down on that randomness which makes PX4 a lot happier.

@lovettchris
Copy link
Member

Closing due to inactivity, please reopen if you are still having this problem with the latest AirSim bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants