start_follow.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # assume we start the script from the root directory
  3. ROOTDIR=$PWD
  4. ROVER=$ROOTDIR/build/sitl/bin/ardurover
  5. GCS_IP=192.168.2.48
  6. BASE_DEFAULTS="$ROOTDIR/Tools/autotest/default_params/rover.parm,$ROOTDIR/Tools/autotest/default_params/rover-skid.parm"
  7. # start up main rover in the current directory
  8. $ROVER --model morse-rover --uartA udpclient:$GCS_IP --uartC mcast: --defaults $BASE_DEFAULTS &
  9. # now start 2 rovers to follow the first, using
  10. # a separate directory for each to keep the eeprom.bin
  11. # and logs separate
  12. for i in $(seq 2); do
  13. echo "Starting rover $i"
  14. port1=$(expr 60000 + $i \* 2)
  15. port2=$(expr 60001 + $i \* 2)
  16. mkdir -p rov$i
  17. SYSID=$(expr $i + 1)
  18. FOLL_SYSID=$(expr $SYSID - 1)
  19. # create default parameter file for the follower
  20. cat <<EOF > rov$i/follow.parm
  21. SYSID_THISMAV $SYSID
  22. SERVO1_FUNCTION 73
  23. SERVO3_FUNCTION 74
  24. INITIAL_MODE 6
  25. MODE6 6
  26. FOLL_ENABLE 1
  27. FOLL_OFS_X -5
  28. FOLL_OFS_TYPE 1
  29. FOLL_SYSID $FOLL_SYSID
  30. FOLL_DIST_MAX 1000
  31. EOF
  32. pushd rov$i
  33. $ROVER --model "morse-rover:127.0.0.1:$port1:$port2" --uartA tcp:0 --uartC mcast: --instance $i --defaults $BASE_DEFAULTS,follow.parm &
  34. popd
  35. done
  36. wait