问:
Modeling of Robots
There are mainly two approaches for controlling robots (mobile robots and static robots): 1) working with kinematic equations, controlling joint or wheel speeds , 2) working with dynamic equations and controlling torques and forces.
I would like to know in practice (in academia and also industry) which one is used more?

I mean dynamic modeling and control is complex, requires much more accurate modeling and therefore more prone to model imperfections and other errors. Kinematic modeling on the other hand is more straightforward and requires less knowledge. I don't mean some special functionalities of robots (for example, mobile robot has 1D arm on it, and it is going to do force control), but rather a general motion of mobile robots, static robotic arms and some other types of robots. Is it in general sufficient to do kinematics with speed control for this purpose?

If not, could you please mention some important deficiencies possible with pure kinematic modeling?

If my question does not have sufficient information for you to answer, could you, please, give some tips how can I make it more focused?

Thanks in advance

答:
The two approaches you mention are not as separated as they seem. Both kinematic models and dynamic models are not 100% accurate. This is the reason closed loop control is needed (well probably only one of the reasons if you ask controls experts).

You should not think of kinematic and dynamic models of being completely separated. They are all models describing the same system. Kinematic models include only motions, not forces, dynamic models include both, forces and motion. They all have their role in a control system.

You are right, dynamics modelling is more challenging because it is harder to come up with exact dynamic models. But this does not mean that the dynamic models are unusable.

Most industrial motor control applications for motion planning use a cascaded control approach with an outer loop for position control (which is usually disabled for mobile robots) a "middle loop" for velocity control and an inner loop for torque control. All of these loops have a PID controller variant (mostly P and PI, PD or PID also possible) and have a feed forward input. This feed forward input is the easiest way to integrate inexact dynamic models.

Consider the case where there is not feed forward signal on the torque controller. This means that the control loop has to minimize the difference between the reference torque (generated by the outer velocity loop) and the currently applied torque. This assumes that the reference torque, generated by the velocity control loop (since it is a cascaded control system) is exactly the right amount of torque needed. Obviously it is not, but the we "hope" that the velocity feedback will take care of this. And it can, but with limited performance. It takes some time for the controllers to settle on just the right amount of torque.

To increase the performance of the control loop we can add a feed forward signal to "help" the controller. We "inject" an additional torque which we think is the right amount. Obviously this will also not be the right amount, but if it would be, the control loops would have "nothing to do" they would behave as pass through. Since we would have an exact model of the system we would not need a controller we could always calculate the right amount of torque. This works well in simulation when the controller plant is exactly known, but (almost) never works in real life.

If we use an inexact dynamic model to inject a feed forward torque, even if it is not exactly the right amount it helps the controller. A simplistic explanation is that the controller does not have to come up with the exact amount of torque needed, but it only needs to correct the feed forward torque.The more precise the dynamic model giving the feed forward signal to the controller is the more it "helps" the controller, the faster the controller settles on the right value. The closer we are to a perfect model the less we need the controller.

A more complex way to use dynamic models, even if they are not precise is model based control. This is well established in academia, but less widely used in the industrial practice.

Title: Modeling of Robots


问:
Can I apply a common voltage to a high speed running DC motor to stop it? Will it damage the DC motor?
I decelerate the velocity of my robot very quickly by applying a common voltage (eg. 24V to both the terminals using Motor driver) to the DC motors. Given, the motor is running at a very high speed and suddenly a common voltage of 24V is applied to the motors. I suppose the kinetic energy should dissipate in the armature resistance. Is it safe for the motors or external braking is advisable?</p>

答:
You can do various Bad Things to a motor by doing this -- but whether it's bad for your motor in your machine depends on what you're doing.

When you short a motor like that, it'll generate a lot of current, and in addition to heating up the armature, that current can damage the commutator or brushes.  On older motors it could demagnetize the magnets, but that's probably not an issue if your motor has rare-earth magnets.

You can compute the current from the motor's speed, it's speed vs. voltage constant and its armature resistance.  Compare that to the motor datasheet's maximum current.  A good motor datasheet will have not only a maximum current, but some sort of instantaneous current that gives you an idea of how much of an overload you can give it for how long.

You may also want to consider how much torque the motor will be absorbing during this, and ask whether you'll be exceeding your mechanism's strengths.  You'll know the current, so use the motor's torque vs. current constant to calculate the torque, and compare that to the capability of whatever you have the motor attached to.

ContentLicense: CC BY-SA 4.0


问:
Drone Horizontal Speed Measurement
Assuming no GPS is available, what can be used to measure the horizontal speed of a hypothetical drone? Sensor mass and size don't need to be taken into account. Could small Doppler radars , maybe placed in an off-nadir angle measure it?

Thank you in advance for your help!

答:
You could use an IMU to measure the speed and position. You just have to:

Calculate the quaternion that represents your drone orientation, using a filter like the Madwick or Mahony filters.

Strip the gravity from your accelerometer raw data readings, the quaternion you calculated is what you will be using for this. It's not the only way, you could also use a low pass filter. I asked this question some time ago here . You can also read this explanation about how to compensate gravity from your accelerometer readings.

Calculate the acceleration vector with the following formula: sqrt((ax * ax) + (ay *  ay) + (az * az))

Finally, you integrate this acceleration value to get velocity, and then you integrate it a second time to get the position but.......

You are not supposed to be doing this. Your data will be extremely inaccurate. When you integrate you are getting an approximate value, and you will be integrating this not-so-precise data over time. If you want to read a really good explanation about this I suggest you this article. You can also read this question, someone asked about speed measurement with an IMU.

Title: Drone Horizontal Speed Measurement


问:
Dynamic models of parallel robots in the form of multi-mass systems with stiffness coefficients
I want to develop a dynamic model of a parallel robot for control tasks. It is known that equations of motion based on Lagrange equations can be transformed into a state space and use such a model.

I was wondering if it is possible to somehow include the stiffness matrix of the manipulator in this model and get a model like the one shown in the second figure.

答:
Yes it is possible.

You can look at the following paper

Stiffness Analysis and Comparison of 3-PPR Planar Parallel Manipulators With Actuation Compliance
Guanglei Wu , Shaoping Bai , Jørgen A. Kepler


答:
The equations of motion is simply
$$
\begin{align}
J_m \ddot{\theta}_1 + K_{md}(\theta_1-\theta_2) &= \tau_e \tag{1} \\
J_d \ddot{\theta}_2 + K_{md}(\theta_2-\theta_1) &= \tau_L + \tau_s \tag{2}
\end{align}
$$
Rewriting (1)&(2), we get
$$
\begin{bmatrix}
J_m & 0 \\ 0 & J_d
\end{bmatrix}
\begin{bmatrix}
\ddot{\theta}_1 \\ \ddot{\theta}_2
\end{bmatrix}
+
\begin{bmatrix}
K_{md} & -K_{md} \\ -K_{md} & K_{md}
\end{bmatrix}
\begin{bmatrix}
\theta_1 \\ \theta_2
\end{bmatrix}
=
\begin{bmatrix}
\tau_e \\ \tau_L + \tau_s
\end{bmatrix}
$$

Title: Dynamic models of parallel robots in the form of multi-mass systems with stiffness coefficients

Body:
I want to develop a dynamic model of a parallel robot for control tasks. It is known that equations of motion based on Lagrange equations can be transformed into a state space and use such a model.

I was wondering if it is possible to somehow include the stiffness matrix of the manipulator in this model and get a model like the one shown in the second figure.


问:
Pre-built PID motor controller
I lead a university robotics team that needs PID controllers for four drive motors and two additional motors that are used in a secondary system. I would strongly prefer to buy pre-built PID controllers that provide just about any reasonable interface for setting PID constants, motor velocity and direction, as the controllers are not remotely central to the difficult, interesting problems we're trying to solve. To my astonishment, the Internet doesn't seem to be saturated with such controllers (talk about reinventing the wheel - hundreds of tutorials but almost no pre-built solutions! Did Willow Garage build their own PID controller for the PR2?!).

Does anyone have recommendations/experience, preferably pointers to such controllers?

I've Googled around quite a bit, and so far this is the best option I've found. It's a cape for a BeagleBone Black (which is the board we're using). The problem is that the Python library is not finished - it resets PID constants at every call, it doesn't support changing the direction of the motor, and it seems to only support setting motor power, not velocity, which gives me the impression that it's not actually using the PID controller at all.

Additional details:

The stall current of our drive motors is 6A. They are brushless DC motors with quadrature encoders. The secondary motors are much smaller, and we're building our own encoders for them.

Our code base is in Python, and we're running on a BeagleBone Black using the latest Debian image from Robert Nelson (that guy's awesome!). Our batteries provide 14.8V, and we already have 3.3V and 5V rails.

Our robot is fairly small, about 1x1x2 feet, and weighs about 9 pounds. This info is meant to give perspective with regard to scale.

$350 or so is the comfortable top range of what we could spend to get all 6 motors PID-controlled.

Any help would be greatly appreciated!

答:
Should be able to find something either here at Kb Drives or at GeckoDrive
I think the "problem" is that very few hobbyists actually use servo drives for projects since steppers are simpler. As a result, most of the prebuilt stuff you will find is for industry, with prices to match. Geckodrive has a good reputation (never used them) and their prices are quite reasonable.</p>

ContentLicense: CC BY-SA 3.0

Title: Pre-built PID motor controller


问:
Robotic vision eye-in-hand research
I started researching Robotic Vision topics for a while but I found myself a bit stuck.
My background is in the Computer Vision and Machine Learning fields but I lack the knowledge in robotics.

My goal for now is to make an eye-in-hand system perform pick-and-place movements. Something like this:
https://www.youtube.com/watch?v=GOY5VED54zQ

I'm pretty sure the key to achieve this is the calibration phase but out of all the resources I found I could not understand how this is done. I get that I need to find transformations between camera frame to robot frame but I have no idea how to get them. Any paper that I read about this gets me lost in the math part which I find very hard to understand for now.

What I know:

how to deal with problems in the camera plane(i.e detect objects)

how to control the robot which is an UR-3 cobot

What I don't know:

how the camera world points relate to the robot world points

Is there a general approach to this problem? Is there any library that can help me with this?

Any study materials/tutorials or explanations are highly appreciated. Thank you in advance.

答:
What you are confused about are frame transformations.

If you have ever poked around with ROS, you will see that robot joint locations are determined through frame transformations.

These transformations are calculated because the current joint angles are known.

Those angles are then passed into what are called homogeneous transformation matrices. The matrices are essentially 4x4 matrices that multiply nicely together to keep track of the end-link orientation (upper left 3x3 part) and the tranlation aka. XYZ of the robot tip (upper right 3x1 vector in homog. matrix).

These matrices, before being given current joint angles, are often created from the Denavit-Hartenberg (D-H) parameters.

Since you are confused with all the math, and robotics is really just applied math, I suggest you start learning how D-H params work.

Then, once you understand how to get the tool-tip orientation and position from the joints, you can then link the camera frame with the base-frame of the robot you are working with.

Essentially, the camera relates to the rest of the world through a root frame, often called a world frame. All data points are synced to that frame.

Then, when you add XYZ points in the camera frame, you can automatically know where they are in Tool-tip frame, aka. End of Arm Tooling (EoAT) frame.

Then, if you mount a camera on the EoAT, you finally have the vision-in-eye setup you envision in your question title.

Does this make sense?

Note:

You asked about libraries? There are many matrix libraries out there, and saying which is better or worse is outside the scope of Robotics Beta and this question. There are Python libraries and C++ libraries: you will have to choose one. I know that there are many matrix libraries to be used with OpenGL, so I recommend looking at what computer graphics people like to use. An example might be GLM.

I should say though, that ROS uses quaternions, but those are faster to compute. They achieve the same thing as 4x4 homog. trans. matrices, with less CPU time.

Title: Robotic vision eye-in-hand research


问:
Connected battery, esc and motor does not power up the arduino
I am currently doing my first arduino project and i am having trouble finishing it.

I have a 3s lipo battery connected with an esc (120A) that is connected to a motor (270KV). From the esc i am connecting two jumper cables that goes to GND and pin 9.
I do not have a jumper cable on the red wire from the ESC.

This is how it looks:

Below you can see a link to a sketch that I found online. The only difference compared to my schematic is that I have an Arduino Uno.

When I insert the battery and switch the ESC to "on" the ESC starts up correctly and the fan starts to go. But the arduino does not get any power. It is still "OFF".

I also noticed that my motor has 4 cables. 3 "bigger" cables that goes to the ESC's 3 big cables. And then a 4th one hanging loose right now because i do not quite know what to do with it. I also noticed there is a hole in the ESC where I can insert this. The hole has 6 "inputs" however where as the loose wire from the motor has 5. Therefor I am a bit concerned if that should be connected there or not.

So to summarize, the problem is that the Arduino does not turn "ON" with my current schematic.
Any help, tips is very appreciated!!

答:
I want to add to @holmeski and his answer.

The ESC, in order to know what voltage the Arduino is sending, needs to know what the reference HIGH voltage is. Usually, in a 3-wire setup as pictured, there is GROUND, HIGH, and SIGNAL. You need to connect an Arduino 5-volt out line to the red line, as well as connect ground and signal the way you did.

Then, as already mentioned, you still need to power the arduino through either

USB

DC Jack

The Vin pin - this is the most dangerous solution, I do not recommend it for nubes (not to be cocky, but you did say you are new to this).

Essentially, the Arduino is not configured to be powered in your current circuit diagram.


问:
First CNC router, where should my zero position be?
I have homing switches and I'm unsure if my zero should be right after they are done homing or if the zero is supposed to be the center of my build volume?</p>

答:
This depends on the machine specifically and the software that is being used to drive it, as well as the work placement and holding for the particular cut. Remember, there are typically two different zeros, a machine zero and a work area zero. Typically the tool moves to machine zero before travelling to the work area zero and beginning the paths. This means that entire travel distance needs to be consistently clear of obstruction to prevent collisions. If you have room to clear your entire cut area, you can use the switch locations as machine zero, typically the minimum travel on X and Y axes, and full retraction on the Z axis. You may want to reset your machine zero to a point inside mounting clamps for instance if there isn't enough clearance. </p>

<p>For me I typically set my toolpathing to use the bottom left corner of the part as the stock origin, so I set my work area zero to a spot on my material where there is sufficient room for the cut I'm making. I use the bottom left as it's pretty easy to reference for me, but any position would work as along as you can verify that there is sufficient area for your cut, and the stock is properly placed to match your toolpaths. Since my machine doesn't have homing switches I also have to be sure to manually set the machine zero to something out of the way of any hold downs and with enough clearance from the work before I set the work area zero.  </p>

Body:
This depends on the machine specifically and the software that is being used to drive it, as well as the work placement and holding for the particular cut. Remember, there are typically two different zeros, a machine zero and a work area zero. Typically the tool moves to machine zero before travelling to the work area zero and beginning the paths. This means that entire travel distance needs to be consistently clear of obstruction to prevent collisions. If you have room to clear your entire cut area, you can use the switch locations as machine zero, typically the minimum travel on X and Y axes, and full retraction on the Z axis. You may want to reset your machine zero to a point inside mounting clamps for instance if there isn't enough clearance.

For me I typically set my toolpathing to use the bottom left corner of the part as the stock origin, so I set my work area zero to a spot on my material where there is sufficient room for the cut I'm making. I use the bottom left as it's pretty easy to reference for me, but any position would work as along as you can verify that there is sufficient area for your cut, and the stock is properly placed to match your toolpaths. Since my machine doesn't have homing switches I also have to be sure to manually set the machine zero to something out of the way of any hold downs and with enough clearance from the work before I set the work area zero.


问:
Speeding Up UR5e Joint Movement
I am working with a Universal Robots UR5e. I am attempting to do a simple back and forth movement of 60 Degrees with Wrist 2, operating at 2 Hz (back and forth in 0.5s). Looking at the Joint Limits, the maximum Joint Speed is listed at 191 deg/sec, which should be plenty fast for this. However, I can't seem to get it to move faster than about 1 Hz. Even if I set the Robot Limits to Least Restricted, I max out at this speed.

I am using a movej command and setting t=0.100 to get the max speed. If I set it to  t=0.250 I will still see the movement take over a second to go back and forth.

Does anyoneone have any suggestions for how to speed up the movement?

Thanks!

答: So it appears that although the documentation for movej() states that it is the time the robot will take to make the move, it's really closer to the time each joint will take to move. If I take my desired time to move and divide by 6 (number of joints), then the speed of movement is increased to be much closer to my goal. It isn't perfect, but it's much improved. I'd still like to hear what others have to say, but this is my best solution for now. </p>

Title: Speeding Up UR5e Joint Movement


问:
Position Control vs Velocity Control vs Torque Control
Please can somebody explain to me the difference between Position Control, Velocity Control, and Torque Control? Specifically, I am thinking in terms of a robot arm. I understand that position control tries to control the position of the actuators, such that the error signal is the difference between the current position and the desired position. Velocity control is then trying to control the velocity of each actuator, and torque control is trying to control the torque of each actuator.

However, I don't understand why these are not all the same thing. If you want to send a robot arm to a certain position, then you could use position control. But in order to move an actuator to a certain position, you need to give it a velocity. And in order to give it a velocity, you need to give it a torque. Therefore, whether the error is in position, velocity, or torque, it always seems to come back to just the error in torque. What am I missing?

答:
I think Mark Booth's answer was best.  Talked about the applicational differences between the modes, without getting into theory or detracting from the original question.

If I can expand a little further to bring more clarification:

Each mode uses the commanded method as its PRIMARY form of control, and it has control of the other parameters only by way of limitation.

As Mark mentioned above, you can use a POSITION MOVE with LIMITS on the torque and velocity.... the controller will do its best to get to that position within the limits provided, but makes no effort to meet anything specified by the velocity or torque limits.  Therefore, you could get to your commanded position with a speed of 10in/sec even though your limit was set at 40in/sec.

Basically, whatever you mode you command in, the move will attempt to meet that criteria first and will ignore the other two (aside from limits).

If VELOCITY is the most important thing you need to control, such as a conveyor... then use Velocity Mode.  If Torque is important, such as not tearing a web or overtensioning something, then use Torque Mode.

I think where it's confusing is between VELOCITY mode and POSITION mode.  Arguably, you could control a conveyor using POSITION MOVES and simply setting limits on how much velocity the movement command can use.  Eventually, after getting up to speed, your conveyor will be moving at the velocity specified in your POSITION MOVE.  However, if you need to adjust your speed a bit, a POSITION MOVE makes this difficult.  You now have to find a new position to move to and either increase or decrease the limit on your "speed max".  This is much easier if you are just using VELOCITY control, as the position of a conveyor is essentially cyclic and infinite.  You can simply adjust up or adjust down the velocity of your velocity command, and you DON'T REALLY CARE where the position of the conveyor is.  Namely, velocity is important but position isn't.

With the "egg robot" example above, your torque control cares about keeping the torque at a specific value, but it doesn't care where the position of the gripper is, or what the velocity is.

It was confusing for me as well, but when you're spec'ing an application, just think about WHAT IS MOST IMPORTANT to you, and use that as your control method.  They all will essentially do the same thing, but it's kind of an "order of precedence" for what it cares about most.


答:
These should work well: http://www.jrkerr.com/

Control via serial w/ tunable PID gains for position, velocity and acceleration. They also require a quadrature encoder signal, so you're good to go in that regard.

My boss has used these in previous robotics projects and vouches for them.

Title: Pre-built PID motor controller

Body:
I lead a university robotics team that needs PID controllers for four drive motors and two additional motors that are used in a secondary system. I would strongly prefer to buy pre-built PID controllers that provide just about any reasonable interface for setting PID constants, motor velocity and direction, as the controllers are not remotely central to the difficult, interesting problems we're trying to solve. To my astonishment, the Internet doesn't seem to be saturated with such controllers (talk about reinventing the wheel - hundreds of tutorials but almost no pre-built solutions! Did Willow Garage build their own PID controller for the PR2?!).

Does anyone have recommendations/experience, preferably pointers to such controllers?

I've Googled around quite a bit, and so far this is the best option I've found. It's a cape for a BeagleBone Black (which is the board we're using). The problem is that the Python library is not finished - it resets PID constants at every call, it doesn't support changing the direction of the motor, and it seems to only support setting motor power, not velocity, which gives me the impression that it's not actually using the PID controller at all.

Additional details:

The stall current of our drive motors is 6A. They are brushless DC motors with quadrature encoders. The secondary motors are much smaller, and we're building our own encoders for them.

Our code base is in Python, and we're running on a BeagleBone Black using the latest Debian image from Robert Nelson (that guy's awesome!). Our batteries provide 14.8V, and we already have 3.3V and 5V rails.

Our robot is fairly small, about 1x1x2 feet, and weighs about 9 pounds. This info is meant to give perspective with regard to scale.

$350 or so is the comfortable top range of what we could spend to get all 6 motors PID-controlled.

Any help would be greatly appreciated!


问:
Why are the angular velocities of concentrated masses in Lagrangian independent?
There is an ordinary linear three-mass system.

If we write its Lagrangian, we get the following equation.

where $W_k$ and $W_n$ - kinetic and potential energy.

To find the moment of rotation of the first mass, we must differentiate lagrangian first by the angle of rotation of the first mass $\phi_1$, then find the rate of change in time of the Lagrangian derivative with respect to speed $\omega_1$.

Lagrange equation

Suppose we want to find the moment of the first mass $J_1$ (we assume that on the shaft of the drive motor).

$\frac{\partial L}{\partial q} = \frac{\partial L}{\partial \phi_1} = -c_{12} (\phi_1 - \phi_2)$

$\frac{d}{dt}\frac{\partial L}{\partial \dot{q}} = \frac{d}{dt}\frac{\partial L}{\partial \omega_1} = J_1 \frac{\partial \omega_1}{\partial t}$

Which ultimately gives us a dynamic equation:

$M - c_{12} (\phi_1 - \phi_2) = J_1 \frac{\partial \omega_1}{\partial t}$

My questions are as follows:

Where did the masses of $J_2$ and $J_3$ go? Because we are looking for a derivative and speeds of this masses $\omega_2$ and $\omega_3$ do not explicitly depend on $\omega_1$, no matter how massive they are, they do not include into the equation of motion and do not affect the torque M.

Do I understand correctly that taking into account the influence of the moments of inertia of the remaining masses $J_2$ and $J_3$ is possible only by bringing the moments of inertia to the motor shaft $J_1$ (by correcting the coefficients of the square of the gear ration).

Is it possible to do without this operation and include the gear ratio in the model?

答:
Welcome to Robotics, Andrew Sol. I think I'm a little confused with your question as it appears to be about independent rotational masses connected by rotational springs, but then later you're asking about gear ratios.

This is a succinct as I can think to put it, and again I may have misunderstood the question so please feel free to comment on this answer or edit your question to clarify:

The equations of motion govern the dynamics of the system. If you have several bodies that are rigidly coupled, as in a gearbox, then you would (I would, at least) modify the moments of inertia to account for the gearbox ratio and then treat the entire gear train as one system.

Consider this: If $\omega_2$ could be calculated by $\omega_1$ and a gear ratio, then what dynamics do you need to solve?


问:
How To Do path planning To move the Robotic Arm in straight line in 3D where the arm is having base, Shoulder, Elbow & wrist?
Now the design we have has the 4 DOF (Base, Shoulder, Elbow, Wrist), there is no problem in moving the arm in a curved manner but the main problem arises in straight-line motion. I'm unable to fid=nd the solution for that. the main concern is which at least 2 motors I should move.
Hoping For Solutions Here.
Regards.  </p>

答:
You need inverse kinematics. Which refers to calculating the joint angles so that the robot will reach a particular pose.

You can not simply move from point A to point B..
You will need to use inverse kinematics to calculate all the positions the arm will pass thru to form a straight line.


问:
Stepper can't turn plastic wheel. Is it normal?
Is it normal, that a stepper motor with the following specifications can't reliably turn a plastic wheel with a diameter of 13cm and a simple direct coupling?

Type: bipolar, two phases

Voltage: 2.55V

Current: 1.7 A/Phase

Resistance: 1.5 ± 10% Ω/Phase

Inductance: 2.8 ± 20% mH/Phase

Holding Torque: 40 N.cm Min

Detent Torque: 2.2 N.cm Max

Rotor Torque: 54 g.cm²

答: If you try to step to fast it will fail to move. If you wish to move a large mass quickly you must accelerate the step rate gradually. Any time you accelerate to fast you should expect the stepper motor to just stop and buzz.</p>


问:
BLDC Outrunner Direction Change?
I'm designing a Quadcopter for my project. I've seen a lot of guides that the motor rotational direction should be opposite to each other. My doubt is whether the motor have a variety of CW rotation and CCW rotation, or we should change any other thing in the motor?   </p>

答:
Brushless (BLDC) motors are not inherently directional. They can be either clockwise or counter-clockwise, it only needs to be set in the software, or by swapping two of the motor wires on the physical phase output pads of the ESC. The only time a brushless motor will care about rotation is if they have different direction threads on the shaft where the propeller attaches. In that case you want the motors rotating in the direction so that the prop nut tightens against the force on the prop. This is purely functional, not electrical though, if you use nylock nuts, it won't matter if they are all a single thread direction.

Brushed motors however often do have a handedness. Some brushed motors will have slight skew in the magnets that effectively advance the timing when they're running "forward" rather than "reverse" compared to their intended direction. This will result in a faster run speed in the forward direction than the reverse. Also once a brushed motor as been broken in in a particular direction it is often hard on the motor to then run the motor in the other direction. This can result in additional wear on the brushes and a motor that wears out quicker than intended. None of this should be an issue with brushless motors.

Title: BLDC Outrunner Direction Change?


问:
How to calculate the maximum charge of the battery?
How to calculate the maximum charge of the battery that it can give from a fully charged state to a fully discharged one. I have been trying to solve this problem for 2 months. The drone itself is not.
Maybe someone knows How to calculate the maximum charge of the battery?
And sorry about my English. I don't know him well.
Or some formulas for finding the electrical capacity of C?</p>

答:
The mAh rating should be written on the battery. For Lipo batteries typically used in drones, the stated mAh is usually a fairly decent estimate of the actual, though that varies some depending on the brand and quality of the battery supplier and the current load and age of the battery. Even if there is no label on the battery, the mAh rating is typically printed on the side of the cells. If there is no label printed with mAh capacity, or you don't trust the stated mAh, you can discharge the battery till the resting voltage is about 3.7 volts per cell under no draw, and then charge it back. Your charger should tell you how many mAh were put back into the pack, and you can typically multiply this by about 1.2 to get an estimate of the total mAh available in the pack. It's not 100% accurate, but it's a safe ball-park. Regardless, the number you get will be a good value to use when estimating functional capacity for flight time estimates.

You typically won't want to draw your battery much below about 3.3-3.5v per cell under load, and it should recover to around 3.7v resting with no load. You don't want to use much more than about 80-85% of the overall mAh capcity of the battery. A resting voltage of 3.7v should get you right there, but if you have way of measuring mAh consumption via a current sensor, it will be much more reliable than relying on voltage alone, as voltage can fluctuate dramatically depending on the current draw load on the battery and the quality of the cells.

Another thing to be aware of is as your battery ages, the useful capacity of the cells, as well as the safe current draw, can reduce fairly dramatically. You'll need to continually monitor the health of your packs throughout their life, and if you start to see a dramatic drop in performance, stop using them and replace them immediately.

Keep in mind this is true only for LiPo batteries we typically use. If you want to use Lithium Ion, the safe discharge voltage and discharge rates are very different, and the claimed mAh ratings can be dramatically off depending on the reliability of your source for the Li-Ion cells.  Some 18650 style Li-Ion cells have been found to contain powder filler and a much smaller cell inside, so be aware of those caveats. Li-Ion cells are also typically safe to draw down to around 2.5v per cell rather than the 3.3ish of LiPos, but that as well as the max recomended current draw can vary depending on the manufacturer. If you have Li-Ion cells, be sure to check the manufacturer supplied specifications if you can find them, and make sure your cells are genuine. Knockoffs are a problem in the Li-Ion world. In general Li-Ion is only suited to applications that have both low current draw and low transient spikes, and there is much more variation in quality and specifications.

For both types of cells, keep in mind the current being drawn from the battery can dramatically impact the ability of the battery to deliver its full capacity. The higher the current draw the less usable capacity you will have regardless of the true pack capacity. This is why it's always the best idea to confirm both the current delivery performance, and the mAh rating if you have any doubts, and why running both a current sensor and  voltage sensor in the air is ideal.

As far as identifying other characteristics of a battery, using a reliable "internal resistance" meter can tell you a lot about the battery performance and how much current you can safely draw from it. I use the Wayne Giles meter, and you can find a good discussion on the theory and how to use the meter here: https://www.rcgroups.com/forums/showthread.php?1323465-ESR-IR-Meter-fo-Lipos


问:
How to synchronise data for fusion in Kalman from multiple sensors with different timestamp information?
I'm using Kalman filter to track the position of a vehicle and receive position data from 2 sensors: A GPS sensor and an Ultrasonic sensor for which I want to implement sensor fusion into the Kalman. However, the data formats between the 2 sensors have different timestamps and hence, I cannot directly consider it together without first synchronising them. Does anyone have any ideas or suggestions as to how this can be implemented in Python?
All suggestions are welcome. Thanks!

The GPS data (GPX file exported from an app) collected gives information about the Latitude, Longitude, Elevation and Timestamp (Format: YYYY-MM-DD HH.MM.SS). The HDF5 data collected from a vehicle (HDF5 Format) gives information about the Vehicle Position X, Vehicle Position Y, and a timestamp that is updated like a counter. (Present in file step_S). I'm able to import the GPS and HDF5 files and read its contents but not able to synchronise them.

GPX file reference in below link:

https://github.com/stevenvandorpe/testdata/blob/master/gps_coordinates/gpx/my_run_001.gpx

HDF5 data:

https://github.com/surishell/Kalman-HDF5/blob/master/TestRoute.hdf5

One idea that I had would be checking the timestamp corresponding to the first non-zero value of X and Y positions of the HDF5 file and setting it as a base index against the timestamp of the first position at which GPS value changes. (Assumption: GPS updates at 1 Hz and the Ultrasonic at 500 ms. Once the index is known, the sensor values can be separated and synchronised by corresponding time step). However, I'm not sure of the implementation and could really use some help from the community.

Code for reading the HDF5 data:

```<code>import h5py
import numpy as np
from tkinter import *
import matplotlib.pyplot as plt

f = h5py.File(
    "C:\Users\Suraj\Desktop\TestRoute.hdf5","r")

with f:

    st = f.__getitem__("daste_step_S")
    t = list(zip(*st[()]))
    step_time = t[0]
    step_id = t[1]
    step_map_in_index = t[2]
    step_map_out_index = t[3]
    step_v_pos_x = t[4]
    step_v_pos_y = t[5]
    step_v_pos_angle = t[6]

    print(step_v_pos_x)
    test1 = [t - s for s, t in zip(step_v_pos_x, step_v_pos_x[1:])]
    print(test1)
    ax = plt.axes(projection="3d")
    ax.plot3D(step_v_pos_x, step_v_pos_y, step_time, 'gray')
    plt.show()
</code>```

UPDATE

Kalman Filter:

I've considered a standard motion model: Constant Velocity (Assuming that acceleration plays no effect on this vehicle's position estimation) and therefore, my states consist of only position and velocity.

+1 =  + ˙ Δ

 ˙+1 = ˙

Therefore, the state transition matrix would be (Considering 2D positioning (x,y) with latitude and longitude coordinates):

```<code>A = [[1.0, 0.0, Δ, 0.0],
     [0.0, 1.0, 0.0, Δ],
     [0.0, 0.0, 1.0, 0.0],
     [0.0, 0.0, 0.0, 1.0]]
</code>```

Since we only have position measurement data available, we can correspondingly write the measurement matrix as:

```<code>H = [[1.0, 0.0, 0.0, 0.0],
     [0.0, 1.0, 0.0, 0.0]]
</code>```

Code for reading GPS data and implementing Kalman filter for Position tracking

```<code>import gpxpy
import pandas as pd
import numpy as np
import utm
import matplotlib.pyplot as plt

with open('test3.gpx') as fh:
    gpx_file = gpxpy.parse(fh)
segment = gpx_file.tracks[0].segments[0]
coords = pd.DataFrame([
    {'lat': p.latitude,
     'lon': p.longitude,
     'ele': p.elevation,
     'time': p.time} for p in segment.points])
coords.head(3)
plt.plot(coords.lon[::18], coords.lat[::18],'ro')
plt.show()
#plt.plot(coords.lon, coords.lat)

def lat_log_posx_posy(coords):

     px, py = [], []
     for i in range(len(coords.lat)):
         dx = utm.from_latlon(coords.lat[i], coords.lon[i])
         px.append(dx[0])
         py.append(dx[1])
     return px, py

def kalman_xy(x, P, measurement, R,
              Q = np.array(np.eye(4))):

    return kalman(x, P, measurement, R, Q,
                  F=np.array([[1.0, 0.0, 1.0, 0.0],
                              [0.0, 1.0, 0.0, 1.0],
                              [0.0, 0.0, 1.0, 0.0],
                              [0.0, 0.0, 0.0, 1.0]]),
                  H=np.array([[1.0, 0.0, 0.0, 0.0],
                              [0.0, 1.0, 0.0, 0.0]]))

def kalman(x, P, measurement, R, Q, F, H):

    y = np.array(measurement).T - np.dot(H,x)
    S = H.dot(P).dot(H.T) + R  # residual convariance
    K = np.dot((P.dot(H.T)), np.linalg.pinv(S))
    x = x + K.dot(y)
    I = np.array(np.eye(F.shape[0]))  # identity matrix
    P = np.dot((I - np.dot(K,H)),P)

    # PREDICT x, P
    x = np.dot(F,x)
    P = F.dot(P).dot(F.T) + Q

    return x, P

def demo_kalman_xy():

    px, py = lat_log_posx_posy(coords)
    plt.plot(px[::18], py[::18], 'ro')
    plt.show()

    x = np.array([px[0], py[0], 0.01, 0.01]).T
    P = np.array(np.eye(4))*1000 # initial uncertainty
    result = []
    R = 0.01**2
    for meas in zip(px, py):
        x, P = kalman_xy(x, P, meas, R)
        result.append((x[:2]).tolist())
    kalman_x, kalman_y = zip(*result)
    plt.plot(px[::18], py[::18], 'ro')
    plt.plot(kalman_x, kalman_y, 'g-')
    plt.show()

demo_kalman_xy()
</code>```

答:
Kalman filter consists of two steps: Time Update and Measurement Update. For asynchronous measurement case you will have variable sampling time which you will calculate using timestamp. For each sensor data(should come with a timestamp information) you might calculate the time difference between the last iteration and the current iteration. Then, you will use this time difference into the time update step. After that, measurement update will be performed with the corresponding measurement.</p>

```<code>For each iteration:
    dt = timestamp - last_time
    TimeUpdate(dt)
    MeasurementUpdate()
    last_time = timestamp
</code>```

Body:
Kalman filter consists of two steps: Time Update and Measurement Update. For asynchronous measurement case you will have variable sampling time which you will calculate using timestamp. For each sensor data(should come with a timestamp information) you might calculate the time difference between the last iteration and the current iteration. Then, you will use this time difference into the time update step. After that, measurement update will be performed with the corresponding measurement.

For each iteration:
    dt = timestamp - last_time
    TimeUpdate(dt)
    MeasurementUpdate()
    last_time = timestamp


问:
Some Kalman filter implementation queries
Just to clear some doubts:

Qn 1. Does kalman filter require constant time step?

From my own study, it does not seem necessary to have a constant time step. You just need to take into account time interval between steps with the prediction steps

Qn 2. What if you need to have an output at constant time interval but only have measurements at irregular interval, say your timestep is at 0.5s but your measurement only comes around 1.5-3s

Does the conventional approach normally output the last kalman filtered result(doing prediction and measurement) at 0.5s
or could they interpolate the result by kalman filter(doing only prediction and not measurement)?

Is there some form of implementation? (with code I can referred to?)

Or what other measures do people normally adopt?

Qn 3. If the measurements is irregularly timed and possibly delayed result
  say the measurements at 50s give actual reading of 49s result. What should we do?

The first idea I can think of is to increase measurement covariance. Am I right? What else can I do?

THanks

答:
Answers are inline

Qn 1. Does kalman filter require constant time step?

Correct it does not.
The reason you may find in literature that it requires a constant time step has to do with with lack of computing power in the 60s-90s and the discretization of a continuous system. You can read more about this in something like this, or other books that deal with Kalman filters.

Essentially it boils down to computing $e^{AT}$ for every $T$. If you use a constant timestep you can compute this value once, and just reuse it.

Qn 2. What if you need to have an output at constant time interval but
  only have measurements at irregular interval, say your timestep is at
  0.5s but your measurement only comes around 1.5-3s

You use whatever the last value was computed. That can come from either the measurement or the prediction step. No interpolation or anything else weird. Literally just the last value. The whole purpose of the prediction step is that it should accurately reflect how your model evolves with time.

Qn 3. If the measurements is irregularly timed and possibly delayed
  result say the measurements at 50s give actual reading of 49s result.
  What should we do?

There are a ton of different ways to deal with this and it is still an active area of research. I would say the easiest are the following options.

Constant Known time delay

If you know what the time delay is, and it is constant then take that into account in your implementation of prediction and measurement updates. E.g if your measurement update is actually measured at 49s, then only run a prediction up to 49s.

Time delay in filter

You can add the time delay as a state in your filter. You then hold off on predicting until you receive a measurement. You then run the prediction step up until $t_m+t_d$, and then run the measurement update. Note your measurement update has to somehow be able to also measure the time delay.

Here $t_m$ is your time of measurement, and $t_d$ is your time delay.

If you do need the predicted state value, at some earlier point then you run prediction as normal, except store the output somewhere differently.

Rolling back Kalman Filter state.

If your implementation is a Linear System, and able to be modeled by a Kalman Filter and not an EKF, then you can do some magic with reversing the state to a previous value. You would have to do some research on this cause I don't know how it is actually done in practice.


答:
Assuming the wheel is unloaded, or has a small load, it appears the wheel is not the problem in this application. Maybe I can point you to your problem in the application.
It appears that you are new to the use of stepper motors.
There are a few things with stepper motors that you need for proper operation:

A 12 volt dedicated supply (Unless the stepper motor specifically requests otherwise)

A stepper driver that can handle around 2x the current requirements for steady state (the 1.7 amp ##, you have to take into account current surges)

The microstep setting (on the driver) has to be configured - in my use cases, I recommend enable full microstep

The driver also needs the current configured through a resistor, a potentiometer, or through digital means.

If one of these things is not addressed, you can get unstable or no operation.

Power Supply

Just because your motor says 2.XX volts doesn't mean that is the only voltage you need. That is simply the voltage coming directly off the driver - this is not the same thing as the supply voltage.

Stepper driver choice

You are given the steady-state current for each phase. Most stepper motors are used in a 2-phase configuration, which means you should really use a driver that can supply 1.7*2=3.4 amps of current, which, to be same, should be rounded to 4 amps. This will enable enough power is available to the stepper at all RPMs.

Microstepping

If you are trying to turn a wheel, I am assuming that you want smooth motion, not necessarily fast motion. Enabling full microstepping will give you smooth motion. There should be pins you need to set to logic HIGH or little switches on the driver, depends what driver model you have (cheap vs. expensive).

Current configuring

Depending on how nice your stepper driver is, you may or may not need to configure the current on it. The nicer drivers are purchased for their specific current limits, and therefore you won't have to configure them. If you have a cheap one, like from a 3d printer driver board like the DRV8825 or those new Trinamic drivers with super hich microstepping, you will need to configure the current limits. Usually there is a potentiometer onboard that you can adjust with a non-conductive screwdriver. I have dipped my screwdrivers in nail polish for this purpose. I then start the motor up with the driver in the fully counter-clockwise position and then slowly turn clockwise until I get nice smooth motion. I suggest you use an Arduino to create a constant STEP and DIR signal such that you can then focus on tuning the current limits.

In summary, stepper motors need tuning for the desired application. You cannot just hook them up like a BLDC and expect them to work perfectly. You need to create a test setup to verify the operation of a stepper motor before adding it to your end product. They are not as replaceable as BLDC motors either: a stepper motor may look the same in size and weight, but perform very differently, keeping all other variables constant.

Try out my configuration recommendations before you attach something onto the stepper. You can use the wheel to check for the stepper resolution: the bigger steps will be more accentuated when you see a wheel doing the jerking.

Final notes

Stepper motors are designed to run hot as ****. Do not be surprised if the motor is so hot you cannot touch it, especially in applications where the the motor is always running for extended periods of time. You will need to look at the datasheet to verify stable temperatures. I have also found that, when choosing stepper motors, they do not need to have much resistance when you try to backdrive a stepper motor shaft yourself. A weak motor can have a surprising amount of torque. I was in for a shocker when I first started using steppers in belt-drive applications.

Title: Stepper can't turn plastic wheel. Is it normal?

Body:
Is it normal, that a stepper motor with the following specifications can't reliably turn a plastic wheel with a diameter of 13cm and a simple direct coupling?

Type: bipolar, two phases

Voltage: 2.55V

Current: 1.7 A/Phase

Resistance: 1.5 ± 10% Ω/Phase

Inductance: 2.8 ± 20% mH/Phase

Holding Torque: 40 N.cm Min

Detent Torque: 2.2 N.cm Max

Rotor Torque: 54 g.cm²


问:
Jacobian of the observation model?
The state vector is
$$ \textbf{X} = \begin{bmatrix} x \\ y \\ v_{x} \\ v_{y} \end{bmatrix}$$

transition function is
$$
\textbf{X}_{k} = f(\textbf{X}_{k-1}, \Delta t) =
\begin{cases}
x_{k-1} + v_{xk} \Delta t \\
y_{k-1} + v_{yk} \Delta t
 \end{cases}
$$

$z_{b} = atan2(y, x)$ and
$z_{r} = \sqrt{ x^{2} + y^{2}}$

the Jacobian of the observation model:
$$
\frac{\partial h}{\partial x} =
 \begin{bmatrix} \frac{-y}{x^{2}+y^{2}} & \frac{1}{x(1+(\frac{y}{x})^{2})} & 0 & 0 \\
                 \frac{x}{\sqrt{ x^{2} + y^{2}}} & \frac{y}{\sqrt{ x^{2} + y^{2}}} & 0 & 0
 \end{bmatrix}
$$

My question is how  the Jacobian of the observation model has been obtained? and why it is 2X4?

the model from Kalman filter.

答:
I've solved the problem by applying
$$  \frac{\partial h}{\partial x} =
\begin{bmatrix}
\frac{\partial z_{b}}{\partial x} & \frac{\partial z_{b}}{\partial y} &
\frac{\partial z_{b}}{\partial v_{x}} & \frac{\partial z_{b}}{\partial v_{y}} \\
\frac{\partial z_{r}}{\partial x} & \frac{\partial z_{r}}{\partial y} &
\frac{\partial z_{r}}{\partial v_{x}} & \frac{\partial z_{r}}{\partial v_{y}}
\end{bmatrix}  =
 \begin{bmatrix}  \frac{-y}{x^{2}+y^{2}} & \frac{1}{x(1+(\frac{y}{x})^{2})} & 0 & 0 \\
      \frac{x}{\sqrt{x^{2}+y^{2}}} & \frac{y}{\sqrt{x^{2}+y^{2}}} & 0 & 0 \\
 \end{bmatrix}
$$</p>

Title: Jacobian of the observation model?


问:
Hardware for Industrial-Grade CNC
I have developed a prototype of a CNC Machine with Arduino and Raspberry Pi for my first client, I now need to use industrial grade components, but I struggle with the hardware, I am confused.

I just learned about PLC, and I don't know anything about them.
What it takes to make an Industrial-Grade CNC ?

Should I use a PLC for my CNC ?
What PLC to use ? What modules ?
What is the hardware configuration ?

I want to learn,
But I struggle to find informations for this on the web.
Do you have some documentations ?

I need your help, I am a little bit lost I have to admit.

Thanks !

答:
CNC machines are usually used for moving a tool using multiple axes in a coordinated way. If you want to do the same with a PLC, the program gets very complicated and that's why it does not make sense to use a PLC instead of a CNC machine.

PLCs are usually used BEHIND the CNC for controlling more PLC like functions for the machine such as hydraulics, clamps, etc. So the CNC does the more complicated moving stuff but the PLC controls the general functions of the machine in the "back end". That being said, CNC's and PLC's are two different tools that are used for two different jobs.

The PLC is also commonly used in civil applications such as in washing machines and for controlling traffic signals and elevators. They are used in many industries to monitor and control production processes and building systems.

Title: Hardware for Industrial-Grade CNC


答:
If you want to learn about batteries and their characteristics, you should probably go to the BatteryUniversity to learn a few things before you start to do calculations, because if you miss interpret stated parameters as facts, you will get wrong results.

https://batteryuniversity.com/learn/

The specific mAh you can get from a battery depends on the voltage difference from charged to discharged state you are willing to use and at what current you do it (careful it can be dangerous or damaging to discharge to low or charge to high as well as overdrawing current). The way to be sure is to measure when you charge or discharge. Stated capacities on batteries are estimnates at best, depending on battery type it can be the most achivable mAh or the minimum value which is always achived ... check your datasheet of the battery for this(if your battery has no datasheet then the only option is measuring).

There is some websites and youtube channels doing battery tests, only if you test a cell you can know exactly how it performs.

LIION:

https://lygte-info.dk/review/batteries2012/Common18650Summary%20UK.html
http://www.dampfakkus.de/akku_liste-nach-groesse.php?size=18650

LIPO:

very difficult to find tests because the batches of batteries even from the same vendor have different performance characteristics. Find some here:

https://rightbattery.com/lipo-liion-life-batteries/

NiMH/NiCd

https://rightbattery.com/nicd-nimh-batteries/

I hope this gives you the right pointers on where to start.

Body:
How to calculate the maximum charge of the battery that it can give from a fully charged state to a fully discharged one. I have been trying to solve this problem for 2 months. The drone itself is not.
Maybe someone knows How to calculate the maximum charge of the battery?
And sorry about my English. I don't know him well.
Or some formulas for finding the electrical capacity of C?</p>


问:
How does scan matching find overlapping regions in two scans?
I have been reading about scan matching and so far I have gathered that scan matching tries to find the transformation (rotation and translation) which leads to the best match between overlapping points of the two scans. My question is : what algorithms does it use to find the overlapping regions ? Any explanations or links to relevant papers are greatly appreciated.</p>

答:
The process you are referring to is called point cloud registration (or point matching). The goal of point cloud registration is find the spatial transformation that aligns two point clouds (i.e., sets of points). One of the most popular methods is iterative closest point (ICP), and many variants of ICP exist. Other methods exist as well such as robust point matching (RPM) and variants, but I am not familiar with RPM.

The basic ICP algorithm essentially works by matching closest points and minimizing the error between point matches to find the rotation and translation between point clouds. The process is then repeated after transforming the original point cloud.

Methods for ICP are provided in the Point Cloud Library (PCL), which is open source software for point cloud processing. Other software also includes implementation e.g., MATLAB, libpointmatcher.  If you are interested in the theory, you can see the original ICP paper:

P. Besl, N. McKay "Method for Registration of 3-D Shapes" in IEEE
  Transactions of Pattern Analysis and Machine Intelligence, 1992.


问:
How to add a magnetometer in an Extended Kalman filter for innovation update?
I can't find out the response so I am posting here.

My post kind of follow this one : Adding magnetic field vector to a Kalman filter
but I already know that I don't have to put the magnetometer in a state vector.

I am working on a implementation of an Extended Kalman filter. So far I have integrated a gyroscope, an accelerometer and encoders wheels.

But I don't know what are the equation for the update state to integrate a magnetometer.

So far :

I have seen some kind of work where magnetometer are fuse with accelerometer.
But I don't have any formulas and I am kind of stuck...

I have seen some kind of work where there is no quaternion but I can't afford this modelisation cause of gimbal lock and I have all my work already in quaternion...

Thanks in advance for help. Don't hesitate if you need complementary details.

答:
If you want to incorporate magnetometer measurements in an EKF, you must model the magnetometer. In other words, you need an equation $\mathbf{y} = \mathbf{h}(\mathbf{x})$ where $\mathbf{y}$ is your magnetometer measurements or some transformation of the magnetometer measurements (e.g., you can preprocess your actual measurements) and $\mathbf{x}$ is your state vector. This is called the observation model and is included in the standard EKF equations.

Now, you might already understand that part, and if so, I assume you don't understand how to come up with the observation model. I can provide you with some direction on what to do:

What states can you measure using a magnetometer with some preprocessing? Can you measure any position states (e.g., x, y, or z)? Can you measure orientation states (roll, pitch, or yaw)? I will give you a hint. On Earth, you can estimate yaw using the magnetometer.

If you can process the measurements to find yaw, you can write your observation model, then plug the observation model in your EKF.

If you want to use in real life, you need to calibrate your magnetometer and do some outlier removal (e.g., do sanity check on yaw estimates from magnetometer). This is an absolute must for real life applications if you want the system to work.

If you need help processing the magnetometer measurements, I recommend this article for a simple model. Many other references exist, but this one is straightforward for getting started.

If you have specific question/confusion about the article or details in processing the magnetometer measurements. I can add some detail to my answer.


问:
Wall-E Legs mechanism
I was trying to understand the mechanism of Wall-E's Legs from the Wall-E 3D animation movie of Pixar Animation Studios, how he is able to move up and down and move the tracks on all directions. Can anyone explain how or point me to some resource?, I've been searching for days or watching slow motion scenes from movies but still I don't get the big picture of it.</p>

答:
This is an appropriate question over at movies SE, but even here its probably interesting. Wall-Es character is definitely an interesting one, very dynamic, anthropomorphic, and modelled quite realistic.

However there is a lot of film trickery going on here. Although Wall-E and other movie robots like Terminator seem like real mechanical systems, there are a lot of cgi clean up going on behind the scenes or scenes are planned in such a way that holding brackets and such are hidden, or things are designed in a way to terminate on faces of other models, but internally are simply non existing. This is Wall-Es case. It‘s modelled exactly enough to look mechanically feasible, but as you‘ve noticed it would be very difficult or impossible to create all his movements.

Title: Wall-E Legs mechanism


问:
Usage of Falkolib(OpenSLAM) for 2D lidar landmark extraction
I am using Falkolib for landmark extraction in a 2D environment. Currently I am using the testKeypointOC executable from the bin directory.

I have changed the testKeypointOC.cpp file and the testData.cpp file slightly to accommodate my own laser readings. I am using a simulation in Gazebo to get the laser readings from a Kinect mounted on a pioneer.

In the testData.cpp I am adding my laser readings into the testRangesOrtho1 list. I have 640 readings from the Kinect and hence I am changing the num of beams parameter to 640 in the testKeypointOC.cpp.

I'm also changing the field of view to 0.977384 (it translates to 56 degrees which is the FOV for the Kinect laser) in the same file and also the min angle to -0.513199985027 (I got this value from the rostopic echo).

After all this, I am still getting the number of keypoints as 0 and hence no landmarks detected. Has anyone used the Falkolib in their project by modifying these values?

答:
After considerable I was able to figure out how to use the Falkolib library. So, after you download the source code from github, you will have a folder called test. In that folder, there will be sample code for using the various detectors.

In my case I experimented with the Falko detector and the OC detector. However I found some issues with the OC detector in my case.

I assumed it to be used in environments where there are walls running parallel(on both sides) to the path of the robot. I assumed this because I understood that this is the use case of the OC detector from the documentation. But it appears that I was wrong and it cannot be used for that purpose.

I tried using the OC in that scenario in simulation and it started to detect landmarks in places where there was no landmark (mostly towards the front and the front was mostly clear). Hence then I experimented with the Falko detector and it worked perfectly.

I imagined the parallel walls scenario to be unique because the walls were always running parallel to the path of the robot and hence I thought that in this case it would be difficult to extract landmarks as it was a very monotonous environment and hence the algorithm would have a work extra hard and find landmarks only on the sides even though the sides would be really similar in most cases(office doors and labs were to the sides and as you know the office doors would appear very similar at each point along the corridor). But again, Falko worked well here.

Now onto how to use Falko: I started off with the testKeypointFalko.cpp file in the test folder. In that file, a LaserScan object is created in the beginning of the main function and inside that object certain parameters are passed. The first parameter is the start angle of the LIDAR, second is the end angle, and the last is the number of beams that the LIDAR shoots.

In my case, I was using a Kinect Laser Scanner and hence I got the start and end angle details by doing a rostopic echo on the Kinect Scanner. And you can find the number of beams for your scanner in the manual. Change those 3 parameters according to the scanner you are using.

Then for the entering the range data, I used the testData.cpp file in which you can manually put in the LIDAR scan ranges in testRanges and testRanges2 array. The testRangesOrtho1 and 2 are if you are going to use the OC detector.

There are 2 arrays for the Falko detector i.e testRanges and testRanges2 because the Falko detector not only extracts the landmarks but also compares the the laser range readings (testRanges and testRanges2 in our case) to find out the similar landmarks.

Once you update the testData.cpp file you can make and run the Falko detector and the you will get the output on the terminal about the landmarks and also the similar landmarks in the 2 laser range readings. Also, in order to detect different types of landmarks, for example circular, you may play with the following variables in the testKeypointOC.cpp file :

RangeRes

RangeMax

NMSRadius

NeighMinPoint

This library, I feel could also be used for data association because if you pass in the entire collected memory of laser scans and the current laser scan readings, it will be able to tell you how many of the extracted landmarks from the current readings are similar to each of the laser scan readings set in memory.

Good luck!


问:
Pre-built PID motor controller
I lead a university robotics team that needs PID controllers for four drive motors and two additional motors that are used in a secondary system. I would strongly prefer to buy pre-built PID controllers that provide just about any reasonable interface for setting PID constants, motor velocity and direction, as the controllers are not remotely central to the difficult, interesting problems we're trying to solve. To my astonishment, the Internet doesn't seem to be saturated with such controllers (talk about reinventing the wheel - hundreds of tutorials but almost no pre-built solutions! Did Willow Garage build their own PID controller for the PR2?!).

Does anyone have recommendations/experience, preferably pointers to such controllers?

I've Googled around quite a bit, and so far this is the best option I've found. It's a cape for a BeagleBone Black (which is the board we're using). The problem is that the Python library is not finished - it resets PID constants at every call, it doesn't support changing the direction of the motor, and it seems to only support setting motor power, not velocity, which gives me the impression that it's not actually using the PID controller at all.

Additional details:

The stall current of our drive motors is 6A. They are brushless DC motors with quadrature encoders. The secondary motors are much smaller, and we're building our own encoders for them.

Our code base is in Python, and we're running on a BeagleBone Black using the latest Debian image from Robert Nelson (that guy's awesome!). Our batteries provide 14.8V, and we already have 3.3V and 5V rails.

Our robot is fairly small, about 1x1x2 feet, and weighs about 9 pounds. This info is meant to give perspective with regard to scale.

$350 or so is the comfortable top range of what we could spend to get all 6 motors PID-controlled.

Any help would be greatly appreciated!

答:
Check http://www.pololu.com , they have few cheap options. If you want more reliable, more expensive solutions, then check http://www.copleycontrols.com . Both have solutions that meet your requirements, just find something that suits your budget.

There is another option that is used mainly for robotic drive, quite easy to setup, but it also allows you to drive motors individually, worth while looking at : www.robot-electronics.co.uk/htm/md49tech.htm

Title: Pre-built PID motor controller


问:
How do I calibrate a rotating laser scanner pose from known global coordinates?
Assume the following scenario:

A 2D LIDAR sensor is mounted with a vertical (not exactly known) scan plane at a height of 20m

The scanner can be rotated about the vertical axis and the encoder values are known and absolute. But I would like to calibrate the scanner from a single scan line (which should contain enough points)

The scanner sees objects relatively far away (no easy way to put calibration pattern close to the scanner)

I can obtain 3d coordinates of scanned points in the global coordinate system

I now wish to compute the scanner rotation and translation w.r.t. to the global coordinate frame.

Question:

Am I correct in the assumption that a few known global coordinates and   their scanner-local correspondences from measurement are sufficient in  computing rotation and translation? Algebraically, it seems that $R \cdot \vec{x}_\text{global} + \vec{t} = \vec{x}_\text{local}$ would lead to a system of linear equations with 9 + 3 unknowns, so I would only need 12 / 3 = 4 coordinate correspondences.

If no, what would I need for performing this task?

答:
You are mostly correct. You can compute the global coordinates from only a few point correspondences, but the system is not linear. If we expand the equation that described the relationship between the local and global coordinates (in 2D for simplicity), we have
$$\begin{bmatrix}
x_\mathsf{global}  \\
y_\mathsf{global}
\end{bmatrix} =
\begin{bmatrix}
\cos{\theta} & -\sin{\theta} \\
\sin{\theta} & \cos{\theta}
\end{bmatrix}
\begin{bmatrix}
x_\mathsf{local}  \\
y_\mathsf{local}
\end{bmatrix} +
\begin{bmatrix}
x  \\
y
\end{bmatrix}$$
where $x$ and $\theta$ are the position and orientation of the lidar with respect to the global coordinate frame (I wrote in 2D but similar applied to 3D).

Now, the parameters you are solving for are the orientation and translation of the lidar, which are $x$, $y$, and $\theta$ in 2D. If you have enough points, you can solve for these parameters, but you need to do some nonlinear optimization. If you have noise in your measurements (as you probably do), you will need even more points depending on how much noise. Hope this is helpful for you.


问:
Collaboration of mobile robot and survaillance camera - classic localization (still) needed?
Just started with the topic of mobile robotics..
so I'm still into concept making and little programming, but have not setup everything or tested at all. I got a (differential) mobile robot (lego mindstorm) and a external camera mounted on the ceiling of my testarea, looking top down. Robot is equipped with a bumper for collision detection and ultrasonic sensor. Area has some static obstacles (3-4) in it and there should be another lego robot moving around as dynamic obstacle. No markers or colors on the ground.

I plan to do a camera self-calibration taking odometry data and tracking the position of the robot by template matching. Creating the map get's done by image processing, with edge filtering and later converting to a gridmap.
So next for localization:
While I get more and more into all the subjects I ask myself how to do the localization in the best manner and still as collaboraive system. Is it possible or even clever to use a particle filter out of robot sensor data?
Or is my localization given, just by my template matching and image position extracting? The problem I see comes with the second robot, which will get the localization very complex.

Another Question is, how can I achieve an iterative map update? - The map should react on happenings, like the moving robot (dynamic).

I was reading about layering the occupancy/grid maps and update the master map. So combining it with A* Path Planning should make it dynamic I guess?

Thanks and best regards

答:
You ask several questions, but I will focus mostly on the localization part.

Is it possible or even clever to use a particle filter out of robot sensor data?

Yes. You can use a particle filter, but I don't understand what part of your system is collaborative. Instead, you have a robot operating in dynamic environment (with a remote sensor). See next comment.

Or is my localization given, just by my template matching and image position extracting?

You can get position (and maybe) orientation measurements from the camera, but the measurements are corrupted with error, so I suggest fusing the measurements from encoders and the camera in a filter. You mentioned a particle filter, but I would use a Kalman filter (however particle will work).

Another Question is, how can I achieve an iterative map update?

I don't know what you mean. I suggest looking up some literature on Simultaneous Localization and Mapping (SLAM). I think you are wanting to do something along these lines, but doing this is not easy.

I was reading about layering the occupancy/grid maps and update the master map. So combining it with A* Path Planning should make it dynamic I guess?

I am not sure what you are asking here. Dynamic usually refers environments that are not static, so in dynamic, obstacles or landmarks can change position while in static they do not.

I hope this is helpful. The questions are very general, so hard to answer specifically.


问:
Fusing IMU sensor with odometry
Would fusing Odometry estimation with IMU sensor increase the accuracy of estimation for planar differential drive robots?</p>

答:
Yes.

Example of this can be found here.

Depending on how good your modeling is you could also use the IMU to help detect wheel slippage.

Title: Fusing IMU sensor with odometry


问:
Inter-processor communication for robotic arm
I'm building a hobby 6-DOF robotic arm and am wondering what the best way is to communicate between the processors (3-4 AVRs, 18 inches max separation). I'd like to have the control loop run on the computer, which sends commands to the microprocessors via an Atmega32u4 USB-to-??? bridge.

Some ideas I'm considering:

RS485

Pros: all processors on same wire, differential signal more robust

Cons: requires additional chips, need to write (or find?) protocol to prevent processors from transmitting at the same time

UART loop (ie, TX of one processor is connected to RX of next)

Pros: simple firmware, processors have UART built in

Cons: last connection has to travel length of robot, each processor has to spend cycles retransmitting messages

CANbus (I know very little about this)

My main considerations are hardware and firmware complexity, performance, and price (I can't buy an expensive out-of-box system).

答:
I know I'm digging up an old thread and this is sort of off topic, but I don't think you can just get hold of ET1200 chips from Beckhoff. I emailed them a little while back and was advised that I need to join the Ethercat group. To do this I had to demonstrate that I was going to contribute back to the group - ie, by building and selling devices that used the Ethercat stuff. At that (and this) point in time, I am still prototyping my device (a brushless motor controller for robot applications - currently using CAN) so I could not offer anything (I cannot give a solid time for completion - Im still working on my undergrad). I expressed to them my disappointment. They said not to be disappointed!! Pretty funny stuff!
I would really like to get into Ethercat, but the ASICs seem to be untouchable to hobbyists or those without a company.
Also, this is my first post, so apologies if I have angered the gods by digging up an old post!


问:
Finding Jacobian matrix using the DH parameter table and relative transformation matrices
Let's say we have a three revolute joint robot with the following DH parameter table:

Where the last row corresponds to the transformation between the last joint frame and the end-effector frame.

We can easily derive the transformation matrices from the DH table:

$$A_{i-1,i}=A_{z,\theta}\cdot A_{z,d}\cdot A_{x,a}\cdot A_{x,\alpha}$$

And get the absolute transformation matrix of the minimal configuration:

$$A_{0,2}=A_{0,1}\cdot A_{1,2}$$

And of the end-effector:

$$A_{0,3}=A_{0,2}\cdot A_{2,3}$$

What are the steps to calculate the Jacobian, without using the predefined formulas:

I know that there are some partial derivatives by each $\theta_i$ involved, but I'm not sure what the procedure is.

答:
Your kinematic equation, which links TCP position to joint position is:
$$X = A_{0,3} \times Q$$

or

$$ \begin{pmatrix} x \\ y\\ z\\ 1\end{pmatrix} = A_{0,3} \times \begin{pmatrix} \theta_1 \\ \theta_2\\ \theta_3\\ 1\end{pmatrix} $$

based on this, you will need to  write:

$$ \left\{
\begin{eqnarray}
x &=& f_x(\theta_1, \theta_2, \theta_3)\\
y &=& f_y(\theta_1, \theta_2, \theta_3)\\
z &=& f_z(\theta_1, \theta_2, \theta_3)\\
\alpha &=& f_\alpha(\theta_1, \theta_2, \theta_3)\\
\beta &=& f_\beta(\theta_1, \theta_2, \theta_3)\\
\gamma &=& f_\gamma(\theta_1, \theta_2, \theta_3)
\end{eqnarray}
\right.$$

where $\alpha, \beta, \gamma $ are the Euler angles of end-effector orientation (it does not matter in which order they are defined, you just have to pick one and stick with it, e.g. XYZ order or ZXZ order). Based on these equations you can write the Jacobian as:
then

$$ J = \left[
\begin{matrix}
\frac{\partial f_x}{\partial \theta_1}  &  \frac{\partial f_x}{\partial \theta_2} & \frac{\partial f_x}{\partial \theta_3}\\
\frac{\partial f_y}{\partial \theta_1} &  \frac{\partial f_y}{\partial \theta_2} & \frac{\partial f_y}{\partial \theta_3}\\
\frac{\partial f_z}{ \partial \theta_1 }  &  \frac{\partial f_z}{\partial \theta_2} & \frac{\partial f_z}{\partial \theta_3}\\
\frac{\partial f_\alpha}{ \partial \theta_1 }  &  \frac{\partial f_z}{\partial \theta_2} & \frac{\partial f_z}{\partial \theta_3}\\
\frac{\partial f_\beta}{ \partial \theta_1 }  &  \frac{\partial f_z}{\partial \theta_2} & \frac{\partial f_z}{\partial \theta_3}\\
\frac{\partial f_\gamma}{ \partial \theta_1 }  &  \frac{\partial f_z}{\partial \theta_2} & \frac{\partial f_z}{\partial \theta_3}\\
\end{matrix}
\right]$$

Please note that this is $6x3$ as it is used to compute both linear and rotational velocities of the end-effector based on the 3 joint velocities as follows:

$$ \left[ \begin{array}
\dot{x} \\ \dot{y} \\ \dot{z} \\ \dot{\alpha} \\ \dot{\beta} \\ \dot{\gamma}
\end{array} \right]
= J \times \left[
\begin{array}
\dot{\theta_1} \\ \dot{\theta_2} \\ \dot{\theta_3}
\end{array}
\right]
$$


问:
How to seal a threaded rod so I won't lose oil?
I have an M5 threaded rod that penetrates a box. Outside it is driven by a motor and it rotates a part inside the box. The box is sealed and I would like to seal the area around the rod as well. I have seen double lip oil seals but I don't think they will work.

The oil is very runny, like water and the reason I am not using a smooth rod (which would be simpler to use in this application) is mainly in order to save on tooling costs as I can get the rods already threaded for very cheap.

Any help would be appreciated!

答:
If not moving, file the rod down or machine it, and take the smooth rod approach or screw it all way in to head and seal it there..

However, if moving..  I'd say use a nylon bushing smaller than threading and screw it on to the point it will align with edge of box it goes into, if it screws on too easy, it may be a bit too loose cause the friction may unscrew it or you can make it stay using a couple more nuts on each side of the nylon...  Then seal the smooth outer edge of the nylon as if just straight rod going through.. The threaded will always work it's way through something so best afix nylon to it, epoxy it, and make it a permanent fixture to the threaded rod and then drill out your hole a tiny bit more.. The only other way I know of would be more costly than just buying straight rods and it involves a type two part joint to isolate inside from outside..


问:
How to communicate vrep with ESP8266 via wifi to send and receive data
I'm looking for some guidance on a project that I've been doing for quite a long time; the project is about a 4WD robotic platform for obstacle avoidance with haptic feedback. If you know about the appropriate communication protocols for my project and can tell me something based on your experience with some similar projects - I will really appreciate it. So, I'm going to tell you what I've done so far.

I'm already taking the distances where the obstacle is located to my ESP8266. This is through a 340° detector made out of two Vl53L0X TOF sensors that use I2C CP, and a micro servo motor to make them turn around. With the same board, I control four Servos Dynamixel that use UART CP.

I command the robot through a web page and receive the data of each sensor in real-time (a delay of 2s) using TCPIP protocol and HTTP.

My questions are:

How can I read the data on the web page using VREP which is where the haptic control will be implemented?

Do you know any other way to connect via WIFI the ESP8266 with VREP and establish a bidirectional communication?

I tried using MATLAB to read the data from the web page and send it back to VREP afterward, but I haven't succeeded, yet. I can just write data, so far. All this using the function TCPIP and TCPCLIENT. Is it convenient to use MATLAB as a bridge between the ESP8266 and VREP? If so, What am I missing to succeed in this?

答:
and 2.

VREP is a simulator system. you can develop plug-ins for it which can run custom code (i.e. communicate with your robot). Here is a short intro on how to start. You can establish a bidirectional TCP-IP Communication from the plug-in. You can make a C TCP-IP Server (as presented here) and run this on a different thread so it does not block your simulation. The message() function of the plug-in can then handle the inter-thread communication between V-REP and the TCP-IP Server. I would ditch HTTP as there is no need for it. You can also consider other protocols, like MQTT instead of TCP-IP (as there are some tutorials, like this, on getting this running on the ESP)

Technically, you can have Matlab in-between, acting as a bridge, but it does not make much sense since it ads additional complexity. If this helps you in any way getting the system running, then make the prototype with Matlab and then work on eliminating Matlab form the solution. This would be a programming exercise, again, I cannot see a technical advantage for having Matlab as a bridge, but it can have a didactic motivation.


问:
Maintaining positive-definite property for covariance in an unscented Kalman filter update
I have an unscented Kalman filter (UKF) that tracks the state of a robot. The state vector has 12 variables. Each time I carry out a prediction step, my transfer function (naturally) acts on the entire state. However, my sensors provide measurements of different parts of the robot's state, so I may get roll, pitch, yaw and their respective velocities in one measurement, and then linear velocity in another.

My approach to handling this so far has been to simply create sub-matrices for the covariance, carry out my standard UKF update equations, and then stick the resulting values back into the full covariance matrix. However, after a few updates, the UKF yells at me for trying to pass a matrix that isn't positive-definite into a Cholesky Decomposition function. Clearly the covariance is losing its positive-definite properties, and I'm guessing it has to do with my attempts to update subsets of the full covariance matrix.

As an example taken from an actual log file, the following matrix (after the UKF prediction step) is positive-definite:

```<code>   1.1969            0            0            0            0            0      0.11567            0            0            0            0            0
        0       1.9682            0            0            0            0            0      0.98395            0            0            0            0
        0            0       1.9682            0            0            0            0            0      0.98395            0            0            0
        0            0            0       1.9682            0            0            0            0            0      0.98395            0            0
        0            0            0            0       1.9682            0            0            0            0            0      0.98395            0
        0            0            0            0            0       1.9682            0            0            0            0            0      0.98395
  0.11567            0            0            0            0            0      0.01468            0            0            0            0            0
        0      0.98395            0            0            0            0            0            1            0            0            0            0
        0            0      0.98395            0            0            0            0            0            1            0            0            0
        0            0            0      0.98395            0            0            0            0            0            1            0            0
        0            0            0            0      0.98395            0            0            0            0            0            1            0
        0            0            0            0            0      0.98395            0            0            0            0            0            1
</code>```

However, after processing the correction for one variable (in this case, linear X velocity), the matrix becomes:

```<code>   1.1969            0            0            0            0            0      0.11567            0            0            0            0            0
        0       1.9682            0            0            0            0            0      0.98395            0            0            0            0
        0            0       1.9682            0            0            0            0            0      0.98395            0            0            0
        0            0            0       1.9682            0            0            0            0            0      0.98395            0            0
        0            0            0            0       1.9682            0            0            0            0            0      0.98395            0
        0            0            0            0            0       1.9682            0            0            0            0            0      0.98395
  0.11567            0            0            0            0            0         0.01            0            0            0            0            0
        0      0.98395            0            0            0            0            0            1            0            0            0            0
        0            0      0.98395            0            0            0            0            0            1            0            0            0
        0            0            0      0.98395            0            0            0            0            0            1            0            0
        0            0            0            0      0.98395            0            0            0            0            0            1            0
        0            0            0            0            0      0.98395            0            0            0            0            0            1
</code>```

The difference between the two matrices above is

```<code>        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0     -0.00468            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
        0            0            0            0            0            0            0            0            0            0            0            0
</code>```

As you can see, the only difference between the two is the value in the location of the variance of linear X velocity, which is the measurement I just processed. This difference is enough to "break" my covariance matrix.

I have two questions:

Updating a subset of the filter doesn't appear to be the right way to go about things. Is there a better solution?

Alternatively, am I missing a step that would keep my covariance matrix as positive-definite?

Thanks!

EDIT:

It looks like I'm not properly placing the values back into the original covariance matrix. Simply copying the values back isn't sufficient. I need to track the correlation coefficients for the covariance matrix, and make sure that when I update a variance value, I update all the values in its row/column to maintain the correlation coefficient value. I have to do some more testing to verify that this is my issue, but some initial analysis in Matlab suggests that it is. If I'm correct, I'll answer my own question.

EDIT 2:

Given the response below and after trying it, I can see that my original edit idea won't fly. However, I have one more question:

As this is a UKF, I don't actually have Jacobian matrices. I think I see how I would make it work within the UKF update equations, but even in an EKF - and I ask because I have one of those as well - my state-to-measurement function $h$ is going to end up being the identity matrix, as I am directly measuring my state variables. In the case, I take it my "Jacobian" would just be an $m \times n$ matrix with ones in the $(i, i)$ location, where $i$ is the index of the measured values in the measurement vector?

答:
A few notes first,

First, as you mentioned, you can't just pull out a submatrix and do an update on it. You can do a propogation step on a submatrix, however.

This is because of the cross-covariance terms (which "spread" information across different parts of the state). This is why having a more accurate estimate of your heading will lead to more accurate position estimates, for example.

However, following your edit, simply updating the cross-correlation (covariance) terms won't do it either, you need to update the whole matrix (unless you know for sure that some elements are independent, conditioned on the state estimate.

Here you go:

To do this, form the Jacobian matrices as before, but note that there should be zeros in all off-diagonal elements when no part of that state is being measured. Then the magic of matrix inversion will spread the innovation corrections to the correct parts of the state. The Jacobian matrix must be of size $n\times m$ for $m$ measured values and $n$ state variables (or $m\times n$ depending on your definition of Jacobian). None of this "update part of the covariance junk" unless you know for sure that the Jacobian elements are equivalent to identity. The safest way is to use the full Jacobian.

Other hacks (once everything is theoretically correct)

However, this still won't ensure PD covariance matrices.
I strongly strongly recommend you don't do the following hacks until you fix all the other mistakes. But in the end, for a field-deploy-able system that operates for non-trivial amounts of time, I've found it is almost always necessary to do the following things:

After all updates, Let covariance $P$ be $P\gets \frac{1}{2}P + \frac{1}{2}P^{T}$, just to "even out" the off-diagonal terms -- for symmetry

Let $P\gets P + \epsilon I_{n\times n}$, where $\epsilon$ is a small scalar to ensure you don't underflow (and wreck the condition number of your matrix)


问:
Finding orientation angles of end-effector from the DH parameter table and transformation matrices
Let's say we have a manipulator with the following DH parameter table:

and transformation matrices:
$$A_{01}=
\begin{bmatrix}
\cos(q_1) & \sin(q_1) & 0 & 95\cos(q_1)\\
\sin(q_1) & -\cos(q_1) & 0 & 95\sin(q_1)\\
0 & 0 & -1 & 0\\
0 & 0 & 0 & 1
\end{bmatrix}$$
$$A_{12}=
\begin{bmatrix}
\cos(q_2) & 0 & \sin(q_2) & 89\cos(q_2)\\
\sin(q_2) & 0 & -\cos(q_2) & 89\sin(q_2)\\
0 & 1 & 0 & 0\\
0 & 0 & 0 & 1
\end{bmatrix}$$
$$A_{23}=
\begin{bmatrix}
\cos(q_3) & -\sin(q_3) & 0 & 147\cos(q_3)\\
\sin(q_2) & \cos(q_2) & 0 & 147\sin(q_2)\\
0 & 0 & 1 & -28\\
0 & 0 & 0 & 1
\end{bmatrix}$$
When multiplied, they form the absolute transformation matrix of the end-effector relative to the reference frame:
$$A_{03}=A_{01}\cdot A_{12}\cdot A_{23}=$$
$$\begin{bmatrix}
\cos(q_3)\cos(q_1-q_2) & -\sin(q_3)\cos(q_1-q_2) & -\sin(q_1-q_2) & 95\cos(q_1)+28\sin(q_1-q_2)+89\cos(q_1-q_2)+147\cos(q_3)\cos(q_1-q_2)\\
\cos(q_3)\sin(q_1-q_2) & -\sin(q_3)\sin(q_1-q_2) & \cos(q_1-q_2) & 95\sin(q_1)-28\cos(q_1-q_2)+89\sin(q_0-q_1)+147\cos(q_3)\sin(q_1-q_2)\\
-\sin(q_3) & -\cos(q_3) & 0 & -147\sin(q_3)\\
0 & 0 & 0 & 1
\end{bmatrix}$$
We can easily read the position of the end-effector relative to the reference frame just from the fourth column of the $A_{03}$ matrix:

$\begin{bmatrix}
x\\
y\\
z
\end{bmatrix} = $
$\begin{bmatrix}
95\cos(q_1)+28\sin(q_1-q_2)+89\cos(q_1-q_2)+147\cos(q_3)\cos(q_1-q_2)\\
95\sin(q_1)-28\cos(q_1-q_2)+89\sin(q_0-q_1)+147\cos(q_3)\sin(q_1-q_2)\\
-147\sin(q_3)
\end{bmatrix}$

How can we read the orientation of the end-effector relative to the reference frame?

答:
Your $A_{0.3}$ matrix is a 4x4 transformation matrix. In a general form these 4x4 matrices can be subdivided into a 3x3 rotation and a 3x1 translation part. (The remaining parts can be used for scaling, but are not used in robotics)

$
A_{0,3}= T_{4 \times 4}=
\begin{pmatrix}
R_{3 \times 3} & T_{3  \times 1}\\
0_{1 \times  3} & 1
\end{pmatrix}
$

The $R_{3 \times 3}$ part is a 3x3 rotation matrix, also called a direction cosine matrix. Basically it is built from the coordinates of the unit vectors of the end effector coordinate system expressed in the reference coordinate system. This guide describes how to convert this matrix to Euler angles.


问:
ShopBot router software crashes after machine moves past limit switch
We just bought a ShopBot for our Workshop and set it up ourselves. The ShopBot Software crashed every time we manually moved the gantry past its magnetic limit switches. Sometimes the software also crashed during a standard X-Y-Zeroing procedure. The machine has both limit switches and hard-stops installed that prevent the gantry from rolling off the rails after passing the limit switch.

Have any of you experienced a similar problem? How can we fix this?

答:
We have a ShopBot at our Maker Space and have had a similar issue. In short, adjust the distance between your limit-switch trigger screws and your hard-stop. If your hard-stop is too far away from your limit-switch trigger screw and allows the magnetic limit-switch to disengage i.e. turn off after passing the limit switch the software encounters an unexpected state that is currently not properly handled. There should never be a scenario where your shop bot is outside of its limits and the limit-switch is not triggered.

You can simply check if this is the problem by manually moving the gantry to its extremes and check if the red light on the limit switch turns off when hitting the switch and if your distance is too large on again after passing the switch before hitting the hard-stop.


问:
Jacobian of the observation model?
The state vector is
$$ \textbf{X} = \begin{bmatrix} x \\ y \\ v_{x} \\ v_{y} \end{bmatrix}$$

transition function is
$$
\textbf{X}_{k} = f(\textbf{X}_{k-1}, \Delta t) =
\begin{cases}
x_{k-1} + v_{xk} \Delta t \\
y_{k-1} + v_{yk} \Delta t
 \end{cases}
$$

$z_{b} = atan2(y, x)$ and
$z_{r} = \sqrt{ x^{2} + y^{2}}$

the Jacobian of the observation model:
$$
\frac{\partial h}{\partial x} =
 \begin{bmatrix} \frac{-y}{x^{2}+y^{2}} & \frac{1}{x(1+(\frac{y}{x})^{2})} & 0 & 0 \\
                 \frac{x}{\sqrt{ x^{2} + y^{2}}} & \frac{y}{\sqrt{ x^{2} + y^{2}}} & 0 & 0
 \end{bmatrix}
$$

My question is how  the Jacobian of the observation model has been obtained? and why it is 2X4?

the model from Kalman filter.

答:
The Jacobian is of size $2\times 4$ because you have four state elements and two measurement equations.

The Jacobian of the measurement model is the matrix where each $i,j$ element corresponds to the partial derivative of the $i$th measurement equation with respect to the $j$th state element.

Title: Jacobian of the observation model?


问:
Is SLAM done only first time in a given environment
I am training Turtlebot 2 to move around the office. I come from robotics hardware background but relatively new to computer vision and robotic mapping.

Here are my two fundamental questions related to localization and mapping.

The algorithm we are using to mapping is SLAM. This makes sense but my question is in general, if we have performed SLAM, then the map is created and this map can be saved for later. So is it right to say, next time if the bot moves in the same environment, it is not using SLAM but instead only localisation (since the map already exist). Is SLAM in general used only for first time mapping within an environment?

If there is no mapping at all, can bots be trained to move randomly and turn back or around only if there is an obstacle or wall.  This wouldn't require mapping, right? So is it right to say, bots can be moved either by mapping or without mapping, depending on the need.

答:
Is SLAM in general used only for first time mapping within an
  environment?

Yes, SLAM is used only once to build map of the environment before navigation operation. Also, In case of significant change in the environment.

If there is no mapping at all, can bots be trained to move randomly
  and turn back or around only if there is an obstacle or wall. This
  wouldn't require mapping, right? So is it right to say, bots can be
  moved either by mapping or without mapping, depending on the need.

Maps are required for

Localization (to know the current location of Robot). One cam localize robot without maps using visual tag or some other markers to make robot identify it location.

Path planning (given destination, returns obstacle free efficient path).

Without map, it is possible to move the robot randomly and avoid obstacles. If you are using laser, you don't need learning, its easy to avoid obstacles based on sensor data.