Rover Code Configuration

Load the code:

If you have not already done so, download and install the Mission Planner.Mac and Linux users can use APM Planner This manual will use Mission Planner as the reference, however.

Once you have installed Mission Planner, run it. Use your USB cable to plug the APM 2.5 into your PC. In the Mission Planner (top right of window), select the COM port that Windows assigned to your APM 2.5 and ensure that the baud rate is 115200. Once that is done, you can load the Rover firmware on to APM 2.5. Just click on the icon shown belpw in the Firmware tab. The code will automatically load.

Capture

Once the code is loaded, press the “Connect” button in the top right of the Mission Planner, and it should connect to the APM 2.5 board via MAVLink. After that is done, you can switch to the Configuration tab and do the setup as follows.

Calibrate Your RC settings:

With APM 2.5 connected via USB and the RC connected as per the hardware installation instructions, turn on your RC transmitter. If your RC receiver (Rx) and transmitter (Tx) are bound, you should be able to see the green pars in the Radio Calibration section moving when you move the transmitter sticks.

If they are not moving, check:

  • Is the solid green light on your receiver? If it’s red or flashing green, your RC transmitter isn’t on or your Rx/Tx need be bound (see the manual that came with your RC equipment for how to do that)
  • If there is no light at all on your receiver, check that you wired it correctly to APM 2.5 (look for connectors that may have been inserted upside down)
  • If you have a solid green light on the receiver and APM 2.5 is connected to the Mission Planner but the bars are still not moving, try clicking on the “Calibrate Radio” button.

MP_rover_radio-calibration

If the green bars do move when you move the sticks, click on the “Calibrate Radio” button. After you click OK on some warning dialogs, red lines will appear on the green bars. Move the sticks (you only need to do the ones for the channels you have connected to APM) until you have pushed the red lines as far as they will go in all direction, as shown below:

Capture

  • For reverse steering in MANUAL mode, reverse the direction of that channel on your transmitter.
  • For reverse steering in AUTO mode, check the “Reverse” checkbox for the ROLL channel in the Mission Planner as shown above

Assign Modes:

Now switch to the Flight Modes section. This is where we will tell APM what modes to assign to each position of your Channel 5 toggle switch. Most toggles switches can only handle two or three positions, but there are ways to combine channels to get six or more. That isn’t normally needed for Rover, but if you want to learn more about having more than three modes, see the instructions (Here!).

Capture

  • Typically, your transmitter’s three-way toggle switch will be on Channel 5 and your two-way momentary toggle will be on Channel 7. If this is not the case, you can change that with your RC transmitter menus (see your RC manual for details).
  • When you move the Channel 5 toggle, the green bar shown above will move to different modes. You can assign the function of those modes with the drop-down menu next to each.

Mode Meanings:

  • MANUAL Mode: Basic radio pass through drive your vehicle with the RC transmitter.
    • Control steering and throttle manually.
    • One dedicated mode is always Manual mode (Flight Mode 6).
    • For all modes other than just driving around in Manual Mode you must have GPS lock and a Home position.
      • After vehicle is first powered up, GPS lock is achieved (when GPS blue LED solid on) and Home position is set to that location.
    • Momentary toggle of (CH7) switch clears the waypoints list.
      • Steering hard right when CH7 switch is toggled resets resets the vehicles current position to the Home position.
  • LEARNING Mode: Also radio pass through drive your vehicle but you can record waypoints for use in auto mode.
    • Control steering and throttle manually.
    • Momentary toggle (CH7) stores the current GPS position as a new waypoint.
  • AUTO Mode: Follow a course of Waypoints generated in while driving in Learning mode or from a loaded waypoint list.
    • Waypoint lists can also be generated with APM mission planner and uploaded to APM via the Flight Planner screen.
    • Rover loops the waypoint lists stored in memory.
    • Momentary toggle (CH7) triggers immediate RTL (return to launch point: Home position), enters HOLD mode after completing RTL.
    • To regain manual control of the rover, switch back to LEARNING or MANUAL mode.
    • In Auto mode if RC reception is lost, the controller will automatically switch to Hold mode.
  • STEERING Mode: Learning mode (sort of) plus obstacle avoidance.
    • Steering mode is a bit like learning mode, except that the controls use the same steering, throttle and obstacle avoidance code as AUTO mode does.
      • The steering controls the “navigation bearing”, which is what AUTO uses to navigate.
      • The throttle controls the target speed, just like AUTO does.
      • When it sees an obstacle it tries to avoid it in the same way that AUTO does.
      • It even does turn speed scaling.
    • So you can use STEERING mode to test your rover while remaining fully in control.
    • Drive it at a obstacle, and it will avoid it, which is not only fun, it’s great for tuning.
    • Momentary toggle (CH7) stores the current GPS position as a new waypoint.
  • HOLD Mode: All Stop
    • When you switch to Hold mode, the vehicle should stop with its wheels pointed straight ahead.
    • It is necessary to set your throttle (RC3_Trim) parameter to the correct position for your vehicles throttle off PWM.
    • If you have a reversing vehicle with a center neutral point set RC3_TRIM parameter to 1500: (May need adjustment for your vehicle).
    • If you have a non reversing vehicle RC3_TRIM can be left to it’s default low (~1100 PWM) setting or adjusted to it if necessary.
    • In Auto mode if RC reception is lost, the controller will automatically switch to Hold mode.
    • If you enable Throttle Failsafe and set the Failsafe action to HOLD it will go to HOLD if radio reception is lost in all modes.
    • Normally you do not have to install this as a switch option.
    • If it failsafes to HOLD mode, switching to another mode and back will clear it.
  • GUIDED Mode: 
    • Does not require a dedicated switch, so don’t select it as a flight mode.
    • It may currently require the “flight altitude” to be set to zero.
    • Allows you to use a Telemetry Radio to specify waypoints on a map in mission planner.
    • And “tell” the Rover to go to those waypoints.
    • See the APMCopter Guided Mode Description for a overview of how it works.
  • For a 3 position switch initially set 5 and 6 to Manual, 3 and 4 to Learning and 1 and 2 to Auto.

Calibrate the compass

This step is important. Rover does most of its steering based on the compass, and if that sensor is giving bad results, either because it wasn’t calibrated right or if it’s seeing too much magnetic interference, the rover will wander all over the place.

Capture

Now go to the Hardware Options section and ensure that the Compass Enable and Auto Dec checkboxes are set. Then click on the Live Calibration button and, holding the rover in the air (as far from metal desks, cars or other sources of magnetic interference as possible) rotate it in all directions (360 degrees) on all three axes (pitch, roll, yaw) for about a minute to collect enough data to calibrate the compass. A dialog box will pop up when it has all the data it needs and will tell you the offset value. If that value is less than around 150, you should be fine. If it’s higher than that, try the calibration again.

Note: It’s often better to do this test with the car’s motor running, to ensure that any magnetic interference from the motor is included in the compass calibration.

Next Step: Plan a Mission

Set up some Parameters

  • Connect to Mission Planner via the USB cable and select “Connected”  and go to the Config/Tuning tab.
  • Select the Planner item in the left menu and ensure the Advanced View item on the bottom right is checked.
  • Click on the Standard Params item in the left menu and install some conservative starting parameters.
    • Set the Channel 7 Option to Learn Waypoint if it is not already set to it.
    • Reduce Target cruise speed in auto from 5.00 to 2.50.
    • Reduce Base throttle percentage from 50 to 30.
  • Set a failsafe to turn your vehicle off (put it in HOLD mode) if you lose RC reception for 5 seconds.
    • Set Failsafe Action to HOLD.
    • Set GCS failsafe enable to Disabled unless you are using a 3DR Telemetry radio.
    • Set Throttle Failsafe Enable to Enabled
    • Failsafe is preset to 5 seconds but can be adjusted in the Full Parameter List with the FS_TIMEOUT parameter.
  •  Select the Advanced Params item from the left menu and ensure the Board Orientation Item matches your setup.
    • I mount my PX4 upside down for improved connector access so I set this to Roll 180 (8).
    • If your controller is mounted right side up select None.
  • Scroll down to Compass Orientation and ensure it is set correctly for your compass.
    • This should have been set in Compass Calibration section above.
  • Scroll down to RC trim PWM (RC3_TRIM) and set it up for (reverse – center – forward) throttle or not.
    • Throttle is normally channel 3, if you have changed it to another channel go there instead.
    • If you have a center loaded throttle with reverse, set this value to 1500, if not leave it at 1100.
  • I also set my transmitter so throttle (channel 3) is moved to the right center loaded elevator stick.
    • And steering (channel 1) is moved to the left rudder stick.
    • You need an appropriately programmable transmitter to do this.
    • Otherwise you can reassign the RC channels in the Flight Controllers Advanced Parameter List instead.
    • You will need to steer with the left stick and go forward and reverse with the right stick, but it is easy with a little practice.

Questions about this page? Comments? Suggestions? Post to APM Forum! Use the platform specific to your query, and make sure to include the name of the page you are referring to.