Page 1 of 1

Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 8:49 pm
by MadManMike
Hey Guys,

So I have been implementing the multiwii code on a custom quadcopter for a school project. However, we are a bit stuck when it comes to the tx/rx part of the code. You see we do not plan to use a standard transmitter and receiver for this project, but rather we plan to use an xbee hooked up to a custom controller and then an xbee on the quadcopter side hooked to the arduino.

My question is, without feeding a signal into the pins required for a receiver , where in the code would I feed in the signal from my custom receiver?

Or even... Let's say I wanted to control my quadcopter via a computer (eg: press up on the keyboard and the throttle goes up), where would I inject the code into multiwii?

-Mike

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 8:58 pm
by kos
short story : put your value in rcData (have a look at computeRc)

you can populate the rcdata by reading from i2c (fast) or from a serial uart (in annexCode) with the existing code


Code: Select all

switch (sr = SerialRead(0)) {
    #ifdef BTSERIAL
    case 'K': //receive RC data from Bluetooth Serial adapter as a remote
      rcData[THROTTLE] = (SerialRead(0) * 4) + 1000;
      rcData[ROLL]     = (SerialRead(0) * 4) + 1000;
      rcData[PITCH]    = (SerialRead(0) * 4) + 1000;
      rcData[YAW]      = (SerialRead(0) * 4) + 1000;
      rcData[AUX1]     = (SerialRead(0) * 4) + 1000;
      break;
    #endif

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 9:04 pm
by MadManMike
Is the data that goes in there just standard servo pwm from 0-256?

-Mike

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 9:24 pm
by kos
rcdata[i] can range from 1000 to 2000 ... 1500 being the input with stick at neutral .. this is the user input.

it then converted into servo or motor command .

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 11:15 pm
by MadManMike
I see thanks.

So the code that you posted above, where does that go? You said serial input can be implemented in the existing annexcode()? So do i paste it in there?

-Mike

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 11:21 pm
by kos
MadManMike wrote:So I have been implementing the multiwii code on a custom quadcopter for a school project.


.. the code I quoted can be found in the source code you said you ported

i suggest your read the code again .. and search for the quoted strings in the code , rtfm

viewtopic.php?f=6&t=1328&p=10494&hilit=xbee#p10494
viewtopic.php?f=6&t=133

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 11:23 pm
by MadManMike
huh, I didn't see it. I will check again.

Re: Controlling without a standard transmitter?

Posted: Sat Apr 28, 2012 11:41 pm
by MadManMike
MadManMike wrote:huh, I didn't see it. I will check again.


Blahh! I downloaded the dev code (and it's not there), just downloaded 2.0 and found it. Thanks man.

-Mike

Re: Controlling without a standard transmitter?

Posted: Mon Apr 30, 2012 3:06 am
by MadManMike
So if I am reading everything correctly, it looks like the serial data that the multiwii bt code is looking to receive is a 5bit serial stream that looks something like:

Code: Select all

byte Array[5] = {'k', yaw, pitch, roll, aux1}
int i;
for (i = 0; i < 5; i = i + 1) {
  Serial.write(Array[i]);
}


Any ideas?

-Mike