Is User Hook available in APMRover?

Hey all,

I know you can have custom "USERHOOK_VARIABLES" as mentioned on  this thread for APMCopter. 

I dont see the UserCode.pde in the Rover code so I assume user hooks do not exist for the rover code?

The big picture:

depth sensor outputting NMEA 0183 sentences >slave arduino> i2c link to APM 2.6> APM logs passed parameters with other standard params locally > apm sends params to ground station via  3DR radios 

If the userhook method is not available, what is the best way to "inject" my own sensor data into the APM log file and send it to the GCS?  Optimally, saving  GPS / Depth data  to a separate file on the APM would be ideal. 

Is this doable? 

Thanks!

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

Join diydrones

Email me when people reply –

Replies

  • Developer

    Hi - sounds very interesting what your doing. Your correct that the Userhook code is only available in Copter.  Its very old and not the recommended approach moving forward.

    The standard way to implement what your doing is to write a driver.  Presumably if you have new I2C device you are plugging onto the APM you have written a driver for it? 

    The APM has very little on board storage so I wouldn't advise trying to keep data there unless you plan to upgrade to a Pixhawk which has loads of local storage on the SDCard. 

    The log file isn't sent to the GCS.  Telemetry data and some other bits and pieces are sent to the GCS and logged there.  You could include your new data in the telemetry stream and the GCS would log it.

    The best place to start is look at how an existing driver works.  Try the plane airspeed sensor.  libraries/AP_Airspeed.  Because your on APM2.6 have a look at AP_Airspeed_I2C .h/cpp files.  That's the driver.  You can see that ArduPlane.pde around line 454 creates the airspeed class and in that constructor it calls init.  That then registers the _timer method in HAL schedule call back and your done.  _timer will be called periodically from the scheduler and you can do your stuff in that. 

    Thanks, Grant.

  • ^ Bump ^

    Any ideas?  I'm working on a project too.  Can't figure out how this code works.  Can't do Serial.begin, Can't do digitalRead. 

This reply was deleted.