问:
2D Transformations as Affine Matrices
I have found the following exercises about 2D Transformations as Affine Matrices. I am stuck at the second exercise that goes as follows:

The 2D pose of a robot w.r.t. a global coordinate frame is commonly written as $x =(x, y, \theta)^T$, where $(x, y)$ denotes its position in the xy-plane and $\theta$ its orientation. The homogeneous transformation matrix that represents a pose $x = (x, y, θ)^T$ w.r.t. to the origin $(0, 0, 0)^T$ of the global coordinate system is given by
  $$
X=\begin{pmatrix}
\textbf{R}(\theta) & \textbf{t} \\
0 & 1
\end{pmatrix}, \textbf{R}(\theta)=\begin{pmatrix}
cos(\theta) & -sin(\theta) \\
sin(\theta) & cos(\theta)
\end{pmatrix}, \textbf{t}=\begin{pmatrix}
x \\
y
\end{pmatrix}
$$

(a) While being at pose $x_1 = (x_1, y_1, \theta_1)^T$, the robot senses a landmark $l$ at position $(l_x, l_y)$ w.r.t. to its local frame. Use the matrix $X_1$ to calculate the coordinates of $l$ w.r.t. the global frame.
  $$
\text{Let } ^g\textbf{T}_{x_1}=\begin{bmatrix}
cos \theta_1 & -sin \theta_1 & x_1 \\
sin \theta_1 & cos \theta_1 & y_1 \\
0 & 0 & 1
\end{bmatrix} \text{ and } ^{x_1}\mathbf{l}=\begin{bmatrix}
l_x \\
l_y \\
1
\end{bmatrix} \text{ then } ^g\mathbf{l}=^g\textbf{T}_{x_1}\cdot^{x_1}\mathbf{l}
$$

In answer a) why does $^{x_1}l$ have this vector $[lx, ly, \mathbf{1}]^T$ instead of $[lx, ly, \mathbf{0}]^T$?

b) Now imagine that you are given the landmark’s coordinates w.r.t. to the global frame. How can you calculate the coordinates that the robot will sense in his local frame?

... we follow the same logic as the previous exercise, i.e.$$
^{x_1}l=^{x_1}T\cdot \text{ }^gl=(^gT_{x_1})^{-1}\cdot\text{ }^gl
$$

The answer to b) is an inverse of $T$ vector multiplied by $^{x_1}l$. Why? Why do I need to inverse T vector? What does a matrix inverse signify in mobile-robotics?

答:
Regarding your first question:

In answer a) why does $^{x_1}l$ have this vector $[l_x,l_y,1]^T$ instead of $[l_x,l_y,0]^T$?

The matrices work out to be one dimension larger than what you're working with in order to keep that $1$ entry in the input vector/matrix. This is because your matrix is doing rotation plus translation in one step:

Consider rewriting your transform matrix as a rotation $R$ and a translation $dS$:

$$
\left[\begin{array}{ccc}
R & dS \\
0 & 1 \\
\end{array}\right]
$$

Now, when you want to transform some points, you append a value of $1$ below the bottom row in order to get something like:

$$
\left[\begin{array}{ccc}
\mbox{transformed points} \\
1 \\
\end{array}\right] = \left[\begin{array}{ccc}
R & dS \\
0 & 1 \\
\end{array}\right]
\left[\begin{array}{ccc}
\mbox{raw points} \\
1 \\
\end{array}\right]
$$

If you write out the matrix math by hand things become a little more clear. You do element-wise multiplication of the first row of the transform matrix by the first column of the raw points vector/matrix and sum the results. This gives you the first row, first column entry in the transformed points vector/matrix, then you do second row of the transform matrix by the first column of the raw points and sum the results, and that gives you the second row, first column entry in the transformed points vector/matrix.

Showing the math here, you get:

$$
\left[\begin{array}{ccc}
\mbox{transformed points} \\
1 \\
\end{array}\right] = \left[\begin{array}{ccc}
R\left(\mbox{raw points}\right) + dS\left(1\right) \\
0\left(\mbox{raw points}\right) + 1\left(1\right) \\
\end{array}\right]
$$

And so you can see that you wind up with:

$$
\mbox{transformed points} = R\left(\mbox{raw points}\right) + dS \\
$$

If you were to append a zero instead of a one in your raw point/input then you would get the WRONG ANSWER of:

$$
\require{cancel}\cancelto{\mbox{wrong answer}}{\mbox{transformed points} = R\left(\mbox{raw points}\right) + \boxed{dS*0}} \\
$$

Appending a zero instead of a one means you won't actually include the translation portion of your transform. The appended one is included to setup the points to be transformed. You append it before you transform your points and you can strip it off as soon as the points are transformed.

Regarding your second question:

The answer to b) is an inverse of T vector multiplied by $^{x_1}l$. Why? Why do I need to inverse T vector? What does a matrix inverse signify in mobile-robotics?

You need to invert the transform because the question is asking you to change your point of reference. If you walk one mile East of your house, where is your house relative to you? You could call it -1 mile East of you, or 1 mile West.

You could say that you turn your body +30 degrees, or you could say that the whole world rotates -30 degrees.

Obviously your house didn't move away from you, and the world didn't rotate, but you have to chose something as your basis for measurement (datum). The transform that will take you from your location back to the world location (measurement datum) is the inverse of the transform that took you from the world location to your current location.

Again, to the math! Consider again the transform matrix:

$$
\left[\begin{array}{ccc}
R & dS \\
0 & 1 \\
\end{array}\right]
$$

If your rotation is zero, then the rotation matrix is the identity matrix $I$, which is essentially 1 (ones on the diagonals). This means that, for no rotation, your transform matrix is then just the change in position $dS$:

$$
T = \left[\begin{array}{ccc}
1 & dS \\
0 & 1 \\
\end{array}\right]
$$

And, if you invert that matrix, you get:

$$
T^{-1} = \left[\begin{array}{ccc}
1 & -dS \\
0 & 1 \\
\end{array}\right]
$$

So you can see there that, if you don't rotate, then the translation that will take you from B back to A is the opposite of the translation that took you from A to B ($dS$).

The full result is marginally trickier, because the direction of your translation will change if you rotate. Consider, for example, taking one large step forward and then turning 90 degrees. How do you get back to where you started? One large step backward and then turning -90 degrees? NO! because your orientation after the first transform is not the same as the starting orientation.

If +90 degrees is a quarter turn to your left (counter clockwise), then instead of just taking a large step backward you need to rotate that large step backwards by -90 degrees, which means sticking your leg behind you and then rotating it a quarter turn clockwise. This results in a large step left, then turning your body -90 degrees.

Similarly, if your initial transform matrix is:

$$
T = \left[\begin{array}{ccc}
R & dS \\
0 & 1 \\
\end{array}\right]
$$

then the full result for inverting it is:

$$
T^{-1} = \left[\begin{array}{ccc}
R^{-1} & -dS(R^{-1}) \\
0 & 1 \\
\end{array}\right]
$$

So you can see that the inverse transform is un-rotating to get back to the direction you were originally facing ($R^{-1}$) AND going the opposite distance $-dS$ for the direction you were originally facing $R^{-1}$.

Hopefully this helps clarify things for you. If you're still stuck, just leave a comment with what's not clicking and I can edit the answer to help.

Title: 2D Transformations as Affine Matrices


问:
How to implement Kalman to merge the data obtained by two Leap Motion devices?
Only position data is obtained from Leap Motion devices. This data was already processed to be on the same coordinate axis by means of a homogeneous transformation.

I'm reviewing WTF is Sensor Fusion? The good old Kalman filter, but it considers speed and acceleration, data that I don't need and my doubt arises if they are all necessary to implement the Kalman filter, as I just need to get the correct estimate of the position between the Leap devices.

I would appreciate a response that clarifies the implementation of these matrices for this case.

答:
You don't need speed and acceleration in your Kalman filter. A Kalman works on any state vector, the components of that vector could be anything, and not necessarily positions. They could be water densities, magnetic field strengths, you name it.

In your case the state vector is just the components of the position.

Of course how you implement the predict phase of the Kalman is up to you. Typically one predicts the new positions by multiplying the velocties by the timestep to get a position delta and then adding that on to the original position. Your velocity is not in the state but that's irrelevant. You can estimate a velocity based on the previous positions, you can make it as simple or as sophisticated as you want. Ultimately you are going to have to predict the new positions based on the previous ones if that's all you've got.

The update phase ought to be straightforward as your expected measurements are simply the predicted positions.

ContentLicense: CC BY-SA 4.0


问:
Stay both pointed forward and equal distance from side walls
Simple task, robot with total knowledge about the world or at least a few side mounted IR sensors which can accurately measure where the robot is relative to a long straight corridor.

We want to BOTH:

Keep the robot moving straight down said corridor

Keep an equal distance from each wall

Noting that the robot is two wheeled or four wheeled. Point being sometimes it will be necessary to not drive straight in order to correct for drift we have accumulated which has pushed us either left or right relative to the virtual center-line we want to stay on.

I'm looking for an approach. Maybe some pseudocode, but even that's not necessary.

Don't say PID, a simple PID controller only accounts for one error term. We have two, the error as an angle between our heading and the desired straight heading and the error as a distance between us and the virtual center-line we'd like to be on at all times.

My previous approach was to attempt to use two PD loops. That didn't work out so well.

答:
Implement two low-level PID controllers, one for each wheel.  Then compute the targets for both wheels using a path planner which determines next wheel setpoints based on the error computed after reading the IR sensors.  If you cannot determine both position and orientation errors using your sensors (you cannot), then keep track of the last few positions to determine actual angle of travel.  </p>

<p>I would add a third PID loop for “squashing” the orientation error, but that isn’t required if you can accept some wavering about the centerline of travel.  </p>

Body:
Implement two low-level PID controllers, one for each wheel.  Then compute the targets for both wheels using a path planner which determines next wheel setpoints based on the error computed after reading the IR sensors.  If you cannot determine both position and orientation errors using your sensors (you cannot), then keep track of the last few positions to determine actual angle of travel.

I would add a third PID loop for “squashing” the orientation error, but that isn’t required if you can accept some wavering about the centerline of travel.


问:
Robotic Arm Senior Capstone. Electronics/Controls/Sensors Questions
I am a mechanical engineering student currently working on my senior capstone. My team of all MechEs has to build a robotic "arm" where the arm is really just a link/bar of aluminum. The thing we really care about is testing for certain control system parameters like resonance and bandwidth.

As you can expect, we have no idea about electronics yet they will play THE vital role in this project. Our advisor has suggested that we would need a motor, a power supply for the motor, a power amplifier (I think for the controller/processor but I am not sure), and encoders to actually measure data that we can use. So I have a few questions:

How would we choose a correct supply for the motor? From researching online, we know we need a DC motor as that is apparently suitable for controls applications.

What exactly is the need/purpose of a power amplifier and how would we choose one?

We have figured out that we need absolute encoders as we need position data. But how exactly do they work and how are they wired/implemented/powered? I understand that they can give us the data we need but I cannot seem to find how to actually use one in a project/build.

Related to #3, does anybody know about torque sensors? We would like to use them but are clueless on how to actually implement them (where to place them, what kind of data they give, etc.).

Is it physically possible to give a step input to a motor to ultimately measure resonant frequency?

答:
This is a question all about "how do I specify/size my equipment," so I think it's probably a fair question for the site, though it is close to an open-ended design question.

Regarding the "how do we choose" portions of questions 1, 2, and 4 - you have to have some kind of a test procedure. Why are you making the arm? What is it that you're intending to test? You mention resonant frequency, but do you mean the structural resonance of the arm or do you mean the plant resonance of the arm+feedback+controller control loop?

How are you intending on performing this test? Are you going to add various weights to the arm and repeat a particular test, or are you going to vary supply voltage to the actuator, or something different?

You'll have to determine the static torque required to support the arm (and test load?), the dynamic torque required to accelerate the arm (and test load?), and estimate a top speed at which you expect to operate. With a torque requirement and a speed requirement you can calculate a power requirement. Motors have some efficiency (listed on their datasheet, but I would use 70% as a thumbrule) so you'll need a power supply capable of providing the motor with the electrical power needed for the motor to provide 70% of that as mechanical power.

Regarding the torque sensors and rotary encoders - again, just like the motor datasheet will give you the actual efficiency for that motor, the sensor datasheet will tell you what the capabilities and limitations are for the particular sensor. This typically includes measurement range, number of revolutions you can turn the sensor, supply voltage, output format, scale factors (how the output format relates to the measurement range), accuracy, etc. An absolute rotary encoder is anything as simple as a potentiometer, which would output a variable voltage, up to a optically isolated high resolution encoder that outputs Grey code on some high speed bus format, and everything in between. Where do you put these sensors? Wherever you want the data. If you want torque at a joint, you put the sensor at the joint. In order for a torque sensor to register a torque it needs to have a torque applied to it, which means that they are typically some load-bearing component in an elbow/joint design.

Regarding the power amplifier - A microcontroller is only going to provide power in the milliwatts region. A computer/USB port may provide a little more power, but probably not enough to drive a large robotic arm. You'll need a device capable of converting the control signal that is outputted from the microcontroller to a variable power source that will be the input to the arm actuator. The variable power source is your power amplifier, and again the size you need is determined by however much power you're expecting the arm to use.

Regarding the step input - you give a light a step input every time you flip a light switch. The supply voltage is 0 V, and then suddenly the supply voltage is 110 V or 220 V. You can give a step input to a motor by applying a voltage to that motor, and you can provide a step input to a controller by providing a reference to that controller.

Finally, maybe you're noticing that this is going to be a lot of work. I would fully expect you to go through 3 or more design iterations. You design an arm of a particular size and shape to ballpark the motor size requirements and find a torque sensor and rotary encoder that also meets your needs. Then you revisit the arm design to try to allow it to attach to the sensors; this re-design may mean that the weight of the arm has changed, which means you get to re-select the motor and sensors you use. This process repeats until your solution converges.


问:
Calculating torque required to rotate a platform
I am trying to spec out a motor's torque required to rotate a platform about an axis.

This diagram makes it better to understand(it's like a rotisserie):

Dimensions are in cm:

I have an arbitrary shaped object on the platform that I simplified to a cuboid to calculate the moment of inertia.

The combined weight is about 25kg.

I use the moment of inertia formula for a cuboid along the length axis and use the parallel axis theorem to move the axis to where I have the rod, I get:

```<code>I = (1/2) * m * (w^2 + h^2) + m*((0.5*h)^2)
  = (1/2) * 25kg * (0.4^2+ 0.5^2) + 25 * (0.2^2)
  = 6.125 kg-m^2
</code>```

Assuming I want to reach 5 rpm in 5 seconds. I have

```<code>  5rpm = (2 * pi * 5)/60  rad/s

  alpha = ((2 * pi * 5)/60 - 0)/(5-0)  rad/s^2

        = pi/30 rad/s^2
</code>```

T = I * alpha    = 6.125 * (pi/30)   = 0.64N-m

Now I am not entirely sure if this calculation is correct. I had a 5N-m rated dc motor lying around and I fit it to the platform. The motor was able to rotate the platform about 45 degree clockwise but was not able to come back to zero degrees. Am I missing something in the above calculation? Gravity doesn't feature in my equations.

There could be other factors like friction, or the gearbox in the motor?

答:
First of all, please draw the axes on the object above to make it easier for others to help you.

If you are going to rotate the cuboid from the end of the rod, you should also be using a parallel axes theorem to translate the moment of inertia equivalent to the length of the rod as well.

From my understanding, you are trying to lift the cuboid by attaching a motor at the end of the rod, am I right?  This is where the clearly labeled axes are important.


答:
In addition to the torque required to turn, you do also need to account for the torque required to hold the load against gravity, which could be significant.

Consider your system in terms of the rod being your arm, held out in front of you, and the box being a yard brush held at the end of the handle. Starting with the brush pointing up, it requires little effort to hold in position. Similarly you can swing it through 360 degrees with only a little more effort, relying on the falling momentum to swing it back around to the top position. Now try to hold it pointing directly sideways theough. You would need to have pretty strong wrists to do that, if you can manage it at all.

Since your load is an arbitrary shape within a bounding box, I think you are better off calculating your weight distribution according to the worst case. For your system, this would be with your full 25kg load being at one of the top corners of the box.

When the rod is rotated such that the load is at its furthest extent, it is $\sqrt{40^2+(50/2)^2}\approx47.17$cm from the rod.

Calculate this torque and add it to the torque required to turn at the speed you want and you should have a motor sized for your application.

If you size your motor for worst case load, then it should should be more than adequate for any load you throw at it. If you size it for anything less, then you may find that some loads exceed the capabilities of your system, so you may need to add additional sensors or control complexity to degrade gracefully in an overload situation.

Title: Calculating torque required to rotate a platform

Body:
I am trying to spec out a motor's torque required to rotate a platform about an axis.

This diagram makes it better to understand(it's like a rotisserie):

Dimensions are in cm:

I have an arbitrary shaped object on the platform that I simplified to a cuboid to calculate the moment of inertia.

The combined weight is about 25kg.

I use the moment of inertia formula for a cuboid along the length axis and use the parallel axis theorem to move the axis to where I have the rod, I get:

```<code>I = (1/2) * m * (w^2 + h^2) + m*((0.5*h)^2)
  = (1/2) * 25kg * (0.4^2+ 0.5^2) + 25 * (0.2^2)
  = 6.125 kg-m^2
</code>```

Assuming I want to reach 5 rpm in 5 seconds. I have

```<code>  5rpm = (2 * pi * 5)/60  rad/s

  alpha = ((2 * pi * 5)/60 - 0)/(5-0)  rad/s^2

        = pi/30 rad/s^2
</code>```

T = I * alpha    = 6.125 * (pi/30)   = 0.64N-m

Now I am not entirely sure if this calculation is correct. I had a 5N-m rated dc motor lying around and I fit it to the platform. The motor was able to rotate the platform about 45 degree clockwise but was not able to come back to zero degrees. Am I missing something in the above calculation? Gravity doesn't feature in my equations.

There could be other factors like friction, or the gearbox in the motor?


问:
What is the difference between a Robot and a Machine?
What is the difference between a Robot and a Machine? At what point does a machine begin to be called a robot?

Is it at a certain level of complexity? Is it when it has software etc?.

For instance: A desktop printer has mechanics, electronics and firmware but it is not considered a robot (or is it). A Roomba has the same stuff but we call it a robot. So what is the difference.

I have always believed that a robot is a robot when it takes input from it's environment and uses it to make decisions on how to affect it's environment; i.e. a robot has a feedback loop.

答:
You asked two (root) questions:

Question: What is the difference between a Robot and a Machine?

and

Question: At what point does a machine begin to be called a robot?

If I may, allow me to present the following text to address the first question:

The six classical simple machines

Reference: https://en.wikipedia.org/wiki/Simple_machine

Lever

Wheel and axle

Pulley

Inclined plane

Wedge

Screw

Any one of these “machines” is a long way from (but may contribute to the construction of) a robot.

Addressing your second question and although fiction, Isaac Asimov presented a line of thought (reference: http://en.wikipedia.org/wiki/Three_Laws_of_Robotics) still discussed today:

The Three Laws of Robotics (often shortened to The Three Laws or Three Laws) are a set of rules devised by the science fiction author Isaac Asimov. The rules were introduced in his 1942 short story "Runaround", although they had been foreshadowed in a few earlier stories. The Three Laws are:

A robot may not injure a human being or, through inaction, allow a human being to come to harm.

A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law.

A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

Since I’m referencing Wikipedia verses presenting any original thought, I might as well continue: (reference: http://en.wikipedia.org/wiki/Robot)

A robot is a mechanical or virtual agent, usually an electro-mechanical machine that is guided by a computer program or electronic circuitry. ... Robotics is the branch of technology that deals with the design, construction, operation, and application of robots, as well as computer systems for their control, sensory feedback, and information processing.

In summary, a machine can be a robot, a robot can be a machine, a robot can be virtual.   I agree with the poster who said it would be several doctoral programs defining the difference.   :)

ContentLicense: CC BY-SA 3.0


问:
Inconsistent results between Simulink derivative model and tf for PD controller
I'm designing a PD controller so that the response due to unit step should exhibit an overshoot of 20% and steady-state error less 0.01. I've computed the parameters Kp and Kd and double-checked the result based on root locus design approach. This is the Simulink for a PD controller where kp=7130 and kd=59.388.

and the result is

I've computed the closed-loop pole  $-38.694+75.5266j$ at the gain kd via another Matlab's script I've written. Matlab shows same closed-loop pole shown below

which agrees with my calculation for kd. The block diagram for the preceding system is

Now, I would like to use stepinfo() to obtain the performance of the system, hence:

```<code>clear all
clc
kp=7130;
kd=59.3880;
num=[kd kp];
den=[1 (kd+18) (kp+72)];
F=tf(num,den);
step(F)
stepinfo(F)
</code>```

which yields this information (i.e. obviously wrong)

```<code>    RiseTime: 0.0133
SettlingTime: 0.0910
 SettlingMin: 0.9182
 SettlingMax: 1.2584
   Overshoot: 27.1141
  Undershoot: 0
        Peak: 1.2584
    PeakTime: 0.0321
</code>```

Why tf yields different results in comparison with Simulink.

Matlab's documentation shows no benefits info regarding this issue.

答:
I think you're having trouble in your block diagram reduction. I (ironically) don't actually have the control system toolbox, but consider the following maths:

Your starting equation:

$$
\boxed{K_p + K_ds}\rightarrow \boxed{\frac{1}{\left(s+6\right)\left(s+12\right)}}
$$

You can "rephrase" your $K_p$ as $\left(K_p\left(\frac{\frac{1}{K_p}}{\frac{1}{K_p}}\right)\right)$, which reduces to $\frac{1}{\frac{1}{K_p}}$.

It looks almost like instead of multiplying the denominator by $\frac{1}{K_p}$ that you're instead just adding $K_p$ to the denominator. Then I think that things are further complicated by not distributing; it looks like you're applying the $K_p$ term to your plant, then taking that result and multiplying that by the $K_d$ term.

To put it a little clearer, it looks like you're doing something like:

$$
\boxed{A + B}\rightarrow\boxed{C}\\
\boxed{B}\rightarrow\boxed{AC}\\
\boxed{BAC}\\
$$

when the right answer should actually be the distributed:
$$
\boxed{A+B}\rightarrow\boxed{C}\\
\boxed{\left(A+B\right)\left(C\right)} \\
\boxed{AC + BC}\\
$$

So, starting out with rephrasing the proportional gain:
$$
\boxed{\frac{1}{\frac{1}{K_p}} + K_ds}\rightarrow \boxed{\frac{1}{\left(s+6\right)\left(s+12\right)}} \\
$$

Then distribute the terms:

$$
\boxed{\left(\frac{1}{\frac{1}{K_p}} + K_d s\right) \left(\frac{1}{\left(s+6\right)\left(s+12\right)} \right)} \\
$$

(I'll drop the boxes from here)

$$
\frac{1}{\frac{1}{K_p}}\left(\frac{1}{\left(s+6\right)\left(s+12\right)} \right) + K_d s \left(\frac{1}{\left(s+6\right)\left(s+12\right)}\right)  \\
$$

Notice here that the left term is modifying the denominator, but the right term isn't. You need common denominators to add numerators, so you'll have to modify the right term by the same $\frac{\frac{1}{K_p}}{\frac{1}{K_p}}$:

$$
\frac{1}{\frac{1}{K_p}}\left(\frac{1}{\left(s+6\right)\left(s+12\right)} \right) + K_d s\left(\frac{\frac{1}{K_p}}{\frac{1}{K_p}}\right) \left(\frac{1}{\left(s+6\right)\left(s+12\right)}\right)  \\
$$

Distribute the $K_d s$:

$$
\frac{1}{\frac{1}{K_p}}\left(\frac{1}{\left(s+6\right)\left(s+12\right)} \right) + \left(\frac{K_d s\frac{1}{K_p}}{\frac{1}{K_p}}\right) \left(\frac{1}{\left(s+6\right)\left(s+12\right)}\right)  \\
$$

A crude cleanup now to combine terms:

$$
\frac{1}{\frac{1}{K_p}}\left(\frac{1}{\left(s+6\right)\left(s+12\right)} \right) + \left(\frac{\frac{K_d}{K_p}s}{\frac{1}{K_p}}\right) \left(\frac{1}{\left(s+6\right)\left(s+12\right)}\right)  \\
$$
$$
\frac{1}{\frac{1}{K_p}\left(s+6\right)\left(s+12\right)} + \frac{\frac{K_d}{K_p}s}{\frac{1}{K_p}\left(s+6\right)\left(s+12\right)}  \\
$$

$$
\frac{1+\frac{K_d}{K_p}s}{\frac{1}{K_p}\left(s+6\right)\left(s+12\right)}  \\
$$

Now you have it in a non-standard form because the $s$ in the numerator has a coefficient that's not $1$, so get it to one by:

$$
\left(\frac{\frac{K_p}{K_d}}{\frac{K_p}{K_d}}\right)\left(\frac{1+\frac{K_d}{K_p}s}{\frac{1}{K_p}\left(s+6\right)\left(s+12\right)}\right)  \\
$$

Then that reduces to:

$$
\frac{s+\frac{K_p}{K_d}}{\frac{1}{K_d}\left(s+6\right)\left(s+12\right)}  \\
$$

I compared step results from your original and the above and they're similar, but not quite exactly the same. As I mentioned, I can't use the tf functions, etc. in Matlab, but hopefully this helps you out!


问:
Position Estimates from sensor fusion
I have a quadcopter, and several components in play.  First, I have a real position system (VICON), and I also have a SLAM platform.  Then, of course, the IMU on the quadcoptor.  I am trying to implement my control system which is heavily dependent on VICON to be dependent on the SLAM data instead.

My SLAM data is not as accurate as the VICON nor are its update as timely.  (ie: VICON 100hz, SLAM 1hz on a Pi, 10hz on a laptop).

What I am trying to do is estimate my position using the on-board IMU data.  Using an EKF, I would like to then use the SLAM data for the correction step.  My hope is that somewhere between the two of these I can get a reasonable position to fly (and map with).

Where I am having some trouble is figuring out how to use the sensors to estimate some kind of position.  My thinking is I will take that into my EKF for the estimation step.

Appreciate any insight into accomplishing this goal.

答: Usually SLAM needs some kind of a localization to build the map. I'm not clear what kind of a method you are using for SLAM. But for your question, you can estimate the position from your IMU measurements. Usually state vector for a quadcopter contains x,y,z position data and roll,pitch and yaw. Inserting angular rates or linear velocities is optional. I assume you have a basic knowledge on EKF. You can calculate the state transition matrix using your state matrix. Accelerations can be inserted to the control input matrix. </p>

Title: Position Estimates from sensor fusion


答: A machine is just a device which is defined to do a particular task whereas a robot can execute any task given to it through programming</p>

Body:
What is the difference between a Robot and a Machine? At what point does a machine begin to be called a robot?

Is it at a certain level of complexity? Is it when it has software etc?.

For instance: A desktop printer has mechanics, electronics and firmware but it is not considered a robot (or is it). A Roomba has the same stuff but we call it a robot. So what is the difference.

I have always believed that a robot is a robot when it takes input from it's environment and uses it to make decisions on how to affect it's environment; i.e. a robot has a feedback loop.


问:
Can somebody explain how these forward kinematics matrix equations were formulaed?

Here's the link to the entire answer:
Designing a 5 bar linkage robot: Plot Clock

答:
It looks (to me) like there's a typo in that answer. The approach is to recognize that you have to wind up at the same point, whether you get there via the left arm (d->e->blue dot) or the right arm (a->b->c->blue dot).

This means that you can go:

$$
\Sigma_{x_{\mbox{left arm}}} = \Sigma_{x_{\mbox{right arm}}} \\
\Sigma_{y_{\mbox{left arm}}} = \Sigma_{y_{\mbox{right arm}}} \\
$$

The "middle linkage" $a$ is horizontal and there's no angle given for it, but if we suppose the angle of $a$ is $\theta_0$, and that $\theta_0 = 0$, then you can do:

$$
\Sigma_{x_{\mbox{left arm}}} = d\cos{\theta_1} + e\cos{\alpha}\\
\Sigma_{x_{\mbox{right arm}}} = a\cos{\theta_0} - b\cos{\theta_2} -c\cos{\beta}\\
$$

I'll point out that the minus signs in there are because of the angle definitions - $\theta_1$ is defined "conventionally," starting at 0=right and getting positive counter-clockwise, where $\theta_2$ is defined opposite - starting at 0=left and getting positive clockwise.

You can define the points for vertical closures:

$$
\Sigma_{y_{\mbox{left arm}}} = d\sin{\theta_1} + e\sin{\alpha}\\
\Sigma_{y_{\mbox{right arm}}} = a\sin{\theta_0} + b\sin{\theta_2} + c\sin{\beta}\\
$$

Since we're assuming $\theta_0 = 0$, you can simplify $a\cos{\theta_0} = a$ and $a\sin{\theta_0} = 0$, you you're left with:

$$
\left[\begin{array}{ccc}
d\cos{\theta_1} + e\cos{\alpha} \\
d\sin{\theta_1} + e\sin{\alpha} \\
\end{array}\right] = \left[\begin{array}{ccc}
a - b\cos{\theta_2} -c\cos{\beta} \\
b\sin{\theta_2} + c\sin{\beta} \\
\end{array}\right]
$$


问:
Driving the iRobot Create 2 straight
I am attempting to make the iRobot Create 2 drive in a straight line using the opcode 137 with the parameters specified in the OI documentation. "Straight = 32768 or 32767 = 0x8000 or 0x7FFF" I have tried both of these parameters, but the robot always veers to the right as it moves forward. I've verified that my byte order is correct.

Is this expected behavior or is there an issue with my unit? Is there a way to get the robot to drive straight? I've also tried the DriveDirect command with various speeds to the two motors with no luck there either. I've read a bit about PID control, but was hoping that was already implemented in the firmware since I've not done PID control before.

The platform that I'm using is a Raspberry PI running Windows 10 IoT Core and a .NET application. I've also tried from a direct serial connection on a Windows Desktop and an Arduino. All of these give me the same results.

答:
I'm using a different controller but here is what I send for a forward command to drive straight

137,0,150,127,255

Title: Driving the iRobot Create 2 straight


答:
Try aleternating 32768 between 32767, it worked for me.

Measure the time or distance of how long it stays straight using only 1 opcode.

Loop through the 2 different codes letting each opcode run less time or distance than it takes for it to start curving.

Title: Driving the iRobot Create 2 straight

Body:
I am attempting to make the iRobot Create 2 drive in a straight line using the opcode 137 with the parameters specified in the OI documentation. "Straight = 32768 or 32767 = 0x8000 or 0x7FFF" I have tried both of these parameters, but the robot always veers to the right as it moves forward. I've verified that my byte order is correct.

Is this expected behavior or is there an issue with my unit? Is there a way to get the robot to drive straight? I've also tried the DriveDirect command with various speeds to the two motors with no luck there either. I've read a bit about PID control, but was hoping that was already implemented in the firmware since I've not done PID control before.

The platform that I'm using is a Raspberry PI running Windows 10 IoT Core and a .NET application. I've also tried from a direct serial connection on a Windows Desktop and an Arduino. All of these give me the same results.


问:
What is the definition of `rollout' in neural network or OpenAI gym
I'm relatively new to the area. I run into several time the term ``rollout'' in training neural networks. I have been searching for a while but still not sure what it means.

For example, the number of rollout for running the hopper environment. I'm not sure what it means.

答:
The standard use of “rollout” (also called a “playout”) is in regard to an execution of a policy from the current state when there is some uncertainty about the next state or outcome - it is one simulation from your current state. The purpose is for an agent to evaluate many possible next actions in order to find an action that will maximize value (long-term expected reward).

Uncertainty in the next state can arise from different sources depending on your domain. In games the uncertainty is typically from your opponent (you are not certain what move they will make next) or a chance element (e.g. a dice roll). In robotics, you may be modeling uncertainty in your environment (e.g. your perception system gives inaccurate pose estimates, so you are not sure an object is where you think it is) or your robot (e.g. noisy sensors result in unreliable transition dynamics).

I think the term comes from Tesauro and Galperin NIPS 1997 in which they consider Monte Carlo simulations of Backgammon where a playout considers a sequence of dice rolls:

In backgammon parlance, the expected value of a position is known as
  the "equity" of the position, and estimating the equity by Monte-Carlo
  sampling is known as performing a "rollout." This involves playing the
  position out to completion many times with different random dice
  sequences, using a fixed policy P to make move decisions for both
  sides.

As you could imagine, this can be quite computationally expensive. A lot of tricks have been developed to make this faster/more efficient. For example, AlphaGo uses a simpler classifier for rollouts than in the supervised learning layers. This results in rollout policies that are considerably less accurate than supervised learning policies, but, they are also considerably faster, so you can very quickly generate a ton of game simulations to evaluate a move.

The Second Edition of Sutton and Barto’s famous textbook on reinforcement learning has a full section just about rollout algorithms (8.10), and also more information on Monte Carlo sampling and Monte Carlo Tree Search (which has a strong simulation component). You can find a draft version here.


问:
Mathematical prerequisites for beginning graduate student in robotics
A beginning graduate student in robotics asked me the areas of mathematics that he should brush up on (prerequisites) to begin a masters research program in robotics. What are some good materials/books that are indispensable for a research student? Which ones should we suggest in order that the student develops a solid foundation in robotics?</p>

答:
Other answers are correct: It depends on where you are focusing, and what your topic will be. However, there are some common themes. I would say that a minor in mathematics from a decent university should cover the bases.

I would strongly recommend the following, based on my experience:

Linear Algebra, at least one or two semesters. Plan on taking refresher courses and specializing if necessary. Because robots operate in the world, and the world is defined by coordinate frames, knowing something about matrix multiplication, inverses, rank, affine and projective transformations, etc is extremely helpful.

Calculus, at least 3 semesters.

Some numerical analysis, because robots use computers.

Probabilities and Statistics, at least 1 semester, though this is becoming increasingly important

For my subfield (Algorithmic Robotics), the following things are very helpful:

Algorithms and Data Structures, at least 2 semesters

Formal Theory of Computation (Hardness and mappings of problems), at least one semester

Matrix Theory, (another semester of a specialized linear algebra)

Discrete Math (graphs, counting and enumueration), at least 1 semester,


问:
Reachable Position with endeffector robotic arm
I have a 7 DOF robotic Arm. All the 7 Joints are rotational and have upper and lower joint angle limits. Now assume my end effector has a certain Pose $x = [X, Y, Z, a, b, c]$.

My Question now is how to calculate the maximal reachable $X$ Position if all other Parameters $(Y, Z, a, b)$ remain the same assuming certain $q_{lower}$ and $q_{upper}$ joint limits.

I know how to do that for differential kinematics: $dx_{max} = J * dq_{max}$ ($J$ is Jacobian Matrix and $dq_{max}$ is the max. angle velocity of the joints).

答:
One possible way to use the inverse kinematics equations. For obtaining the inverse kinematics equations you can either use the Jacobian matrix or the geometric approach.

For a robotic arm that has 3 DOF using the geometric approach is easier. But since your robot has 7 DOF, you should use the Jacobian Matrix. Please refer to the link below.

Computing the Jacobian matrix for Inverse Kinematics

Once you have the inverse kinematics equations, keep the $(Y,Z,a,b)$ parameters constant and vary the $X$. When you exceed the maximum reachable $X$, the result of the inverse kinematics equation will become a complex number in the form of $a\pm jb$.

Another way would be a more visual method. You can simulate the robot arm and mark the end effector positions as you vary the joint angles. The unreachable points will not appear in the generated plot. For example see the following 2 DOF (R-R) robot arm:

Obviously the smaller step size will give you higher accuracy. See the following 3 DOF (R-R-P) robot arm.


问:
Pnumatic sulinoid with multiple outputs
I can't figure out what solenoid I would use. Everything I search for comes up with cylinders. Not sure if it's even a sulinoid that I need.

I'd like to have 8 hoses connected to a compressor. I'd like to control which hose releases air to push something off a conveyor belt. Like the image below.

答:
You are searching for the wrong thing.

This is a solenoid

This is what you want, a solenoid operated valve.

Title: Pnumatic sulinoid with multiple outputs


问:
How to protect the milk in a homemade vending machine?
I am working on a homemade vending machine project that serves milk and cookies, using arduino and some basic servos and stuff.

The problem is: I really have no clue on how to protect the milk to last long, or how to even know if the milk is still ok to drink.. All I really know is that air is bad for the milk (and the cookies), so here is what I came up with:

Two solenoids that activates at the same time, to allow air in, and milk out. All of this should be inside a "slightly" colder place.

I'm sure this design might sound stupid to some of you, but this is where I need your help please, do you think this design can work ? (Would that solenoid on top make any difference to protect milk?) How to improve it to make the milk last as long as possible ?

I'v heard about the big guys making machines that keep milk fresh for weeks even months, while i'm probably sure my milk won't stand a couple of hours..

Any idea or any information, link, or clue would be greatly appreciated. Thank you.

答:
Milk is readily available in plastic bags inside cardboard boxes, as illustrated in the picture below of part of a cafeteria-style milk dispenser.  Flow of milk is controlled by pinching off the white plastic tube that comes out of the bottom front edge of the box.  To resupply the machine, you get a new box of milk from a larger refrigerator, rip open a tab and pull out the white tube, put the box into the dispenser, thread the tube through the pinch-off, then cut off the seal at the bottom end of the tube.

Using a readily available commercial product like this probably would be a better approach than having to clean and refill a tank like that shown in your picture.

Picture source: hurstgreenplastics.com


问:
Question about Lens distortion
Suppose I have a 240x180 camera with the following distortion co-efficients,

$$k_1 = -0.138592767408$$
$$k_2=0.0933736664192$$
$$k_3=0.0$$
$$p_1=k_4=-0.000335586987532$$
$$p_2=k_5=0.000173720158228$$

The camera center is given to be

$$u_0 = 129.924663379$$
$$v_0 = 99.1864303447$$

And the distortion formulae are

$$r^2=(u-u_0)^2+(v-v_0)^2$$

$$
\begin{align}
  \begin{bmatrix}
    u_d\\
    v_d
  \end{bmatrix} = & (1+k_1r^2+k_2r^4+k_3r^6)
  \begin{bmatrix}
    u-u_0\\
    v-v_0
  \end{bmatrix} + \\
& \begin{bmatrix}
    2k_4(u-u_0)(v-v_0)+k_5(r^2+2(u-u_0)^2)\\
    k_4(r^2+2(v-v_0)^2+2k_5(u-u_0)(v-v_0)
  \end{bmatrix} +
  \begin{bmatrix}
    u_0\\
    v_0
  \end{bmatrix}
\end{align}
$$

In the above formulae, $p_1=k_4$ and $p_2=k_5$, $u$ and $v$ are the undistorted co-ordinates and $u_d$, $v_d$ the corresponding distorted ones.

My understanding of the undistorted co-ordinates is that it is a mapping of every undistorted co-ordinate to a distorted one. Therefore, the ranges of both undistorted and distorted co-ordinates should be between (0-240, 0-180). However, going by the above formula, I get extremely high numbers for distorted co-ordinates if I input undistorted co-ordinates in the range(0-240, 0-180) which goes against this understanding. Have I done something wrong here?

答:
Hmm. Have you check the indices used in your code? Simple bugs like swapping i and j happen all the time for rows/columns.

Perhaps its a Hardware issue involving Little Endian vs BIG ENDIAN. in 8 bit 64=64 but 16 BIT 64 is swapped to highorder thus theres rotation in bit order results that the single bit 64 is represents as 256*64 the 256 comes from 2^8

Title: Question about Lens distortion


问:
Which algorithms to locate a static 3D object relative to a moving camera/IMU?
I am using typical setup with camera and IMU as found on a smartphone. Using this, I would like to estimate the relative pose between the camera and an object (for simplicity, let's say a cube). The series of measurements contain motion around the object, so a monocular visual-inertial dataset.

Now, related to this usecase I have two questions:

Which state-of-the-art algorithms would commonly be used to solve such a problem?

What's a realistic accuracy that could be achieved? (just a rule-of-thumb)

答:
You need a SLAM to track the object location.

There are some available resources on visual-inertial SLAM. To name some of them, okvis, svo2, orb-slam2 and so on.

If you hire a good slam, error will be less than 10cm.


问:
Arduino based quadcopter flipping problem
I have built an Arduino DUE based quadcopter and I am using HC-12 as a transmitter and receiver between my laptop and the quadcopter. What am I doing is just send a speed value from my laptop and apply that value to all the quadcopter motors wirelessly.
The problem is my quadcopter is flipping while trying to go up. Watch this video here to get an idea of what I mean. I had tried to make the quadcopter balanced and I got the same problem. By the way, I tried to change the motors and tried many ways to balance it and to make the center of gravity in the center of the quadcopter but I faced the same problem of flipping.
I need to make the quadcopter go up normally without control and flipping just by giving the value of the motors speed from the laptop without RC.

Edit: Now I rebuilt it and recalibrated the ESCs after that, I got this result. My quadcopter seems to be hovering from 3 sides and the last one can't hover for the same speed. I tried to increase the speed of that motor and change the motor but I got no difference.

答:
Quadrocopter is nowhere near to normal RC airplane, where balancing can help a lot with stability. You'll need to utilize at least PID controller to keep your multirotor steady.

I guess you don't have much experience with quadrotors whatsoever, therefore I'd suggest you to use an integrated flight controller, i.e. this one. Mind that, when building such device, you will surely need much more knowledge and experience in electronics and software engineering to get satisfying flight results.


问:
What is the difference between Kinect for Windows and Kinect for XBox?
As I see there is a huge price gap between the two \$223 vs \$99 (at amazon).

My intention is to use one of those from Ubuntu linux to perform depth sensing, navigation etc. and naturally I prefer the cheaper.
However I am not sure if I miss some important point while betting on the Kinect for Xbox version.

As it seems the Windows version is overpriced because it has the license for development. Here it is stated that there are internal differences but without exact details (The minimum sensing distance seems to be better for Windows version.).

Could anyone give a comparison chart?
It would be good to know about

Connectivity: USB, special connector, ... .

Hardware differences: are they the same or do they really differ in weight, energy consumption, speed, sensing range, ...?

Driver: could I use Xbox version under Ubuntu?

API usage: could I develop on Xbox version, could I use the same/similar API on both, is the API for Xbox mature enough?

License: is it against the license of Xbox version to develop for home/hobby/educational use?

Thanks.

答: You can forcefully disable IR light for Kinect for Windows (by using the property ForceInfraredEmitterOff) which you cannot do for xbox Kinect. This feature is very useful when using multiple Kinect sensors because when their FOVs overlap, some serious issues arise.


问:
project to create a lighter wall
We are working in a project to help blind people cross the street alone .so ,Can I create a Virtual reality wall or a holographic 3d one that is visible in the Street and in all day times ?? ( morning ..)I mean is it doable ?and how ?? And if someone is expert in those things please tell me because I have some other question and big thanks in advance .</p>

答:
I've seen your previous question about projecting lights on the street using lasers. Well I guess its possible if you are willing to use holographic image projectors.
And incase of virtual reality you can create identical environment of the real world and add walls where it's necessary, google 360 image has all the pictures of our surrounding, their technology is capable of producing identical virtual world for the (NIGHT ) blind people who cant see in low light.

And I have thought about moving objects , specially transports, cars, buses, etc. The augmented world you will create will have  gps that tracks cars, if not possible for all the car, the driver whose carrying or the passengers have cell phones which has GPS in it can notify the blind people about the moving object because the gps in always working.

It's just a concept, you cant build a project with your own hands but if you are participating in any competition you use this concept by developing this core concept. I Hope it helps. Thanks IN ADVANCE ! and the answer is yes. Possible

Title: project to create a lighter wall


问:
Inverse kinematics with end effector orientation?
I'm trying to implement an inverse kinematics solver, but this time even with the end effector's orientation. I succeeded with the case when the end effector only requires the position.

I learned that in this case, you can construct the Jacobian Matrix like this, where $w_i$ is the $i^{th}$ rotation axis in global space and $p_i$ is the vector from the $i^{th}$ axis to the target position.

The problem is when I have to calculate the $\dot{x}$ here in the equation below.

$$
J \dot \theta = \dot x
$$

When $\dot{x}$ had only positions to take into account, and no orientations this was quite simple, since the $\dot{x}$ vector was calculated as (target_location - current_end_effector_location) * (delta_time = 0.01).
But now when $\dot{x}$ requires 6 entries (position, orientation), I don't know what I should do for the orientation part. I've been using euler angles for representing orientation in my program until now.

The idea I've got at the moment is just subtracting current end effector's yaw, pitch, and roll with the target's yaw, pitch, and roll, and multiplying each result with $\Delta t$. But this seems a bit complicated and not right. Are there any better ways to address this issue? Any ideas would be highly appreciated!

In case it helps, the forward kinematic map looks like this (T stands for the translation matrix relative to parent node)

```<code>(x,y,z) = Root_T * Shoulder_T * Shoulder_Rx(q_0) * Shoulder_Ry(q_1) *
    Shoulder_Rz(q_2) * Elbow_T * Elbow_Rx(q_3) * Hand_T * Hand_Rx(q_4) * Position
</code>```

答:
The same as for positions, the angular components of $\dot x$ are angular velocities.

Expressing them as motion difference over time is generally correct. The unit of measurment in this case needs to be rad/s.

The other problem can come from the how the rotations are expressed. There are many conventions on how rotations can be expressed and Euler angles are also ambigous (if not further specified).  However, from the formulation of $J$ it seems that you should use angular velocities arount the fixed reference frames, so extrinsic Euler Angles. The rotation order should be x, y, and z as far as I can tell from the forward kinematic map you have posted.


问:
ROS: catkin_make vs. catkin build
When using ROS:

Why should I use catkin build from catkin_tools instead of catkin_make?

I've been told that catkin build is better but no one who tells me this can give me a reason why.

答:
The main difference is the isolated environment that you get with catkin build. This makes the whole build configuration much more compartmentalized and robust to changes in the configuration (add/remove package, modify a cmake variable etc.)

Apart from that you also get much better and easily-readable colored cmdline output which makes the whole experience much more pleasant.

@SteveO's link also gives a nice summary of the changes between the tools.

Adding to catkin build you also get many other useful subcommands with catkin including catkin clean for cleaning the build, devel and install spaces, as well as catkin list , catkin locate, catkin profile

Title: ROS: catkin_make vs. catkin build


答: If the three wrist axes intersect at a common point, your problem can be simplified using wrist partitioning.  With this method, you compute the inverse kinematics to the wrist center (also the intersection point of the three wrist axes).   These equations will not involve the wrist angles - they only require you to use the position vector.   Once you have that, you can solve for the inverse wrist angles using only the relative angles between the end effector frame and the forearm frame.   These equations will not have any terms that include the arm rotations.

Title: Inverse kinematics with end effector orientation?

Body:
I'm trying to implement an inverse kinematics solver, but this time even with the end effector's orientation. I succeeded with the case when the end effector only requires the position.

I learned that in this case, you can construct the Jacobian Matrix like this, where $w_i$ is the $i^{th}$ rotation axis in global space and $p_i$ is the vector from the $i^{th}$ axis to the target position.

The problem is when I have to calculate the $\dot{x}$ here in the equation below.

$$
J \dot \theta = \dot x
$$

When $\dot{x}$ had only positions to take into account, and no orientations this was quite simple, since the $\dot{x}$ vector was calculated as (target_location - current_end_effector_location) * (delta_time = 0.01).
But now when $\dot{x}$ requires 6 entries (position, orientation), I don't know what I should do for the orientation part. I've been using euler angles for representing orientation in my program until now.

The idea I've got at the moment is just subtracting current end effector's yaw, pitch, and roll with the target's yaw, pitch, and roll, and multiplying each result with $\Delta t$. But this seems a bit complicated and not right. Are there any better ways to address this issue? Any ideas would be highly appreciated!

In case it helps, the forward kinematic map looks like this (T stands for the translation matrix relative to parent node)

```<code>(x,y,z) = Root_T * Shoulder_T * Shoulder_Rx(q_0) * Shoulder_Ry(q_1) *
    Shoulder_Rz(q_2) * Elbow_T * Elbow_Rx(q_3) * Hand_T * Hand_Rx(q_4) * Position
</code>```


问:
Will a change of motor driver improve motor performance?
I have this motor, from datasheet it works on the 6-12V range and has a no load current of 0.52A, and a stall current of 20A. I want to test the motor before buying an expensive motor driver.

I have an L298N H bridge at home and a mbed microcontroller. I am using the mbed to generate the PWM control signal.

So far, I cannot get the motor to move. I have tried several PWM frequencies, from 50Hz to hundreds to 2kHz and higher.

With frequencies between 100-2kHz I get a buzz as I increase the PWM duty cycle but the motor doesn’t move.

The L298N has a max current of 2A per channel, so I was wondering that maybe it is not enough to start moving the motor. This motor is not high end quality but is very powerful.

My question is: Can I expect a better performance if I change the motor driver to one with more current output?

Edit 1

To clarify my problem I uploaded a video to YouTube https://youtu.be/7ZT4wXyWSXA.

I could not move the big motor so I moved to a smaller one. The yellow one in the video.

As I increase the PWM duty cycle the buzz increases but the motor does not move.

At some point the motor starts to move but at a very high speed to be taken as the initial speed.

If I decrease the PWM duty cycle the motor keeps moving. I think is because is has some inertia, so now it’s easy to move even at low speeds.

At some point the motor stops.

How can I make the motor move from beginning at low speeds?

Can a different motor driver improve the PWM performance?

答:
If you want to test the motor, just apply a DC source to it directly rather than using the l298.

A 12V car battery is a source you likely have access to that can supply enough current so you can test the torque and speed.

Regarding the pwm control, you need to have sensor feedback. Then you will be able to use a control algorithm to, in effect, sense when the voltage, as created by the pwm, has overcome motor inductance to generate enough current to create enough torque to break the static friction and then continuously adjust the pwm to accelerate and then maintain the velocity of the output to be what you want.


问:
What is the best way to turn in 2WD simple differential drive line following robot?
I've used 4 sensors & a standard smart robot chassis kit with geared motors & L298 motor driver.

What is the difference between turning in:

One wheel stopped, one wheel moves.

Both wheels moves, but in opposite direction.

What is the best way to go in a curve?
What is the best way to turn 90°?

答:
Your question is a little bit fuzzy. You achieve different results with these two turning scenarios.

If you keep one wheel stopped the the radius of the curve (turn) you make equals the robot width and your turning point is the stopped wheel, while when you move both the wheels with opposite but same velocity (rpm) then you achieve a maneuver with 0 radius, turning in place, and also the turning point is the center of the robot.

In the first case the curve you make is more smooth, while in the second is more "aggressive".

In the end what matters is what you want the robot to do, and the shape of the curve you want to follow.

Maybe this paper, Design of a Differential-Drive Wheeled Robot Controller withPulse-Width Modulation - Farshad Arvin, Khairulmizam Samsudin, and M. Ali Nasseri, could be of some help.


问:
Control a DIY Robot Arm Kit Educational Robotic Claw Set with ROS
I've just started robotics and ROS and I wondering if I can control a DIY Robot Arm Kit Educational Robotic Claw Set (I think its motherboard is arduino).

You can find the kit here.

Can I use ROS to control such kind of kits?

答:
The answer is a resounding 'yes'. Check out this ROS package here.

You'd have to get a little creative with your code to control all of your servos, but I think you're good to go.

Good luck!


问:
Forward kinematics: Findling the positions of points on lynx robot
I have a task to find position of 5 points on lynx robot. I need to write below function. This function takes theta values as input.

function [ pos ] = lynx_fk( theta1, theta2, theta3, theta4, theta5 )

I have also given the kinematics chain to decode a(r), alpha and d values.

I have already written a function which computes the dh matrix, which is as follows.

function A = compute_dh_matrix(r, alpha, d, theta).

Now i'm confused on how to find the positins of points?
My approach is: From the DH matrix i have to extract the values of translation vector(A[1,4], A[2,4] and A[3,4]).

Plese comment and correct my approach.

Thanks for your time.

答:
it is hard to answer since you did not specify the 5 points you are looking for.

The DH Matrix is a transformation matrix between two coordinate systems. If you are looking for a point on a rigid body, you should identify the DH transformation chain leading to the coordinate system associated with that rigid body. I.e. if you are looking for the coordinates in world frame of the center of mass on linkage 3, you should identify the chain of transformation matrices from the world frame to linkage 3:

$A_{03}= A_{01} \times A_{12} \times A_{23}$

Next you will need the vector pointing from the frame asociated with linkage 3 to the center of mass:

$ v_{CoM} =  [x_{CoM}, y_{CoM}, z_{CoM}]$

The coordinates of the center of mass in World frame will be:

$$
\left[
\begin{array}{c @{{}={}} c c @{{}+{}} c c}
 v_{CoM}^{world} \\
 1
\end{array}
\right]= A_{03} \times
\left[
\begin{array}{c @{{}={}} c c @{{}+{}} c c}
 v_{CoM} \\
 1
\end{array} \right]
$$

or expanded:

$$
\left[
\begin{array}{c @{{}={}} c c @{{}+{}} c c}
x_{CoM}^{world} \\
y_{CoM}^{world} \\
z_{CoM}^{world} \\
 1
\end{array}
\right]= A_{03} \times
\left[
\begin{array}{c @{{}={}} c c @{{}+{}} c c}
x_{CoM} \\
y_{CoM} \\
z_{CoM} \\
 1
\end{array} \right]
$$

iff $v_{CoM} = [0, 0 ,0]$ you can take the elements of the last column of the transfromation matrix directly.


答: If you are concerned about the milk coming in contact with the air. I'd suggest using a plastic bag which the air from the first solenoid pours into. On expansion, the plastic bag(filled with air) will force the milk in the container to push out through the second solenoid. This way doesn't come in contact with milk. The only problem I see, which would compromise the milk, is any leaks in the bag itself. And another problem would that you'll have to find a way to drain that air in the plastic bag once all the milk is out.</p>

Title: How to protect the milk in a homemade vending machine?

Body:
I am working on a homemade vending machine project that serves milk and cookies, using arduino and some basic servos and stuff.

The problem is: I really have no clue on how to protect the milk to last long, or how to even know if the milk is still ok to drink.. All I really know is that air is bad for the milk (and the cookies), so here is what I came up with:

Two solenoids that activates at the same time, to allow air in, and milk out. All of this should be inside a "slightly" colder place.

I'm sure this design might sound stupid to some of you, but this is where I need your help please, do you think this design can work ? (Would that solenoid on top make any difference to protect milk?) How to improve it to make the milk last as long as possible ?

I'v heard about the big guys making machines that keep milk fresh for weeks even months, while i'm probably sure my milk won't stand a couple of hours..

Any idea or any information, link, or clue would be greatly appreciated. Thank you.


答:
the answer for this kit is most likely yes, has it has standards servos and arduino board so the drivers already exit.

ROS can be used with arduino board with the rosserial package, which contains a library for servos.

You will need to update the code on your arduino accordingly to your need in order to be able to have control over ROS on a remote machine.

Title: Control a DIY Robot Arm Kit Educational Robotic Claw Set with ROS

Body:
I've just started robotics and ROS and I wondering if I can control a DIY Robot Arm Kit Educational Robotic Claw Set (I think its motherboard is arduino).

You can find the kit here.

Can I use ROS to control such kind of kits?


问:
3 arm robotic claw
I am attempting to design a 3 prong robotic claw for a robotic arm I am working on. I am planning to use sg90 servo motors, but I can't get my current design to work. My current layout is to use one servo motor on a pulley system. The servo motor rotates, which pulls fishing line connected to the end of the claw arms. This is supposed to pull the claws inward(as it does in theory), but the servo motor isn't strong enough to close it fully, and I don't have enough space in the head of claw to fit a larger servo motor inside of it. Is there a different gear system I could use to operate the arms?</p>

答:
You're probably going to need to use a different gear ratio to get the amount of torque you want.
You'll get more torque, but the hand won't be able to close as fast.
Learn more about gear ratios here. </p>

Title: 3 arm robotic claw


问:
Data Driven Modelling for Motor Position Control
I am trying to identify a plant model for a motor position control using MATLAB System identification toolbox.

If it is a speed control example the data set can be generated easily. In this a case it will be a set of pwm values and the corresponding speed values.

But what will be the input and output parameters for a motor position control? If I have a motor with an encoder and use different pwm values for generating data set, it will start to rotate continuously (or saturate if there is a mechanical stopper) after certain pwm values. Since my aim is to implement something similar to a hobby servo which has single rotation, this method is not useful.

The closest solution I found so far is given below

https://in.mathworks.com/company/newsletters/articles/motor-control-with-arduino-a-case-study-in-data-driven-modeling-and-control-design.html

But I don’t know how to modify this setup for a DC geared motor with encoder because it doesn’t have a mechanical stopper and motor will start to rotate continuously after certain PWM limits indata acquisition phase.

答:
System identification is used to model the system. A hobby servo has a built-in position regulator.

If the system you are using does not have a position regulator, then you can't expect the system identification to tell you how to make a position regulator, or how a position regulator works, or what inputs are needed to achieve a particular position. That's not what your system does.

It sounds like your system is a motor. Motors turn. You can use system identification to try to determine parameters of your motor like rotating inertia, response bandwidth/time constants, etc., but you're not going to get anything out of it relating to position or position regulation.

You can use the results of your motor identification to build a better position regulator, or you can try to build a position regulator first and include that in your system when you perform the system identification, but again that's not what your system currently does.


问:
information filter instead of kalman filter approach
I read many sources about kalman filter, yet no about the other approach to filtering, where canonical parametrization instead of moments parametrization is used.

What is the difference?

Other questions:

Using IF I can forget KF,but have to remember that prediction is more complicated link

How can I imagine uncertainty matrix turning into an ellipse? (generally I see, area is uncertainty, but I mean boundaries)

Simple addition of information in IF was possible only under assumption that each sensor read a different object? (hence no association problem, which I posted here

答:
The difference between kalman filter and information  filter arise in there Gaussian belief representation. In kalman filter Gaussian belief represented by their moments(mean and covariance). Information filters represent Gaussians in their canonical representation, which is comprised of an information
matrix and an information vector.   </p>


问:
WHY are there no operating torque specifications on steppers?
I have been looking online for a while, and I cannot seem to find any steppers without any torque ratings. (Operating torque, not holding torque.) I even looked on hobby sites that usually have all the ratings, including Adafruit and Sparkfun. I only have found one ever that said the operating torque, however, it didn't seem that reputable and it didn't have holding torque, so it might be likely that it's a mistake. I might contact them and ask.

Am I missing something? Can I calculate what it will run at with certain factors? (How long in between each step, etc.)

The reason that I say that is I found a tutorial saying how much torque (didn't specify which kind, but I kinda assume it isn't holding) you need for a CNC machine (what I'm building).

Equation (From this site):

```<code>Torque = ((weight)(inches/revolution))/2(pi)
</code>```

Also on the page:

By the way, we are talking about torque during a continual turning motion, not at a holding position.

That seems like operating torque, but what makes it the most confusing is they sell steppers and they only list the holding.

What am I missing?

答:
I'm pretty sure that people at the place that manufactured your stepper motors did, in fact, write up a datasheet including operating torque specifications and lots of other information.

It is unfortunate that all too often a person ends up with some electrical part in his hand, and somehow the datasheet was lost along the way.
I've discovered that it's well worth the money to buy stuff from people who actually do supply good datasheets, rather than try to save a few nickles buying allegedly "the same" part from other people who can't be bothered to forward the datasheets they got from the manufacturer.

A few links to datasheets that list operating torque:

Torque curve for the KL23H251-24-8B

"Stepper Motor Operation and Theory": "Fig. 7-1 Speed - Torque Curve" gives a brief explanation of the speed-torque curve.

"Lin Engineering Catalog": "Reading a speed and torque curve" on p. 11 gives  a brief explanation of the speed-torque curve. The rest of the catalog has many speed-torque curves for particular motors.

torque curves for several Lin Engineering steppers

Pull out torque curve for the SY42STH47-1504A

Torque figures for Trinamic QSH4218 series(p. 7-8)

Pulse-torque characteristics of the 42BYGHW (several graphs of speed vs. torque, each one of the same motor connected to a different kind of motor driver).

Speed-Torque Characteristics of the Oriental Motor PKE245DA-L

As you can see from the above graphs, the torque at the maximum-mechanical-power part of the torque curve is very roughly half the "holding torque" (the torque when moving very slowly).


问:
Why is the contact force of the rigid-body robot model ks*xr?
In the paper "On Dynamic Models of Robot Force Control", which is written by Steven D. Eppinger and Warren P. Seering, there is a model 'rigid-body robot model'. The model is like below.

In the paper, the model is described as:

We model the robot as a mass with a damper to
  ground. The mass $m$,. represents the effective moving mass
  of the arm. The viscous damper $b_r$ is chosen to give the
  appropriate rigid body mode to the unattached robot. The
  sensor has stiffness $k_s$ and damping $b_s$. The workpiece is
  shown as a "ground state". The robot actuator is
  represented by the input force $F$ and the state variable $x_r$,
  measures the position of the robot mass.

In the paper, the contact force, which is the force across the sensor, is $F_c=k_s x_r$. But because the damping source from $b_s$ is also the part of the sensor, I think the contact force is $F_c =k_s x_r + b_s \dot{x}_r$. However because this paper and model are cited by many studies, I think I'm wrong. So, why $F_c=k_s x_r$?

PS : I wrote $f_s = k_s x_r$ previously. I modified that to $F_c = k_s x_r$.

答:
This paper is a thought experiment, using simplified models and mathematical analysis to try to gain some insight into the observed instabilities in real systems. As such they make simplifications as needed to fit the thought experiment.

I don't see any clear explanation for why they are not including the sensor damping force. Since this is a dynamic analysis I don't think it is an assumption of zero velocity. Rather, I think it reflects the simpleness of the model and the type of real-world sensors they were using in their other work.

The main thing to take away from this paper is to note that in the end they had no new ideas and no interesting results. The best use for this type of paper is to think about the problem they were trying to solve (induced instability during contact) and think about how you would approach it differently. Do you get better insight if you you use a more complex sensor model? Or is pole-zero analysis of a phenomena caused by abbe error, latency, and overly simplistic plant models not a great approach?


答:
Edited:

You should have put the subscript $c$ on variable $F$, because they define $F_c$ as the contact force the system is trying to maintain.   Since achieving and servoing around that desired contact force is the goal, the velocity at the target state will be zero.  Therefore $F_c = k_sx_r$.   You’ll find the damping terms in the dynamic model - they are in the denominator of the transfer function.

Note:  I see you added the subscript now.  Thanks.

Title: Why is the contact force of the rigid-body robot model ks*xr?

Body:
In the paper "On Dynamic Models of Robot Force Control", which is written by Steven D. Eppinger and Warren P. Seering, there is a model 'rigid-body robot model'. The model is like below.

In the paper, the model is described as:

We model the robot as a mass with a damper to
  ground. The mass $m$,. represents the effective moving mass
  of the arm. The viscous damper $b_r$ is chosen to give the
  appropriate rigid body mode to the unattached robot. The
  sensor has stiffness $k_s$ and damping $b_s$. The workpiece is
  shown as a "ground state". The robot actuator is
  represented by the input force $F$ and the state variable $x_r$,
  measures the position of the robot mass.

In the paper, the contact force, which is the force across the sensor, is $F_c=k_s x_r$. But because the damping source from $b_s$ is also the part of the sensor, I think the contact force is $F_c =k_s x_r + b_s \dot{x}_r$. However because this paper and model are cited by many studies, I think I'm wrong. So, why $F_c=k_s x_r$?

PS : I wrote $f_s = k_s x_r$ previously. I modified that to $F_c = k_s x_r$.


问:
Controlling the robot with joystick values
I struggling days with this problem :

I have joystick values 0~FF for each axis. So the higher this value, the faster the axis moves. I am trying to find a way to control a robot with these values.

For instance:

The 1. axis of the robot should move 50 cm into z-direction.
For this experiment there is not any feedback system from the robot. So we dont know how much the robot has moved with each joystick values. Will there be a solution for this given circumstance?

At first, I tried to solve this problem with a simulation model. After building a robot model, I could calculate the desired joint angle value changes for each axis with a IK solver. Then again, the problem is to convert the calculated joint angle value changes into joystick values. Since the robot is controlled with this values.

答:
Joysticks are good for velocity control.  Whether you control each joint independently, or control the end effector position using inverse kinematics, the process is the same:

Determine the maximum velocity the controlled variable can achieve.

Calculate the ratio of Maximum velocity divided by FF.

When a new command is issued, multiply its value by the ratio computed above to determine the new velocity command to send to the robot.


答:
What you are attempting to achieve is called Dead Reckoning.  Given the velocity at every instant in time and current position, one can calculate the new position by taking the integral of velocity with respect to time.  The relationship between position, time and acceleration is discussed here in a lecture note from uiuc.edu.

It is almost always better to use feed back to determine a new position. As any errors accumulate during these types of calculations.

Title: Controlling the robot with joystick values

Body:
I struggling days with this problem :

I have joystick values 0~FF for each axis. So the higher this value, the faster the axis moves. I am trying to find a way to control a robot with these values.

For instance:

The 1. axis of the robot should move 50 cm into z-direction.
For this experiment there is not any feedback system from the robot. So we dont know how much the robot has moved with each joystick values. Will there be a solution for this given circumstance?

At first, I tried to solve this problem with a simulation model. After building a robot model, I could calculate the desired joint angle value changes for each axis with a IK solver. Then again, the problem is to convert the calculated joint angle value changes into joystick values. Since the robot is controlled with this values.


问:
How to maintain a robot's center of gravity
I am on a robotics team where our robot has to balance on an unstable beam.  However, at the same time, the robot must be able to reach to the side in order to grab field materials.

What possible ways are there to help the robot maintain balance as an arm extends to one side of the beam?  Is there any specific linkage that could help work this?

答:
There are basically two approaches to this problem: You can solve it mechanically or through sensors/programming, or some combination of both.

jsotola's response offers several good mechanical approaches - clamping to the beam, lowering the center of gravity below the beam, etc. Exploit loopholes if you can; does the robot have to balance on top of the beam, or can it hang from underneath? But depending on the situation, purely mechanical options such as these might not be viable. Consider a Segway, or the Cubli in jsotola's answer. Neither of these have purely mechanical solutions to stay upright and balanced. How do they do it?

The answer is something called a PID Controller. For a balancing robot it basically works like this:

The balancing robot gets a sensor reading from a gyroscope/accelerometer sensor to "feel" if it is falling.

Based on how much the robot has tilted and how quickly it is falling, the PID formula figures out how forcefully the robot should respond. If the robot doesn't respond quickly enough it will fall, but it also can't respond too quickly or it may over-correct and fall the other way. By adjusting the constants in the PID formula you can make it output the proper amount of response for whatever amount of disturbance the robot detects.

Using the value from the PID, the robot adjusts its motors to arrest any unwanted tilting/falling.

The Cubli uses spinning weights to apply torque and balance on a corner.

A Segway makes very small adjustments to its speed to keep the wheels under the center of mass.

This process repeats tens or even hundreds of times per second so it can quickly respond to disturbances.

How does this apply to you?

It's impossible to say without knowing more about your specific situation, but I can think of a few scenarios in which you could employ this.

How does the robot respond to a tilting beam? The robot could employ a heavy balance bar (like a tightrope walker), or simply put a heavy weight on a pivot (maybe its own battery pack). But how fast do you have to tilt the weight to stay balanced on the beam? Gyro/accelerometer sensor and a PID controller.

How does the robot avoid driving off the side of the narrow beam? Use a sensor to detect how close it is to the edge of the beam, use a PID to adjust the steering to correct for it.


问:
Why information filter called information filter
We all know Information Filter is a dual representation of kalman filter. The main difference between information filter and kalman filter is the way the Gaussian belief is represented. In kalman filter Gaussian belief is represented by their moments where as in Information filter Gaussian belief is represented by canonical form. Canonical form is comprised with a information matrix($\Omega$) and a information vector ($\xi)$.

As we all know the name kalman filter name after Rudolf E. Kálmán, one of the primary developers of its theory.

Now I want to know that from where the name information filter came?Why it is called information filter?what type of information attached with this filter? Is there any signification behind the nomenclature?

I have the same question about information matrix and information vector. Is there any signification behind the nomenclature?

I already read Probabilistic Robotics by Sebestian Thrun. Chapter 3 Gaussian filter ,in the subsection 3.4 The information Filter. There are many equations and theories but that does not tell us about the nomenclature.

Probabilistic Robotics

答:
I think the answer is that a covariance matrix represents uncertainty. As its singular values grow, uncertainty grows as well. On the other hand, if you look at its inverse you see (of course) the opposite. As singular values of the covariance matrix inverse grow, uncertainty decreases.
In other words, uncertainty decreases when more valuable information is gathered. That is why the inverse of the covariance is called information. Since the filter propagates this matrix and its associated vector it is called an information filter. </p>


答:
Just a short note-
There is a significant difference between information filters and Klaman filters.
Although they are mathematically similar (inverses of each other), marginalization is simple in Kalman filters and complicated in information filters. However, smoothing is simpler in information filters while it is complicated in Kalman filters.
Since modern state estimation techniques tend to employ smoothing to mitigate the effects of non-linearities, enhance precision and allow loop closures information filters are now on the rise.</p>

Title: information filter instead of kalman filter approach

Body:
I read many sources about kalman filter, yet no about the other approach to filtering, where canonical parametrization instead of moments parametrization is used.

What is the difference?

Other questions:

Using IF I can forget KF,but have to remember that prediction is more complicated link

How can I imagine uncertainty matrix turning into an ellipse? (generally I see, area is uncertainty, but I mean boundaries)

Simple addition of information in IF was possible only under assumption that each sensor read a different object? (hence no association problem, which I posted here


问:
Inconsistent results between Simulink derivative model and tf for PD controller
I'm designing a PD controller so that the response due to unit step should exhibit an overshoot of 20% and steady-state error less 0.01. I've computed the parameters Kp and Kd and double-checked the result based on root locus design approach. This is the Simulink for a PD controller where kp=7130 and kd=59.388.

and the result is

I've computed the closed-loop pole  $-38.694+75.5266j$ at the gain kd via another Matlab's script I've written. Matlab shows same closed-loop pole shown below

which agrees with my calculation for kd. The block diagram for the preceding system is

Now, I would like to use stepinfo() to obtain the performance of the system, hence:

```<code>clear all
clc
kp=7130;
kd=59.3880;
num=[kd kp];
den=[1 (kd+18) (kp+72)];
F=tf(num,den);
step(F)
stepinfo(F)
</code>```

which yields this information (i.e. obviously wrong)

```<code>    RiseTime: 0.0133
SettlingTime: 0.0910
 SettlingMin: 0.9182
 SettlingMax: 1.2584
   Overshoot: 27.1141
  Undershoot: 0
        Peak: 1.2584
    PeakTime: 0.0321
</code>```

Why tf yields different results in comparison with Simulink.

Matlab's documentation shows no benefits info regarding this issue.

答:
After some investigation, there is a problem with the derivative block in Simulink. tf yields the correct response in my case. While the values of Kd has been designed to yields 20%, the system is not a second-order system because there is no zero-pole cancellation. The zero comes from the PD controller. The new system yields 27%.

The derivative block as shown in my post must be used with caution. The discussion can be found in What are the implications of using the Derivative block in Simulink?. The answer is provided by  MathWorks Support Team staff which is

Here is a list of recommendations on the usage of the Derivative
  block:

1) Signals connected to the Derivative block should be continuous in
  time and amplitude

Derivative blocks amplify discontinuities when connected to a
  non-continuous signal. In example 'Example1_Discont.mdl', the slope of
  the input signal changes instantly. After being passed through a
  Derivative block, it becomes a peak.

2) Signals connected to the Derivative block should have a small
  derivative at t=0

‘Example2_Spike.mdl’ shows how a spike can occur in the second
  derivative after the first time step. This occurs because the
  Derivative block yields 0 by default at the initial time step, instead
  of 2*pi in this case. If this model is simulated again with a smaller
  time step, the spike amplitude increases.

3) Signals connected to the derivative should contain a low level of
  noise

In general, taking the derivative of a noisy signal tends to
  exacerbate the influence of that noise. Therefore, Derivative blocks
  in Simulink exhibit this behavior as well. In ‘Example3_Noise.mdl’,
  the noise gets amplified in the output, to the point where the
  derivative of the sine wave is not recognizable. By using a filtered
  derivative transfer function which filters out higher frequencies, a
  much better result can be obtained in the example.

If your model cannot respect the above guidelines, you might want to
  consider the following alternatives:

a) Rearranging the equations

Typically, a system's best-form mathematical model exclusively
  involves integrators (i.e., no derivatives). It is usually possible to
  design the model in such a way that Derivative blocks are never
  needed. In 'Example4_BestForm.mdl', the "naive" first approach
  involves a Derivative block; however, the second approach avoids
  having to compute the derivative.

b) Including the derivative into a transfer function

If a Derivative block and another Transfer Function block are in
  series, it may be possible to remove the Derivative block and multiply
  the numerator of the transfer function by ‘s’ (see
  ‘Example5_InSeries.mdl’, where the magnitude of the error is very
  small compared to the magnitude of the output signal).

c) Filtered derivative

The Derivative block can be replaced with a transfer function of the
  form G(s) = s/(tau*s+1), where ‘tau’ is a time constant which should
  be small compared to the dominant time constant of the system, to
  avoid filtering out important system dynamics. ‘Example6_Filtered.mdl’
  contrasts this transfer function with the Derivative block.

Additional note:

How is the derivative part of the PID controller implemented in
  Simulink? It does not use a Derivative block, but instead implements a
  filtered derivative similar to the one described above. In a model
  including a PID Controller block, right-click on the block and select
  ‘Look Under Mask’ to see the exact implementation of the controller,
  and in particular its derivative part.

The credit goes to @Matteo Ragni. The actual implementation for the derivative block is provided by Matteo.


问:
EKF singularity problem when measurement noise R is zero
my Extended kalman filter (EKF) program works well, my estimated state vector is same as real state vector when I give any positive definite number to measurement noise R. But I want to make covariance analysis and one part of covariance analysis I need to set zero measurement noise. When I do this, I get singularity warning from K= (HPH'+R)^-1 (kalman gain part of measurement correction part of EKF). I checked eigenvalues and rank. When I get R=0, some eigenvalues becomes negative a few seconds later and rank is decrease from 15 to 1. When I get R>0, all eigenvalues are positive definite and rank goes to 15 to 7. How can I solve problem, I can not detect cause of this problem. Could you help me please?

答:
I think you need to step back a bit and think beyond the math. An (E)KF is used to estimate the true value of a signal in the presence of noise; it's only because of this noise that we even need the algorithm. When you set R to zero you are saying "I have a perfect measurement". In this case there is no need for an estimate.

In practice, I think you have two options:

Do analysis with a series of decreasing R value and try to estimate in the limit as R->0

Instead of doing all the measurement step math, simply assign the state estimate to match your measurement (which is what R=0 means). You'll also need to zero out your estimate covariance, P=0.


问:
How to calculate effort/torque values of a joint
I have a robotic arm with 6 DOF. For each joint, I get get the Joint Wrench, which is composed by the force and torque of the parent and child links of the joints. In other works, for joint 1 I can get ParentLinkForce, ParentLinkTorque, ChildLinkForce and ChildLinkTorque. Each of one is a 3D vector with x, y z.

My question is, how can I transform this to the current effort of the joint in N.m? So I can directly get the effort value of the torque after applying a torque action in the joint.

答:
The wrench characterizes the forces and torques acting on the respective linkages. Part of this is motor torque, the other forces and torques are loading the mechanical structure (and motors down the chain).

If you have followed the Denavit Hartenberg convention in defining the coordinate systems and you have a rotational joint the joint torque is the z component of the torque part either the parent of the child wrench (depending on the motor orientation).

If you did not follow the DH convention, you should locate the axis which is co-located with the motor axis and use the torque component from the wrence corresponding to the co-located axis. If you do not have such an axis, you need to define a new coordinate system which has such an axis and make the coordinate system transformations form the parend/child coordinate system to the new one. Afterwards transform the wrench to the new coordinate system atteched to the motor and select the torque component corresponding to the co-located axis.

Please make sure the regard any gearboxes which the motor might have when calculating any actual motor torques.


问:
Robotics and Software defined radio
From time to time here in the forum are messages gets posted about radio communication with quadcopters. So called “radio modems” are used for a “robot to groundstation”-communication. But the more appropriate term would be software defined radio, because it has always to do with ham radio and shortwave communication.

I think, the robotics community has no choice than learn some of the vocabulary used in the amateur radio community, for example JT65 for distance communication and GNU radio for converting audio signals. The main problem seems to be, that it is not possible to utilize a full blown amateur radio station for a small sized quadcopter. A typical shortwave device has a power consumption of 100 Watt and needs lots of space. So my question is, can this be scale down to an USB stick with a simple antenna but provides transmitting facilities to a robot? As far as i know, radio amateurs are often use the RTL2832 chipset which is sold in DVB-T sticks but I'm unsure if it's possible to send a signal with it, or is this more a passive scanner?

答:
It is not clear what you are asking.

Software-defined radio (SDR) as a concept essentially means that low-/physical-layer computational tasks like modulation/demodulation, error-correction coding, filtering, etc are being implemented in software and such that the software environment is "opened up" to users. The key thing here really is the run-time environment, not the particular communications technology that happens to be implemented in this environment. In practice, software-defined radio is useful for people doing research in wireless physical layers and/or signal processing, or in situations where (for example because of weight constraints) one only wants to use one piece of communications circuitry but possibly needs to support several communications standards (which is possible, just not at the same time).

The vast majority of all people (and I would include the vast majority of robotics users/researchers here as well) only have "bread-and-butter" requirements in terms of communications and normally have no need to employ SDR, but they will be perfectly fine with commercially available transceivers which don't employ SDR technologies.

Title: Robotics and Software defined radio


问:
how to calculate the angular velocity of end effector of two link robot arm?
I am trying to calculate the angular velocity of end effector of two-link robot arm. Can anyone help me to find it?

If $q_1$, $q_2$  are joint angular position and $\dot{q_1}$ and $\dot{q_2}$ are joint angular velocities, and $\omega$ is angular velocity of end effector, then I use $\omega=\dot{q_1}+\dot{q_2}$.
Is that correct?

答:
Jacobian would help you in this case. The joint velocities and the end effector velocities are related by the following equation,

$$ \dot{X} = J(q).\dot{q} $$


问:
Programming Robots with JavaScript
As somebody who is spending the majority of his time programming in JavaScript, what's the best route to get into small-robotics without needing to deviate too much from my current language focus?

Are there any project kits or tools that make use of the JavaScript language that might make the field more approachable for developers like myself? I would even be interested in virtual environments where all code is executed in a simulation.

答: There is also a project called Espruino, which is a JavaScript interpreter for low power ARM microcontrollers. It is a rewrite of the tiny-js project, a small C++ interpreter for Javascript.</p>

Title: Programming Robots with JavaScript


问:
Motor controller for two Hitec D845WP servos
I am undertaking a project using two Hitec D845WP servos running at 8.4 V.

Hitec's website lists idle current of 30 mA, no load operating of 1600 mA, stall current of 10 A and motor type as "5 Poles Cored Metal Brush". I believe that I can use a Cytron 10A 5-30V Dual Channel DC Motor Driver (RB-Cyt-153).

Can anyone please clarify the difference between a "DC Motor Driver", a "Brushed DC Motor Controller" and a "RC Servo Motor Controller"?

Are there other components necessary in my circuit if I opt for a "Driver" compared to a "Controller" and, if so, what are they please?

答:
As you know microcontroller board (e.g. arduino) have limited current output and mostly fived voltages  3.3V/5V. So they can not be used directly to power the motor, so you need either a motor driver or controller to power it.

The difference is that a motor driver only handles power, and the control has to be done by a microcontroller, often the signal to be sent to the motor driver require proper timing and care. Whereas a motor controller is a motor driver plus some logical part taking care of the low-level control of the motor, that means that you can send high-level commands to the controller like pwm or set points, and it takes care of the interaction with the driver.

Back to the driver, DC motor do not require a specific protocol to be controlled, but servos, stepper and brushless require a specific type of signal to be operated properly.
When you buy some packaged servo, they usually consist of a DC motor and a controller, so you need to provide a high-level (eg pwm) and the required power. In that case you only need an adequate power supply and something able to produce a pwm signal.
See for example this tutorial from howtomechatronics.com


问:
Simulating the robot using moveit with ROS
I'm an absolute beginner in this field so I request you to help me although the question seems very silly.

I want to send the robot (in simulation) pose goal from ROS node. I want to use to moveit framework. Previously I have used V-REP simulator and controlled a robot in V-REP using ROS node.

I want to do same by using moveit framework and gazebo simulator. I have already created the panda_moveit_config package but I don't know what to do next. My main questions are:

Where can I keep my source file of ROS node(containing the code to control the robot)?

How can I run the node and send commands to robot model in Gazebo?

I'm looking forward to any tutorials or advice which will help me from environment setup till running the code. Any help is appreciated.

答:
After generating the moveit_config package you have to do a lot of work to get it working in simulation.

1)make sure your robot urdf has inertia parameters, if not guess them reasonably.

2)add transmissions to all joints in the urdf and load the gazebo_ros_control plugin (check out gazebo grasp_fix plugin incase you have trouble grasping)

3)add create a controller.yaml file specifying which controller you want to use for each joints

4)create a launch file for spawning model, spawning ros_controllers in gazebo

5)edit moveit_controllers.launch to link moveit to the controllers you have spawned.

I suggest you go through these links: 1 ,2 , 3, 4


问:
time to Initialise or start sensor after power given
I am working on a time critical project. I use an optical sensor. I would like to know the initialisation or boot time the sensor after power given which will be in µS. How could I measure that?</p>

答:
First crucial thing to know is what is your sensor - its part number, to be clear. If your sensor is digital, its initialization time is probably given in the datasheet.

If you are using analog one, check datasheet too - settling time might be one of values documented. If you can't find anything in the datasheet, you can perform simple test using oscilloscope:

Place sensor in some stable state, ie. looking at uniform surface from a fixed position,

Connect the probe to analog output of the sensor and probing ground to sensor's ground,

Set oscilloscope to single trigger mode,

Power up the sensor.

That way you can observe analog voltage rising from zero to some value, determining its initial settling time.