I am using master version of Ardupilot, I used mav_sysid of target plane 11 and then foll_sysid of 11 in follower plane
Whenever I start the script using rc 7 2000. It start showing these messages.
@timtuxworth Sir please help, followed all your methods, it has been three days to make it working
After consulting with ChatGPT I removed this concatenation, just one line. Still when I start the script it doesnot follow vehicle 11 (target). It first says LOST, then keeps on repeating - no target 11
What could be the issue, What am I missing to make it working
Setting up 2 vehicles in SITL can be tricky, especially if you want them to have different parameters (for this you do) but also communicate with each other. There may be better ways, but here’s how I do it:
create separate directories for each plane (I call them plane1 and plane2)
create a script for each plane that will start a different instance of arduplane in each directory
create a scripts directory in plane1 → this is where you copy the plane_follow.lua and it’s modules
when you start the arduplane instances you need to make sure they can communicate with each other by passing –serial0 mcast: to both of them
then after you start both copies of ardupilot, I start mavproxy.py to communicate with each vehicle.
I think there might be a way to do this using the –instance option to sim_vehicle.py, but I use this way to get it to work for me.
So I have a script to start plane1, something like this dual_plane1.sh:
Then I have a. “master” script that starts the 2 planes and runs mavproxy. Something like this:
# assume we start the script from the root directory of the git clone we are using
export ROOTDIR=$PWD
PLANE=$ROOTDIR/build/sitl/bin/arduplane
WINDOW=$ROOTDIR/Tools/autotest/run_in_terminal_window.sh
($WINDOW ArduPlane1 dual_plane1.sh) &
($WINDOW ArduPlane2 dual_plane2.sh) &
mavproxy.py --retries 10 --console --map --master=tcp:localhost:5772 --out=udp:localhost:14551 --out=udp:zenbook-ts:14550 --streamrate=-1
I adapted my code from the example of setting up 2 vehicles for aerobatics which you can find in git under libraries/AP_Scripting/applets/Aerobatics/FlxedWing/RateBased
Once you have the two vehicles running you can switch between them using mavproxy using the “vehicle” command … “vehicle 11”, “vehicle12” … where the 11 and12 are the MAV_SYSID of the vehicle to connect to.
Looking at what you’ve done here, this might work, but you have a problem with your –out on both vehicles is using the same port which for sure won’t work.
@timtuxworth First of all Thank you very much sir for helping, by following your steps I do able to enable Follow mode
(Target: 11, Follower: 12)
Now its just That I am unable to follow my target plane, I didn’t understand what could be the reason
When I write link in follower plane, it only show 1 link, Do I need to have 2 links?
Can you check what could be wrong, I can paste whatever you need to debug
I don’t know why this happens, but you need to leave the “vehicle x” set to the follow vehicle. I guess this is 12 in your example.
If you set vehicle to 11, 12 will stop following in SITL. If you set vehicle 12, then the follow will start following. This doesn’t happen in the real world, only in SITL. You can change the direction of vehicle 11 by switching to it but always switch back.
If you don’t want to have to keep switching back and forth, put a mission on vehicle 11 and set it in auto mode.
Also - no need to set Vehicle 12 to guided. the script (rc 7 2000) automatically sets the vehicle to guided.
Other than that - it looks like you have everything right. Yes you only have one link, thats correct and actually important because it means the mcast: is working. If you had 2 links the vehicles would not be communicating.