问:
Covariance and optimization
I am trying to build a map containing lamps as landmarks. I drive around with a robot and a monocular camera looking to the ceiling.

The first step is detect the edges of each observed rectangular lamp and save the position in pixels and also the current position from odometry of the robot. After the lamp disappears from the field of view, there is enough base-line to do a 3D reconstruction based on structure from motion. Once this reconstruction is done there will be uncertainty in the position of the lamps that can be modelled by covariance. Imagine if the robot was driving for a while, its own position estimated from odometry will also have a relatively high incertitude, how can I integrate all of those incertitudes together in the final covariance matrix of the position of each lamp?

If I understand well there would be the following covariances:

noise from camera

Inaccurate camera calibration matrix

inaccurate result from optimization

drift in odometry

My goal is to manually do loop closure using for example g2o (graph optimization) and for that I think correct covariances are needed for each point.

答:
This is the basic slam problem. You have to find out (model) how the uncertainty of the robot affects the uncertainty of the landmarks, and visa-versa. This is done using the cross-correlation terms of the uncertainty. Or, the covariance. Those four things you referred to as covariances are actually variances. The covariance describes how the uncertainties in one thing bleed over to create uncertainty in the other things. This sounds terrible, but actually, if you reduce uncertainty in one thing, then the fact that two things co-vary allows you to reduce uncertainty in two things.

See, when you discuss covariance of the robot's position, what you mean is something like a 2x2 matrix. The matrix has multiple terms, two variances in the principal x-y directions, and the covariance of the x uncertainty and the y uncertainty. So you're already doing SLAM. Sorta.

What you have to do for $N$ lamps in $2D$ space and 1 robot moving in $2D$, is construct the giant $2\times (N+1)$ by $2\times (N+1)$ matrix.  How to do this is mechanically straightforward, but an intuitive understanding is difficult to build up. I'm sure someone will come along that has a better mechanical answer for you. But until then, you might check out Probabilistic Robotics, by Thrun.

UPDATE:

For example. Let's say you have one landmark, and one robot. Both are on the line, and so the state is simply their $x$ position. (This greatly simplifies the problem). Then, let's say the robot measures the distance (with direction) to the landmark. The the measurement function (which describes what the robot measures) is
$$h=x_l - x_r$$.

We'll use the EKF update equations to find the covariance of the robot-landmark state. Note, this will be a $2\times 2$ matrix, given the discussion above. We're not really limited to the EKF update equations. Most estimators use the same equation to estimate the covariance of the state. If you really want to know more about this, read up on the Fisher Information Matrix, which is the gold standard for covariance estimation.

Back to the topic at hand.

The full state covariance matrix after the robot moves with some uncertain actuation is given by:

$$ P = F^T P F + G $$

and after the measurement, is given by

$$ P = \left( P^{-1} + H^T R^{-1} H \right)^{-1} $$

Here, $R$ is the measurement noise, $H$ is the jacobian of the measurement function with respect to the state, $F$ is the jacobian of the update function (the kinematics) with respect to the state, and $G$ is the noise matrix for the controls.

In our case,

$$H
=\begin{bmatrix} \frac{\partial h}{x_r}, \frac{\partial h}{x_l} \end{bmatrix}\\
=\begin{bmatrix} -1, 1 \end{bmatrix}\\
$$

Suppose the robot's position is known up to variance $\sigma_r^2$ and the measurement is corrupted by zero-mean noise with variance $\sigma_s^2$. Then, when the landmark is measured, (assuming a diagonal starting covariance)

$$ P^{-1} =
\begin{bmatrix}
\frac{1}{\sigma_r^2}, 0\\
0, \frac{1}{\sigma_l^2}
\end{bmatrix}
+
\begin{bmatrix} -1\\ 1 \end{bmatrix}
\frac{1}{\sigma_s^2}
\begin{bmatrix} -1, 1 \end{bmatrix}
$$

Simplifying,
$$
P^{-1}=
\begin{bmatrix}
\frac{1}{\sigma_r^2}, 0\\
0, \frac{1}{\sigma_l^2}
\end{bmatrix}+
\frac{1}{\sigma_s^2}
\begin{bmatrix} 1, -1\\-1,1 \end{bmatrix}
$$
Implying,
$$
P=
\begin{bmatrix}
\frac{1}{\sigma_r^2} +\frac{1}{\sigma_s^2}&
-\frac{1}{\sigma_s^2}\\
-\frac{1}{\sigma_s^2}&
\frac{1}{\sigma_l^2}+\frac{1}{\sigma_s^2}
\end{bmatrix}^{-1}
$$

The previous defines a computational way to calculate the covariance after a measurement. A similar method using the control function to get the matrix $F$ will get you the update step.

To get this in closed form, just carry the partial derivatives through.

Or, a better way:
In general, the matrix on the right is known as the Fisher Information, with the caveat that the matrix $H$ is not linearized at the true target location. To construct an arbitrary covariance matrix from scratch, you can do so by noting that the FIM has each i,j element given by (assuming gaussian noise), for state vector $x$.

$$
\begin{bmatrix}
\frac{\partial h}{x(i)}\ln \mathcal{L}(x)
\frac{\partial h}{x(j)}\ln \mathcal{L}(x)
\end {bmatrix}
$$

In the previous, $\mathcal{L}(\cdot)$ is the liklihood function of the measurements. In this case, a Gaussian.
This derivation is covered in this thesis and also this one (with the full disclosure that the second one is mine).

Title: Covariance and optimization


问:
Device to generate screen tap response
I have extremely limited knowledge in the general topic of robotics and therefore this question is a shot in the dark. Please let me know if the topic is unsuitable for the site.

I am interested in creating a device that would generate a touchscreen tap. In a nutshell, I would like to replicate on a touchscreen the automated mouse functionality you can obtain with software like AutoHotKey in Windows. Since, without jailbreaking the phone, a software solution is basically impossible, it occurs that one of the first components would be a physical device that simulates a tap. Do any options for such a component exist?

I recognize that there are philosophical implications with creating such a device. I am assuming the entire conversation to be theoretical and solely related to the hardware design.

Thanks,
Alex

答: As I mentioned in this other question on the same topic, it should be easy to put a stylus on a small robot arm.  Note that since you don't need a lot of elevation difference, a gantry, Delta, or SCARA style robot is probably better than a "traditional" robot arm.</p>

ContentLicense: CC BY-SA 3.0

Title: Device to generate screen tap response


问:
Powering my robot with 12V battery which is charged by a gas/petrol generator while the robot is operating?
A have designed a robot to perform tasks in farms.  But the problem now is I'm not sure on the best way to supply continuous power to my robot.  All the motors are rated at 12V and only Arduino and a few sensors work at 5V or less.

Can I continuously charge a 12V lead acid battery with an adapter (comes with the battery) plugged into the AC output of the generator while the robot is operating? Do I have to worry about overcharging the battery?

Or should I use the generator's DC output which can supply 12V and up to 8.3Amp. Or is there any other suggestions?

Some information about the adapter which are stated on the package:
1. Built-in over-charge protection device.
2. Built-in thermal protection device
3. Output: 6v/12v 2Amp

This is the generator that I have:
http://global.yamaha-motor.com/business/pp/generator/220v-60hz/0-1/et950/

This is my first robot which is quite big that requires a lot of electrical/electronic knowledge to power it. I do not have a lot of experience in this field. So any feedback is greatly appreciated.

答:
The alternator in a car is constantly charging the 12V battery while the car is running, which is to say battery-wise you shouldn't have any issues.

Several things could be meant when you say the motors are "rated" for 12V. Is that a maximum, minimum, or nominal voltage? I'm assuming they're rated for DC power, but there are some low voltage AC motors.

If I recall correctly, I think a vehicle 12V bus could swing from dead battery voltage of 11.8 to a charging voltage of 14.4V, so you should check that you aren't violating any ratings on the motors.

For the electronics I would use a 5V DC-DC converter. You should consider a 12V-12V DC-DC converter for power conditioning if the generator output is too noisy.

The only reason I would consider using a battery is if the generator can't supply the peak current you need or if you have to be able to run some functions without the generator on. Remember that the generator must supply more than the average power draw or you'll always wind up running the batteries dead.

Lastly, some generators may require a minimum load for proper voltage regulation, so be sure to check.


问:
Two exclusive inputs control
I have a system with two inputs (throttle and brake) and one output (speed). How does one design a controller in such a way that the two outputs of the controller (throttle and brake) are never both greater than zero (so that it doesn't accelerate and brake simultaneously)?

Thanks

答:
The system is nonlinear for acceleration. If the desired acceleration value is bigger than 0, use the throttle, if smaller than 0, use the break.

Other than that, you should be fine using a cascaded control loop with an inner acceleration loop and an outer speed control loop. Despite the fact that it has a discontinuity in the acceleration control loop, you should be able to treat it as a linear one if both break and throttle can be set to arbitrary small values, creating a smooth transition between the use of throttle and break at 0 acceleration.

Title: Two exclusive inputs control


问:
How to find out how far a motor has taken a vehicle?
I have a small motorized vehicle with gears as wheels running up and down a track made of gear racks. How can this robot know when it has run half the track? And what's the best method to keep it from running off its track at the end and then return to start.

The robot is carrying water, not exactly the same amount each time, so it will not weigh the same. Therefore it might not be the same amount of steps in the stepper-motor each time.

Here I have some ideas that might work, though I am a beginner, and don't know what's the best solution.

GPS tracking it (overkill on such a small scale?)

Some kind of distance measurer

Have a knob it will hit at the middle of the track, telling program to delay for a given time

Track amount of steps the motor has performed (won't be as accurate?)

答:
If you are running on a fixed track, by far the easiest method is to use a pair of endstops.

Typically these would be mechanical, magnetic or optical.

Mechanical

A mechanical endstop could be as simple as a physical barrier at the end of your track, much like a train track buffer stop. Your vehicle would bump up to buffer, detect that it wasn't moving and take that as a signal that it had reached the end of travel.

If you are moving slowly, with low toque and the restraining force of the buffer is significantly greater than the motive force of the vehicle plus the force from dissipating the momentum of the vehicle, then a simple mechanical endstop might be sufficient.

If you want to get a little more sophisticated, you could add a mechanical switch to your vehicle bumpers, ideally on a spring such that it is closed before the main body of the vehicle hits the buffer. When the buffer stop is close, the control system would be told by the closing of the switch that and could apply the brakes.

Magnetic

A magnetic endstop would be a magnet on the track with a reed-switch attached to your control system. When the reed switch rolls over the magnet, the circuit is closed and the control system can stop the vehicle.

This has the advantage over the mechanical switch that it is non contact, so is less likely to be damages if the vehicle becomes a run-away.

Optical

An optical endstop would be a slotted optical switch on the vehicle and a blade of metal near the end of travel on the track, which runs through optical switch, blocking the beam when the vehicle gets close to the end of travel.

This has the advantage that rather than relying on a magnet that is in one spot on the track being detected, it can signal an end of travel condition for the whole distance from the end of required travel right up to any mechanical endstop.

Soft endstops

Essentially, this is just keeping track of where you have commanded your stepper motor to move and applying limits on how far you allow the higher level software to move. If you are requesting motion which is well within the parameters of the motor you have specified for your vehicle (speed, torque and acceleration profile etc.), then it should not be skipping steps and soft end-stops may well be sufficient.

If you do this though, I would also recommend adding one of the other mechanisms as belt and braces.

Combinations

Most industrial systems have multiple end of travel detection and over travel prevention systems, usually soft limits and either a mechanical endstop plus limit switches or soft limits, mechanical endstop plus opto endstop. All three systems have to fail in order for the system fail overall.

You might also want to have a look at the answers to Why do I need an endstop sensor with stepper motor? over on Electrical Engineering Stack exchange.


问:
Why are bipedal robots difficult?
Not sure if this has been asked, but there are lots of simulations of bipedal locomotion algorithms online, some of the evolutionary algorithms converge to very good solutions. So it seems to me that the algorithm part of bipedal locomotion is well-understood.

If you can do well on simulations, you should be able to do it well in the real world. You can model delay and noise, you can model servo's response curve.

What I don't understand is then why is it still difficult to make a walking robot? Even a robot like the Big Dog is rare.

答:
If you can do well on simulations, you should be able to do it well in the real world.

There's this lovely saying:

In theory, there is no difference between theory and practice.

And what that implies for practice goes without saying.

You can model delay and noise, you can model servo's response curve.

A simulation is only as good as the model it is simulating. We like simple models. We don't like nonlinear things. We don't like to deal with too many variables...

That something works well in a simulation is often a necessary condition to be able to do it in the real world, but it's not necessarily (pun intended) a sufficient one.

Given all the necessary information doesn't mean it's possible to do it or reasonable to do so. Maybe we know how to do the calculations and have all the input, but cannot do the calculations quick enough with a reasonable sized processor.

It appears to me that your reasoning is that because we are able to do it, we should be doing it. There are plenty of other reasons to do (or not do) something aside from the mere possibility of doing it. Maybe it is in fact possible to build a robot with bipedal locomotion. It's quite possible that the difficulty in actually doing it is in finding a reason to do so.

Would that bipedal robot be faster than a robot with wheels? More stable? Would it require less energy? How well would it work on different terrain? Will the money required for further research and testing pay off later in any way?

A lack of benefits or at least lack of obvious benefits is a major difficulty to develop something. Running a computer simulation is one thing, but building a physical robot (and designing one before that) requires funding which requires making rich people interested in finding a solution to the problem.

some of the evolutionary algorithms converge to very good solutions

Speaking of evolution, bipedal motion is not exactly the most popular one.
And it isn't the best one either, because no matter how successful you consider the bipedal homo sapiens, one thing he did was to invent other forms of locomotion superior to his bipedal one.

It looks like this is one of those research topics that we'd like to solve so we can claim that we are able to do it, but other technologies (drones fro example) seem to offer more and more obvious advantages.

Title: Why are bipedal robots difficult?


问:
Line following robot path planning
I have built a mobile robot with several ultrasonic sensors to detect obstacles and an infrared sensor to track a line as a path. I have written a simple algorithm to follow the line which works fine, but avoiding obstacles are a problem because the robot doesn't know the layout of the path, so even if it does move around the obstacle, it is not guaranteed that it will find the path line again(unless the line is perfectly straight). Therefore, I think I may need to use a path/motion planning algorithm or find a way to store the layout of the path so that robot could predict where to move and get back to the path line and keep on following after overcoming an obstacle. I would like to hear suggestions or types of algorithms I should focus on for this specific problem.

Picture might help specifying the problem I'm facing.

Thank you.

答:
Line following is a simple reactive behaviour. Before you get into planning to solve the obstacle avoidance problem - which can get quite complex - you should consider simpler solutions.

What this simpler solution could be depends a bit on the environment and on your robot. But let me make a suggestion:

```<code>while()
    follow line
    if( detect obstacle )
         turn left (leave line)
         while( not detect line )
             keep obstacle within distance d to the right
</code>```

The devil is in the implementation and sensor setup, but the principle idea is that you track the contours of your obstacle to get you back to your line.

Title: Line following robot path planning

Body:
Line following is a simple reactive behaviour. Before you get into planning to solve the obstacle avoidance problem - which can get quite complex - you should consider simpler solutions.

What this simpler solution could be depends a bit on the environment and on your robot. But let me make a suggestion:

while()
    follow line
    if( detect obstacle )
         turn left (leave line)
         while( not detect line )
             keep obstacle within distance d to the right

The devil is in the implementation and sensor setup, but the principle idea is that you track the contours of your obstacle to get you back to your line.


问:
"Ambiguous up to scale" , Explanation required
I am reading "Computer Vision: Models, Learning, and Inference" in which author writes at several points (like on page 428-429) that although matrix A seems to have 'n' degree of freedom but since it is ambiguous up to scale so it only has 'n-1' degree of freedom? Can anyone explain what this thing means? Why one degree of freedom is decreased?

答:
I don't have access to the quoted reference, but believe the explanation (stated, for simplicity, in terms of a vector rather than a matrix) below will apply.

Consider an  $n$-element vector $V$.  In general, there are $n$ degrees of freedom for populating the vector.  However, if scale is unimportant or of no account, that is, if all scalar multiples $a V$ are taken as equivalent, then we might as well scale $V$ so that $||V|| = 1$ (ie has unit length).  In this case, we have at most $n-1$ degrees of freedom, because specifying any $n-1$ elements of a unit length vector forces the value of the remaining element.


答:
If you are running gears as wheels on gear tracks, I do not understand how weight could change the number of steps. How can they slip? If there is no slippage, then the amount of steps should always be sufficient, although as mark suggested, most real world solutions would also include a limiting touch switch in case of mechanical failure.

Since using number of steps involves some math, it may be just easier and as good to use only  limiting touch switches. It is common to put touch switches at any location such as the middle. In the case for a middle switch, some protrusion on the tracks would trigger the switch on the robot.

typical switch

Title: How to find out how far a motor has taken a vehicle?

Body:
I have a small motorized vehicle with gears as wheels running up and down a track made of gear racks. How can this robot know when it has run half the track? And what's the best method to keep it from running off its track at the end and then return to start.

The robot is carrying water, not exactly the same amount each time, so it will not weigh the same. Therefore it might not be the same amount of steps in the stepper-motor each time.

Here I have some ideas that might work, though I am a beginner, and don't know what's the best solution.

GPS tracking it (overkill on such a small scale?)

Some kind of distance measurer

Have a knob it will hit at the middle of the track, telling program to delay for a given time

Track amount of steps the motor has performed (won't be as accurate?)


问:
How to calculate the current consumed by a brushless motor on a quadcopter
I want to create a virtual quadcopter model, but I am struggling to come up with a satisfying model for the brushless motors & props.

Let's take an example, based on the great eCalc tool:

Let's say I want to know how much current is consumed by the motor in a hovering state. I know the mass of the quad (1500g), so I can easily compute the thrust produced by each motor:

```<code>Thrust = 1.5 * 9.81 / 4 = 3.68 N per motor
</code>```

Thrust is produced by moving a mass of air at an average speed of V:

```<code>Thrust = 0.5 * rho * A * V²
</code>```

Where rho (air density) is 1.225kg/m3 and A (propeller disk area) is PI * Radius² = 0.073m² (12" props). So I can compute V:

```<code>V = sqrt(Thrust / 0.5 / rho / A) = 9.07 m/s
</code>```

All right, now I can calculate the aerodynamic power created by the propeller:

```<code>P = Thrust * V = 3.68 * 9.07 = 33.4 W
</code>```

All right, now I can calculate the mechanical power actually produced by the motor. I use the PConst efficiency term from eCalc:

```<code>Pmec = Paero * PConst = 33.4 * 1.18 = 39.4W
</code>```

Here, eCalc predicts 37.2W. It's not too far from my number, I imagine they use more sophisticated hypotheses... Fair enough.

From this post, I know that this power is also equal to:

```<code>Pmec = (Vin - Rm * Iin) * (Iin - Io)
</code>```

Where I know Rm (0.08 Ohms) and Io (0.9 A). So, finally, my question: How do you calculate Vin and Iin from here? Of course, if I knew the rotation speed of the engine I could get Vin from:

```<code>n = Kv * Vin
</code>```

Where Kv = 680 rpm/V. But unfortunately I don't know the rotation speed...

(Note that Vin is assumed to be averaged from the pulse-width-modulated output produced by the ESC)

Thanks for your help!

答:
The missing piece was the expression of the pitch speed, which relates the parameter V with the rotation speed n and the pitch of the propeller:

```<code>V = n x pitch x (0.0254 / 60)
</code>```

(The coefficient passes from in/min to m/s)

Knowing V and pitch, I can evaluate n, then (Vin - Rm * Iin), and finally Iin (since I know everything else).

By the way, I also recommend this link, which contains theoretical propeller formulas, corrected empirically.

Body:
The missing piece was the expression of the pitch speed, which relates the parameter V with the rotation speed n and the pitch of the propeller:

V = n x pitch x (0.0254 / 60)

(The coefficient passes from in/min to m/s)

Knowing V and pitch, I can evaluate n, then (Vin - Rm * Iin), and finally Iin (since I know everything else).

By the way, I also recommend this link, which contains theoretical propeller formulas, corrected empirically.


问:
Can I connect the Arduino usb to laptop after the Arduino is started?
I have some sensors attached to Arduino Uno r3 and an ESC. I start the Motor attached to ESC through Arduino with no USB connected to laptop. It starts correctly. There is a must that I will have to start the Arduino from non USB supply so that ESC is correctly started, which means that my motor doesn't start with USB connected to PC. Now, how can I get the sensor values to a laptop? If I connect the USB to the PC after starting the motor, will this work?</p>

答:
What exactly is the question?
I'm not sure, so I'll describe one system I have, and hope you find your answer somewhere in this description.

I connect my Arduino USB cable to my laptop all the time, both before and after applying main motor power.

power

"How do I start the Arduino before inserting the USB cable?"

Many people find it easier to plug a AC-to-DC adapter into the wall, which sends 7 V to 12 V to a barrel plug, and then they plug that barrel plug into the barrel jack of the Arduino.
On my system, I connect power to an Arduino shield, and that shield sends that power into the Vin pin of the Arduino board.
See
"Arduino Tutorial: Power up!";
"Powering an Arduino";
"If I have my Arduino connected to a 9V DC supply and then connect the Arduino to a computer with a USB cable, what happens exactly?"

As soon as power is connected to the Arduino, the Arduino starts running the setup() function.

reset

"What happens when the Arduino is running off external 12 VDC power, and I later plug in the USB cable? What do I do about that reset?"

On my (unmodified) Arduino, like most Arduinos, plugging in the USB cable resets my Arduino.

There are 2 ways to deal with this:

Accept that it's going to reset occasionally. Design the rest of the system to tolerate resets. Or,

Add some hardware to prevent that reset.

I prefer the "tolerate resets" approach, because that also makes the system more robust against the inevitable power glitches.
People who design systems that can't tolerate resets usually end up with a system that can't tolerate power glitches either, so they have to put in some sort of battery backup system.

Every time my Arduino resets or powers up, it forgets where it was before and starts my program from the beginning -- the setup() function.

My program does exactly the same thing after it powers up, whether or not the USB cable is plugged into it.

My main loop() prints some debug information out its USB port using the Serial library.
Usually nothing is plugged into that Arduino's USB port, so that information is simply lost, but sometimes I plug in a USB cable to my laptop, and that information shows up in the serial monitor window.

My main loop() uses the Servo library to repeatedly tell each servo where to go based on the current values in an array.
(Those values are slowly incremented or decremented elsewhere in my program based on other sensors).

Because my setup() function initializes that array to all zeros,
when I first power up my system, all my servos reset and suddenly snap back to the zero position (centered). Then they start slowly wandering around.

Because my setup() function initializes that array to all zeros,
when I plug in my USB cable after the system is already powered on, all all my servos reset (again) and (again) suddenly snap back to the zero position (centered).
Then they start moving normally, slowly wandering around, and I start getting data on my laptop serial monitor.

For my particular system, this sudden motion is a harmless quirk.

How do I prevent this reset?

If you don't want your Arduino to reset every time you plug in the USB cable,
you might want to look at
"Disabling Auto Reset On Serial Connection";
"Why does starting the serial monitor restart the sketch?";
"Preventing reset on serial monitor connect?";
etc.

How do I make a system that tolerates reset?

Many Arduino systems have no long-term state.
They do exactly the same thing every time through the main loop,
whether it's the first time through the loop when powered on,
or it's been running for months.
A person can design such a system to tolerate reset relatively easily.

If you want to collect data while the USB cable is unplugged,
then later send that data through the USB port,
you might consider storing that data on a SD or MMC card
using the Arduino SD library,
or perhaps storing that data in EEPROM
using the Arduino EEPROM library.

If you want to send commands to the Arduino while the USB cable is plugged in,
and you want the Arduino to continue to act on those commands even after the USB cable is plugged back in a second time, you might consider storing the result of those commands in a SD or MMC card or in the Arduino EEPROM using those same libraries.
Then both immediately after storing, and also in the setup() routine that runs every time the Arduino resets or is re-connected to power, call a function that reads that non-volatile memory and does the appropriate things.

That stored data is part of the "long-term state",
so we put it in non-volatile memory.
The normal volatile SRAM memory is zeroed out every time the Arduino powers up or is reset.

ContentLicense: CC BY-SA 4.0


问:
High-traction thin tires vs Wide moderate-traction tires? [Sumo-bot]
I am building a sumo-bot and our competitors have thin sticky tires, while we have wider and less sticky tires. The diameter is the same, and the gearbox/motor is the same. Who will win?

PS: Sticky tires: https://www.pololu.com/product/694 & wide tires: https://www.pololu.com/product/62

Thanks!

答:
If you measure  weights of the bots and the coefficients of friction for both kinds of wheels when used on the competition surface, and add those numbers to the question, it will be answerable.

Sliding force of friction = μ times normal force, where μ is the  coefficient of sliding friction.  For example, see wikipedia's Friction article.
and regentsprep.org's Friction article.

(Note, in computing μ as (maximum force of static friction)/(normal force), the answer to the question will become obvious along the way.)

It may be that the sticky wheels will win, at least at first, if the competition surface is fairly smooth or slick; but as the sticky wheels get gunked up, they will work less and less well.  Also, if the surface has a rough texture, the wide wheels with tread are likely to work better from the start.


答:
Well, I moved my answer here from the Engineering SE because it looks like your question is probably going to get closed there, just like it got closed at the physics site.

Assuming everything about the vehicles is the same - mass especially, but also shape, center of gravity, etc., such that the entire problem boils down to tire grip, you will lose.

See this answer for more information, but essentially, assuming your vehicle weight is low enough that you're not going to deform the competition surface, static friction is given by:

$$
F_{\mbox{friction}} = \mu_{\mbox{static}} P_{\mbox{tire}} A
$$

where $\mu_{\mbox{static}}$ is the static coefficient of friction, $P_{\mbox{tire}}$ is the pressure the tires exert on the ground, and $A$ is the contact surface area. However, because:

$$
P_{\mbox{tire}} = \frac{F_{\mbox{normal}}}{A}
$$

where $F_{\mbox{normal}}$ is the normal force of the vehicle, you wind up with:

$$
F_{\mbox{friction}} = \mu_{\mbox{static}} \frac{F_{\mbox{normal}}}{A} A
$$

or

$$
F_{\mbox{friction}} = \mu_{\mbox{static}} F_{\mbox{normal}}
$$

So, again, assuming everything else about the two robots is the same, and that you're not operating on a surface like mud or something else that will appreciatively deform under the tires, then the traction/friction force will be higher in the vehicle with a higher coefficient of friction.

That is, your tires should start slipping before theirs do, and since static friction is greater than dynamic friction, once your tires start to slip they get a significant "pushing" advantage over you.

Title: High-traction thin tires vs Wide moderate-traction tires? [Sumo-bot]

Body:
I am building a sumo-bot and our competitors have thin sticky tires, while we have wider and less sticky tires. The diameter is the same, and the gearbox/motor is the same. Who will win?

PS: Sticky tires: https://www.pololu.com/product/694 & wide tires: https://www.pololu.com/product/62

Thanks!


问:
Using SLAM to create 2D topography
I have a small mobile robot with a LidarLite laser range finder attached to a servo. As of now I have the range finder side-sweeping in a 30 degree arc, taking continuous distance readings to the side of the robot (perpendicular to the robots forward motion).

My goal is to have the robot drive roughly parallel to a wall, side-scanning the entire time, and create a 2D map of that wall it is moving past. The 2D topography map is created post processing (I use R for much of my data processing, but I don't know is popular for this kind of work).

From what I know of it, SLAM sounds like a great tool for what I want to do. But I have two issues:

1: I know my robot will not have a consistent speed, and I have no way to predict or measure the speed of my robot. So I have no way to estimate the odometry of the robot.

2: The robot will also move further and closer to the wall as it proceeds down it's path. So I can not depend on a steady plane of travel from my robot.

So given that I don't have any odometry data, and my realtive distance to the wall changes over the course of a run, is it possible to use SLAM to create 2D maps?

I'm looking into stitching algorithms that are used for other applications, and some of these can handle the variances in relative distance, but I was hoping SLAM or some other algorithm could be of use here.

答:
One way you can use SLAM in your setup is to stop the robot every 30 cm or so, and perform a sweep with your lidar. You can then use e.g. one of the 2D SLAM packages from openslam.
The problem with sweeping while you are moving is that you cannot get any correspondence information from a single range reading. SLAM works by associating features in one reading with the same feature in another reading. By having a single point reading you cannot tell if two readings have the same original scene point or not. If you have two scans on the other hand, scene features like e.g. a bump in the wall can be matched between the readings.</p>

Title: Using SLAM to create 2D topography


问:
How can a load be balanced between multiple AC electric drive motors?
I have a three wheeled vehicle in a tricycle configuration attached to a fixed frame. Each wheel is powered by an AC electric motor. The AC motors are fed by motor controllers that take a speed demand. The single main wheel (which is also steerable) has a lower gear ratio than the rear wheels so it has a theoretical higher top speed.

When the vehicle drives in a straight line each of the motor controllers are given identical speed requests. Unfortunately feedback from the controller indicates that some motors are pushing while some are pulling. In particular we have a common scenario where one rear wheel is pushing while the front wheel is trying to slow down. The third wheel will often have almost no current.

What can be done to make all three motors work together and avoid situations where they fight?  Is there a way to change the request to the motor controller to encourage the drives to work together? Do we have to switch from a speed request setup to a current control setup? If so what is the appropriate way to control the motors then?

Let me know if I haven't included any important details and I will update my question.

答:
You need to command your motors by torque, and not speed

then with n motors, you get n vectors, so you now get 1 vector you regulate according the speed, and you compute the torque for each three motors.

To control an AC motor by current you need an inverter capable of Field Oriented Control, and for the vectoring an Arduino could be fine


问:
Can someone explaine to me this code?
```<code>static void set_default_param(DPMTTICParam& param)
{

    param.overlap = 0.4;
    param.threshold = -0.5;
    param.lambda = 10;
    param.num_cells = 8;
}
</code>```

答:
It seems to belong to this software:
https://github.com/CPFL/Autoware/blob/master/ros/src/computing/perception/detection/lib/image/dpm_ttic/include/dpm_ttic/dpm_ttic.hpp

So - I assume that is just a case where someone is using that software, and it is showing how to set some default parameters.

I would suggest you ask the developers of that software directly though, if you want to use it.

Title: Can someone explaine to me this code?


问:
How Should I tie My quadcopter to some thing, to adjust pid on one axis
I am stuck in adjusting the PID of my quadcopter, I cant adjust them on the fly because it just get out of control. I am adjusting them while attaching my quadcopter to something.

Is this method correct. Will the pid values required will be different on the fly or same. Please suggest me how to attach my quad to some thing.

答:
Since you're trying to adjust the stability, you should make sure that your method of restraint isn't restricting the motion along that axis.

So, the preferred way to restrain a quadcopter is by connecting strings to the center of the body, above and below.  Here's an example:

You could also disable the motors on one axis and run a rope under each of the propeller shafts on that axis (sideways) to simulate the lift that those motors would provide while constraining any movement.


问:
Sensor orientation of an external magnetometer
On many drones are already external magnetometers. Unfortunately, the orientation of such sensors is sometimes unknown. E.g. the sensor can be tilted 180° (pitch/roll) or X° in yaw. I was wondering, whether one could calculate the rotation of the sensor relative to the vehicle by application of the accelerometer and gyrometer?
Theoretically, the accelerometer yields a vector down and can be used for calculation of the coordinate system. The discrepancy between magnetometer and gyrometer then, may be used for calculation of the correct orientation of the compass. Later the compass should be used for yaw calculation.
Below is the starting orientation of both sensors (just an example, the orientation of the compass can be anything). Does someone know a good way to figure out the rotation of the compass?

答: If you put a strong magnet under the magnetometer, its readings of direction should match the accelerometer reading for gravity.  You could then place the magnet in the other cardinal directions in order to resolve any ambiguity in the orientation you calculate.</p>


问:
Using DC motor as a generator to recharge battery of my robot
I am trying to recharge my 12V lead acid battery with a 12V DC motor.  I am using the battery to power the robot when it climbs. When it descends, I notice that I dont need to apply reverse voltage but the dc motor just backdrives instead. This can act as generator to recharge back the battery, am I right?

I know that i need to step up the low voltage that is generated by the backdriven motor to 12V needed to recharge the battery. This is the board that I think can do the job:
https://www.pololu.com/product/799

Is this all I need to make it work? With this method, should I be concerned about the 3 stages of battery charging: bulk, absorption and float?

Please advise. Any feedbacks are greatly appreciated.

答:
This question may be more suited to an electrical engineering site, but one thing to consider is that your batteries will have a maximum allowable charge current.  </p>

<p>What this means is that if the wheel is turning too quickly, you will need to either limit the current into the charge circuit, or dissipate it some other way (such as in a resistor).  </p>

Body:
This question may be more suited to an electrical engineering site, but one thing to consider is that your batteries will have a maximum allowable charge current.

What this means is that if the wheel is turning too quickly, you will need to either limit the current into the charge circuit, or dissipate it some other way (such as in a resistor).


问:
Arduino Motor control
I'm working on a rather low budget project, and need some way to control four or more motors using one Arduino. I've looked at motor shields a little, but I have a shield on top of it already, It does have female input on the top though, so a motor shield may work. Any suggestions?</p>

答:
You'll have to determine yourself whether a motor controller shield is compatible and can be stacked on your existing shield.  </p>

<p>In some cases, you can use Arduino's SPI.  In other cases, you'll need to check whether the pins that your shield uses would conflict with the pins needed by a motor controller.  </p>

Title: Arduino Motor control

Body:
You'll have to determine yourself whether a motor controller shield is compatible and can be stacked on your existing shield.

In some cases, you can use Arduino's SPI.  In other cases, you'll need to check whether the pins that your shield uses would conflict with the pins needed by a motor controller.


答:
This should be straightforward, because the throttle can never provide negative acceleration and the brake can never provide positive acceleration.

It sounds like you want to create a linear mapping from an input acceleration $(a)$ to a throttle and brake output.  If the response of the throttle system for a given velocity $v$ is

$$
f(x_{throttle}) = a
$$

(where $a > 0$), and the response of the braking system is

$$
g(y_{brake}) = a
$$

(where ($a < 0$ if $v > 0$ and is 0 otherwise), you will just define the controller in a piecewise fashion.

$$
control_{throttle}(a) = \begin{cases} f^{-1}(a) & a \gt 0 \\ 0 & a \le 0 \end{cases}
$$
and
$$
control_{brake}(a) = \begin{cases}g^{-1}(a) & a \lt 0 \\ 0 & a > 0  \\ C_{parkingbrake} & a = 0 \end{cases}
$$

Title: Two exclusive inputs control

Body:
I have a system with two inputs (throttle and brake) and one output (speed). How does one design a controller in such a way that the two outputs of the controller (throttle and brake) are never both greater than zero (so that it doesn't accelerate and brake simultaneously)?

Thanks


问:
When to use multiple batteries vs a UBEC
When should you use multiple separate batteries vs a single battery with multiple UBECs?

I'm trying to design the power system for a small 2-wheeled robot. Aside from the 2 main drive motors, it also has to power an Arduino, a Raspberry Pi and a couple small servos to actuate sensors.

the motors are each rated for 6V with a peak stall current of 2.2A

the Arduino uses about 5V@100mA

the Raspberry Pi uses about 5V@700mA

the servos each use 6V and have a peak stall current of 1.2A.

So the theoretical max current draw would be 2.2*2+.1+.7+1.2*2 = 7.6A.

Originally I was planning to use three separate Lipo batteries:

one 12V using a step-down converter to power the main drive motors for 6V@4.4A peak

two 3.7V lipos each with step-up converter (rated for 5v@3A) to handle the servos and logic separately

Then I discovered UBECs, which sound too good to be true, and they seem to be both cheap (<$10) and efficient (>90%) and able to handle my exact volt/current requirements.

Should I instead use a single high-current 12V lipo with three UBECs to independently power my drive motors, sensor motors and logic? Or will this still suffer from brown-out and power irregularities if a motor draws too much current?

What am I missing?

答:
Any quality power device should list its load regulation capability, which is typically in a datasheet as a voltage range coupled with a maximum output current. You can expect normal voltage fluctuations to occur within this band.

However, when you include a motor in the scenario, you need to be aware that voltage can spike up/down if you suddenly remove/apply current to the motor because the motor windings act like (are) an inductor. Typically a flyback diode is used to prevent/limit the spikes caused by motor operation; see this thread for a schematic of an H-bridge driving a DC motor with flyback diodes.

Another thing I would like to point out is that you are adding currents, which could be a troublesome thing to do - while 5V and 6V seem very close, 6V is actually 20 percent more than 5V. I would suggest that you convert your "current"@"voltage" to the power required by each circuit, then use that power rating to find a suitable supply.

You said:

the motors are each rated for 6V with a peak stall current of 2.2A

the Arduino uses about 5V@100mA

the Raspberry Pi uses about 5V@700mA

the servos each use 6V and have a peak stall current of 1.2A.

But I would suggest:

Motors are 6V@2.2A = 13.2W

Arduino is 5V@0.1A = 0.5W

Raspberry Pi is 5V@0.7A = 3.5W

Servos are 6V@1.2A = 7.2W

Assuming 2 motors and 2 (a couple) servos, your total power requirements are:

$$
\begin{array}{ccc}
P_{\mbox{req}} & = & (2*13.2) + 0.5 + 3.5 + (2*7.2) \\
P_{\mbox{req}} & = & 44.8W\\
\end{array}
$$

Now you can take your power requirement and use that for any power converter/battery eliminator. Divide your power requirement by the nominal pack voltage to get your current requirement for a specific battery pack. Divide the current by the battery capacity (in Ah, or remember to convert current requirement to mA) to get the estimated run time on a particular battery pack.

All of this is guidance to help you select a proper BEC, because yes, as long as your battery provides enough current and you can tolerate the voltage swing, it should work fine.


问:
"Thermal Imaging" with Arduino and/or Lego Mindstorm NXT 2.0?
I'm trying to build a robot that can be sent into rooms/buildings and detect people using nxt and/or Arduino. In addition to this I would like to be able to view what my robot is "seeing" in real-time on my PC as an infrared image. The sensors I've shortlisted for this are:

Thermal Infrared NXT Sensor from Dexter industries - £44

RoBoard RM-G212 16X4 Thermal Array Sensor - £94

Omron D6T MEMS Thermal IR Sensor - £31

I believe the RoBoard and Omron sensors are capable of thermography, so I was wondering if anyone here has experience with these sensors and give me some advice.

I was also thinking about using an idea from this project: www.robotc.net/blog/tag/dexter-industries.

In this case I'd use the data read from the sensor to plot a graph showing different temperatures.

答:
Since you are using an Arduino a .NET app isn't going to be much help unless you can get the source code and use that as a reference.  .NET can be used on Arduinos but you are probably going to get stuck, because there will be less examples.  (The source code will probably be in either C# or VB and if you can read Arduino C you can read them)

"Do the sensors create an image?"  Yes and no.  From what I can see from the data sheets you have a number of pixels that have analog values.  These values are stored in memory on the sensor and you use I2C to read from that memory.

There are I2C libraries for an Arduino.  There is probably an I2C library to interface with the memory chip.  There might even be a library to talk to the sensor.  However the most difficult part will be converting the pixel values into something that allows your Robot to 'see' a heat source, this will take some research on how to do it.

The sensors have different numbers of pixels.  Having 64 pixels is fine, but how long will it take an Arduino to read 64x16bit numbers over an I2C interface and then evaluate the data and make a decision on which direction to move.  I think you should be looking at a multi-microprocessor system.

Which sensor is better? Personally I would go with the Omron mounted horizontally.  My reasoning isn't just  the cost, the RoBoard wants 2.5-2.7V and that is going to be harder to regulate than the 4.5-5.5V that the Omron wants when you are running on batteries.  The 1x8 sensor only has a 6 degree vertical angle, but it has much higher resolution that the 4x4.  One possible option might be to have one of each and perform a gross search with the 4x4 and the focus in with the 8x1 sensor.
You are probably going to want to have the ability to rotate the sensor and pan it vertically to allow the robot to look around the room. Then stich the data together to get the bigger picture.

Hope that helps


答:
Since the gyros are only good for measuring rotational rates, they are essentially useless at calculating your orientation. The accelerometers, as you say, will calculate exactly your reference plane, but it seems your question is about an arbitrary yaw within that plane.

Now this is where the compass becomes important: for measuring the yaw. Since the compass is fixed to the frame, it should be known at design time how its orientation differs from the vehicle's.

Title: Sensor orientation of an external magnetometer

Body:
On many drones are already external magnetometers. Unfortunately, the orientation of such sensors is sometimes unknown. E.g. the sensor can be tilted 180° (pitch/roll) or X° in yaw. I was wondering, whether one could calculate the rotation of the sensor relative to the vehicle by application of the accelerometer and gyrometer?
Theoretically, the accelerometer yields a vector down and can be used for calculation of the coordinate system. The discrepancy between magnetometer and gyrometer then, may be used for calculation of the correct orientation of the compass. Later the compass should be used for yaw calculation.
Below is the starting orientation of both sensors (just an example, the orientation of the compass can be anything). Does someone know a good way to figure out the rotation of the compass?


答:
I'll try to go through your question as best as I can:

I was wondering, whether one could calculate the rotation of the sensor relative to the vehicle by application of the accelerometer and gyrometer?

Without any more information than an accelerometer and a gyro, no, you cannot, because gyros measure velocity and accelerometers measure acceleration, which means that you can only use those to find a position by using a constant of integration.

The constant of integration here would be an initial velocity for the first integration of accelerometer output, and and initial position and heading for the second integration of accelerometer output and gyro output, respectively.

The gyro and accelerometer will only ever give you relative positions and headings. You would need to find an initial heading to align those outputs to a (literal) global coordinate system, at which point you would be using whatever device you used for initial heading to compare with the magnetometer.

Theoretically, the accelerometer yields a vector down and can be used for calculation of the coordinate system.

I would be careful regarding this - see Ben's question/comment regarding his experience that 3-axis accelerometers tend to have a left-handed coordinate system. That is, if you haven't read the datasheet on the accelerometer, you could mis-interpret the orientation of the sensor because it's not using the coordinate system you think it is.

The discrepancy between magnetometer and gyrometer then, may be used for calculation of the correct orientation of the compass. Later the compass should be used for yaw calculation.

I don't know if you're using magnetometer and compass interchangeably here or if you are actually referring to two different devices, but as stated above, a gyro will only ever output a relative heading, so you can't use it to determine any absolute heading. This means that you can't use it to set/test/check the alignment of an absolute output device such as a magnetometer.

Below is the starting orientation of both sensors (just an example, the orientation of the compass can be anything). Does someone know a good way to figure out the rotation of the compass?

I don't know how specific you are trying to get with your measurement, but in general, I would just command the vehicle to point North. If you have a rotationally symmetric vehicle like a quadcopter then you'll have to determine which arm/end of the vehicle is "forward" (should correspond to a "move forward" command) and mark that end. Once the vehicle stops actively maneuvering to reach your heading command you can use a manual/secondary compass to determine true North and mark/compare the difference between that position and "forward" on your vehicle.

If you need a more precise measurement or if you can't command an absolute heading, then your only other choice is to try to get access to the electronics. I would look for the magnetometer chip itself, find the orientation of the chip, then read the datasheet and determine how it senses North. The chip will be soldered to a board which, in turn, will be attached to the vehicle. You can then relate compass orientation to the craft.


答:
A stepper motor actually will move the same amount of steps per control signal regardless of weight, drawing more current as needed to turn the motor shaft the same amount. If there was wheel slip to account for, weight would be a factor there. However, given your gear rack track, wheel slip is negligible and can be ignored.

I've built small line-follower robots in the past using 5V geared stepper motors running off AA batteries. Wheel slip was fairly small due to rubber O-rings mounted to the wheels. We took two identical prototypes and set them side by side and sent a move forward signal to both simultaneously. They moved in perfect lockstep over the course of a meter. We then placed a glass bottle of beer on one of the robots and repeated the experiment. Same result despite the weight difference.

The specifications for your stepper motor will list a Step Angle, the number of degrees that the motor shaft turns for a single step (I'm assuming that you're not doing any microstepping). You then need to account for the gear ratio to figure out how far you actually move. This is a little trickier to calculate with a rack and pinion than a normal pair of spur gears. Gear ratio is normally determined by the diameter of the input and output gears, but your output gear (the rack) is technically of infinite diameter.

If you haven't already, set up your control code so that you can make your stepper motor turn a given number of steps. Suppose the step angle of your motor is 7.5 degrees. The number of steps required to turn 360 degrees is:

360° / 7.5° per step = 48 steps

You can verify your 360 degree turn code by by placing a small mark on the pinion gear. Now set your robot on the rack and measure how far it travels along the rack when you turn the motor 360 degrees (48 steps in this case). You can use this measurement to determine how far along the rack the robot moves per step. Suppose it travels 12 centimeters.

12 cm / 48 steps = 0.25 cm of linear motion per step

Try the track measurement again with the maximum water load and verify that a 360 degree turn of the pinion gear still occurs. If not, you are trying to step too fast for the motor torque to keep up and it's missing steps. Increase the interval between steps until you get a full 360 degree turn of the pinion gear with the water weight.

You can now encode movements to 0.25 cm resolution. If you know the length of the track and can guarantee your start position, you can get away with not having an endstop or limit switch. That being said, it's always a good idea to have them there anyways just in case.


问:
EMAX ESC Simon Series with arduino
I want to control a brushless motor with the "EMAX Simon Series 30amp ESC" and Arduino (Leonardo) board. I am really confused how to do that. I can't understand which beep sounds mean what. I have tested many code examples but they weren't useful.  </p>

答:
When say you say you "want to control a brushless motor with [a] ESC ... and Arduino", do you mean:

Do you want the Arduino to act like the RC receiver in the airplane in the air and make the propeller spin slow, stop, fast, etc.? Or,

Do you want the Arduino to act like a person changing settings in the ESC using a programming card on the ground?

In the air

In the air, the 3 wire cable between the RC receiver and the ESC carries the so-called "RC PWM signals".
The RC receiver sends exactly the same kind of signals to RC servos.
The ESC neither knows nor cares where these signals come from -- the RC receiver, the Arduino PWM (using the Arduino Servo library), the Arduino Software Servo library ( periodically calling refresh() in the main loop() ), or some other source.

On the ground

The "beep sounds" are really only useful when changing the settings in the ESC on the ground, perhaps with a programming card.
To learn what the "beep sounds mean", see the user manual "EMAX User Instruction for SimonK Series ESC".

Normally this is a one-time setup, so most people do this once manually on the ground.

Title: EMAX ESC Simon Series with arduino


问:
How much offset speed of motors on an axis is required before adjusting pid
For adjusting the pid for quadcopter, how much speed of motors are required before adjusting the pid. Do we need to give so much offset speed so that it cancels weight? I am sure we cant start adjusting pid with zero speed of motors initially.</p>

答:
This is intended as a comment only and it is based on my limited experience working on this topic. </p>

<p>PID works based on the error that resulted from the difference between the actual value (from sensor) and the reference value (your goal). This error is calculated and then is fed into the PID controller. Whether or not the speed is zero, that is not the only determining factor as it also depends on your reference point. </p>

Body:
This is intended as a comment only and it is based on my limited experience working on this topic.

PID works based on the error that resulted from the difference between the actual value (from sensor) and the reference value (your goal). This error is calculated and then is fed into the PID controller. Whether or not the speed is zero, that is not the only determining factor as it also depends on your reference point.


答:
For tuning PID controllers (and generally any linear controller) it is a very common practice to go through the following steps:

Let the system reach a steady-state condition, e.g. the quadcopter is stabilized at a given height, thus the motors are spinning with nonzero speed.

Superimpose a specified signal (step-wise, sinusoidal waveform ...) to the commands provided to the system, e.g. add up a step to the voltage used to command a given motor.

Measure back the response of the system to the injected signal, e.g. acquire the controlled variable of the quadcopter (i.e. position and/or velocity).

Come up with a linear model which best describes such a response. Of course, we have to subtract from the command and the response the terms that contribute to the steady-state.

Use this model to design/tune the PID according to one of the numerous techniques available (e.g. poles placement).

This approach assumes that the response of the system to the commands variations remains somewhat linear irrespective of the working point. This is generally a reasonable hypothesis, taking into account the fact that a robustly tuned PID is capable of compensating for quite huge nonlinearities in the system.

So basically, to answer your question, just double check that the steady-state speed of the motor required to keep the quadcopter stabilized in the air does correspond to a commanded voltage around which it is possible to carry out signal modulation without hitting the voltage limits.

Title: How much offset speed of motors on an axis is required before adjusting pid

Body: For adjusting the pid for quadcopter, how much speed of motors are required before adjusting the pid. Do we need to give so much offset speed so that it cancels weight? I am sure we cant start adjusting pid with zero speed of motors initially.</p>


问:
Robot arm reachability of a pose in Cartesian space
Given a set of robot joint angles (i.e. 7DoF) $\textbf{q} = [q_1, ... , q_n]$ one can calculate the resulting end-effector pose (denoted as $\textbf{x}_\text{EEF}$), using the foward kinematic map.

Let's consider the vice-versa problem now, calculating the possible joint configurations $\textbf{q}_i$ for a desired end-effector pose $\textbf{x}_\text{EEF,des}$. The inverse kinematics could potentially yield infinitely many solutions or (and here comes what I am interested in) no solution (meaning that the pose is not reachable for the robot).

Is there a mathematical method to distinguish whether a pose in Cartesian space is reachable? (Maybe the rank of the Jacobian) Furthermore can we still find a reachability test in case we do have certain joint angle limitations?

答:
It depends on how theroetical/practical solution you are looking for.

If you are considering a theoretical workspace, with no angular limits of your joints (e.g. due to mechanical constraints) then the calculating the inverse kinematics for a Cartesian pose which is out of the workspace would result in complex joint angles (at least one of the 7 joint angles in your case would be complex).

One solution would be to check whenever you calculate a square root in your IK if the term under the square root is negative. If yes, the cartesian pose is unreachable.

For 6 DOF the case is simpler, there it is enough to check if the point is within sphere (again disregarding angular joint limits), however for 7 DOF the additional expression (that is required to solve the IK) might make the point unreachable.

Hope this helped..


问:
Robotic cell simulation software, PLC
I need to simulate robotic cell where cartesian robot trims a PCB arriving on conveyor, picks it up with vacuum cup and and places in another device. After receiving signal from device the robot would pick it up and place on another belt. I want to make the cartesian robot myself using servomotors and control cell using a PLC. Would there be software that can simulate all this? I would also need to integrate sensors and possibly machine vision.</p>

答:
A simple PLC is not meant to control a robot. You will at least need OpenPLC Motion Control capabilities for the PLC to control motions. Or you can opt for a motion controller to have better control over the motions.

If you are thinking of writing PLC code, running on the PLC, and you want to see what happens to motors/drive amplifiers when they receive a certain output, and what happens in your cell, you could use a virtual commissioning tool for example. Those are meant to simulate the plant, connected to a real PLC, and the PLC "has no idea" that the connected systems are just simulated, not real.

Title: Robotic cell simulation software, PLC


问:
Relative frame calculation
what's the quickest way to calculate a relative coordinate of a frame, as shown in the code below. The Kuka robot language this ":" is referred to as the geometric operator.
I would like to perform this calculation in matlab, scilab, smathstudio or java, could you please advise on which library to use and/or how to proceed?</p>

```<code>Frame TableTop=[x1 y1 z1 a1 b1 c1]
Frame RelCoord=[x2 y2 z2 a2 b2 c2]

Frame AbsCoord= TableTop:RelCoord
</code>```

答:
The operation you mentioned can be mathematically formulated as a matrix multiplication.

You build your homogeneous transformation matrices (4x4) for both frames and multiply them.

After than you can extract the 6 coordinates from the resulting matrix. Extracting position is easy, take the first three rows of the last column. Extracting rotations can be done in Matlab easily by using the dcm2angles() function.

Please not that quaterions might be a better alternative to transformation matrices, but are more complicated to implement.

Title: Relative frame calculation


答:
There are a few things you should consider when designing your system.

Motors are usually rated for the stall current, but sometimes generate out-of-spec currents. Higher current draw may happen when the motor turns backwards and back-currents occur when switching the motor off.

When using LiPos with high discharge rate, those currents are usually absorbed by the battery with low voltage fluctuations, due to its low output impedance.

BECs usually but not always have a low-pass filter. Sometimes those filters are enough to handle spikes, sometimes not. Sometimes those filters also help filtering spikes backward.

With those in mind, it is usually enough to have separate BECs for logic/application processors and motors. Use a high-current rated battery (usually most LiPos are at least 15C, so a standard 2200mAh is usually enough). Do not chain them and try to avoid connections and wiring before the BECs.

Title: When to use multiple batteries vs a UBEC

Body:
When should you use multiple separate batteries vs a single battery with multiple UBECs?

I'm trying to design the power system for a small 2-wheeled robot. Aside from the 2 main drive motors, it also has to power an Arduino, a Raspberry Pi and a couple small servos to actuate sensors.

the motors are each rated for 6V with a peak stall current of 2.2A

the Arduino uses about 5V@100mA

the Raspberry Pi uses about 5V@700mA

the servos each use 6V and have a peak stall current of 1.2A.

So the theoretical max current draw would be 2.2*2+.1+.7+1.2*2 = 7.6A.

Originally I was planning to use three separate Lipo batteries:

one 12V using a step-down converter to power the main drive motors for 6V@4.4A peak

two 3.7V lipos each with step-up converter (rated for 5v@3A) to handle the servos and logic separately

Then I discovered UBECs, which sound too good to be true, and they seem to be both cheap (<$10) and efficient (>90%) and able to handle my exact volt/current requirements.

Should I instead use a single high-current 12V lipo with three UBECs to independently power my drive motors, sensor motors and logic? Or will this still suffer from brown-out and power irregularities if a motor draws too much current?

What am I missing?


答:
Nowadays we no longer employ exact solutions for the IK problem, simply because the number of degrees of freedom so as the number of constraints the final configuration needs to comply with make the so called geometric approach intractable.

By contrast, iterative methods are used to converge to the most plausible solution. Therefore, the reachability is tested at the end of this iterative process by comparing - within a given threshold - the target with the pose reached by the end-effector.

Of course, one can create beforehand a map of the workspace containing samples of reachable and/or dexterous locations for the manipulator and use it as a sort of rough prediction.

The Jacobian embeds a local description of the robot, so that it cannot account for any global hint whether the goal can or cannot be attained.

Title: Robot arm reachability of a pose in Cartesian space

Body:
Given a set of robot joint angles (i.e. 7DoF) $\textbf{q} = [q_1, ... , q_n]$ one can calculate the resulting end-effector pose (denoted as $\textbf{x}_\text{EEF}$), using the foward kinematic map.

Let's consider the vice-versa problem now, calculating the possible joint configurations $\textbf{q}_i$ for a desired end-effector pose $\textbf{x}_\text{EEF,des}$. The inverse kinematics could potentially yield infinitely many solutions or (and here comes what I am interested in) no solution (meaning that the pose is not reachable for the robot).

Is there a mathematical method to distinguish whether a pose in Cartesian space is reachable? (Maybe the rank of the Jacobian) Furthermore can we still find a reachability test in case we do have certain joint angle limitations?


问:
image processing
I am making a Robot goalie, the robot is supposed to detect whether a ball has been thrown in its direction , sense the direction of the ball and then stop it from entering the goal post. A webcam will be mounted on top of the goal post. The robot is required to only move horizontally (left or right), it shouldn't move forwards or backwards. The robot will have wheels, the image processing will be performed by raspberry pi which will then send the required information to a micro controller which will be responsible for moving the robot in the required direction(using servo motors). Which image processing algorithm will be the best to implement this scenario?</p>

答:
Ball detection using vision is not extremely difficult, especially if the ball is easy to recognize. There are a lot of tutorials and blogs which give a detailed explanation on how to implement an algorithm to solve this problem:

Raspberry Pi Ball tracking

Using OpenCV on the Beagleboard to track an Aibo pink ball

OpenCV Tutorial C++ - Color Detection & Object Tracking

Ball Tracking / Detection using OpenCV

Ball detection with OpenCV

Design of an Image Processing Algorithm For Ball Detection

Fast Object Tracking – Robot Computer Vision

...

Title: image processing


问:
What is the difference between a CNC router versus a CNC mill?
People at the RepRap 3d-printing project often mention CNC routers or CNC mills.

Both kinds of machines almost always have a motorized spindle with stepper motors to move the spindle in the X, Y, and Z directions.

What is the difference between a CNC router versus a CNC mill?

(Is there a better place for this sort of question -- perhaps the Woodworking Stack Exchange?)

答:
On a typical CNC router, the work is stationary and the spindle-head moves in x/y/z coordinates.

On a typical CNC mill, the work moves in x/y coordinates (ie, is attached to an x/y table) and the spindle-head moves in the z axis only.

An example of each is shown below (photos from pdjinc.com and hylands.net):


问:
Is there a simpler way than ROS for 5 DOF Dynamixel arm control
I will have a 5 or 6 DOF arm build with Dynamixel or HerculeX smart servos. I need  to move the gripper along Cartesian trajectory, which I will calculate in my C++ application. I looked at ROS, but the learning curve is pretty steep and it looks like a major overkill for this use case. I don't need a distributed system with all the complexity it brings. Preferably, I would like to call a standalone C++ library or libraries to get the arm actuated.

What are my options? What will be the limitations of not using a full blown robotics framework like ROS or YARP in this case.

EDIT

Here is how I would like to code it:

```<code>vector<Point> way_points;
vector<Pose>  way_poses;

compute_Cartesian_trajectory(way_points, way_poses);   // my code
execute_Cartesian_trajectory(way_points, way_poses);   // library call
</code>```

The last line can be spread over several library function calls and intermediate data structures, if needed. The end result should be the gripper physically following Cartesian trajectory given by way_points and way_poses.

答:
Cross post on YARP Q&A channel:

https://github.com/robotology/QA/issues/54


答:
The library call could be as simple as these two OpenRave Python lines:

```<code>robot.GetController().SetPath(traj)
robot.WaitForController(0)
</code>```

Of course the types would have to match and all that.  You would also have to write a controller plugin, which I have heard can be quite a bit of work.  (These are just Python bindings for the C++ API, but I am not familiar enough with the C++ API and the calls are slightly different).

That being said, I use OpenRave a lot for forward / inverse kinematics and Jacobian stuff.  But wrote my own trajectory follower and robot interface.

You should also check out Orocos KDL, it seems to have some support for trajectories, but I don't know if will "execute" the trajectory.

Title: Is there a simpler way than ROS for 5 DOF Dynamixel arm control

Body:
I will have a 5 or 6 DOF arm build with Dynamixel or HerculeX smart servos. I need  to move the gripper along Cartesian trajectory, which I will calculate in my C++ application. I looked at ROS, but the learning curve is pretty steep and it looks like a major overkill for this use case. I don't need a distributed system with all the complexity it brings. Preferably, I would like to call a standalone C++ library or libraries to get the arm actuated.

What are my options? What will be the limitations of not using a full blown robotics framework like ROS or YARP in this case.

EDIT

Here is how I would like to code it:

```<code>vector<Point> way_points;
vector<Pose>  way_poses;

compute_Cartesian_trajectory(way_points, way_poses);   // my code
execute_Cartesian_trajectory(way_points, way_poses);   // library call
</code>```

The last line can be spread over several library function calls and intermediate data structures, if needed. The end result should be the gripper physically following Cartesian trajectory given by way_points and way_poses.

Body:
The library call could be as simple as these two OpenRave Python lines:

robot.GetController().SetPath(traj)
robot.WaitForController(0)

Of course the types would have to match and all that.  You would also have to write a controller plugin, which I have heard can be quite a bit of work.  (These are just Python bindings for the C++ API, but I am not familiar enough with the C++ API and the calls are slightly different).

That being said, I use OpenRave a lot for forward / inverse kinematics and Jacobian stuff.  But wrote my own trajectory follower and robot interface.

You should also check out Orocos KDL, it seems to have some support for trajectories, but I don't know if will "execute" the trajectory.


问:
Robot wire follower + how to position on wire
I'm designing my lawn mower robot, and I am in the perimeter stage.
The electronic part is done, and works quite good, now comes the software.

I need an advice on how to deal with the problem of line following. I mean, once the robot is on the line, parallel to the line, that's relatively easy.
But how to manage the situation when the robot is driving around and approaches the line (wire)?

I have two sensors, left and right, turned 45° with respect to the forward direction.

The robot could arrive from any angle, so the signal amplitude read from the sensor could be completely random..
So I don't understand what to do in order to move it in the right position on the wire...
What's the usual approach?

The idea is the same as here:

The wire is all around the yard. on the mower there are 2 sensors, left and right, that sense the signal emitted from the wire, a square wave signal at 34 KHz. The signal amplitude read from the sensors on the mower is about 2 V when it's above the wire.

答:
There are a lot of possible ways to solve your problem.

First, let's get you off the wrong track: this isn't a simple, line following problem.  For it to be a line following robot, you need to lay track lines under your lawn for every place that you want to mow.  Imagine a grid like a potato masher instead of the one your drew.

The problem seems to be:

Given a perimeter wire & an autonomous robot, how can I make a robot mow my lawn, and how can it do the job in a relatively efficient manner? (ie: don't take a random walk).

Here's what I would do:

1) Add a start/stop location to you map. You could use a strong IR emitter and sensor (test it to make sure your robot can see it in bright sunlight).  Add this to your "charging station" and you've killed 2 birds with 1 stone.

2) Ensure that you're using encoded motors for your wheel motors. I'd take an approach similar to SLAM, but without the on-the-fly mapping.  You can encode your yard as a map, making the code and problem drastically easier.

MIT's "SLAM for Dummies"

Also look into "particle filter localization".

3) Assume your yard is forever static.  If it's not (if you plant a tree, remove the pool, or get a pile of mud after a storm, etc), we'll get to that in code with obstacle avoidance & with localization.  But for now, we'll start with the simplest case, and we'll build up in difficulty from there.

Now with these 3 additions, I'd start the robot by hugging to the perimeter line -- this is its one little bit of line following.  Let's start at the home, ie: the "charging station," and we'll work up the map towards the house.  The root will straddle the perimeter wire.  When the left sensor drops from 2V to zero, you're at the top of the map.  Turn right, follow the line for x-inches or x-centimeters, turn right again, and go down the line blindly. This should work well until you reach the house's left perimeter line.  You'll need to try this out in the yard and see how reliable your encoders are, how little slippage your gears give, etc.

Particle filtering will help your robot as it moves blindly to the next perimeter line.

The next issue to tackle is how to get around the pool. The encoded wheels will give you a decent idea of your positioning, so you can simply revert back to line following when you hit the pool perimeter.  Follow the line for x-inches again, and turn.  Unlike your exterior perimeter, your turns here are not 180 degrees.  You'll need to experiment.

In lieu of trying to work that out, you can just avoid the pool area.  Mow the easy part of the grid (everywhere that allows for simple 90 and 180 degree turns), and then come back to the pool at the end, where you're more likely to have poor localization.

I'd also add a sonar sensor at the front for obstacle avoidance.

I hope this spurs some ideas for you.

Ryan


问:
USB instead of RS232
RS232 is not popular as it used to be and is mainly replaced by USB [wikipedia]. Problems such as mentioned in this question doesn't help its reputation either.

In a new system design therefore, one could think of using USB instead of Serial Port for communication. However, it still seems like RS232 is the serial communication protocol/port of choice.

Why is that? I understand changing old machinery that work with RS232 is costly, but what prevents new system designers from using USB instead of RS232?

答: Communication latency is another reason why USB1.1 or USB2.0 is not always a good replacement for RS232. Data on USB1.1 or USB2.0 bus is formatted into 1ms or 125us frames respectively, which forces minimum receive to transmit latency equal to two frame periods (often more in practise). This is an important consideration for modern PC hardware, which usually doesn't have built-in RS232 port and USB/RS232 converter is used instead.</p>

Title: USB instead of RS232


问:
Camera Calibration fails to run on ROS
I am running ROS Indigo on Ubuntu 14.04. I am doing a mono-camera calibration and trying to follow the camera calibration tutorial on the ROS Wiki.

I give the following command:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square
  0.108 image:=/my_camera/image camera:=/my_camera

I get the following error:

ImportError: numpy.core.multiarray failed to import Traceback (most
  recent call last): File
  "/opt/ros/indigo/lib/camera_calibration/cameracalibrator.py", line 47,
  in  import cv2 ImportError: numpy.core.multiarray failed to
  import

I thought it was to do with updating numpy and did a rosdep update but no difference.

What is a possible way to solve this problem?

UPDATE:
I uninstalled and reinstalled ROS completely from scratch. I still get the same error. Should I have to look somewhere outside ROS?

答:
Are you doing stereo or mono camera calibration?  Can you post more code? (Please update the question, don't post code in a comment on this answer)

I ask because there's a few things to check. Highlights from the tutorial:

Start by getting the dependencies and compiling the driver.

```<code>$ rosdep install camera_calibration

$ rosmake camera_calibration
</code>```

Make sure that your monocular camera is publishing images over ROS. List the topics to check that the images are published:

```<code>$ rostopic list
</code>```

This will show you all the topics published, check to see that there is an image_raw topic. The default topics provided by most ROS camera drivers are:
  /camera/camera_info
  /camera/image_raw
  If you have multiple cameras or are running the driver in its own namespace, your topic names may differ.

Title: Camera Calibration fails to run on ROS

Body:
Are you doing stereo or mono camera calibration?  Can you post more code? (Please update the question, don't post code in a comment on this answer)

I ask because there's a few things to check. Highlights from the tutorial:

Start by getting the dependencies and compiling the driver.

$ rosdep install camera_calibration

$ rosmake camera_calibration

Make sure that your monocular camera is publishing images over ROS. List the topics to check that the images are published:

$ rostopic list

This will show you all the topics published, check to see that there is an image_raw topic. The default topics provided by most ROS camera drivers are:
  /camera/camera_info
  /camera/image_raw
  If you have multiple cameras or are running the driver in its own namespace, your topic names may differ.


答:
Generally, the term comes from how the machine derives its cutting power.

A mill generally cuts slow RPM, from 3,000 to 5,000 with a lot or torque.

A router will usually run 10 times that with 30,000 to 50,000 RPM with much less torque.

The axis movements as mentioned by jwpat7 also apply.

Body:
People at the RepRap 3d-printing project often mention CNC routers or CNC mills.

Both kinds of machines almost always have a motorized spindle with stepper motors to move the spindle in the X, Y, and Z directions.

What is the difference between a CNC router versus a CNC mill?

(Is there a better place for this sort of question -- perhaps the Woodworking Stack Exchange?)


问:
What's the most accurate way to obtain a locational fix using GPS?
Obviously GPS is the most obvious and accessible technology for obtaining a locational "fix" for a robot at any particular time. However, while it's great sometimes, in other locations and situations it's not as accurate as I'd like, so I'm investigating whether there's a relatively easy way to improve on this accuracy (or not, if that turns out to be the case.)

I've considered the following options, but found limited information online:

Would using a much better antenna help, especially for low signal areas? I'm thinking yes to this, but if so how would I construct such an antenna and know that it's an improvement? Are there any good guides on how to do this? I could use a ready made antenna if they're not too expensive.

Would using multiple separate receivers in tandem help, or would they likely all be off by a similar amount, or would I not be able to extract a meaningful average with this approach?

What sort of characteristics should I look for when choosing a good GPS receiver to help accuracy?

Is there anything else I should consider which I've missed?

答:
If you want to be really clever, you could consider Assisted GPS (see Wikipedia for full details) which uses the phone network to provide a better initial fix, by using the cell towers fixed positions as a basis.

Note, however, that A-GPS uses your data stream, so if you have to pay for data, you may not want to use this!!!


问:
Adding Rotary Encoders to an Electronic Wheel Chair
We have an electric wheel chair, and are looking to add a rotary encoder to each wheel.  We don't want to hack the motor itself, so want to add the encoder without harming the motor-to-wheel connection.  We will be using an arduino to read the signal.

Does anyone have any experience adding rotary encoders to already assembled wheel assemblies?

答:
An optical encoder is fairly simple to add to an existing wheel.

Essentially you mount a photosensor that can detect notches or patches on a disk as it rotates with the wheel. You could use through hole light detection as well.

The circuit design is fairly straight foward

And your arduino program counts the number of pulses it receives. Knowing the number of ticks per revolution, and wheel size, you can get accurate odometry.

Another solution that may work for you is add on encoders for DC motors. Their original intent is to make a regular motor a Servo motors, but would work great for this task as well. The only real difference being that a servo motor uses the information in a closed loop to position the motor, as opposed to just keeping track of it.

And one other solution I thought of - if your wheel chair has spokes like a bicycle, then a magnet like this would be easy to attach, and a magnetic sensor, very similar to the above light detection circuit could be located on the chair/frame. That would probably be the least intrusive to implement. If you needed more than 1 per revolution accuracy, just add more magnets to more spokes, as long as they are distributed evenly.


问:
Hand Eye Calibration Solver
I have a rig for which I have a pretty good estimate of the static transformation between the camera and a joint based off of the CAD. It has some errors though and I was hoping to fix it by doing a hand eye calibration. So, I started off with generating some data based off of the transformation that I have already. From the papers that I have been reading, they all want to solve the $$AX = XB$$ problem by either converting $A$, $B$ to dual quaternions or simplifying the equation to something like
$$ n_A = Xn_B $$ where $n_A$, $n_B$ are the eigenvectors corresponding to the eigenvalue of 1 for the $A$ and $B$ rotations.

After generating the data, I tested if my data collection was correct and I validated it by checking if $AX = XB$ for all of the $A$s and $B$s that I generated. I used the CamOdoCal library to try and solve the problem but I got this -

```<code>/hand_eye_calib_node    :
[ 0.00196822,   -0.457069,    0.889429,    0.143463;
   -0.999965, -0.00813605, -0.00196822,    -1.74257;
  0.00813605,   -0.889394,   -0.457069,   0.0270069;
           0,           0,           0,           1]

----------------------------------------

/hand_eye_calib_node    : Actual transform
    0         0         1   0.08891
   -1         0         0 -0.070465
    0        -1         0   0.07541
    0         0         0         1
</code>```

The actual transform is the one that I had based my $A$ and $B$ data on. Then I tried implementing the Tsai-Lenz and Horaud and Dornaika's Nonlinear optimization techniques using LM solver but to no avail. I do not get the correct transformation out of any of the solvers.

So, I was wondering if you could point me to a hand eye calibration library or paper that has worked.

答:
From your data, it is not obvious where the issue is. Can you give more details?

Here is a commonly used hand eye calibration routine written in Matlab:
http://lazax.com/www.cs.columbia.edu/~laza/html/Stewart/matlab/handEye.m

(Note that you also need to download the helper function quat2rot.m from the same directory.)

It implements the Tsai-Lenz method.

Generally, a common mistake in hand eye calibration is to provide inverse transformations.
Maybe you re-run your routine with one set of transformations inverted?

Title: Hand Eye Calibration Solver


问:
Wires or columns which contract on passing electricity
Background: Introductory robotics competition for college freshmen; Bot has to open 8 jars (with two balls in each of them) in ten minutes and load the balls into a shooting mechanism.

So, we were doing this project and we hit upon a challenge that the jar is not opening like we originally intended to. So we decided to get a rack-pinion mechanism and use it for unscrewing the lid. However, it is too large and we are unable to fit the bot in the required dimensions

The actual question: Are there any wires or rigid columns/things which can contract ~1 cm when electricity is passed through it? And what would their price range be? Our budget is also in the list of constraints for the bot

Edit: We can include a wire of length <1m or a column of length <30 cm. Also, the wire needs to contract only more than 7mm

答:
Have you looked at linear actuators?  However you might be better with a motor and a pulley.

Have you considered alternatives such as:

Wrap a rubber loop around the edge of the lid, put it tight with a high torque motor, and then twist it off with another motor.

Do the rules say you have to open the jars by removing the lids?  If not a arming your robot with a hammer may be an option.


答:
It sounds like you are looking for an artificial muscle.
I see you've already looked at one type of

shape-memory alloy; also called memory metal, memory alloy, muscle wire, Nitinol

Have you looked at

twisted fishing line artificial muscles?

The other types mentioned in the Wikipedia: "artificial muscle" article?

It seems more natural to me to use normal rotary motors to rotate the screw-on lid of a typical jar, so I am curious to see how your system works.
Good luck!

Title: Wires or columns which contract on passing electricity

Body:
Background: Introductory robotics competition for college freshmen; Bot has to open 8 jars (with two balls in each of them) in ten minutes and load the balls into a shooting mechanism.

So, we were doing this project and we hit upon a challenge that the jar is not opening like we originally intended to. So we decided to get a rack-pinion mechanism and use it for unscrewing the lid. However, it is too large and we are unable to fit the bot in the required dimensions

The actual question: Are there any wires or rigid columns/things which can contract ~1 cm when electricity is passed through it? And what would their price range be? Our budget is also in the list of constraints for the bot

Edit: We can include a wire of length <1m or a column of length <30 cm. Also, the wire needs to contract only more than 7mm


问:
velocity of the end-effector
The joint velocities are constant and equal to $\dot{\theta}_{2}$ = 1 and $\dot{\theta}_{1}$ = 1. How to  Compute the
velocity of the end-effector when $\theta_{2} =\pi/2$ and $\theta_{1} = \pi/6$

答:
In velocity kinematic, you can establish a relationship between the velocity of the end-effector and the joint velocities,

$$
\begin{align}
x_{2}(t) &= a_{1} \cos\theta_{1}(t) + a_{2} \cos(\theta_{1}(t)+\theta_{2}(t)) \\
y_{2}(t) &= a_{1} \sin\theta_{1}(t) + a_{2} \sin(\theta_{1}(t)+\theta_{2}(t))
\end{align}
$$

where $a_{1}$ and $a_{2}$ are the lengths of the links. Now the aim is to acquire $\dot{x}_{2}(t)$ and $\dot{y}(t)_{2}$. This is Matlab code for obtaining the derivatives if you are lazy to do them by hand.

```<code>clear
clc

syms a1 a2 x y th1 th2 t

th1(t) = symfun(sym('th1(t)'), t);
th2(t) = symfun(sym('th2(t)'), t);

x = a1*cos(th1(t)) + a2*cos(th1(t) + th2(t));
y = a1*sin(th1(t)) + a2*sin(th1(t) + th2(t));

dxdt = diff(x,t)
dydt = diff(y,t)
</code>```

$$
\begin{align}
\dot{x}_{2}(t) &= -a_{1} \dot{\theta}_{1}\sin\theta_{1} - a_{2}(\dot{\theta}_{1} + \dot{\theta}_{2}) \sin(\theta_{1}+\theta_{2}) \\
\dot{y}_{2}(t) &= \ \ \ a_{1} \dot{\theta}_{1}\cos\theta_{1} + a_{2}(\dot{\theta}_{1} + \dot{\theta}_{2}) \cos(\theta_{1}+\theta_{2})
\end{align}
$$

Now you substitute the given parameters in the aforementioned equations.

Title: velocity of the end-effector

Body:
In velocity kinematic, you can establish a relationship between the velocity of the end-effector and the joint velocities,

$$
\begin{align}
x_{2}(t) &= a_{1} \cos\theta_{1}(t) + a_{2} \cos(\theta_{1}(t)+\theta_{2}(t)) \\
y_{2}(t) &= a_{1} \sin\theta_{1}(t) + a_{2} \sin(\theta_{1}(t)+\theta_{2}(t))
\end{align}
$$

where $a_{1}$ and $a_{2}$ are the lengths of the links. Now the aim is to acquire $\dot{x}_{2}(t)$ and $\dot{y}(t)_{2}$. This is Matlab code for obtaining the derivatives if you are lazy to do them by hand.

clear
clc

syms a1 a2 x y th1 th2 t

th1(t) = symfun(sym('th1(t)'), t);
th2(t) = symfun(sym('th2(t)'), t);

x = a1*cos(th1(t)) + a2*cos(th1(t) + th2(t));
y = a1*sin(th1(t)) + a2*sin(th1(t) + th2(t));

dxdt = diff(x,t)
dydt = diff(y,t)

$$
\begin{align}
\dot{x}_{2}(t) &= -a_{1} \dot{\theta}_{1}\sin\theta_{1} - a_{2}(\dot{\theta}_{1} + \dot{\theta}_{2}) \sin(\theta_{1}+\theta_{2}) \\
\dot{y}_{2}(t) &= \ \ \ a_{1} \dot{\theta}_{1}\cos\theta_{1} + a_{2}(\dot{\theta}_{1} + \dot{\theta}_{2}) \cos(\theta_{1}+\theta_{2})
\end{align}
$$

Now you substitute the given parameters in the aforementioned equations.


问:
rotation matrix to euler angles with gimbal lock
How do i determine which angle i can negate when gimbal lock occurs.

As i've understood with gimbal lock that it remove one degree of freedom, but how do i determine which degree can be removed when a  value R[1][3]  of a rotation matrix (size 3x3) has the value 1.  Is it the Roll, Pitch or yaw which can be taken out from the equation?

答:
All rotation matrices can be expressed in Euler angles. Precisely, all 3D rotations can be expressed as 3 subsequent unit axis rotations.
(Note there are 24 different, equally valid conventions of unit axes to write Euler angles.)

For Euler angles, a "gimbal lock" occurs iff the Euler angle representation for a given rotation matrix is not unique, i.e. there are infinite solutions.
At the same time, the mapping from the rotation matrix to Euler angles is non-smooth.

In the case of z-x-z extrinsic Euler angles, this special case is for R[3][3]==0. You could than apply an arbitrary z-rotation before and its inverse after without an effect.

https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Rotation_matrix_.E2.86.92_Euler_angles_.28z-x-z_extrinsic.29


问:
How can I avoid Roomba Error 10 Code?
I am trying to run my 600 series Roomba in a large, open space (1700+sf) and it does not recognize the large, open space and throws the Error 10 code.  It does not recognize an edge of 2 12"-3" either; it will fall off the edge and become stuck.  Any suggestions?</p>

答:
iRobot's home robot support page has a list of error codes and specifies a few different solutions for error code 10.  </p>

<p>But simply: if your room is too big, use virtual walls.  And if your wheel is stuck, clear the debris.  </p>

Title: How can I avoid Roomba Error 10 Code?

Body:
iRobot's home robot support page has a list of error codes and specifies a few different solutions for error code 10.

But simply: if your room is too big, use virtual walls.  And if your wheel is stuck, clear the debris.


问:
How can I upgrade an existing robot with a higher torque, sensored motor @ ~100 watts?
I would like a high torque motor (37 oz-in @ 5760 rpm) for souping up a Scorbot 3 I bought. I really need it to have an encoder to count the number of revolutions and to allow high start-up torque. So far, I'm having difficulty finding a suitable motor.

The closest I've found are:

Revolver S Stubby
(still not ready for purchase)

Team Novak Ballistic 25.5T

I've found other RC car motors, but they are usually too big.

Some alternatives I thought about are:

adding hall sensors to an existing motor - how hard is this?

rewinding a motor with more turns to increase torque (decrease Kv)

Does anybody know of any motors that fit these requirements or modifications I can make to existing ones?

Update: I had almost given up hope, until someone at Homebrew Robotics suggested using the Maxon motor finder.

If you just type in my given torque and speed, it returns 3 motors, but they're all over powered because the search interprets your specs as a continuous operating point, whereas my robot will only need that much power 20% of the time, and maybe for 1 second max.

If I type in 12V, 5000rpm, and 15 oz-in, then it returns 2 brushless motors, of which, the Motor EC 45 is the best fit, which has this operating curve:

http://msp.maxonmotor.com/camosHtml/i?SIG=fb9a5d91198caf381122a3d6eab8b1bda3877f30_fa_1e0.png

However, I don't want to pay what Maxon is charging, so instead, I've contacted the guy who makes the yet to be released Revolver Stubby and he has kindly offered to build a custom high torque, low RPM motor for me.

Can anyone comment on why high torque, low RPM motors like the one I want seem so rare? Is due to lack of applications (robotics) or is there some intrinsic difficulty in making them?

答:
One possible solution to your torque problem is to use mechanical advantage to trade speed for torque.

If you replace a 1:2 gear/drive belt combination with a 1:1 gear/drive belt combination then you will get twice the torque at half the speed. Swap the gears and you can use the same drive belt to get a 2:1 ratio instead and get even more torque for even less speed.

Of course you will have to re-tune your motors, the PID control parameters will be completely different with the new gearing.


问:
Two DC motors and single output?
I saw one old industrial robot(Year 1988) end effector is having 2 DC motor for roll drive. After roll drive, yaw and pitch drives are connected and it has dc motors separately.

But roll drive has two DC motors. Why are they used like this? why not single with higher torque.

All the roll, pitch and yaw motors are same spec. Total 4 DC motors.

Two DC motor connected to single shaft using gears in roll.

答:
Reusing parts is a very important and common concept.

Using the same DC motor 4 times means you have to deal with only one motor type. If you choose a 2nd type of motor for the roll, you have to fiddle with the characteristics of two motors. Using a motor with more torque usually means that you need a different drive circuit. From here on the problems are proliferating.

What if the supplier of the bigger motor stops selling the motor?

What if the driver circuit of the bigger motor does not have the
precision of the smaller ones?

What's the price to buy 1 + 2 motors vs. buying 4 of the same kind?

If you are a company building industrial robots you buy DC motors in bulk. You use few standard motors that your engineers are familiar with. The driver circuits are proven and tested.

If you face a higher torque requirement, you simply add another familiar motor. It's not economical to pay somebody finding a better suited motor, which has several possible drawbacks as pointed out above.

As a company your goal is to sell robots, not to overengineer them.

Title: Two DC motors and single output?


问:
Quadcopter stability vs (PID error signal lag and sample time)
The question I am asking is that, what is the effect on stability of increasing or decreasing both the sample time and lagging of error signal to PID. Does it helps in stability or degrade it?</p>

答:
In general, a system that is "discrete" will always be less stable, the less samples per time, the less stable it will be.

Imagine you are driving a car. You are only allowed to turn the steering wheel every 10 minutes. Can you keep the car on a curvy road this way?

To expand the example to answer your second question: don't drink and drive.
If your sensors are lagging, your ability to control the car are evidently reduced.