Hot answers tagged

9

The first thing to realise is that this is not a control problem, this is a planning problem. If you conflate the two, you are making life much more complex than it needs to be. Solution - Motion planning The traditional way to achieve what you want is to have two loops. The outer planning/supervisory loop generates way-points for specific points in time, ...


8

Raspberry Pi has only one hardware PWM channel and Linux distribution it runs is not a real time system, so software PWM may be very unstable. You are not guaranteed, that your program will be executed at exact frequency you want, so you will have trouble getting precise timing required to drive servos. If you already have Arduino Mega and SSC-32, I would ...


7

Even very small errors can bother the balancing. Small errors such as: Weight of the quadcopter is unbalanced. One motor is rotating faster/slower than others due to manufacturing or your power-source. Air resistance and wind. Unbalanced propellers due to manufacturing. Strong magnetic forces. You simple can not send the same motor speed to all motors ...


6

The short answer is yes, but the long answer is that you're approaching the code the wrong way and will need to rewrite things a bit. It looks like you're attempting to read a button and have it flash some LEDs while at the same time having your stepper move back and forth. The problem is your delay(5); commands, which pause the execution of your code. ...


6

It looks like your proportional gain is too high. You seem to be constantly increasing RPM on one motor while locking in the other one to make the system rotate. This isn't a good control strategy as eventually those are going to both saturate and you will lose control. Also as time increases your ability to command the system decreases. So you need a ...


6

Stereo vision and SLAM are pretty heavy algorithms, both in terms of the processing power and RAM required. You can forget about running this on a little microcontroller like an Arduino. These run at tens of MHz, and have only a few KB RAM. At the very least you'll need something running at hundreds of MHz with hundreds of MBs of RAM. You didn't say exactly ...


6

Assuming a constant update of 5Hz, your sample time is (1/5) = 0.2s. Get one position of the target, p1. Get a second position of the target, p2. Target speed is the difference in position divided by difference in time: $$ v = (p_2 - p_1)/dT \\ v = (p_2 - p_1)/0.2 $$ Now predict where they will be in the future, where future is $x$ seconds from now: $$...


5

Chris is right, the problem is that the mechanical contact of the switch is bouncing. However, I disagree with his statement that the most elegant solution is polling. Polling is very inefficient for the task of counting how many times a button was pressed, and so I decided to post my own answer for clarification: Interrupts are what you want. Polling is ...


5

The servo.write(angle) function is designed to accept angles from 0 to 180. (The value 180 is significantly larger than 100). Could you tell me where in the Servo documentation you read "100 (motor at full power)", so we can fix that typo? Please change the line int maxspeed=100; /* wrong */ to int maxspeed=180; Also, please run servo.refresh() ...


5

Firstly, this is a stupid nit-picky thing, but neither the Arduino nor RPi are micro controllers. Anyways, to answer your question: Neither of your concerns are really problems. Arduinos come in all kinds of sizes and ALL of them should have enough pins to do what you want. And the RPi can easily be run headless, and programs can be run at startup with ...


5

A Raspberry Pi should be sufficient for the control you intend to do with it. In designing a controller under a full multitasking operating system, like the Linux operating systems that are available for the Raspberry Pi, you have to be careful about the real-time requirements, and if the time share chunk of processor made available to your software will be ...


5

You can drill a hole to match the shaft into whatever it is and either fix it with a setscrew against the flat or glue it. Or you could glue a brass tube (hobby shop) to the shaft if you can find one that fits. The shaft is 5mm diameter, as venny says. Of course it's easier if you have access to a small lathe (such as Sherline or one of the small Chinese ...


5

There are 2 (or 3, depending on how the planned lifetime of the robot is) thing thats you have to consider. Static load: The motors stall (zero revolution) torques have to be able to hold the weight in the robots most unfavorable pose (usually the arm stretched out). You can determine this by static modelling, that involves only an equilibrium of forces for ...


5

Actually, the caster wheel has ideally no effect on the kinematics of the vehicle. In reality there will be some resistance from the caster wheel that does impact the vehicle motion, but we can still ignore it for the sake of designing a control law. Based on the extended discussion in the comments, your sensor can be used to measure the lateral error of ...


5

if you aren't moving, the accelerometer will give you the direction of gravity. if you are moving and hoping to use this orientation data for control you'll need to incorporate at least one more sensor. The extra sensor is needed because you have no method separating the acceleration of gravity and the acceleration of the sensor. The other drawback is that ...


5

For interfacing with a camera, I would recommend the Pi. The reason is that the AVR in the Arduino is an ordinary processor, whereas the Broadcom SoC in the Pi was originally designed for multimedia. Besides the ARM processor, it contains video encoding/decoding hardware that you won't find in the Arduino. Of course, you would need to learn how to use that ...


5

Nobody can tell how much magic smoke is still in the device. You need a magic smoke detector (rarely also referred to as a "voltmeter"), hook one of its contacts up to the pin that should have 5 volts of smoke come out of it and the other to ground. If the detector says there are still 5v, you are probably in luck.


5

The signals to the ESC's using PWM should be sent after the PID algo is done processing the errors. The output calculated from the PID is the PWM value to be sent to the ESC's to actuate the motors in such a way that they move to reduce the error thus obtaining the desired orientation So the right order is: Read RX signal Calculate desired pitch, roll, ...


5

A good choice for sensor fusion with the MPU6050 is a second order complementary filter, which I used for the orientation estimation in a project. The complementary filter is computational cheap and so a good choice for a microcontroller. A paper about the implementation you can find here: http://www.academia.edu/6261055/...


5

The reason is Clock on the Raspberry Pi. Note that the raspberry is powerful but not that powerful that it can run an OS and simultaneously give you precisely timed PWM outputs. I assume that you'll be handling the motors with PWM on the Enable pin on the motors. Reasons: As stated, it is more on getting precise PWM outputs on for the motor driver. The ...


4

The short answer is "no, a sonic range sensor can't do it". It might "work" under very controlled conditions, but relying on only the attenuation of the returned signal to determine thickness may leave you open to incorrect results due to multipath propagation effects. The more traditional way to measure thickness with sound is called profiling. The ...


4

Your code uses the typical servo.attach(pin) where you can use the overload of servo.attach(pin, min, max) to set the min and max microseconds of the pulse width to match the desired ranges for you ESC. Additionally to make it a bit more clear where myservo.write(90); is used to set the angle, you can use myservo.writeMicroseconds(1500); to set the duration ...


4

Quadcopter is inherently unstable system. So you have to apply some feedback controller (eg. PID) to keep it airborne. Even if you apply some basic PID using angular rates and angles, you still have to provide manual correction for drift till PID gains are perfectly set. So using radio control for manual control is really helpful during initial development ...


4

I read the code but it looks like it is for the first attempt where you tried to hover "open loop" that can't work. So now you tried a PID control based straight off the raw IMU data. Tha't better but you are going to need one more step between the two. Will I say this assuming you are using a low-cost IMU, the kind that just breaks out the chip. ...


4

I suspect that your Arduino is reseting, by the fact that the stall current of the motor by the product sheet is $800mA$, and you are using the USB power, then Arduino regulator, to supply the motor. As you are using the USB/Serial converter to make the connection to the Raspberry Pi, when it resets, it can be creating a new "virtual" serial port on the ...


4

The simplest sensor you can build is a weight on a string. Lower it down until the tension of the string is reduced. I assume you want sonar. So just go buy one they are dead easy to interface to. You can buy these at marine hardware stores. They are not cheap. Look for a depth finder that has "NMEA" output. You may have heard of NMEA as the data format ...


4

You part list is fine as this is your first build. However I would suggest you to use ready made flight controller instead of buying arduino and program it yourself. Once you are comfortable flying quad rotor, it will be easier for you to test your code and adjust controller gains which is a very crucial step to control quad rotor as per your requirement. ...


4

analogWrite() does not support a higher range of duty cycle. However the timers on the AVR chip do support higher precision/resolution, so you can bang the registers directly, especially if you don't need to use the rest of the Arduino libraries. I recommend using avr-gcc with avr-libc and avrdude for programming, and let go of Arduino IDE/libraries ...


4

There are two main ways to power an Arduino: with 5 volts and with 6.5 to 12. Since your case falls under the 6.5 to 12 option there are two main ways you can get power into an arduino. The barrel jack can be plugged into a 6.5/12v source which works well. I have a habit of chopping the connectors off wall warts then I use the power supplies for other things ...


4

When there is miscommunications between the microcontroller and a chip, assuming the electronics are not damaged, there could be a couple of things that can go wrong. Of course, further diagnosis is required. Typical things that could go wrong are (generally, not just in your particular case): Connections: Is the chip connected to the correct power supply? ...


Only top voted, non community-wiki answers of a minimum length are eligible