Hello,
I am going through the ardupilot github code, and trying to write a basic code to output the current PWM values for the motors/channels. And I was wondering if I could get some help regarding that.
I am trying to get those values from the UART and "print/output" them through a BeagleBone.
Using something like this -
uint8_t nchannels = hal.rcin->num_channels();
for (uint8_t i=0; i/span>nchannels; i++)
{
uint16_t v = hal.rcin->read(i);
hal.uartE->printf("Channel: %d Output: %d \n",i, v);
}
But this doesn't display anything when I try to read from the UART port. Any help regarding this?
Replies
Thanks BIll. I will look into that link! Currently I have it working to an extent, but I will definitely check it out! Thank you!
I'd recommend building the UART_test in /ardupilot/libraries/AP_HAL/examples/UART_test to see if firstly you have the setup correct and that you are indeed getting anything.
Where is that code you have above live? Are you enabling the uartE? Are you setting correct baud etc...the new codebase has a SerialManager(AP_SerialManager) that you should look at to make sure setup is correct.
good luck!
Thanks for the reply Steve. I did refer to the UAT_test. I seemed to have figured it out by writing to the uartE instead of printing anything. I then just read at the UART from the BeagleBone.
That does work if I use the write function specified for writing size bytes as per UARTDriver.cpp (AP_HAL_PX4).
That's the only way it worked for me.