Controlling without a standard transmitter?

Post Reply
MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Controlling without a standard transmitter?

Post 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

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: Controlling without a standard transmitter?

Post 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

MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Re: Controlling without a standard transmitter?

Post by MadManMike »

Is the data that goes in there just standard servo pwm from 0-256?

-Mike

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: Controlling without a standard transmitter?

Post 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 .

MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Re: Controlling without a standard transmitter?

Post 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
Last edited by MadManMike on Sat Apr 28, 2012 11:21 pm, edited 1 time in total.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: Controlling without a standard transmitter?

Post 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
Last edited by kos on Sat Apr 28, 2012 11:28 pm, edited 2 times in total.

MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Re: Controlling without a standard transmitter?

Post by MadManMike »

huh, I didn't see it. I will check again.

MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Re: Controlling without a standard transmitter?

Post 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

MadManMike
Posts: 8
Joined: Sat Apr 28, 2012 8:43 pm

Re: Controlling without a standard transmitter?

Post 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

Post Reply