Hi all, it’s my first post here and I’m currently an undergrad working on my own custom drone project.
I’m still a newbie and I’ll appreciate any help given!
I want to Log a parameter that I’ve created but It’s not working as I wanted to.
I’ve read through the wiki page and apart from the fact that some files ( i.e. AP_logger.h) are missing due to version differences, I’ve managed to log “something” to the log file.
Basically, I want to return the value of _paremterA instead of Test within the function “get_Pwm”
but so far, I’ve only been allowed to return static parameters
If _parameterA can be logged, any other methods are alright as well.
I’ve pasted the codes that I’ve used briefly down below.
Thank you for you kind attention!
struct PACKED log_Test {
LOG_PACKET_HEADER;
uint64_t time_us;
float a_value;
};
void DataFlash_Class::Log_Write_Test(void)
{
struct log_Test pkt = {
LOG_PACKET_HEADER_INIT(LOG_TEST_MSG),
time_us : AP_HAL::micros64(),
a_value : AP_Mount::get_Pwm(25)
};
WriteBlock(&pkt, sizeof(pkt));
}
//DataFlash.h
void Log_Write_Test(void);
//AP_Mount.h
class AP_Mount
{
public:
static float get_Pwm(float Test);
AP_Int16 _parameterA;
//AP_Mount.cpp
float AP_Mount::get_Pwm(float Test)
return Test;
}
wiki page : http://ardupilot.org/dev/docs/code-overview-adding-a-new-log-message.html