Hi everyone,

Does anyone have experience with configuring their own sensors onto the Pixhawk (I have an IRIS)? I purchased a gas sensor that I'd like to wire to it, does anyone know of any good resources to help me get started? I've downloaded the PX4 development environment from the Pixhawk developers website and have gone through some of the "getting started" instructions on there, I have been able to install the firmware through Eclipse as opposed to the Mission Planner. I also purchased 3-position and 5-position connectors for the analog inputs.

I was also wondering if there is a way to view the telemetry log data on Mission Planner during flight? If I did add this sensor, would data be saved through the telemetry logs or dataflash logs?

I appreciate whatever help I can get, thank you!

Kate

Views: 14185

Reply to This

Replies to This Discussion

Thanks for the encouragement, Eric. Will do!!

James,

I've made the changes as you've described, but how are you reading pin 13 into sonar_alt? I will be using pin 15 and am not sure where/how that needs to be changed in the code.

Thank you!

Kate

Kate,

Please alter the line:

    test_adc = hal.analogin->channel(13);

to

    test_adc = hal.analogin->channel(15);

It also looks like GCS_Mavlink.pde has changed in master...

Please ignore the above and alter your code like this starting from line 402:

#if CONFIG_SONAR == ENABLED
static void NOINLINE send_rangefinder(mavlink_channel_t chan)
{
    // exit immediately if sonar is disabled
    if (!sonar.healthy()) {
        // return; commented out
    }
    mavlink_msg_rangefinder_send(chan, sonar_alt * 0.01f, 0);
}
#endif

You are welcome!

James,

Does the above work? Even though you have commented out the return so that the message gets sent, if Sonar is not enabled, the whole section of code in GCS_Mavlink.pde will not run because of the #if CONFIG_SONAR == ENABLED.

If you enable sonar, then you will also enable the sonar behaviors. I would have thought that you would have been better off leaving Sonar disabled and modifying the code to be;

 //  #if CONFIG_SONAR == ENABLED
   static void NOINLINE send_rangefinder(mavlink_channel_t chan)
   {
   // exit immediately if sonar is disabled
  // if (!g.sonar_enabled) {
   // return; commented out this line to force message to be sent
  // }
   mavlink_msg_rangefinder_send(chan, sonar_alt * 0.01f, 0);
  }
 // #endif

Hi ausdroid, the #if statement is a compiler directive and has no effect on the running code. It determines if the enclosed code is compiled or not. In this case CONFIG_SONAR was used to reduce the size of the executable binary when sonar was not required. 'sonar_enabled' is the parameter that is typically set in MP to dynamically enable/disable sonar.

Yep. Copy that. Soooo...it would be enabled by default.

Thanks.

J

James, 

I don't know if you have spent much time looking at ArduPlane, but there is no UserCode.pde for ArduPlane.  Is there somewhere else that ArduPlane users should put that code?  

Thanks!

Hi Evan, Unfortunately I have not worked with Arduplane at all. UserCode.pde can just be created in the ArduPlane directory however it seems that the userhook loop functions are not used in Plane. You would have to add userhook_MediumLoop() to the scheduler in ArduPlane.pde (or simply call from another task scheduled at 10Hz like update_logging1(). It also seems that unless you wanted to recreate the entire userhook setup in Plane, you will have to put your USERHOOK_VARIABLES in ArduPlane.pde and USERHOOK_INIT code in the init_ardupilot() function in system.pde.

If you think this might be useful I could put together an example for you

Hi James.  An example would be great if you have the spare time! 

Hi all,

i am currently working on an px4 i2c driver to communicate with an external board.
i used the hmc5883 and mb12xx drivers as guiding examples.
everything compiles fine but when i try to send data to the external board i get "i2c::transfer returned -6" in the nsh.

is anyone familiar with this problem or can point me in the right direction?

thanks in advance!

Hello Aaron,

I want to use some sensors connected to an arduino and then connect the arduino to the pixhawk by i2c to get thoses values in dataflash logs and to in mavlink messages to store them in live in the ground station.

Have you succeeded to do that with your gas sensors ?

Have you some code sample to begin with this ?

Thanks,

Ed.

Hi,

Glad I found this post.  I have had some success in connecting an  Odroid XU4 to a Pixhawk using the UART-USB connection to the telemetry.  The sad thing is that the connection is intermittent (might be an issue with my connection setup).  however, it does read the gas sensor (I tried an CO2 sensor) connected to the ADC pin on the odroid and display the voltage readings.. the parts per million(concentration levels can be easily obtained from the voltage given).  I can send details of how to connect to anyone interested. 

What I am in need of is to trace a plume based on the concentration levels and have a drone navigate that to locate the source of the plume.. any ideas would be most welcome..

Good post folks..  Keep up the good work

Cheers

Prasanna

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service