Creating a switch to set "home".

I've been looking for a way to set my home location after the APM2 is powered up. So I can get everything working on the edge of a field, then walk in to the middle and set home before I launch.

If I create a simple mission:

DO_SET_HOME

Would that update the home location when I switched the plane to Auto?

If not, is there anything I could add to make it work?

If I added

DO_SET_HOME

DO_JUMP 0

Would that continually loop, updating the home location until I turned Auto off? Would the mission remain incomplete so I could run it again later without resetting the APM2?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Developer

    If you have telemetry (or a mini USB) can you set the home location through the mission planner?

     

    To be honest, although I'm on the [arducopter] dev team, I'm slightly unsure of the relationship between the home location shown in the planner and the GPS location that's captured after the first GPS lock...

    3692492406?profile=original

  • Developer
    @ Andre where do we add the pushbutton 1 home set trigger? Main loop or system.pde?
  • Hi again,

    won't help your APM2 I'm afraid but I may have found another solution that may be interesting for APM1 users so I mention it here due to the lack of a better place. So it turns out there is an unused pushbutton on APM1's oilpan on pin 41 (active low) which can be used for that purpose. It has been disabled in the next version of ArduPlane but if there is sufficient interest maybe one could bring it back. I haven't tested it yet on the field but on my bench it seems to work. So for ArduPlane (maybe works for ArduCopter, too but haven't checked) basically add something like this which will flash LED A twice and set home to the current location whenever you push the button (on your own risk of course:-)

    if (digitalRead(PUSHBUTTON_PIN) == 0) {
    digitalWrite(A_LED_PIN,LED_ON);
    delay(250); digitalWrite(A_LED_PIN,LED_OFF); init_home();
    delay(250);
    digitalWrite(A_LED_PIN,LED_ON);
    delay(250);
    digitalWrite(A_LED_PIN,LED_OFF);
    }
  • Can anyone from the development team please give us a definitive answer as to how/when HOME can be set?

  • Hmmm.  I thought that home was set when you armed your FC.  If not, that explains a few problems I've had....

  • Hi,

    there appears to be a MAVLINK message type (mavlink_msg_set_gps_global_origin) that is inteded for that purpose (note that I am just guessing this by its name). However, it does not seem to be implemented in neither ArduPlane or ArduCopter based on a quick grep of the sources.

    So I guess you could just make a feature requires on the issue tracker and hope you get one of the devs interested. Or, which may be a lot faster, just implement it yourself :)

    I may be interested in that, too but guess I won't have time for that in the near future at least. I have the same problem of standing at the boundary of the flying field and when I do RTL the other guys doing their own RC things (understandingly) get a bit annoyed :-)

    Cheers, Andre

  • Ok, I've played around a bit more and I think this mission will work.

    LOITER_UNLIM (lat, lot, alt)

    DO_SET_HOME 1

    DO_SET_SERVO 2 1000 (move the elevator as a confirmation the script has run)

    DO_JUMP 1 -1

    Does that look right to someone?

This reply was deleted.

Activity

Jose Araujo liked Jose Araujo's profile
Aug 29
spencer harvey liked spencer harvey's profile
Jul 9
More…