Rather than starting my new autopilot project by crashing a plane I decided I would rather start out by crashing an RC car. As I wait for my new Ardupilot to arrive in the mail I have a question about my configuration. My 2ch receiver has 3 "ports": Ch1 goes to the ESC, Ch2 goes to the steering servo and the 3rd slot is unused and is labled "Batt". I understand from the diagram in the assembly instructions that I'll connect Ch1 to IN1 on ArduPilot and Ch2 to IN2. My question is what to do with the CTRL pin on ArduPilot? Would this connect to the battery slot on the RX or do I have the wrong RX to use ArduPilot? What would happen if I couldn't connect CTRL to anything and are there any workarounds?

Tags: RC Car, RC Truck, ardupilot, setup

Views: 564

Attachments:

Reply to This

Replies to This Discussion

You could set the code so that the mux is always on or comes on after a specific amount of time or change the code so that it would be on toggled on by a certain setting of throttle & steering for a certain amount of time. For example, you could make it check for the servos positions that equal full right and full brake for say ten seconds to turn the mux on. Full left and full brake for ten seconds would turn it off.

My personal work around was to use a Spektrum DX7 and AR6100 so that I could have a third channel. Also to keep from having to change the code for altitude holding I just put an extra servo on the Ardupilot throttle channel (IN1) as a dummy load and kept manual control of the throttle as an extra failsafe.

I think a car is better for inital testing since it can show you how things work in a smaller area than most planes can. In my opinion it also lets you more directly see what is happening when you start trying to change some of the control variables for steering.
You can modify the code to ignore the MUX and have the autopilot on all the time.

In the first tab add the line: "int mux=1;"

Then in the ArduPilot tab and AutoPilot tab anywhere that you see "if(digitalRead(4) == LOW)" , change that to "if(mux == 0)" . And where you see "if(digitalRead(4) == HIGH)", change that to "if(mux == 1)"

If you want to simulate manual mode, set "int mux=0;" instead,
Chris I have tried your suggestion but I'm afraid I must have missed something. I added "int mux=1;" on the ArduPilot tab just above the Void Setup() line. I also found 2 other places on that same tab where I replaced "if(digitalRead(4)==LOW)" with "if(mux == 0)". In addition on the AutoPilot tab I replaced the line "if((middle_measurement_lock==0)&&(digitalRead(4)==HIGH))" with "if((middle_measurement_lock==0)&&(mux==1))". I didn't see any other reference to Pin4 to change.
I have loaded the code to the board and everything looks good. The blue GPS lock lights up and I get position data returned to Arduino IDE. The only problem is the control stays in manual mode. Both speed and steering are controlled via the transmitter but not from ArduPilot.

I don't know if I've bungled something in the software or have the hardware setup incorrectly. I am using ArduPilot version 1.0 and Arduino 13.

I have uploaded a picture of my hardware configuration. Could it be that not having anything connected to the CTRL port on the board is causing this problem?
Attachments:
Ah, I forgot to mention something. You've also got to change the code in the Attiny that switches control from RC to ArduPilot! The code is in the "open source essentials" in this post. Warning: I've never looked at that code and don't have any specific suggestions. But all it needs to do is to hold pin 6 (TMISO) and 7 (TMOSI) high, so maybe you only need two lines of code!.

In fact, once you modify that Attiny code to hold pin 7 high, you actually can leave the ArduPilot atmega code the way it originally was.

It never occurred to us that someone would want to use ArduPilot with a 2-channel RC...I think you're the first to try ;-)
That makes perfect sense, Chris. Thank you so much.

I have to admit I'm a bit nervous about programming the ATtiny. I think that would require a AVR programmer and some other software, right? I'm a total novice. I don't suppose I could use some mickey mouse workaround like jumpering one of the digital pins from ATmega to the CTRL pin and then use code in ArduPilot to set it HIGH or LOW? I'd love to know if there are other ideas that would prevent me from the need to dive into ATtiny code.
For what its worth, I've answered the above question... My workaround did work. I simply jumpered a wire from digital pin 6 to the 3rd pin of the CTRL pins then added "pinMode(6,INPUT);" to the Init tab and then added "digitalWrite(6,HIGH);" to the ArduPilot tab. After I load the code I have to hit the reset button once. From then on the MUX light stays on and the autopilot controls the car!
Clever you! Well done..
GhostRider,

Where exactly in the Init and ArduPilot tabs did you put the "pinMode(6,INPUT);" and "digitalWrite(6,HIGH);" lines? I have a similar setup where I've connected the D6 pin to the signal pin of the CTRL channel, but I'm still having some trouble with my car following GPS waypoints and I'm not sure if I made the code modifications correctly.

Thanks,
barkerzd
barkerzd, on the Init tab I inserted pinMode(6,INPUT); right after the line that says pinMode(5,INPUT);. on the Ardupilot tab In inserted "digitalWrite(6,HIGH);" right after "init_startup_parameters();" and before "gps_read_test();".

It didn't work for me right away but I found that if I hit the reset button on the board, the light comes on after the program resets. Not sure why that happens exactly.

I am interested in auto-pilot for RC cars, as well. I would like to know how it is working for you, what type of car you have, what type of radio control it is - the original stuff (not sure what it's called) or the new TQi, etc.

Great advice. Thank you both.

I don't exactly know how the MUX works but I don't suppose I could just split one of the leads from either CH1 or CH2 and plug one end into CTRL and the other into one of the IN's? Sorry if that's a rediculous noob question. I'm not much of a programmer (yet!).
No. CTRL is meant for a toggle switch channel. If you plug another channel in you'll just turn the autopilot on and off every time you move the stick.

RSS

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The third round was a reliablilty/aerial photography round for both planes and copters, which is now closed. Stay tuned for the next round, beginning soon.

A list of all T3 contests is here

 

© 2012   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service