0
$\begingroup$

I'm trying to create a simple MAVROS node that takes off, goes to a specific location and then comes back to its home location. As this is currently being tested inside Gazeboit uses fake gps. I now want to publish the GPS coordinates myself, and thus need to disable the existing fake gps that keeps publishing.

I could publish my gps locations (lat, lon, alt) through mavros/global_position/global topic and then read from it. I want to disable that and see if my quadrotor does go to a custom gps point that I send it to.
I also noticed there is something called mocap=true in rosparam list. Should I disable this as well or I'd be fine to leave it as is? if so how can I do that as well?

Note:
The GPS coordinates that I'm publishing are not something random. They are created using a combination of other sensors. so they are accurate, maybe not as accurate as the original GPS coordinates, but I believe they are accurate enough. that's why I asked, how I can disable the fake gps that gazebo/mavros/ros(not sure which one) is also publishing, so I can test my generated coordinates properly.
In other words, I want the mavros/global_position/global to only contain my published coordinates. currently, in gazebo/mavros there is a fake gps that also is publishing coordinates on this topic whenever I start simulating. I want to stop this

$\endgroup$

1 Answer 1

1
$\begingroup$

There will be a slight problem with that because the custom GPS point you give might be far from the current GPS coordinate at which the drone is present. I'm assuming you are using px4 autopilot(or ardupilot). I think you cannot publish to /mavros/global_position/global. You should publish your setpoints to /mavros/setpoint_position/global topic. So when you switch to offboard mode, then takeoff and publish your setpoint to the above topic. Then the drone will reach the position of your input. You can try to see the drone's home position using the QGroundControl app and then adjust your custom setpoint accordingly. Hope it helps.

$\endgroup$
10
  • $\begingroup$ Thanks a lot. The GPS points will be accurate. the thing is, my board does not have a gps sensor, and therefore I'm trying to provide the gps coordinates myself, so that I can set the target coordinate using mavros/setpoint_position/global and move the quadrotor to target. I believe without doing this "setpoint_position/global" can not be used, as the current coordinate will be unkown. am I wrong? $\endgroup$
    – Hossein
    Aug 9, 2021 at 9:03
  • $\begingroup$ So you want to navigate the drone to the target which is published at the mavros/setpoint_position/global and also want to check if your drone has reached the goal or not without using any GPS data? Is that what you are trying to do. $\endgroup$
    – Sankeerth
    Aug 9, 2021 at 9:23
  • $\begingroup$ Yes. thats pretty much it. $\endgroup$
    – Hossein
    Aug 9, 2021 at 9:27
  • $\begingroup$ Then calculate the heading angle and the distance. Once the drone takes off, publish a velocity message to adjust its heading angle and then publish the velocity setpoint with value v to the drone. When v*time reaches the distance, get the drone to stop. You can't publish a GPS point without the drone having any info about GPS. It constantly checks itself if it's reached the setpoint, so without GPS data, it can't. Either you fake the GPS or use the heading angle and distance. $\endgroup$
    – Sankeerth
    Aug 9, 2021 at 9:49
  • 1
    $\begingroup$ So you will know the drone's GPS position(not accurately but). You want to publish your own GPS data on the global topic. Is that what you want to do? You can disable the fake GPS by going into mavros/mavros/launch/px4_config.yml there will be a fake GPS segment and you can remove it. $\endgroup$
    – Sankeerth
    Aug 9, 2021 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.