问:
the uncertainty of initializing new landmark in EKF-SLAM
In EKF-SLAM (based-feature map) once the robot senses a new landmark, it is augmented to state vector. As a result, the size of the state vector and the covariance matrix are expanded. My question is about the uncertainty of the new landmark and its correlation with other pairs of the covariance matrix. How should I assign them? When I assign them to be zero, the error of the estimation this landmark won't change as time goes. If I assign them with very large value, the estimation is getting better every time the robot reobserves this landmark however, the error approaches to fixed value not to zero. I assume the problem id with assigning the uncertainty. Any suggestions?</p>

答:
I don't have experience with SLAM specifically, but I do have a lot of EKF experience so here's my input.

Stick with your second approach. It is normal for the error to approach a non-zero steady-state value. This number can be calculated analytically for nominal cases, but I don't remember the math right now and would probably be too complicated anyhow once you start to include the covariances with all the other landmarks.

Don't worry too much about what specific value you should initialize the covariance to. In the simplest case, just set the variance to some nominal value based on your sensor noise level and use 0 covariance with the other landmarks. Over time the EKF update steps should adjust things to their "proper" values (assuming your initial values were at least in the ballpark).


问:
How to control an Arduino Board with wireless PS3 controler?
I'm currently building a hexapod bot, composed with an Arduino Mega board and an USB SSC-32 (from Lynxmotion).
But now I want add a PS3 wireless controller to move my hexapod, I have made some search but nothing realy interesting. Maybe the Servoshock module but it seems works only with the ServoshockShield, a kind of Arduino card with Servo output.

Can I use the ServoShock module alone ?

Can I connect it with Rx/Tx port of the Arduino Mega board ?

Do you have other solution for me ? Board with documentation and sources codes ?

Thank you all

答: I don't have experience connecting a PS3 controller to an Arduino board, but if you can work out a computer-arduino connection then you can use PyGame to read the state of all the buttons and axes.</p>

ContentLicense: CC BY-SA 3.0


问:
What are some low cost alternatives for lidar?
It need not be as effective as lidar or it may have some disadvantages when compared with lidar.   What are the probable alternatives?

Edit:
I'm intending to use it outdoors for navigation of autonomous vehicle. Is there any low cost LIDAR or is there any alternative sensor for obstacle detection?

答:
http://hackaday.com/2014/01/23/lidar-with-leds-for-under-100/

This could be a good alternative to lidar. I dont know if it is commercially available.


答:
I don't have enough reputation to comment, but I'll add my 2cents in an answer. Basically you're limited to lidar mapping if you want any decent fidelity. Stereoscopic imaging via OpenCV in one distribution or another will be processing intensive and will take too long for any type of real-time navigation unless you're just shredding things computationally or you don't care about time.

I honestly wouldn't even consider sonar modules unless you're wanting to ONLY use them for very very near obstacle detection with low fidelity (as the other user said: curved surfaces don't play nicely with ultrasonic waves).

Hacking a couple of Kinects may be the best option, but you're range-limited to a closer distance than a decent lidar module. You can spend thousands on lidar modules that have a pretty phenomenal range. I should also add that there are probably people that have hacked Kinects as well to do the same task and you could even possibly rotate one around to map out complete surroundings so long as you have a computer hooked up to it to map it out and retain the point clouds that you generate.

Title: What are some low cost alternatives for lidar?

Body:
It need not be as effective as lidar or it may have some disadvantages when compared with lidar.   What are the probable alternatives?

Edit:
I'm intending to use it outdoors for navigation of autonomous vehicle. Is there any low cost LIDAR or is there any alternative sensor for obstacle detection?


问:
What is the actual application for manufactuing, with robot arm autonomous object classification system
I’m a graduate student, and we're doing a project that is going to introduce a robot arm into manufacturing. Our goal is to build up an autonomous object classification system. We already have the software and hardware required for the task, but we have no idea if there is any existing manufacturing scenario where we can apply the system and really improve the efficiency or save human resources.

Here is some info about the robot arm:
For the hardware part, the robot arm is with 7 dof and 5kg payload (the weight of the end effector is not counted). Besides, the end effector is a 1.5kg 3-fingered robot hand with 2kg payload. The workspace is approximately a sphere with 0.9m diameter.

For the software part, we have programming by touch, by which human can drag the robot and record the desired pose. Besides, we have PCL object recognition that can recognize the object and its pose in the scene. Lastly, we have online trajectory generator and dynamic obstacle avoidance that can improve the safety when the robot corporates with human.

Since we know few about manufacturing, we hope that someone can give us a hint about the scenario and an actual application where we can apply this system.

答:
You seem to have described something similar to the UR-5 from universal robotics.

Here are a couple of videos worth watching to give an idea of how they are used:

A Company Called OTV Plastic

Brief glimpse of a couple dozen applications

There's plenty more videos out there too (including BMW's factories where they use the UR-5), but I just joined this StackExchange site so I can't post more than 2 links. Many of these applications use different attachments than the 3 fingered hand you describe, but this should still give you a good idea.

Anywhere the production line has a place where an object needs to repetitively be grabbed and moved or repositioned, your robot could be used. It could be used for packing products at the end of the assembly line. Depending on accuracy and repeatability, it could be used for assembling small parts.

The nice thing about being programmed as you described is that it doesn't take a dedicated programmer on staff when the robot needs to be re-purposed for another job. And of course the safety features are nice because standard industrial robots need to work in a space that is separated from human workers to avoid injury risk.


答:
If you want to do this on your own, you need additional hardware:

A arduino with an USB-Host (Mega will not work) or an shield which provides the USB-Host

A Bluetooth dongle

On your Arduino you will have to run the PS3BT
You have to know the MAC adress of your BT-dongle. This can be obtained in two ways:

Most simple: It is written on the dongle itself

Or you have to run the script and the MAC should be displayed over SerialMonitor

If you have the address then you have to comment the line 19 in the code and uncomment line 20. Additionally you have to enter your MAC address in the line 20.

Then unplug the dongle from the arduino, plug in the PS3 controller via USB and reset the arduino. The controller will be paired with the dongle.

Now plug in the dongle again and pair the controller (pressing the playstation button). It should work from here on. The script just prints the inputs from the controller to the serial monitor. Then you just have to implement all the rest of your code.

Title: How to control an Arduino Board with wireless PS3 controler?

Body:
I'm currently building a hexapod bot, composed with an Arduino Mega board and an USB SSC-32 (from Lynxmotion).
But now I want add a PS3 wireless controller to move my hexapod, I have made some search but nothing realy interesting. Maybe the Servoshock module but it seems works only with the ServoshockShield, a kind of Arduino card with Servo output.

Can I use the ServoShock module alone ?

Can I connect it with Rx/Tx port of the Arduino Mega board ?

Do you have other solution for me ? Board with documentation and sources codes ?

Thank you all


问:
Quadcopter Roll, Pitch Fluctuation
For my quadcopter, i turn on the quadcopter while letting it stable on the ground. But i see that the Roll, Pitch fluctuate with the max difference being 15 degree. When i protect the sensor with soft material, then i observe the max difference is around 6 degree. Is this fluctuation for the quadcopter? By the way, i use complementary filter and DCM with scaling factor being 0.8 gyro and 0.2 accel
Thanks in advance!</p>

答: What imu combination do you use to measure the roll and pitch? Do you use a fusion algorithm to correct for drift? Personally I think the drift values that you report are far to big.</p>

Title: Quadcopter Roll, Pitch Fluctuation


问:
Controlling multiple Arduinos wirelessly
I am designing a experiment of controlling 6 small wind turbines wirelessly. For each wind turbine, I need to measure power time series (or voltage or current time series) from the generator, and control blade pitch angle, yaw angle, and generator load (using variable resistance). The control input will be all PWM signal.

I am planning to put an Arduino UNO with a ZigBee wireless module to each wind turbine, making it measure the power time series and transmit to the central node, as well as receive the control input from the central node and command the control input to servo motors. The central node will be additional Arduino UNO.

Here are my questions:

Is it possible for each Arduino to send time series signal to central node wirelessly without interference with other Arduino? (6 wind turbines transmitting time series to a central server). If it is possible, How can I implement such network ? recommending a source for learning would be also greatly helpful.

Interface between the central node and the computer software: The algorithm in the computer need to process the received power time series and determine the optimum control input for 6 wind turbines. Then these control input should be transmitted to wirelessly to 6 wind turbines. In such case, what is the good option to interface the algorithm and the Arduino connected to the computer? Currently the algorithm is written in Matlab. I heard there is the sketch interfacing Arduino and Matlab, is it efficient enough for such project?

答:
Well first answer is "yes"
The ZigBee-Standard allows multiple slaves in one network. The master or coordinator can send the specific xbees or send broadcasts...
you have to figure out which one is easier. both methods are possible...

the interface will be a problem. The zigbees are connected with the uart interface to your arduino but the arduino uno uses the same interface to the computer (if you use the usb-port)

You need there two different uart interfaces on your board (arduino mega or arduino due)

There are two possible ways to interface matlab with your arduino.

using the matlab interface matlab interface

exporting simulink code directly to the board (this can run on it's own)

This depends on the computation power which is needed. If you export the simulink code, then i strongly recommend buying the due, 'cause of his great computation power

If you want to read more about the matlab interface link


答:
For your problem ,

Yes every arduino can connect the central node without connecting to the other Arduino

I recommend to use a good high speed Arduino version for the central node like Due or Teensy

Also for communication handling I prefer to check out Arduino Wireless Sensor Network systems like https://code.google.com/p/arduinode/ or this www.youtube.com/watch?v=dsiae9x2Ckk

For Computer Interface , a good GUI application using C# or python with Serial communication module to handle requests from /to central Node, you can also use Processing to handle such a case

Note: I'm sure you are using Xbee module not "Zigbee" ......

Title: Controlling multiple Arduinos wirelessly

Body:
I am designing a experiment of controlling 6 small wind turbines wirelessly. For each wind turbine, I need to measure power time series (or voltage or current time series) from the generator, and control blade pitch angle, yaw angle, and generator load (using variable resistance). The control input will be all PWM signal.

I am planning to put an Arduino UNO with a ZigBee wireless module to each wind turbine, making it measure the power time series and transmit to the central node, as well as receive the control input from the central node and command the control input to servo motors. The central node will be additional Arduino UNO.

Here are my questions:

Is it possible for each Arduino to send time series signal to central node wirelessly without interference with other Arduino? (6 wind turbines transmitting time series to a central server). If it is possible, How can I implement such network ? recommending a source for learning would be also greatly helpful.

Interface between the central node and the computer software: The algorithm in the computer need to process the received power time series and determine the optimum control input for 6 wind turbines. Then these control input should be transmitted to wirelessly to 6 wind turbines. In such case, what is the good option to interface the algorithm and the Arduino connected to the computer? Currently the algorithm is written in Matlab. I heard there is the sketch interfacing Arduino and Matlab, is it efficient enough for such project?


答:
Very nice question , </p>

<p>Kindly check EMF and make sure to isolate the MPU9150 from any EMF and Make sure that it's temperature is Stable and change in the temperature will lead to huge drift in reading regardless the filter you are using </p>

Title: Quadcopter Roll, Pitch Fluctuation

Body:
For my quadcopter, i turn on the quadcopter while letting it stable on the ground. But i see that the Roll, Pitch fluctuate with the max difference being 15 degree. When i protect the sensor with soft material, then i observe the max difference is around 6 degree. Is this fluctuation for the quadcopter? By the way, i use complementary filter and DCM with scaling factor being 0.8 gyro and 0.2 accel
Thanks in advance!</p>

Body:
Very nice question ,

Kindly check EMF and make sure to isolate the MPU9150 from any EMF and Make sure that it's temperature is Stable and change in the temperature will lead to huge drift in reading regardless the filter you are using


问:
Is increasing gyro , accelerometer sensor range is good or bad ? how does it affect the accuracy
I've been using mpu6050 IMU unit ( gyro + accelerometer  )

I found that I can set acc range to +/- 2g or 4g till 16 g

and same for gyro +/- 250 deg/sec , 500 deg/sec and so

I know that they are low cost and full noise , so which settings to the range are best to ensure higher accuracy ?

答:
The smaller the range, the more sensitive the device will be. So, in that sense, a smaller range is better. However, the downside of a smaller range is that movement of the robot will be more likely to exceed the range of the sensor.

You should select the smallest range which you're sure will never be exceeded by normal operation of your robot.

Or, the smallest range within which you want the robot to be under control. I.E. the range might be exceeded during a crash, but at that point control is pretty irrelevant.


答:
It sounds like you have a solution in search of a problem...

Autonomy, online path planning, and general object classification have been slow (if at all) to be used in manufacturing.  The reason is because in manufacturing you know exactly which parts are coming down the line, where they will be and when.  You also have almost complete control over the environment, colors, lighting, keeping humans away, etc.

That being said, some companies are trying to make inroads to the light-manufacturing area.  Universal Robotics mentioned by Warren is one company, Rethink Robotics (http://www.rethinkrobotics.com/) is another.

Title: What is the actual application for manufactuing, with robot arm autonomous object classification system

Body:
I’m a graduate student, and we're doing a project that is going to introduce a robot arm into manufacturing. Our goal is to build up an autonomous object classification system. We already have the software and hardware required for the task, but we have no idea if there is any existing manufacturing scenario where we can apply the system and really improve the efficiency or save human resources.

Here is some info about the robot arm:
For the hardware part, the robot arm is with 7 dof and 5kg payload (the weight of the end effector is not counted). Besides, the end effector is a 1.5kg 3-fingered robot hand with 2kg payload. The workspace is approximately a sphere with 0.9m diameter.

For the software part, we have programming by touch, by which human can drag the robot and record the desired pose. Besides, we have PCL object recognition that can recognize the object and its pose in the scene. Lastly, we have online trajectory generator and dynamic obstacle avoidance that can improve the safety when the robot corporates with human.

Since we know few about manufacturing, we hope that someone can give us a hint about the scenario and an actual application where we can apply this system.


问:
In PID control, what do the poles and zeros represent?
Whenever I read a text about control (e.g. PID control) it often mentions 'poles' and 'zeros'. What do they mean by that?  What physical state does a pole or a zero describe?</p>

答:
The function $T(\mathbf{x})$ that describes how ones input to a system maps to the output of the system is referred to as a transfer function.

For linear systems the transfer function can be written as $N(\mathbf{x})/D(\mathbf{x})$ where $N$ and $D$ are polynomials, i.e. $$T(\mathbf{x}) = {N(\mathbf{x})\over D(\mathbf{x})}$$

The zeros of the system are the values of $x$ that satisfy the statement $N(\mathbf{x}) = 0$. In other words they are the roots of the polynomial $N(\mathbf{x})$. As $N(\mathbf{x})$. approaches a zero, the numerator of the transfer function (and therefore the transfer function itself) approaches the value 0.

Similarly the poles of the system are the values of $x$ that satisfy the statement $D(\mathbf{x}) = 0$. In other words they are the roots of the polynomial $D(\mathbf{x})$. When $D(\mathbf{x})$ approaches a pole, the denominator of the transfer function approaches zero, and the value of the transfer function approaches infinity.

The poles and zeros allow us to understand how a system will react to various inputs. The zeros are interesting for their ability to block frequencies while the poles provide us information about the stability of the system. Generally we plot the poles and zeros in the complex plane and we say a system is bounded-input bounded-output (BIBO) stable if the poles are located in the left half of the complex plane (LHP - Left Half Plane).

Finally, when we design a controller we are in effect manipulating it's poles and zeros so as to achieve specific design parameters.


问:
Forward Kinematics/D-H parameters for perpendicular joint axes
I am trying to compute forward kinematics of the Kuka youBot using DH convention:

http://www.youbot-store.com/youbot-developers/software/simulation/kuka-youbot-kinematics-dynamics-and-3d-model

The arm joint 1 and arm joint 5 are revolute and rotate about the world z-axis (pointing to the sky)

But the other 3 joints are all revolute and rotate about x-axis, let's say (points horizontally)

DH convention says the "joint distance" is along the "common normal". But unless I am mistaken, the only common normal is the y-axis, and that is also horizontal, meaning there is no joint distance.

I was thinking I would use link offset for joint1 - joint2, but then I ran into a problem with joint4 - joint5. Link offset is supposed to be along the previous z-axis, and in that case it would point horizontally out to nowhere. But link distance STILL doesn't work either, because that is the common normal distance, and as established the common normal is x-axis, also horizontal. So now I feel very screwed. I am sure there is a simple solution but I can't see it.

So I guess the question is, how do I use the DH convention for the links between 1-2 and 4-5, when the joint rotational axes are perpendicular?

答: This YouTube video by TekkotsuRobotics does a great job at explaining how to specify DH parameters, including what to do when you have parallel axes of rotation.  Also note that different textbooks have slightly different notations regarding which joint and link the parameters apply to.  So you should stick with the convention of your professor, school, textbook, etc.  This paper: "Lipkin 2005: A Note on Denavit-Hartenberg Notation in Robotics" explains the 3 main DH parameter conventions and how they differ.</p>


问:
Ackerman steering model
I am trying to create a simulation of a robot with Ackerman steering (the same as a car). For now I'm assuming that it's actually a 3-wheeled robot, with two wheels at the back, and one steering wheel at the front:

Knowing the wheel velocity, and the steering angle a, I need to be able to update the robot's current position and velocity with the new values at time t+1.

The obvious way to do this would be to calculate the position of the centre of rotation, where the axles of the wheels would meet, however, this leads to an undefined centre of rotation when a = 0. This means that the model doesn't work for the normal case of the robot just driving in a straight line.

Is there some other model of Ackerman steering which works over a reasonable range of a?

答:
This problem is not specific to Ackerman steering but comes up with any model if you try to describe its motion as following a circle of certain radius: A straight line is equivalent to a circle with radius $r \to \infty$.

This is usually not a big problem, though: Just write down the equations of motion. If you want to evaluate these for driving straight, you will find a term that evaluates to "$\frac{0}{0}$" in this case (i.e. an indeterminate form). You can still compute the limit using L'Hôpital's rule and come up with a numerically sane equation for this special case.

Title: Ackerman steering model


问:
Laser Beam based model probability in case of single particle
I am trying to calculate likelihood of laser scan($Z$) at give pose($x$) with known map ($m$) using beam based model

$P\left(z_t|x_t,m \right)=\prod_{i=1}^{n}P'\left(z_i|x_t,m \right)$

My scan has 360 rays i.e $n=360$, When i calculate $P\left(z_t|x_t,m \right)$ it becomes zero as multiplication all propabilities $<1.$

In ROS amcl they are using ad-hoc which works better like

$P\left(z_t|x_t,m \right)+=\sum_{i=1}^{n}P'\left(z_i|x_t,m \right)*P'\left(z_i|x_t,m \right)*P'\left(z_i|x_t,m \right)$

later they normalise it with number of particle to get weight of each particle.

My query is how to get probability normalised and not zero with single calculation (i.e image in case of single particle)

Thanks.

答:
When you have to multiply so many (often low) probability values or in this case probability densities, you are bound to get in trouble because of limited floating-point accuracy. It is advisable to instead sum up their logarithms, since this will give you a more accurate result.

$\log p\left(z_t|x_t,m \right)=\sum_{i=1}^{n} \log p'\left(z_i|x_t,m \right)$

If you try to compute the probability $p\left(z_t|x_t,m \right)$ by exponentiating its logarithm above, you will most likely still get 0. But in a particle filter, you can arbitrarily scale the measurement model likelihoods (weights are later normalized anyway), which corresponds to adding the same constant to the logarithms above for each particle.

What amcl does is a dirty hack that seems to work well but has no probabilistic foundation as far as I can tell.

My query is how to get probability normalised and not zero with single calculation (i.e image in case of single particle)

Use logarithms as shown above, but check whether you really need the actual probability (density), since it will be dangerously close to 0.


问:
Deducing single wing plane transfer function Aka Transfer function estimation through set of points
I'm trying to control a plane via roll  using PID controller ,

I had a problem finding the transfer function thus I used the following method :-

Fix the plane in an air tunnel

change the motor that controls the roll in fixed steps and check the
  roll

thus I will have a table of roll/motor degree

next is to deduce the nonlinear function using wolfram alpha or
  approximation neural network  .

Is this a correct method or should I try another method ?

答:
I'm not an expert concerning aerodynamics, but I guess you are using kind of aileron to get the right roll.
 So your setpoint is the roll (in degrees or something similar) and your input is the motor position (in degrees, too).
 Your method was only about measuring the open-loop gain.
 This won't help you in designing the PID.

Now you have a Look-up-table with lot of different values. You can just look up your motor position for your target roll, BUT you cannot control the roll, therefor you need to measure the complete step-answer.

IF you set your motor to a specific position your plane will not have the target roll instantaneously. The plane will roll other a period of time. This period of time may be short but it is measurable and you are interested (as a control designer) to see how the system reacts in this dynamic state.

You should change your method!

One possible solution (there are others) is identifying the system with the step-answer
You just need to measure your roll in degrees as a function of time, when you turn your motor from 0 to a specific position.
Then you can carry on with mathematica or matlab


答:
You're correct that measurement and modeling is the right way to go about this.

For your PID to work properly, you need to be able to make a somewhat linear conversion of error (desired roll vs actual roll) into corrective force (in this case, provided by the control surfaces -- the aileron angle, influenced by air speed and other factors).

The $k_d$ term of your PID should account for the inertia of the plane in rolling from side to side, so don't worry about that in your measurements.

What you should measure in your wind tunnel tests is the torque on the longitudinal axis of the plane, in response to airspeed (in both X and Y axes, if you have on-board sensors for that) and aileron angle.  That will provide data on the following relationship:

$$
\tau_{actual} = f(\theta_{\text{aileron}}, \text{airspeed}_x, \text{airspeed}_y, \text{[other measurable factors]})
$$

You are going to approximate the inverse of that function -- finding $\theta_{\text{aileron}}$ given $\tau_{desired}$.  Whether you do that with a neural network, wolfram alpha, multivariate regression, or a  good knowledge of physics is up to you.  In the end, you want to produce a modeling function in this form:
$$
\theta_{\text{aileron}} = f(\tau_{desired}, \text{airspeed}_x, \text{airspeed}_y, \text{[other measurable factors]})
$$

The PID will give you $\tau_{desired}$, and your sensors will give you the other factors to plug into this function.

Title: Deducing single wing plane transfer function Aka Transfer function estimation through set of points

Body:
I'm trying to control a plane via roll  using PID controller ,

I had a problem finding the transfer function thus I used the following method :-

Fix the plane in an air tunnel

change the motor that controls the roll in fixed steps and check the
  roll

thus I will have a table of roll/motor degree

next is to deduce the nonlinear function using wolfram alpha or
  approximation neural network  .

Is this a correct method or should I try another method ?


问:
Seeking dirt cheap, wheeled, programmable robot
I was playing the old "confuse the cat with a flash-light" game, when I thought that I might like to program a confuse-a-cat robot.

Something, probably with tracks, which can right itself if he flips it over, and which I can program to move randomly around a room, turning at walls, making an occasional sound or flashing a light.

Since I am on a very tight budget, I wondered if there is some cheap kit which I can program ...

Arduino, Raspberry Pi, any platform, so long as it is programmable.

Thanks in advance for your help

答:
You haven't define what's the limit of your budget.

However, for cheap programmable robots you can use: the DFRobot 2WD Mobile Platform and interface it with an Arduino Uno. You can also use a Pololu 3pi Robot or even a PICAXE Microbot which is already equiped with a front bumper

Look a this for more kits: 47 Programmable Robotic Kits


答:
Did you say dirt?  May I recommend a Roomba?

It has wheels and tracks.

A cat wouldn't be able to flip it over.

It already knows how to move randomly around a room, turning at walls.

It already makes sounds and has some LEDs.  You should be able to hack how they behave.

Some cats like Roombas.  Others are highly indifferent to them.

Bonus: it can pick up cat hair.

Title: Seeking dirt cheap, wheeled, programmable robot

Body:
I was playing the old "confuse the cat with a flash-light" game, when I thought that I might like to program a confuse-a-cat robot.

Something, probably with tracks, which can right itself if he flips it over, and which I can program to move randomly around a room, turning at walls, making an occasional sound or flashing a light.

Since I am on a very tight budget, I wondered if there is some cheap kit which I can program ...

Arduino, Raspberry Pi, any platform, so long as it is programmable.

Thanks in advance for your help


答:
Dirty cheap robot:

Try seeking in Aliexpress/Ebay/your local e-store something called 2WD robot chassis.
For about ~14-16 usd you will get two wheels and two engines and quite good basic platform for further development.

Then you will have to add:

Arduino or clone (cheaper) ~8-9 usd

Driver shield or H-bridge (H bridge or transistors are much cheaper but you will have to learn how to use them. It's not wasted time if you want to pursue robotics hobby) ~6-7usd for cheapest

Ultrasonic sensor 2 usd

6x battery holder 1 usd

Breadboard and dupont cables (jumpers) 6 usd

You will get complete kit for ~40 usd total. If you will add about 20 usd for arduino kit that will be more than enough to start.

Start here and search for suitable elements
http://www.aliexpress.com/wholesale?SearchText=arduino&catId=&initiative_id=SB_20140925122631


问:
What mechanical parts can be attached to a 28BYJ-48 stepper motor?
Sorry I am asking a mechanical question here, but, after all, where else people have experience with using motors? If there is a better forum for this, please do guide me.

Everywhere I've seen online, the stepper motor 28BYJ-48 is used in tutorials, to rotate on its own, or, at most, to spin a clothes pin attached to it. I am trying to get Arduino to work for my 10 year old kid. He's got the motor rotating, now what? How does he attach anything to it?

Don't laugh, I made him a wheel out of a raw potato. He is happy with it now. Where can I find any guidance as to what to do next?

答:
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 ones).

If you need to allow for misalignment between shafts it's better to buy or make a shaft coupler such as these helical style ones:

There are other types (some of which have a bit of backlash). You can also use a collar with setscrews, but the shaft on that motor is a bit stubby and that type of coupler allows for almost no shaft misalignment so it would jam easily (and the motor is not very powerful). The kind with backlash generally has a bit of flexible material such as urethane rubber sandwiched between two interlocking sets of fingers.

I made a sky tracking drive using one of these cr*p motors and I just drilled out the center of a standard gear (from Stock Drive) a bit to get a slip fit and used the grub screw to secure it. The shaft is pretty stubby so it's hard to get something secured to it unless it fits very tightly or is a clamp or collet-style fixing. In my case, the gear drives a nut that works on a leadscrew.

BTW, you might find the robotics SE useful in this kind of thing. I've not looked at it once, but those folks run into this sort of thing regularly.

OwnerDisplayName: Таня Т.

ContentLicense: CC BY-SA 4.0

OwnerDisplayName: Spehro Pefhany


答:
The diameter of the shaft is 5mm, it sould be possible to use a 5mm propeller collet commonly used on RC airplanes, like this one:

(source: hobbyexpress.com)

Tightening the nut secures the attached object and at the same time it clamps the collet to the shaft.

The shaft should be inserted fully into the clamp, to grip also the non-flattened portion to provide good stability.

Title: What mechanical parts can be attached to a 28BYJ-48 stepper motor?

Body:
Sorry I am asking a mechanical question here, but, after all, where else people have experience with using motors? If there is a better forum for this, please do guide me.

Everywhere I've seen online, the stepper motor 28BYJ-48 is used in tutorials, to rotate on its own, or, at most, to spin a clothes pin attached to it. I am trying to get Arduino to work for my 10 year old kid. He's got the motor rotating, now what? How does he attach anything to it?

Don't laugh, I made him a wheel out of a raw potato. He is happy with it now. Where can I find any guidance as to what to do next?

OwnerDisplayName: venny


问:
Control a 2.4 Ghz AR Drone from the computer
I had a Doyusha Nano Spider R/C mini-copter, it's controlled by a 4ch joystick 2.4 Ghz.

I look for a low cost method to control it from the computer. The software is not a problem, but how can I transform the WIFI or the Bluetooth signal of the computer to an R/C signal compatible with the mini-copter receptor?

Or is there another solution that is low cost?

答:
The simplest way to do this, is to buy a more advanced PPM transmitter that has a trainer port, and use this PCTx device to control it from your PC through USB. They provice a simple library and some sample code to get your started. The control signals go from your

```<code>software -> through the PCTx device -> PPM transmitter -> over RF to your copter
</code>```

Compatible transmitters are listed on that link.

I'm not familiar with your particular brand of mini-copter, but im assuming it uses standard 4 channel RC-PPM control signals. If it doesn't, the above solution will not work.

You can also, if you are so inclined roll out your own PC based PWM transmitter. This would involve writing software to implement the PPM signal, which can get a bit involved. You might even need some sort of an oscilloscope or a signal analyzer to debug issues. Some people have created Arduino based solutions. Examples:
1

Again, the assumption is that your copter uses standard RC-PWM. If it doesn't you'll have to first figure out what protocol it uses and then try to emulate that using software and an RF Tx module.

Since your copter receives 2.4Ghz radio signals, there is no drop-in solition to directly use WiFi or Bluetooth.

Body:
The simplest way to do this, is to buy a more advanced PPM transmitter that has a trainer port, and use this PCTx device to control it from your PC through USB. They provice a simple library and some sample code to get your started. The control signals go from your

software -> through the PCTx device -> PPM transmitter -> over RF to your copter

Compatible transmitters are listed on that link.

I'm not familiar with your particular brand of mini-copter, but im assuming it uses standard 4 channel RC-PPM control signals. If it doesn't, the above solution will not work.

You can also, if you are so inclined roll out your own PC based PWM transmitter. This would involve writing software to implement the PPM signal, which can get a bit involved. You might even need some sort of an oscilloscope or a signal analyzer to debug issues. Some people have created Arduino based solutions. Examples:
1

Again, the assumption is that your copter uses standard RC-PWM. If it doesn't you'll have to first figure out what protocol it uses and then try to emulate that using software and an RF Tx module.

Since your copter receives 2.4Ghz radio signals, there is no drop-in solition to directly use WiFi or Bluetooth.


问:
12V compressor and air pressure control
I am trying to make a simple robot with few functionality for someone, one of these functionality is inflating a balloon inside the robot, I know how to control a compressor using Arduino but the problem is that the requested task is bit different here:
There must be an air exit and it must be controllable through arduino, so he can inflate the balloon to a certain pressure, and depress the air from another exit if needed (I don't know if it is possible to have a depression through the same pressure-in valvle.

I think that it can be done somehow using a solenoid 3/2 valve or something but I am bit unfocused these days and I need some hints.

Any thoughts?

答:
Whether a single 3-way, 2-position pneumatic valve (typically with a work port, an input port, and an exhaust port ‒ see page 3 of nationalpneumatic.com's pdf about valves) will suffice depends on information not given in the question.  For example, if you can turn the compressor on or off at will, and if it will hold pressure when off, you can attach the balloon to the work port, the compressor to the input port, and leave the exhaust port open (or put an exhaust silencer or rate control on the exhaust port).

If, however, you are using a reservoir and need three settings – balloon fill, balloon hold, and balloon exhaust – you will need to use either a 5-way, 3-position valve with center off (see eg youtube.com about Closed Center Valves), or a pair of 3-2 or 5-2 valves.  (The 5-2 valves would be used as overqualified 3-2 valves, with extra ports either blocked or left open as necessary.)  Using two 3-2 valves X and Y, on valve X attach the balloon to the work port and leave the exhaust port open (or silenced, etc).  Connect X's input port to Y's work port.  Connect Y's  input port to the compressor, and block Y's exhaust port.

The  “VIAIR 12V 120 psi Air Compressor” mentioned in a comment is an oilless single-piston compressor.  As well as being sold at the robotshop.com site, it is marketed as part of a roughly twice-as-expensive air system, on Amazon and other sites.  A single 3-way, 2-position pneumatic valve should work ok for balloon air control if used per paragraph 1.

Somewhat-less-expensive compressors that will work ok for initial experiments or for light duty production include Harbor Freight models 61788, 69284, and 4077.

Title: 12V compressor and air pressure control


问:
Connecting a 6 pole motor to a motor driver?
We are trying to power this motor with this motor driver , using a 11.1V 2.2Ah lithium-ion polymer battery.

(We're in over our heads with this and really need the help)

We checked with the company (E-flite) and the motor is definitely DC -- we're a bit confused as to the purpose of three wires, and how we should connect them to the motor.

Any help would be appreciated.

答:
The motor you have there is a Brushless DC motor. It's still technically a DC motor, but you won't be able to drive it by plugging it into a battery, or even into the driver you linked to. You need a driver specifically for brushless motors that can drive all three wires correctly.

Something like this Electronic Speed Controller will drive it pretty well:

You connect the motor to the 3 wires, and the power to the two wires. The little 3-wire connector normally goes to a Radio Control (RC) receiver, plugging into the servo socket. It accepts a PWM signal just like a normal servo.


问:
Where do roboticists look for used sensors/hardware?
I recently built a self-driving vehicle-type robot for a competition, and am looking to sell sensors (GPS, INS, etc.) used in order to have money for the next project. Is ebay where people tend to go looking for used sensors and hardware?</p>

答: I generally use ebay for selling and buying individual used sensors or other bits. I've also used gumtree when I had stuff to clear but wasn't looking for money for it. Ebay has quite detailed search/categorising which I think makes it more appropriate for technology stuff. </p>


问:
Do simple, non-sonic, omni-directional rangefinding beacons exist?
I am on a robotics team that plans to compete in a competition where one of the rules is that no sort of sonic sensor is allowed to be used. I guess that limits it to some sort of EM frequency right?

Ideally, my team is looking for a simple beacon system, where beacon A  would be attached to the robot, while beacon B would be attached to a known point on the competition space. Then, beacon A can give information about how far away B is. After some searching, I could only turn up laser rangefinders that required pointing at the target. I am a CS student, so I'm not familiar with the terminology to aid searches.

Another nice property would be if the beacons also gave the angle of beacon A in beacon B's field of view, although this is not necessary, since multiple beacons could be used to obtain this information.

We have an Xbox 360 Kinect working, and able to track things and give distances, but it looses accuracy over distance quickly (the arena is about 6 meters long), and this beacon should be as simple as possible. We ONLY need it for a relative position of our robot.

Alternate Solution:
Another way to solve this would be for an omni-directional beacon to only give angle information, two of these could be used to triangulate, and do the job just as well.

答:
You could use AR markers attached to each robot or in known locations around the room. In fact, this is how it is typically done in research for indoor, multi-robot systems. The libraries for recognizing and extracting range / angle information from AR markers are well developed, and included in the Robot Operating System. Now, you won't need to actually use ROS to drive your robot, maybe just to read the AR Markers.

The requirements are:

Omni-directional AR Markers, which are typically barcodes affixed (wrapped around) poles on top of the robot. Check out Keith Leung's work here, which does exactly what you want.  Note, his research is on multi-robot SLAM, which is not what you want, but those markers on top of the robots are exactly what I'd use.

Camera (Kinect will do, it has one, you know)

A laptop with some processing power

ROS

In particular the ar_pose library


答: An extremely cheap method would be to use IR leds mounted on your beacon and an omni-directional IR sensor array on your robot (just a few remote control leds arranged around your robot) The beacon will be glowing like a neon sign in IR and a simple brightness detection algorithm will give you a direction. Move 10cm, take another reading, etc.</p>

Title: Do simple, non-sonic, omni-directional rangefinding beacons exist?

Body:
I am on a robotics team that plans to compete in a competition where one of the rules is that no sort of sonic sensor is allowed to be used. I guess that limits it to some sort of EM frequency right?

Ideally, my team is looking for a simple beacon system, where beacon A  would be attached to the robot, while beacon B would be attached to a known point on the competition space. Then, beacon A can give information about how far away B is. After some searching, I could only turn up laser rangefinders that required pointing at the target. I am a CS student, so I'm not familiar with the terminology to aid searches.

Another nice property would be if the beacons also gave the angle of beacon A in beacon B's field of view, although this is not necessary, since multiple beacons could be used to obtain this information.

We have an Xbox 360 Kinect working, and able to track things and give distances, but it looses accuracy over distance quickly (the arena is about 6 meters long), and this beacon should be as simple as possible. We ONLY need it for a relative position of our robot.

Alternate Solution:
Another way to solve this would be for an omni-directional beacon to only give angle information, two of these could be used to triangulate, and do the job just as well.


答:
Yes, there is such a system available today, ScenSor from DecaWave:

These tags can measure their distance from base stations using the time of flight of radio packets.

They have an precision of about 10cm, I.E. successive samples are randomly distributed in a 10cm diameter cloud around the true location. Also, the radio signal needs a clear line of sight from the tags to the base stations. Any obstacles will cause a slight delay in the signal, giving a slight error in the readings.

However, if you combine enough tags and base stations, plus odometry from your robot, you can get pretty good precision indeed.

One caveat: The chips on the modules are very complex to use, and the example source code provided by Decawave is a nearly indecipherable mess, so expect to put a lot of time and effort into getting these to work.


问:
Finding a light load high precision servo motor
I have a project that requires me to be able to accurately and repeatedly rotate an object 120 degrees.

The object is small and lightweight (let's say several grams). The axis does not necessarily have to always spin the same direction. It simply needs to be able to stop reliably at 0, +/- 120, and +/-240 degrees from the origin.

I have VERY limited experience with motors and robotics, but my understanding is that a servo motor will be my best bet for accuracy (if that incorrect, please let me know).

Since I know next to nothing about these motors, the spec sheets list a lot of specs which don't mean all that much to me. I'm hoping to learn, but in the mean time, what specifications do I need to be focusing on for these requirements?

It doesn't need to be high speed. When I say accurate, it doesn't have to be absolutely perfect to the micrometer, but I would like it to be able to run through a loop of stopping at 0, 120, and 240 hundreds of times without visually noticeable variance - the more precise the better though.

To be more specific about the accuracy. Let's say the object being rotated will have a flat surface on the top at each of those 3 stopping points.  Upon inspection the surface needs to appear level each and every time through hundreds of cycles.

Could these requirements be met by a servo that might be used in building a quadricopter, or am I going to be looking for something higher grade than that?

答:
Since you didn't state your accuracy requirements in terms of degrees, I assume you want it to be accurate enough to the eye.  Pretty much any RC servo motor will do the job.

These can easily support a few grams weight.

All you need to do is provide it with the control signal to tell it which angles to go to, and the simplest way to do that is with something like an Arduino, or PSoC4 development board.


答:
Another idea is to use polarized light beacons.  If you have a few light sources polarized at different angles, then you can use some simple light sensors (or cameras) similarly polarized.  If the beacons are at known world locations, you should be able to figure out your location through triangulation or trilateration.  the polarization lets you distinguish between the different light sources.

This robot competition uses polarized light beacons to designate the goal areas: http://www.botlanta.org/cube-quest.  And here is some detail on the beacons they use: http://www.botlanta.org/contests/cube-quest/beacon-details.


问:
What is the best way to power a large number (27) servos at 5 V?
I apologize if this question may sound a little vague. I am working on a robotics project that will contain 27 servos of various sizes and I am having trouble figuring it how they should be powered.

I was hoping to use several (3-6) 5 W 18650 battery boxes to power them, but the smallest motors would use 2.5 W each, so 1 battery box can only power two. The larger servos, obviously, use even more current, so this plan of using a small number of 18650's becomes infeasible.

There is not enough room on the robot for a 12 V car battery, and adding one would require recalculating the sizes of the servomotors that would be needed. Furthermore, I am not sure how to convert the 12 V it gives down to 5 V for the servomotors.

P.S. What about the stall current of the motors? Should the power supply be able to supply the stall current of all the motors it supplies (at the same time) or just the working current? Should I use a fuse to handle when (if?) the servomotors stall? Should I use a fuse or a circuit breaker? Do they make 5 V fuses? If so, where can I get one?

Something like a larger version of the 18650 box would be most preferable.

答:
As Rocketmagnet mentioned, just because a motor is rated at 2.5 W doesn't mean it will be pulling 2.5 W all the time. Most robots have at most 1 or 2 servos that are running at full power at any one time; the rest have very low mechanical loads (and therefore pull much less electrical power) or are "off" and therefore pull practically zero electrical power.

This leads to 2 very different approaches to power supplies:

Tethered robots and desktop computers use a power supply and heat-sinks that can handle the maximum possible worst-case power draw --
when everything pulls the maximum power at the same time.
27 servos * 2.5 W @ 5V requires a 5 VDC and at least 14 A power supply
(or perhaps several 5 VDC supplies that add up to at least 14 A).

Autonomous robots and modern laptops use a power supply and heat-sinks that can handle some thermal design power.
Some human arbitrarily picks some the TDP, which is much smaller than the worst-case power, but somewhat above the power required in "typical situations".
Then the power supply is designed so it can handle any load from 0 to slightly above the TDP.
And the rest of the system is designed so it never exceeds the TDP --
except perhaps for a few milliseconds.
The simplest approach is to have something that measures the total current draw --
then when the current exceeds the TDP, assume that things have already gone horribly wrong, and shut everything down for a few seconds.
More sophisticated approaches measure the current of each motor individually:
When some motor stalls, "limp mode" kills the power to that one motor,
so the robot continues to use the other motors at full power.
When lots of motors pull a total current that is too high,
"tired mode" reduces the power to all the motors
so the robot continues to use all the motors at a slower speed.

5 V fuses?

You could install one big 14 A fuse. Or you could install 27 individual 0.5 A fuses, one in the +5V power line of each motor. Or both. You'll probably find it easier to find "12 V" or "250 V" fuses, which will work just fine in your application.

There are many cheap polyfuses available (designed to protect 5V USB ports from excessive current). Alas, polyfuses take several seconds to "blow" -- too late to protect stuff from permanent damage, but quick enough to keep stuff from heating up, catching on fire, and burning down your house.

possibly related:
How to do a simple overcurrent protection/circuit breaker circuit for 12V 1-2A?

convert 12 V to 5 V

Most people using servo motors use an off-the-shelf DC-DC converter to convert whatever voltage the batteries supply to the 5V required by the servos.(c)
I see that some 18650 battery box (a) include a little DC-DC converter to convert the battery power to 5 VDC "USB battery charger".
(A few people use servomotors designed to be connected directly to 12 VDC. a)

Many DC-DC converters are set up so that they never pull more than some maximum current from the battery -- when the motor connected to their output stalls, the converter switches to a "constant-current" mode at some lower output voltage, pulling less power from the batteries.
If you put such a DC-DC converter on each servo, it automatically goes into and comes out of "limp mode" appropriately.

batteries

"Selecting the proper battery for your robot" (a)

"Robot batteries" (b)

"Batteries I use in my Robotics" (c)

etc.
a
b
c
d
e
f


问:
SLAM without landmarks using sonar
I'm currently programming an app for a robot and I'd like to make him map a zone and then make him move autonomously from one point to another.

I have to solve a SLAM problem, but the biggest matter is that I can't use landmarks to find myself in the environment. The robot just has the abilities to move, and to make distance measurements over -120/+120 degrees using a sonar.

I can't find any simply explained algorithm that permits me to solve this SLAM problem with the no-landmark limitation.

Have you any idea ?

答:
Have you considered to use grid maps?

A particle filter based SLAM with grid maps can be found here:
https://www.openslam.org/gmapping.html

Title: SLAM without landmarks using sonar


答: I asked this question before in here when I had no idea what SLAM problem actually is. I realized later this question was a sign indicates that I have no idea about the problem. The word SLAM is an acronym for Simultaneous Localization And Mapping which indicates that the environment must be part of the problem or in other words the robot needs to navigate an  unknown environment and concurrently localizes its pose in this map. If you don't want to include the landmarks or the environment, then you don't need SLAM at all. The problem then decreases to a kinematic problem in which the robot moves in an empty space and you hope to determine its pose in this empty map. If this is the case, then you need odometry info or just use GPS. As you can see, odometry is an accumulated error problem if the noise is presented. GPS doesn't work in an indoor environment. I highly recommend you to read this book Probabilistic Robotics. This is the only book that I know covers the problem in depth with providing a complete algorithm for constructing SLAM with a given model. </p>

Title: SLAM without landmarks using sonar

Body:
I'm currently programming an app for a robot and I'd like to make him map a zone and then make him move autonomously from one point to another.

I have to solve a SLAM problem, but the biggest matter is that I can't use landmarks to find myself in the environment. The robot just has the abilities to move, and to make distance measurements over -120/+120 degrees using a sonar.

I can't find any simply explained algorithm that permits me to solve this SLAM problem with the no-landmark limitation.

Have you any idea ?


问:
Controlling Dynamixel servo wirelessly using Arduino Mega
I am planning to control multiple Dynamixel servos (MX28T or MX-64T) wirelessly using Arduino Mega. Since this servo uses serial communication, I need an additional serial port to interface with Xbee module. Although it seems to be very common application controlling these servos wirelessly based on Arduino, I could't find any of them in web. I found the two very well constructed libraries.

https://code.google.com/p/slide-33/downloads/list. This library is for MX28T servo, which is the same servo I am trying to use, but it uses UNO;therefore, I cannot interface with Xbee.

http://www.pablogindel.com/informacion/the-arduinodynamixel-resource-page/. This library use UART1 (serial1) to interface with servo (AX-12) motors. Therefore, I can connect Xbee module to UART0. But, the problem is that this library is outdated and not compatible with MX64-T servo anymore.

So my question is here:

Is there any one who has experience in controlling Dynamixel MX24T, MX64T servo series using Xbee module simultaneously? If you have experience, please share with me.

Is it possible for Arduino Mega can interface with Xbee module using Serial1 (i.e., RX18 TX19)? If it can, I might be able to use the library1 without any modification.

答:
The
"arduino mega + xbee pro shield"
thread describes how to tweak the xbee pro shield
so you can connect whichever Arduino Mega serial port you want to it
(Serial1: RX1 and TX1; or Serial3: RX3 and TX3, or etc.).

Brief summary:

de-solder solder jumper 2 and solder jumper 3.

flip the switch to "DLINE" (away from "UART")

(Now the TX and RX pins on the xbee aren't actually connected to anything).

Connect the TX on the xbee to any RX of your choice on the Arduino Mega (perhaps RX3).

Connect the RX on the xbee to the TX of your choice on the Arduino Mega (perhaps TX3).

While I haven't used Dynamixel servos (yet),
I have used the Arduino Mega to communicate with other devices over several of its UART serial ports more-or-less simultaneously,
so I am confident that the Arduino Mega can control Dynamixel servos and communicate over Xbee modules simultaneously.


问:
Can a 5S LIPO battery be changed to a 3S and a 2S?
Newbie to robotics here!

I bought a 5S LIPO but now realise that it is overkill. And these things are expensive!

So, given that (as far as I know) the pack is apparently made up of individual cells of 3.7 volts each, is there any way in which I could somehow (safely) separate out the cells to get a 3S and a 2S or even single 1S cells?

答: Yes theoretically you can split 5S lipo in indivisual cells as 5S represents it is pack of 5 cells connected in Series.(S in 5S denote connection in series). But practically you have to be extremely cautious while doing this as lipos are dangerous to handle and even more dangerous when you are splitting them apart.</p>


问:
How mature is real-time programming in robotics?
Edit: I don't know why, but this question seems to be confusing many people. I am aware of when/where/why/how to use real-time. I am interested in knowing whether people who have a real-time task would actually care enough to implement it in real-time or not.

There's no need to mention why real-time operations are important for a robot. My question is however, how much is it actually used in robotics?

Take this question for example. Only one answer mentions any platform with real-time capabilities, and it is far from the top too. ROS apparently, being a very popular platform which is not real-time.

In the real-time world however, RTAI1 seems to be the only workable free real-time platform of use. It is however, limited to Linux (no problem), badly documented and slowly developed.

So, how much is real-time behavior sought after among robotics developers? The question is, how much are developers inclined to write real-time applications when real-time behavior is actually needed? If not much, why?

For example, reflexive behavior based on tactile data, cannot go through ROS because it would lose its real-time property. But do people really come up with a real-time solution or use ROS anyway, ignoring the real-time property?

1 or similarly Xenomai

答:
Yes, assuming the hardware resources can meet the timing requirements (enough processing power, low enough latency), when the scheduler can not sequence processes and threads appropriately, then one uses a real-time scheduler, usually attached to a kernel specifically optimized for the challenges of this. Hardware drivers can also be optimized for real-time conditions.

Yes, if ones software cannot be guaranteed to do it's job in the required time constraints, then one uses real-time approaches.


答:
If you open a Lipopack it looks basically like this:

There you can see the single cells with some cables attached to them.

If you want to open a lipo pack you have to cut the packaging with knife....
This is more or less everything you have to do. You will have 5cells which wired in series. just cut the cables to divide them in 3-2 and then you have to solder two cables.

There is one Thing you have to careful with: Try to not damage the cells with the knife, because lithium is an alkali metal and these metals react violently with the oxygen in the air. At the end the cell will ignite itself (it won't explode, don't worry) and the fumes may be dangerous.

Title: Can a 5S LIPO battery be changed to a 3S and a 2S?

Body:
Newbie to robotics here!

I bought a 5S LIPO but now realise that it is overkill. And these things are expensive!

So, given that (as far as I know) the pack is apparently made up of individual cells of 3.7 volts each, is there any way in which I could somehow (safely) separate out the cells to get a 3S and a 2S or even single 1S cells?


问:
Adding reverse function to a brushed motor electronic speed controller
This is for a Hobby-weight (5.44 Kg) battle robot.

I bought two ESCs for my drive motors but the ESCs do not have a reverse function (or brake for that matter).

Is there any simple way I can achieve this through maybe either:

The R/C settings (setting middle position of joystick as stopped, top-wards as forward and bottom-wards as reverse?)

Or could I maybe achieve this using Arduino? I have a card with relay switches that I can use with the Arduino so am not worried about high voltage or current but I am worrying it could get messy..

I could just buy two new ESCs with the above features but they cost quite a bit more than the ones I already have so I would prefer to try a few tricks first - if there are any!

答:
If your ESC does not provide reverse functionality, it will never do.

The "reverse" mode can be achieved in general by swapping any two motor cables. I would do this with the arduino setup in combination with your R/C settings.
Arduino can easily get the RC information from a receiver.

Now it depends on your relays, you may achieve it with 2 relays, but if the relays are not the right ones you need 4 of them


问:
Over-voltage on a brushed electronic speed controller
This is for a battle robot in the hobby-weight class (5.44 Kg max)

I want to drive the robot using  2 cordless drill motors rated at 14.4 volts. I have 4S LIPOs which means I have 4 x 3.7 volts or 14.8 volts. So far so good.

The problem is that I bought 2 ESCs and only afterwards noticed that they are rated for 2-3S (or max of 11.1 volts).

So my question is am I likely to damage the ESC if I use my 4S LIPOs instead of 3S LIPOs?

Or should I just buy 3S LIPOs and live with the reduced performance?

答:
Well over voltage at an ESC usually results in an instant magic smoke. I would never recommend this.

If you have enough reserve power you can use the 3S version. If you are not sure or do not have enough power reserve then you should buy 4s ESCs.


答:
To enable reverse, a popular design is to use an H-bridge (essentially a circuitry version of manually flipping the polarity of the wires) placed between your ESC and the motor.  According to this answer, H-bridges are a normal part of an ESC output stage -- that your ESC appears to lack.

Although it could be built with relays, it may be better for your ESC and/or motors to select an appropriate semiconductor-based H-bridge.  There are ICs available specifically for this purpose.

Title: Adding reverse function to a brushed motor electronic speed controller

Body:
This is for a Hobby-weight (5.44 Kg) battle robot.

I bought two ESCs for my drive motors but the ESCs do not have a reverse function (or brake for that matter).

Is there any simple way I can achieve this through maybe either:

The R/C settings (setting middle position of joystick as stopped, top-wards as forward and bottom-wards as reverse?)

Or could I maybe achieve this using Arduino? I have a card with relay switches that I can use with the Arduino so am not worried about high voltage or current but I am worrying it could get messy..

I could just buy two new ESCs with the above features but they cost quite a bit more than the ones I already have so I would prefer to try a few tricks first - if there are any!


答: Like others said yes it is possible. I made it few times when i needed less height(stacked cells side-by-side), but SAFELY no. The only safely method would be to buy 2 or 3 s battery! You can damage your self.


答:
As another person said, you can buy cheap basic motorised platforms from such Chinese sites.

I use banggood.com myself and get loads of stuff from there; H-bridges, ESCs, motors, components, sensors, bench power supplies, oscilloscopes etc. basically anything except batteries which are a problem here since we live in Europe and there are a lot of safety standards.

For instance here is a motor and wheel assembly for 3 dollars: http://www.banggood.com/Robot-Smart-Car-Wheel-Deceleration-DC-Motor-For-Arduino-Smart-Car-p-907973.html?currency=USD

And here is a whole kit for 10 dollars. http://www.banggood.com/Smart-Robot-Car-Chassis-Kit-Speed-Encoder-Battery-Box-For-Arduino-p-915324.html

As for reliability, I can confirm that everything I order arrives safely and payment can be made through paypal so is pretty much safe also. The only catch is the basic delivery period (free shipping!) takes up to 27 days. Some items offer expedited shipping for a charge and that gets a bit weird because sometimes it is just a couple of dollars and the item arrives in a few days.

Mind you I would not trust my life to anything sourced from such places because quality is not always the best (for instance an imitation Arduino may have some parts not perfectly aligned), but for fun stuff its great.

So I would highly recommend it. Hope that helps!

By the way if you want to make it more fun you might want to incorporate a laser (make sure it points downwards just ahead of the vehicle. In that way the cat will tend to spring at the spot rather than the vehicle!) if you want to do this for free, get an old DVD drive (not CD) and dismantle it to get the 3 lead diode.

Say hi to your cat for me. :-)


问:
Robot Serial Communication Error
We are using a Koro robot for our PC based automation solution. But sometimes the robot is getting the command but refuses to respond. Then I get a serial communication timeout error. The error is happening for a random type of commands and it is also not happening all the time making the troubleshooting difficult.

I doubt the driver problem. How do you approach this problem.?

Thanks

答: I found out the problem was with the serial communication card..I connected the robot through the direct PC com port 2. It was working fine</p>

Title: Robot Serial Communication Error


问:
What are the calculations for a badminton robot and mechanisms?
I am designing a badminton robot but i am very confused about mechanisms needed for a badminton robot and various calculations needed for millisecond response.I am also confused about calculations needed about the forces needed and efficient angles needed for hitting the shuttlecock.Please suggest me some ideas or suggestions needed for construction of badminton robot.</p>

答:
I like questions like this because more experienced engineers have a knee-jerk reaction of "it's not possible". It's easy to figure out ways something couldn't work, the hard thing is to figure out how to make it work anyway.

Now, this is a very difficult problem, but I actually think it's possible. You'll have to accept some trade offs though. To move the robot, I would suggest omnidirectional wheels. They'll let you move in all directions, yet retain speed. To swing the racket, a full 6 degree of freedom robot arm is much too expensive, complicated, and heavy to build or buy. But you don't need a real robot arm, you need to swing a racket. Something as simple as a large solenoid behind a plate could work, or you could attach a linear actuator to the racket and use a catapult-like movement to hit the shuttlecock. It's not going to look like a humanoid robot, and it may only be able to hit the shuttlecock in one way (ie not impart spin), but it could at least change the direction in which it hits by angling itself right before making contact.

Tracking the shuttlecock and identifying it can be done in one step with a depth sensor like a Kinect. Basically, you'll be looking for the smallish thing that's getting close to you really fast. You can filter out everything that's not white and is beyond a certain distance to help with this. This is a significant programming task, but there is lots of example code and support for the Kinect and for doing simple color filtering.

The really hard part will be actually getting to the shuttlecock in time. Badminton is a fast game, and this theoretical robot is not going to be able to move as fast as a person. But, I think it's feasible to be able to get to shots that are high and slow (ie a tall parabola). That will give enough time to move and make tracking the shuttlecock easier, since there won't be many other objects in the sky to act as false positives.

So I would say that this task is not "well beyond the capabilities of the top robotics research labs". It is not any easy task by any means and it's not going to be as good at Badminton as you're probably picturing in your head, but it can be done. Heck, we have entire teams of robots that play soccer, why not Badminton?


问:
Position Controller for a Quadrotor
I have a question regarding the implementation of a quadrotor's position controller.
In my Matlab model the quadrotor takes 4 inputs: a desired altitude ($Z_{des}$) and desired attitude angles($\Phi_{des}$, $\Theta_{des}$, $\Psi_{des}$) which reflects the motion described by the differential equations of the model (see last picture).

Here an insight into the implemented Matlab dynamic model. As you can see it has a structure like an inner loop controler:

Anyway...it "hovers" perfectly on the starting point. (perfect graphs :) )
Now I just need to go over and implement a sort of position controller to let the quadrotor to get from a start to a goal point, defined as usual through 3 coordinates $[X_d, Y_d, Z_d]$.

That's tricky because I don't have the same space state variables as input and output of the system. So the controller must take a vector of three coordinates and be able to output 3 different angles to get there. The only exception is the height because it will be simply bypassed by the controller and doesn't need another calculation loop. A different story is for the three angles...

My first idea was to simply create a feedback between the position given at the output of the simulated system and the desired position as in the figure above.
But that rises another question: my quadrotor model solves the following equation system:

$$
\large \cases{
 \ddot X = ( \sin{\psi} \sin{\phi} + \cos{\psi} \sin{\theta} \cos{\phi}) \frac{U_1}{m}  \cr
 \ddot Y = (-\cos{\psi} \sin{\phi} + \sin{\psi} \sin{\theta} \cos{\phi}) \frac{U_1}{m} \cr
 \ddot Z = (-g + (\cos{\theta} \cos{\phi}) \frac{U_1}{m} \cr
 \dot p  = \frac{I_{YY} - I_{ZZ}}{I_{XX}}qr - \frac{J_{TP}}{I_{XX}} q \Omega + \frac{U_2}{I_{XX}} \cr
 \dot q  = \frac{I_{ZZ} - I_{XX}}{I_{YY}}pr - \frac{J_{TP}}{I_{YY}} p \Omega + \frac{U_3}{I_{YY}} \cr
 \dot r  = \frac{I_{XX} - I_{YY}}{I_{ZZ}}pq - \frac{U_4}{I_{ZZ}}
}
$$

that means that they expect (as in the matlab model above) the desired angles and height.
But now I need right the inverse: given a desired position calculate the right angles!!!
For the direction is the solution really simple, since I can write something like:

```<code>Psi = atan2( (yd - yactual), (xd - xactual) );
</code>```

where y and x lies on the horizontal plane. This is not so simple for the other two angles. So what can I do at this point? Just "invert" the given equations to get the desired angles?

Another idea could be to implement a simple PD or PID controller. This is much more easier given the fact that I can experiment very quickly using Simulink and get very good results. But the problem is here again: how get I the desired angles from a desired position?

答:
By far, the most common solution to this problem is to use 2 separate controllers. The inner loop controller is what you already have: it tracks angle and height commands.

The outer loop controller assumes that the angles are tracked perfectly and treats angles as inputs, rather than separate states. So it takes the position error and converts it to a desired roll/pitch (via PID, just like any other system where you use a controller to calculate desired system inputs), and those desired angles are passed into the inner loop controller.

Make sense?

If you want to get more complicated, your outer loop controller can define a desired acceleration. Using a bit more complicated math you can turn that into desired angles. This is theoretically cleaner but in practice you're still just tuning PID loops so the actual benefit may not justify the time and effort.

------------ EDIT -----------

To elaborate. The outer loop looks something like this. (for simplicity assume yaw=0)

$$
\begin{align}
\hat{\phi}^d &= k_{p,y} (y-y^d) + k_{d,y} (v_y - v_y^d) + k_{i,y} \int_0^t (y-y^d) dt
\\
\hat{\theta}^d &= -k_{p,x} (x-x^d) = k_{d,x} (v_x - v_x^d) - k_{i,x} \int_0^t (x-x^d) dt
\end{align}
$$
where $\hat{\phi}^d$ is the desired roll angle and $\hat{\theta}^d$ is the desired pitch angle. When yaw $\ne$ 0 you combine the two. Something like
$$
\begin{align}
\phi^d &= \cos(\psi) \hat{\phi}^d - sin(\psi) \hat{\theta}^d
\\
\theta^d &= \sin(\psi) \hat{\phi}^d + cos(\psi) \hat{\theta}^d
\end{align}
$$
where $\psi$ is the yaw angle (FYI, I might have the signs wrong there)

Then, in the inner loop you have your existing controller.

Title: Position Controller for a Quadrotor


问:
How to estimate yaw angle from tri-axis accelerometer and gyroscope
I would like to estimate the yaw angle from accelerometer and gyroscope data. For roll and pitch estimate I've used the following trigonometric equations:

```<code>roll  = atan2(Ax,Az)  * RAD_TO_DEG
pitch = atan2(Ay,Az)  * RAD_TO_DEG
</code>```

and a simpified version of the Kalman Filter to consider also angular rates. The roll and pitch estimates are accurate (accelerometer values need to be filtered in presence of chassis vibrations).

In order to get the Yaw angle I'm using the following equation:

```<code>yaw = atan2(Ax,Ay)  * RAD_TO_DEG;
</code>```

but the it doesn't work. Do you have any advice?

答:
Assuming your vehicle is roughly horizontal to the ground, you won't be able get a good estimate of yaw from the accelerometer. Consider the nominal case: when your accelerometer is pointing straight down (Ax=0, Ay=0, Az=g) the reading will never change as you change yaw angle.

Normally, to get yaw angle vehicles use a magnometer (measure earth's magnetic field) or cameras and track the scene.


问:
Why do I need a Kalman filter?
I am designing an unmanned aerial vehicle, which will include several types of sensors:

3-axis accelerometer

3-axis gyroscope

3-axis magnetometer

horizon sensor

GPS

downward facing ultrasound.

A friend of mine told me that I will need to put all of this sensor data through a Kalman filter, but I don't understand why. Why can't I just put this straight into my micro controller. How does the Kalman filter help me about my sensor data?

答:
You could use particle filters as well. For the basic intro to Particle Filters, you could have a look at Professor Thrun's videos in Programming a Robotic Car.

http://www.youtube.com/watch?v=H0G1yslM5rc

http://www.youtube.com/watch?v=QgOUu2sUDzg

Particle filters are more robust and have a far lesser probability of the loop closure error, which commonly occurs while implementing an EKF.

The videos describe the functioning of a particle filter.

Title: Why do I need a Kalman filter?


答:
There are SLAM methods that do use landmarks and others that do not. If your sensor allows you to easily find and and identify landmarks (e.g. using cameras you can easily detect interest points and identify these using feature descriptors) it can be beneficial to do so. But in many cases (e.g. laser scanners, sonar) reliably detecting and identifying landmarks is nearly impossible.

The current state of the art in SLAM are graph-based methods and while I am not aware of an existing system using sonar sensors, the straight-forward approach which is widely used with laser scanners would be:

Use a pose graph representation and store sonar measurements at key poses.

Use the odometry of your robot to add measurement edges between consecutive nodes.

Can you use your robot's sonar array for registration/scan matching (even with rather inaccurate results)? Also add the resulting relative pose edges to your pose graph.

From time to time: Perform pose graph optimization. After that you might want to create an occupancy grid map using sonar scans corresponsing to nodes with their corrected pose.

For 2D laser scanners, this is described in more detail in this paper and implemented in karto

Title: SLAM without landmarks using sonar


问:
Mechanical or electrical engineering for robotic and automation?
I have decided to pursue a career in automation and robotic. At the moment, I am being torn between Mechanical and Electrical Engineering. I know that both of them relate to my choices of career, and at the moment, I think that I like them equally. I hope you guys can help me solve my dilemma by using your insights/experiences to assist me with the following questions:

1/ From your experiences and opinions, which of the two engineering fields is generally more crucial and challenging, especially in an automation/robotics project?

2/ Which will see an increase in demand and importance in the near future? Which of them might become outdated/obsolete or at least develop at a slower rate compare to the other?(I have a feeling that EE has a slight edge over this matter; however, I am not so sure)
3/ Which of the fields is more versatile? Which is more physical demanding (I am actually quite frail)

4/ Which is generally easier to self-study? Robotics is obviously an incredibly broad and complex field and I have prepared to step outside of my comfort zone and do lots of studying by myself to achieve my goals and passion.

I could probably come up with a few more questions; however, I am sure that you guys got the gist of my puzzle. Thank you very much and I apologize if there is any grammatical error.

答: Have a look at the research being done at your university. Stop by some professors offices, and ask them what their degree has offered in terms of robotics. Of course, a bunch of us on stackexchange are probably in favor of CS, but I can tell you from attending conferences that roboticists come in all flavors, and CS-type problems are being solved by people of all backgrounds. In fact, a lab here at my university specializes in building new types of robot actuators or chassis, and strangely all of their students are in CS as is the professor.


问:
Is there an advantage to multiple magnetometers for heading computation
I'm building an autonomous sail boat (ripped out the guts of an RC sail boat and replaced with my own mainboard etc.)

The controller board I have can accommodate both an MPU9150 and an HMC5883. Is there any advantage is using both magnetometers for a tilt-compensated heading? I'm thinking that I could compute the unit vector with soft/hard iron offsets removed for both, and then average  the two vectors to get one slightly better one?

Not sure if it would yield a better result though.

答: A brief google search turned up this paper on using multiple magnetometers.  Depending on how far out at sea you expect to deploy this sailboat, you may want to consider a fallback mode where if the 2 compasses diverge by a certain amount then you consider one of them to be malfunctioning (since the average would be very inaccurate).</p>


答:
Gyroscopes will only give you the rate of change of the yaw angle, not the absolute yaw angle.

Unless you plan to set the yaw angle initially and have it drift further and further into garbage values (as you integrate the rate of change), you'll need another sensor to provide periodic updates on your actual yaw.  This could be a magnetometer (compass), or a GPS, or a pair of GPSes, or some other method of finding your heading, which would provide input to a correction algorithm (e.g. Sebastian Madgwick's filter).

Title: How to estimate yaw angle from tri-axis accelerometer and gyroscope

Body:
I would like to estimate the yaw angle from accelerometer and gyroscope data. For roll and pitch estimate I've used the following trigonometric equations:

```<code>roll  = atan2(Ax,Az)  * RAD_TO_DEG
pitch = atan2(Ay,Az)  * RAD_TO_DEG
</code>```

and a simpified version of the Kalman Filter to consider also angular rates. The roll and pitch estimates are accurate (accelerometer values need to be filtered in presence of chassis vibrations).

In order to get the Yaw angle I'm using the following equation:

```<code>yaw = atan2(Ax,Ay)  * RAD_TO_DEG;
</code>```

but the it doesn't work. Do you have any advice?


问:
What should I be looking for in a DC motor that will be used in a UROV thruster?
I know that some DC motors produce a lot of torque but only actually move at a very slow rate, while others do the exact opposite. I know that I need some sort of balance between torque and the RPM's of the motor for use in a underwater thruster, but I am not sure what I should favor more, torque or RPM's? Also, it would be great if someone could suggest a motor at or below the $300 range for a UROV.</p>

答:
The engine's ideal torque and RPM characteristics are dependent on what propeller you use.  In general, if you know about how large of a propeller you want (relative to the size of your vehicle), you should be able to work backwards from there to find the ideal motor torque/RPM to support that. There will be a few options, based on possible variations on the number of blades, attack angle, etc of the propeller.

OpenProp may help you if you're approaching it from a very theoretical angle.

This question about upgrading motors on the Sea Perch ROV also has some insight that you might find relevant.


问:
Device to roll a mat
I'm looking for some direction on how to create a device that does the following:
Imagine you have a yoga mat, I want a device that can roll it up and unroll it without a human intervening in the rolling process.
I reliable this is a robotics forums but there doesn't appear to be a section for mechanical engineering so I'm posting my question here.</p>

答:
Could you start the rolling with some sort of scraping action, and use rollers to control it from there?

For example: http://www.youtube.com/watch?v=5xhbctEcAAA#t=90

The challenge would be making sure you stay oriented left/right to the mat being rolled.

Title: Device to roll a mat


问:
Short distance ball transport
I'm looking for a way to transport balls (diameter 50mm) 220 mm up with over a slope with a length of 120 mm. Currently I'm considering the usage of a belt system but I cannot seem to find a good belt system.

Because of space constraints within my robot, normally I would probably take a nylon belt and jam nails trough it to make little slots and then use that. However this would result in considerable reduction in available space as it means that I have to also take into account the extra space required for the nails on the way back. This means that ideally there would be a way to reduce the space used by the nails on the way back.

Does anybody have a good solution for this?

答:
If you wanna stick to the belt system, then cut circular holes into the belt with a diameter of ~30mm. The ball will not fall through and can be transported upwards.

if you don't need much control over the ball, then you can "shoot" it with air pressure or a mechanical construction; something like a racket .

If you have enough place at the beginning of the slope, you could use a pneumatic actuator to push the ball.

Title: Short distance ball transport


问:
PD Algorithm for a Quadrotor [Simulation]
I have a big problem trying to stabilize a quadrotor with a PD controller.
The model and the program has been written in C++ and the model dynamic has been taken from this source in internet:

Well, in my code I wrote the model like in the eq. system ( see eq. 3.30 on page 21):

```<code>/* Calculate the acceleration about all 6 axis */
body_pos_current_.x_dot_2 =  ( thrust_.total / masse_ ) * ( sin( body_ang_current_.theta ) * cos( body_ang_current_.phi ) * cos( body_ang_current_.psi ) + sin( body_ang_current_.psi ) * cos( body_ang_current_.phi ) );
body_pos_current_.y_dot_2 =  ( thrust_.total / masse_ ) * ( sin( body_ang_current_.theta ) * sin( body_ang_current_.psi ) * cos( body_ang_current_.phi ) - cos( body_ang_current_.psi ) * sin( body_ang_current_.phi ) * cos( body_ang_current_.psi ) );
body_pos_current_.z_dot_2 =  ( thrust_.total / masse_ ) * ( cos( body_ang_current_.theta ) * cos( body_ang_current_.phi ) ) - 9.81;

body_ang_current_.phi_dot_2   = ( torque_.phi   / Jxx_ );
body_ang_current_.theta_dot_2 = ( torque_.theta / Jyy_ );
body_ang_current_.psi_dot_2   = ( torque_.psi   / Jzz_ );
</code>```

where body_ang_current.<angle> and body_pos_current_.<position> are structures defined in a class to store position, velocities and accelerations of the model given the 4 motor velocities about all 3 axis.

$$
\large \cases{
 \ddot X = ( \sin{\psi} \sin{\phi} + \cos{\psi} \sin{\theta} \cos{\phi}) \frac{U_1}{m}  \cr
 \ddot Y = (-\cos{\psi} \sin{\phi} + \sin{\psi} \sin{\theta} \cos{\phi}) \frac{U_1}{m} \cr
 \ddot Z = (-g + (\cos{\theta} \cos{\phi}) \frac{U_1}{m} \cr
 \dot p  = \frac{I_{YY} - I_{ZZ}}{I_{XX}}qr - \frac{J_{TP}}{I_{XX}} q \Omega + \frac{U_2}{I_{XX}} \cr
 \dot q  = \frac{I_{ZZ} - I_{XX}}{I_{YY}}pr - \frac{J_{TP}}{I_{YY}} p \Omega + \frac{U_3}{I_{YY}} \cr
 \dot r  = \frac{I_{XX} - I_{YY}}{I_{ZZ}}pq - \frac{U_4}{I_{ZZ}}
}
$$

Once I get the accelerations above I m going to integrate them to get velocities and positions as well:

```<code>/* Get position and velocities from accelerations */
body_pos_current_.x_dot = body_pos_current_.x_dot_2 * real_duration + body_pos_previous_.x_dot;
body_pos_current_.y_dot = body_pos_current_.y_dot_2 * real_duration + body_pos_previous_.y_dot;
body_pos_current_.z_dot = body_pos_current_.z_dot_2 * real_duration + body_pos_previous_.z_dot;

body_ang_current_.phi_dot   = body_ang_current_.phi_dot_2   * real_duration + body_ang_previous_.phi_dot;
body_ang_current_.theta_dot = body_ang_current_.theta_dot_2 * real_duration + body_ang_previous_.theta_dot;
body_ang_current_.psi_dot   = body_ang_current_.psi_dot_2   * real_duration + body_ang_previous_.psi_dot;

body_pos_current_.x = 0.5 * body_pos_current_.x_dot_2 * pow( real_duration, 2 ) + ( body_pos_previous_.x_dot * real_duration ) + body_pos_previous_.x;
body_pos_current_.y = 0.5 * body_pos_current_.y_dot_2 * pow( real_duration, 2 ) + ( body_pos_previous_.y_dot * real_duration ) + body_pos_previous_.y;
body_pos_current_.z = 0.5 * body_pos_current_.z_dot_2 * pow( real_duration, 2 ) + ( body_pos_previous_.z_dot * real_duration ) + body_pos_previous_.z;

body_ang_current_.phi   = 0.5 * body_ang_current_.phi_dot_2   * pow( real_duration, 2 ) + ( body_ang_previous_.phi_dot   * real_duration ) + body_ang_previous_.phi;
body_ang_current_.theta = 0.5 * body_ang_current_.theta_dot_2 * pow( real_duration, 2 ) + ( body_ang_previous_.theta_dot * real_duration ) + body_ang_previous_.theta;
body_ang_current_.psi   = 0.5 * body_ang_current_.psi_dot_2   * pow( real_duration, 2 ) + ( body_ang_previous_.psi_dot   * real_duration ) + body_ang_previous_.psi;

/* Copy the new value into the previous one (for the next loop) */
body_pos_previous_.x = body_pos_current_.x;
body_pos_previous_.y = body_pos_current_.y;
body_pos_previous_.z = body_pos_current_.z;

body_pos_previous_.x_dot = body_pos_current_.x_dot;
body_pos_previous_.y_dot = body_pos_current_.y_dot;
body_pos_previous_.z_dot = body_pos_current_.z_dot;

body_ang_previous_.phi   = body_ang_current_.phi;
body_ang_previous_.theta = body_ang_current_.theta;
body_ang_previous_.psi   = body_ang_current_.psi;

body_ang_previous_.phi_dot   = body_ang_current_.phi_dot;
body_ang_previous_.theta_dot = body_ang_current_.theta_dot;
body_ang_previous_.psi_dot   = body_ang_current_.psi_dot;
</code>```

The model seems to work well but, as like reported in many papers, is very unstable and needs some controls.

The first approach for me was to create a controller (PD) to keep the height constant without moving the quadcopter, but just putting a value (for example 3 meter) and see how it reacts.

Here the small code I tried:

```<code>/* PD Controller */
double e = ( 3.0 - body_pos_current_.z );  // 3.0 is just a try value!!!
thrust_.esum = thrust_.esum + e;
thrust_.total = 1.3 * e + 0.2 * real_duration * thrust_.esum;
</code>```

The problem, as you can see here in this video, is that the copter starts falling down into the ground and not reaching the desired altitude (3.0 meters).
Then it comes back again again like a spring, which is not damped.
I tried already many different value for the PD controller but it seems that it doesn't affect the dynamic of the model.

Another strange thing is that it goes always to a negative point under the ground, even if I change the desired height (negative or positive).

What s wrong in my code?
Could you me please point to some documents or code which is understandable and well documented to start?

Thanks

EDIT:
Many thanks to your suggestion.
Hi was really surprise to know, that my code had lots of potential problems and was not very efficient. So I elaborate the code as your explanation and I implementers a RK4 for the integration. After I ve read those articles: here and here I got an idea about RK and its vantage to use it in simulations and graphics PC.
As an example I rewrote again the whole code:

```<code>/* Calculate the acceleration about all 6 axis */
pos_.dVel.x =  ( ( thrust_.total / masse_ ) * ( -sin( body_position_.angle.theta ) * cos( body_position_.angle.phi ) * cos( body_position_.angle.psi ) - sin( body_position_.angle.phi ) * sin( body_position_.angle.psi ) ) );
pos_.dVel.y =  ( ( thrust_.total / masse_ ) * ( sin( body_position_.angle.phi ) * cos( body_position_.angle.psi ) - cos( body_position_.angle.phi ) * sin( body_position_.angle.theta ) * sin( body_position_.angle.psi ) ) );
pos_.dVel.z =  ( ( thrust_.total / masse_ ) * ( -cos( body_position_.angle.phi ) * cos( body_position_.angle.theta ) ) - 9.81 );

pos_.dOmega.phi   = ( torque_.phi   / Jxx_ );
pos_.dOmega.theta = ( torque_.theta / Jyy_ );
pos_.dOmega.psi   = ( torque_.psi   / Jzz_ );

/* Get position and velocities from accelerations */
body_position_ = RKIntegrate( body_position_, real_duration );
</code>```

which is much more clear and easy to debug. Here some useful functions I implemented:

```<code>QuadrotorController::State QuadrotorController::evaluate( const State &initial, const Derivative &d, double dt ) {

State output;
output.position.x = initial.position.x + d.dPos.x * dt;
output.position.y = initial.position.y + d.dPos.y * dt;
output.position.z = initial.position.z + d.dPos.z * dt;

output.velocity.x = initial.velocity.x + d.dVel.x * dt;
output.velocity.y = initial.velocity.y + d.dVel.y * dt;
output.velocity.z = initial.velocity.z + d.dVel.z * dt;

output.angle.phi   = initial.angle.phi   + d.dAngle.phi   * dt;
output.angle.theta = initial.angle.theta + d.dAngle.theta * dt;
output.angle.psi   = initial.angle.psi   + d.dAngle.psi   * dt;

output.omega.phi   = initial.omega.phi   + d.dOmega.phi   * dt;
output.omega.theta = initial.omega.theta + d.dOmega.theta * dt;
output.omega.psi   = initial.omega.psi   + d.dOmega.psi   * dt;

return output;

};

QuadrotorController::Derivative QuadrotorController::sampleDerivative( double dt, const State &sampleState ) {

Derivative output;

output.dPos = sampleState.velocity;
output.dVel.x = pos_.dVel.x;
output.dVel.y = pos_.dVel.y;
output.dVel.z = pos_.dVel.z;

output.dAngle = sampleState.omega;
output.dOmega.phi   = pos_.dOmega.phi;
output.dOmega.theta = pos_.dOmega.theta;
output.dOmega.psi   = pos_.dOmega.psi;

return output;

};

QuadrotorController::State QuadrotorController::RKIntegrate( const State &state, double dt ) {

const double C1 = 0.0f;
const double C2 = 0.5f, A21 = 0.5f;
const double C3 = 0.5f, A31 = 0.0f, A32 = 0.5f;
const double C4 = 1.0f, A41 = 0.0f, A42 = 0.0f, A43 = 1.0f;

const double B1 = 1.0f/6.0f, B2 = 1.0f/3.0f, B3 = 1.0f/3.0f, B4 = 1.0f/6.0f;

Derivative k1 = sampleDerivative( 0.0f, state );
Derivative k2 = sampleDerivative( C2 * dt, evaluate( state, k1 * A21, dt ) );
Derivative k3 = sampleDerivative( C3 * dt, evaluate( state, k1 * A31 + k2 * A32, dt ) );
Derivative k4 = sampleDerivative( C4 * dt, evaluate( state, k1 * A41 + k2 * A42 + k3 * A43, dt ) );

const Derivative derivativeSum = k1 * B1 + k2 * B2 + k3 * B3 + k4 * B4;

return evaluate( state, derivativeSum, dt );
}
</code>```

Now I m really lost because...because the simulated qudrotor has the same behavior as before. Nevertheless I ve implemented the same PD algorithm as discussed in the paper, it stabilize on Z (height) but it get really crazy due to unstable behavior.
So... I dunno what is wrong in my code and my implementation. And above all I cannot find any source in internet with a good self explaned dynamic model for a quadrotor.

Regards

答:
At the end I discovered Simulink and the possibility to write a non linear system with it.
Simply take the differential equations in the paper and put them as they are in simulink. Really strightforward.
After I ve written a PID controller for my system it seems to work really good.

The ide a linearized system to implement was good but for some reason didn t have the expected reaction during simulation.

Anyway many thanks to all explanations and the suggestions that other people gave me.

Regards


问:
is it possible to track movement on a tennis court?
I'd like to track my run in an indoor tennis court. GPS won't be available so I was thinking researching for other solutions:

Accelerometer: I concluded it's a no go because while playing tennis the player makes a lot of movements that include spinning his body that can alter the data.

Then I thought that a 3/4 point IR system might help but again from what I've understood it's hard for the IR system to track the movement since they won't be able to focus on the player.

So my final thought went to radio systems but I couldn't find any info and it's also hard for me to see a theoretical solution at least on how I can mesure the movement/speed of the player.

So here is my question: Is there any existing system that is able to track random movement of an object (athlete) and give info like speed and distance? is there anywhere resources about how such a system might be achieved or at least the exact technology used for it?

Any suggestions and ideas are greatly appreaciated.

答:
Well the IR tracking system can work, but I think you need to place the camera at the ceiling.
Usually the distance between player and camera at the ceiling of a tennis-hall (height 8+m I guess) stays about the same.

Using IMU-Data is a bad idea cause of the really complex movement

EDIT1:
For implementing the IR-Tracking (in this case a pretty simple one) you need an IR camera.
Use a 25$ playstation camera and modify it: http://www.maximumpc.com/article/features/build_your_own_multitouch_surface_computer?page=0,2)

Then place a IR Led at your head or at another position which can be seen pretty good by the camera.

I'm actually not sure if there is any fitting software, but writing such stuff is pretty straight forward.

If you look now at a picture of this cam. It will be all black except one mega-bright spot

OpenCV will be able to communicate with the camera easily and get some images. Then you can use some simple object tracking (or also called blob detection) in opencv to get the position
You will get your x/y position. You can perform some basic trigonometry to improve the result but basically the x/y position correlate with a real life postion (the camrera is not moving and you will have most of the time the same vertical distance between you and the camera)

Now it's just a pretty straight logging.
For the velocity just multiply the distance you moved between two frames with the frame rate.


答:
You should look into motion capture systems.  These systems use fixed infrared cameras to track retro-reflective markers on the object.  They got their popularity from tracking humans for the movies.  But are very handy in robotics.  Most of the fancy research being done with quadcopters relies on these systems.  For rigid bodies, you can get sub-millimeter accuracy at hundreds of hz.

The price is probably out of the question for a personal project, but if you are doing this as part of a school or lab, then it may be a good investment.  Vicon (http://www.vicon.com/) is probably the most well known company.  Another is NaturalPoint (https://www.naturalpoint.com/optitrack/).

Title: is it possible to track movement on a tennis court?

Body:
I'd like to track my run in an indoor tennis court. GPS won't be available so I was thinking researching for other solutions:

Accelerometer: I concluded it's a no go because while playing tennis the player makes a lot of movements that include spinning his body that can alter the data.

Then I thought that a 3/4 point IR system might help but again from what I've understood it's hard for the IR system to track the movement since they won't be able to focus on the player.

So my final thought went to radio systems but I couldn't find any info and it's also hard for me to see a theoretical solution at least on how I can mesure the movement/speed of the player.

So here is my question: Is there any existing system that is able to track random movement of an object (athlete) and give info like speed and distance? is there anywhere resources about how such a system might be achieved or at least the exact technology used for it?

Any suggestions and ideas are greatly appreaciated.