I am trying to modify the AP_GPS.cpp file so the Ardupilot reports the GPS position with an offset. I would like to use the BCN_LATITUDE, BCN_LONGITUDE, BCN_ALT, and BCN_ORIENT_YAW to be able to change the offset without the need to recompile the firmware.
How can I get the value of these parameters within the AP_GPS.cpp ?
I am new to firmware programming and I am just testing. If there is a wiki where there is all the dev documentation please point me there.
Hope anyone can help me the the value to the parameters within the AP_GPS.cpp file.
Making this modification in the Parameters.cpp, the compiler gives me an error telling me that the AP_GPS_NMEA in GOBJECT is not declared.
I also tried to access any of the parameters of AP_GPS.h from AP_GPS_NMEA.cpp, for example _min_dgps, but all I get is _min_dpgs was not declared in this scope.
What am I missing?
Can someone please help me create a parameter that I can access from within AP_GPS_NMEA.cpp that I can change from Mission Planner ?
Can you provide with a full example on how I would need to do it? I tried everything the documentation says and I also tried to get the value of the AP_GPS.h parameters but I get that the parameter is not declared in the scope.
I just need to know how to add one parameter as later I will copy the code to generate as many parameters as I need.
The code you’re looking at is full of examples of parameters which are properly declared and implemented.
I can’t give any better explanation than what is in the wiki. It was written by developers who are much better programmers than me.
I am failing to see that the AP_GPS_NEMA.cpp is getting the value of any parameters.
I want to follow the wiki as I assume how everyone codes but after trying what the wiki says the SITL gives up errors meaning I am doing something wrong that I am failing to see or the wiki is not up to date with the current code so the tutorial in the wiki does not work.
The only thing I am missing is how to access the value of parameters. I could hardcode my modifications but every time I would need to recompile the code and upload it to the drone for each flight.
Also, what is the correct way to get the value of a parameter in the code? (Failed to see an example in the wiki)
From my understanding, it has to be as simple as using the declared parameter name but I only get that this parameter name is not declared in the scope.
For example, the _min_dgps which is declared in AP_GPS.h and AP_GPS_NMEA.h includes AP_GPS.h so it should be in the scope.
Do I understand correctly the workings of the scope or not?
Maybe I wrote it wrong. I meant that the Ardupilot thinks that it is at the place with the offset.
So everything needs to be inside the code no lua or companion computer.
From my understanding, this is my first time modifying the source code, if I can create or reuse a latitude and longitude parameter that can be set from mission planner, only I would need to add this value to the NMEA output to apply the offset. Therefore I could change the offset without needing to recompile as the latitude and the longitude are a parameter not a fixed variable.
As explained in my previous post, I tried to create new parameters using the documentation as a guide but I got an error telling me that AP_GPS_NMEA in GOBJECT is not declared.