Hello, everyone!
I am a fresh man in the domain of UAV, with just a little experience of C++.
I am trying to learn the example code, and have some confusion now, so sincerely hope someone can help me for my question that may seems childish, thanks a lot!
My question is as follows:
I noticed the statement “hal.console->available()” in INS_generic.cpp, but I can’t find the function body of available().
Two known information:
The type of console: AP_HAL::UARTDriver*
The inheritance relation of class: Stream→BetterStream→UARTDriver
When I select the “available”, the context window of Source Insight displays the pure virtual function available() in the “AP:HAL::Stream:public AP::Print”.
In my opinion, the available() should be redefined in the derived class. But I didn’t find it in BetterStream Class or UARTDriver Class. Besides, I didn’t find any derived class of UARTDriver.
PS: I think UARTDriver might have derived classes, but I didn’t find them. Because I noticed there are many pure virtual functions in UARTDriver, and the definition of virtual functions should be in the derived classes.
If your IDE isn’t “smart” enough to automatically find all the implementations of a virtual function, you can use its text-based search of the project instead.
I found myself lacking a lot of necessary knowledge. I know a little about the “AP_HAL_ChibiOS” and “AP_HAL_SITL”, only know HAL is a virtual class, and the above two classes are its derived class, which represents a hardware platform.
Thanks for your suggestion~ I will try to find the implement of available() in these derived classes.
I also think the Source Insight seems not so smart.
In fact, I lack in elementary skills for reading the code.
Very grateful for the two methods you provide~
Next, I will try my best (#^.^#)