JBmiog / QC-embedded

QUADCOPTERS
0 stars 2 forks source link

PC send packet rate #21

Closed makbut closed 8 years ago

makbut commented 8 years ago

In the temporary branch, at pc-terminal folder, at pc-terminal1.c, when creating the time loop we get the time in nanoseconds and then we divide with NANO_SECOND_MULTIPLIER which is equal to 1 000 000.

That means that we don't convert to milliseconds (10^-3) but to (10^-9 * 10^-6 = 10^ -15) which is very very small. Therefore, the packets were sent very fast. Maybe that was causing the delay issue, since the drone was receiving packets at very fast rate.

Normally nanosecond = 10^-9 second, thus in order to convert nanosecond to millisecond, you have to multiply with one million (10^6) and get 10^-3 second=millisecond. I don't know if it was the problem, but for sure the way it is written now is wrong.

JBmiog commented 8 years ago

Wauw, how could we have missed that in the first place. good work. I asked the TA on how to validate this, and he suggested we toggle the voltage on an output pin and attach a osciloscope. Will try to do so on monday:) I really like the work. Maybe "temporary_branch" seems a bit of an ambigious description, but it seems fine for the moment :)

JBmiog commented 8 years ago

I've pushed temp branch into master, as it included all the commits we did when we finished lab on friday, makbut, could you please net time create a branch called "issue #X" where X refers to the issue being solved? we could keep the master as a stable version, if we do so. We then merge issue branches into the master branch once they are succesfully tested. Unfortunately for now, the packet rate is untested, and in the master.

makbut commented 8 years ago

I think everything is working fine now. I did several tests. In the fixed_version branch at PC-terminal.c file you can see that there is a time check for sending packets every 100ms, but that doesn't guarantee that the packets are sent every 100ms. There is also the function for receiving from the board and the function that receives from the keyboard and constructs and sends packets.

Anyway right now it sends packets every 143ms approximately, but it can be changed to lower values as well as I checked.

The final conclusion is that it works, or at least it seems so, you never know :P.

JBmiog commented 8 years ago

donneeee