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?
Hey do you guys need any help? I can help modify the code to do want your asking. It's actually pretty easy.
there is a function called
void set_servo_mux(boolean mode)
set_servo_mux(true) will take over the mux no matter what the control switch says.
In the main loop - comment out this line:
// read_control_switch();
the function set_mode will force Ardupilot into full auto mode.
set_mode(AUTO);
While in AUTO, you should be able to override the steering. I assume you would want to control the throttle yourself, so I would run the throttle directly into the CH3 Mux Input.
I would also think dead reckoning would be very useful and accurate for a car. I will leave it to you, but the navigation function has all the code you need to dead reckon your turns.
Let me know if you need any more help.
I'm also setting up with a 2ch car. I've followed all the setup instructions, but when I tried to modify the code as discussed in this thread, I got nowhere. I'm assuming it was a previous version of the code that was talked about, because I can't find much of what you guys were referencing (I'm using 2.5). Can anyone point me in the right direction for how to enable the autopilot without a control channel?
Additionally.. I don't know if this is related, but my GPS does not get a lock. And when powered on the red light on the GPS blinks steadily, and I can't find any documentation to explain what that means.
Are you all using the ArduPilot 1.0 code to run your RC cars, and, if so, was it heavily modified from the code used to control airplanes? I'm just getting started on controlling my crawler with ArduPilot and I need some suggestions from those of you that have done this on how to get started. First off, how would one modify the code to make the maximum speed of the ESC very slow? I want to try playing around with the navigation settings, but I want to be able to walk along side the car as it's navigating. Thanks for any suggestions that you might have.
I used a Losi Mini Rock Crawler from Horizon Hobby because the kids already had it. It works well since it can go over most terrain and is not fast enough to get into trouble quickly. Any RC car or truck with standard three wire servo plugs should work.
The toy grade cars normally have everything hard wired to a combination Rx/ESC so they could be very difficult to work on.
Is there a list or could you list what R/C car or truck you are using. I would like to duplicate your setup and get started with this kind of a setup too.
I not only don't want to crash something, I would like to be able work with this (like at lunch at work) where flying would be a very big no-no (like I work right next to an airport that is pretty busy at times)
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!).
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,
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.
Replies
thanks!
This radio
http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXYYC3&P=7
Has one two position and one three position switch. I figured it would be good for adding features as well.
Still working on the settings file to get it navigating properly, will update when I get it working.
there is a function called
set_servo_mux(true) will take over the mux no matter what the control switch says.
In the main loop - comment out this line:
the function set_mode will force Ardupilot into full auto mode.
While in AUTO, you should be able to override the steering. I assume you would want to control the throttle yourself, so I would run the throttle directly into the CH3 Mux Input.
I would also think dead reckoning would be very useful and accurate for a car. I will leave it to you, but the navigation function has all the code you need to dead reckon your turns.
Let me know if you need any more help.
Additionally.. I don't know if this is related, but my GPS does not get a lock. And when powered on the red light on the GPS blinks steadily, and I can't find any documentation to explain what that means.
Are you all using the ArduPilot 1.0 code to run your RC cars, and, if so, was it heavily modified from the code used to control airplanes? I'm just getting started on controlling my crawler with ArduPilot and I need some suggestions from those of you that have done this on how to get started. First off, how would one modify the code to make the maximum speed of the ESC very slow? I want to try playing around with the navigation settings, but I want to be able to walk along side the car as it's navigating. Thanks for any suggestions that you might have.
barkerzd
I used a Losi Mini Rock Crawler from Horizon Hobby because the kids already had it. It works well since it can go over most terrain and is not fast enough to get into trouble quickly. Any RC car or truck with standard three wire servo plugs should work.
The toy grade cars normally have everything hard wired to a combination Rx/ESC so they could be very difficult to work on.
I not only don't want to crash something, I would like to be able work with this (like at lunch at work) where flying would be a very big no-no (like I work right next to an airport that is pretty busy at times)
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!).
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,
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.