Custom sensors and Real-Time logging

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

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

Join diydrones

Email me when people reply –

Replies

            • Hi James, 

              I have finally managed to make the changes to the arducopter files and have the necessary tools to build the firmware. However, I didn't understand what you meant by "Don't forget to uncomment USERHOOK_INIT and USERHOOK_MEDIUMLOOP in APM_Config.h

              I see the file APM_Config.h, what change do i make.

              Thanks for the fast responses brother.

              - Rai Gohalwar

              • Rai,

                In the file APM_Config.h:

                Line 52:

                // Put your custom code into the UserCode.pde with function names matching those listed below and ensure the appropriate #define below is uncommented below

                //#define USERHOOK_INIT userhook_init(); // for code to be run once at startup

                Line 56:

                //#define USERHOOK_MEDIUMLOOP userhook_MediumLoop(); // for code to be run at 10hz

                These lines are prefixed with "//" which causes the compiler to ignore them as comments.

                You need to remove the "//" from the beginning of these two lines so the compiler includes them as code and calls the two functions at the appropriate time.

                • Hi James,

                  Thanks, all done with the code modification.

                  What method of building the firmware did you use?  Make or Microsoft visual basic?

                  reason I ask is because I am using make and it keeps giving me a variable error?

                  - Rai Gohalwar

                  • I will private message you my skype address

                  • It kept saying that a float was used in case of a char in id 157 

                    Weird, never seen that before. By the way i was using the console to do it. How do you build it from the eclipse?

                    -Rai Gohalwar

                  • Rai, I use make both from the command line and from Eclipse. What is the error you are getting? 

    • Wow, this is great. Can't thank you enough for this.

      Just to clarify, you did this with an Arduino communicating between the sensor and Pixhawk? Do you know if there is a way to eliminate using the Arduino?

      Thank you!

      • Sorry to be unclear. The second post was referring to using the Pixhawk only with a sensor connected to pin 13 on the ADC3.3 port. The output is the voltage present on this pin. The code in the first post was not used - only those changes listed.

        pixhawk11-212x300.jpg

        • 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!

This reply was deleted.

Activity

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