I successfully got my rover to follow me around the yard. Right now the code tells the rover to come when you push the down arrow button. I plan to experiment with having it send a new location every x seconds and also be able to add some offset. I would like the offset to be to the right or left and forward back so needs to take into account the direction I'm moving but shouldn't be too tough. Here's what I have so far in case anyone finds it helpful.
ps. sorry to all who recieved emails this is my first post and I did it the wrong way. My apologies
Its python code that I run using droneapi and mavproxy.
from droneapi.lib import VehicleMode, Location
window = pygame.display.set_mode((800,
black = (0,0,0)
api = local_connect()
v = api.get_vehicles()
altitude = 30 # in meters
#returns list of lat,lon
# Use the python gps package to access the laptop GPS
gpsd = gps.gps(mode=gps.WATCH_ENABLE)
# Once we have a valid location (see gpsd documentation) we can start moving our vehicle around
# This is necessary to read the GPS state from the laptop
if (gpsd.valid & gps.LATLON_SET) != 0:
loc = [gpsd.fix.latitude, gpsd.fix.longitude]
for event in pygame.event.get():
comloc = Location(gpsloc, gpsloc, altitude, is_relative=True)
roverloc = Location(v.location.lat, v.location.lon, v.location.alt, is_relative=True)
#~ print 'comloc', comloc
#~ print 'roverloc', roverloc
#~ print 'latoffset=',dest_lat_offset
#~ print 'lonoffset=',dest_lon_offset
print 'sending vehicle now!!!!!'
print 'comloc', comloc
print 'roverloc', roverloc
print 'sending vehicle west!!'
dest3=Location(v.location.lat, v.location.lon-.000084, altitude, is_relative=True)
Hi Matthew. Great work.
Late last week I fixed the GUIDED mode for rover and that code is in master on github. If you don't build your own code you can download the latest build from firmware.diydrones.com and it will be in there.
The instructions in the link below are for copter but they will now also work with a Rover. So if you do the magic "ctrl+f" in Mission Planner and select Follow Me your rover should follow you around.
I have some more work to do in this area shortly but I'll keep you posted.
Let us know how you go!
That's great thanks! I tinkered a bit with the firmware but not being a programmer decided I could get up to speed on python quicker than C. I'm glad somebody's working on it though!
My long term goal is to put this in a tractor on my farm, I'm hoping I can get all the functionality I need using python scripts, I think it will be possible but the accuracy of the gps is going to be problematic, I read that I should be able to use the gps off my tractor which is significantly better. However I also read the the coordinates that mavlink sends are truncated and only accurate to 1m?? Know anything about that?
Yes they are only accurate to about 1m. There is an open issue on this in github if you search. Its just a matter of priorities. At the moment the accuracy is fine for almost all use cases. Its only a handful of rover users who are keen to see it improved. It will be fixed eventually.
This is great! Do you run it from the Linux command line, or from within MAVProxy with "api start [program name].py"?