Set 'GPS_TYPE' param through mavlink


I want to inject false GPS data to arducopter with master.mav.gps_input_send. In order to do that, I also have to set GPS_TYPE to 14.

  1. I tried,
    master.target_system, master.target_component,

After that, when I request GPS_TYPE, the value is 14. However, it won’t use the GPS info in master.mav.gps_input_send, instead, it uses the original GPS value.

  1. If I change GPS_TYPE in /Tools/autotest/default_params/copter.parm, it will take the GPS into in master.mav.gps_input_send. However, I want to feed the GPS data in runtime. In other words, the GPS data can be switched to fake GPS data in flight and can also switch back to correct data later.

How should I achive that?

There are Mavlink commands to change the value of a parameter. Use that mavlink message to change the value of GPS_TYPE.

Thanks, my question should be how to inject fake gps data during flight.

I can set ‘GPS_TYPE’ in the command you mentioned, but I can’t inject false gps data if I modify GPS_TYPE this way. However, if I change GPS_TYPE in default params, I can send fake gps data.