答: Just as manna kalsariya suggested, you can try to use the pseudo inverse. The README of the Universal Java Matrix Package (see "Quick Start") shows that the pseudo inverse is implemented and available for you to use. Instead of Matrix mu=omega.inv().mtimes(Xi);, try Matrix mu=omega.pinv().mtimes(xi);.

Title: Matrix is singular error in GraphSLAM

Body:
I have gone through The GraphSLAM Algorithm with Applications to Large-Scale Mapping of Urban Structures. I implemented the code for GraphSLAM. The fundamental formula of GraphSLAM is

$$\mu = \Omega^{-1}\xi$$

When I inverse $\Omega$ it gives me an error that Matrix is singular.

In the above document there are some hints how to avoid this error. But I failed to understand that. On the eighth page of the above document - on page 410 - they discuss it in section 4. The GraphSLAM Algorithm portion. If anybody can understand it, please help me to understand.

From the text:

In particular, line 2 in GraphSLAM_linearize initializes
  the information elements. The “infinite” information entry in
  line 3 fixes the initial pose $x_0$ to (0 0 0)$^T$ . It is necessary, since
  otherwise the resulting matrix becomes singular, reflecting the
  fact that from relative information alone we cannot recover
  absolute estimates.

I added my code here for better understanding

```<code>import java.io.IOException;
import org.ujmp.core.SparseMatrix;
import org.ujmp.core.Matrix;

import java.io.File;
import java.util.Scanner;

public class Test1 {
public static void main(String args[]) throws IOException {
    Matrix omega = SparseMatrix.Factory.zeros(5, 5);
    Matrix Xi=SparseMatrix.Factory.zeros(5,1);
    int i = 0, i1 = 0, k1 = 0, k2 = 0,l=0,l1=0;
    double[] timex = new double[5];
    double[] forwardx = new double[5];
    double[] angularx = new double[5];
    double[]x1=new double[5];
    double[]y1=new double[5];
    double[]theta1=new double[5];
    double []landx=new double[2];
    double[]landy=new double[2];
    double[] timeya = new double[2];
    double[] codea = new double[2];
    double[] rangea = new double[2];
    double[] bearinga = new double[2];
    Scanner x = new Scanner(new File("/home/froboticscse/IdeaProjects/UJMPtest/src/main/java/a.txt"));
    Scanner y = new Scanner(new File("/home/froboticscse/IdeaProjects/UJMPtest/src/main/java/b.txt"));
    while (x.hasNext()) {

        double time = x.nextDouble();
        double forward = x.nextDouble();
        double angular = x.nextDouble();
        timex[i] = time;
        forwardx[i] = forward;
        angularx[i] = angular;
        x1[i]=((forwardx[i]*0.006+Math.cos(0+(angularx[i]*0.006)/2)));
        y1[i]=((forwardx[i]*0.006+Math.sin(0+(angularx[i]*0.006)/2)));
        theta1[i]=(angularx[i]*0.006);
        i++;
    }

    while (y.hasNext()) {
        double timey = y.nextDouble();
        double code = y.nextDouble();
        double range = y.nextDouble();
        double bearing = y.nextDouble();
        timeya[i1] = timey;
        codea[i1] = code;
        rangea[i1] = range;
        bearinga[i1] = bearing;

        i1++;

    }
    while (k1 < timex.length && k2 < timeya.length) {
        if (timex[k1] < timeya[k2]) {
            omega.setAsDouble(1, k1, k1);
            omega.setAsDouble(1, k1, k1 + 1);
            Xi.setAsDouble(x1[l],k1,0);
            k1++;
            l++;
        } else if (timex[k1] == timeya[k2]) {
            landx[l1]=x1[k1]+rangea[k2]*(Math.cos(bearinga[k2]+theta1[k1]));
            omega.setAsDouble(1, k1, k2);
            omega.setAsDouble(1, k2, k1);
            Xi.setAsDouble((landx[l1]+x1[l1]),k1,0);
            k2++;
            l1++;
        } else {
            System.out.println("Nothing to add");
        }
       // System.out.println(Xi);
    }
    System.out.println(omega);
   /* Matrix mu=omega.inv().mtimes(Xi);
    System.out.println(mu);*/
}
</code>```

}


问:
How to tringulate many projections of a point to optimal postion?
Suppose we have many images for the same scene (with known poses already,using for ex: a GPS ), and the same feature appear in more than 2 images .

How to use all the available info to compute as precisely as possible the 3d-reconstruction of the scene? (actually ,I want a dense map but let's start with a point)

For 2 images , it's a least square problem solved with OpenCV function: cv2.tringulatePoints

but for many, how to find the best estimate?

any ideas on the subject? [no problem with dense math]

答:
I will assume, similar to OpenCV, that each camera is a pinhole camera, so you already corrected for things like lens distortion. In this case each visible point in 3D space $(x,y,z)$ gets projected into camera coordinates using

$$
\begin{bmatrix}
x'_i \\ y'_i \\ z'_i
\end{bmatrix} = R_i \,
\begin{bmatrix}
x \\ y \\ z
\end{bmatrix} + \vec{t}_i, \\
u_i = \alpha_i\,\frac{x'_i}{z'_i} + \gamma_i, \\
v_i = \beta_i\,\frac{y'_i}{z'_i} + \delta_i,
$$

where $R_i$ is the rotation matrix of camera $i$, which determines the orientation of the camera, $\vec{t}_i$ is the position of camera $i$ in reference frame of the camera itself, $u_i$ and $v_i$ are the pixel coordinates of the point in the image of camera $i$, and $\alpha_i$, $\beta_i$, $\gamma_i$ and $\delta_i$ are camera parameters that scale and translate the projected coordinates into the pixel coordinates of camera $i$.

For the least squares problem it will be assumed that for each camera its parameters $R_i$, $\vec{t}_i$, $\alpha_i$, $\beta_i$, $\gamma_i$ and $\delta_i$ are known and that the pixel coordinates $u_i$ and $v_i$ of the point that has to be triangulated are known as well. In this case the least squares problem can be formulated as follows

$$
(x,y,z) = \arg\min_{x,y,z} \sum_{i\in\mathcal{I}} (\hat{u}_i - u_i)^2 + (\hat{v}_i - v_i)^2 \\
\text{s.t.} \begin{bmatrix}
\hat{x}'_i \\ \hat{y}'_i \\ \hat{z}'_i
\end{bmatrix} = R_i \,
\begin{bmatrix}
x \\ y \\ z
\end{bmatrix} + \vec{t}_i, \\
\hat{u}_i = \alpha_i\,\frac{\hat{x}'_i}{\hat{z}'_i} + \gamma_i, \\
\hat{v}_i = \beta_i\,\frac{\hat{y}'_i}{\hat{z}'_i} + \delta_i,
$$

where $\mathcal{I}$ is the set of all indices of the cameras which see the considered point. You could also add weights to each quadratic term in the summation, for example to reduce the influence of bad or low resolution cameras. The error terms in the summation are also known as the reprojection errors.

I suspect that this problem is not convex, mainly due to the division by $\hat{z}'_i$. However I do suspect that if you would use an initial guess that is well within the viewing frustum of each camera that it would converge to the global minimum in most cases. This optimization problem can be solved with methods like gradient decent or Newton's method where the gradient can be calculated with

$$
\nabla f = 2\,\sum_{i\in\mathcal{I}} (\hat{u}_i - u_i)\,\nabla\hat{u}_i + (\hat{v}_i - v_i)\,\nabla\hat{v}_i, \\
\nabla\hat{u}_i = \frac{\alpha_i}{\hat{z}_i'}\,R_i^\top \left(
\begin{bmatrix}1 & 0 & 0\end{bmatrix}^\top - \frac{\hat{x}_i'}{\hat{z}_i'} \begin{bmatrix}0 & 0 & 1\end{bmatrix}^\top
\right), \\
\nabla\hat{v}_i = \frac{\beta_i}{\hat{z}_i'}\,R_i^\top \left(
\begin{bmatrix}0 & 1 & 0\end{bmatrix}^\top - \frac{\hat{y}_i'}{\hat{z}_i'} \begin{bmatrix}0 & 0 & 1\end{bmatrix}^\top
\right).
$$

In a similar way the hessian can be calculated as well, but its expression gets a bit long and does not add that much to this answer.

I have not found a source for the problem formulation above, but I did found a source which suggested a fast way of minimizing the maximum value of of the $p$-norm of $\begin{bmatrix}\hat{u}_i - u_i & \hat{v}_i - v_i\end{bmatrix}^\top$, while also adding the constraints that $\hat{z}_i' > 0$. So this problem formulation, without the extra constraints, can be characterized as $(\ell_\infty,\ell_p)$, whereas my problem formulation can be characterized as $(\ell_1,\ell_2)$.

A non-iterative way would be linear least squares triangulation.
This method searches for the depth of the point of each camera ($z'_i$) and the 3D position at the same time. Namely, when ignoring disturbances in the pixels coordinates of the point, the set of all 3D points which would get projected to the same pixel coordinates would span a line. This line would go through the cameras position and the actual 3D position. By rewriting the first equations, then for each camera the following equation can be formulated

$$
z_i'
\begin{bmatrix}
\frac{x_i'}{z_i'} \\ \frac{y_i'}{z_i'} \\ 1
\end{bmatrix} = z_i'
\begin{bmatrix}
\frac{u_i - \gamma_i}{\alpha_i} \\ \frac{v_i - \delta_i}{\beta_i} \\ 1
\end{bmatrix} =
R_i \,
\underbrace{\begin{bmatrix}
x \\ y \\ z
\end{bmatrix}}_{\vec{x}} + \vec{t}_i.
$$

Solving the third row of the above equation for $z_i'$ gives $z_i' = R_{i,3}\,\vec{x} + \vec{t}_{i,3}$, where $R_{i,3}$ is the third row of $R_i$ and $\vec{t}_{i,3}$ is the third element of $\vec{t}_i$. Substituting this back into the top two rows of the equation above gives

$$
\left(\vec{u}_i\,R_{i,3} - R_{i,1:2}\right)\,\vec{x} =
\vec{t}_{i,1:2} - \vec{u}_i\,\vec{t}_{i,3}, \\
\vec{u}_i =
\begin{bmatrix}
\frac{u_i - \gamma_i}{\alpha_i} \\ \frac{v_i - \delta_i}{\beta_i}
\end{bmatrix},
$$

where $R_{i,1:2}$ are the firs two rows of $R_i$ and $\vec{t}_{i,1:2}$ are the first two elements of $\vec{t}_i$. All these equations can be combined into one system of linear equation by using

$$
\underbrace{\begin{bmatrix}
\vec{u}_1\,R_{1,3} - R_{1,1:2} \\
\vec{u}_2\,R_{2,3} - R_{2,1:2} \\
\vdots \\
\vec{u}_n\,R_{n,3} - R_{n,1:2}
\end{bmatrix}}_{A\in\mathbb{R}^{2n\times3}}\,\vec{x} =
\underbrace{\begin{bmatrix}
\vec{t}_{1,1:2} - \vec{u}_1\,\vec{t}_{1,3} \\
\vec{t}_{2,1:2} - \vec{u}_2\,\vec{t}_{2,3} \\
\vdots \\
\vec{t}_{n,1:2} - \vec{u}_n\,\vec{t}_{n,3}
\end{bmatrix}}_{b\in\mathbb{R}^{2n}},
$$

where $n$ is the number of cameras (so $\mathcal{I} = \{1,2,\cdots,n\}$) and has the least squares solution for $\vec{x}$ given by $(A^\top\,A)^{-1}\,A^\top\,b$. The inverse of $A^\top\,A$ should exist when using two or more (unique) cameras, so you should always be able to find a solution. The downside of this approach would be that it does not take into consideration the uncertainty of the direction of the line which get amplified more the larger $z_i'$ is and it would require more memory, especially for a large number of cameras.

I did do some testing with both methods and found that with the first could diverge when a bad initial guess was used. For this I did not use the constraints that $\hat{z}_i' > 0$, so adding this might avoid this. But when it did converge it would often get a slightly better answer than the second method, probably because the second method does not take into consideration the possibility that the pixel coordinates might be slightly of. So the best option might be to first use the second method to get a good initial guess for the first method, however you might already consider that this initial guess is already good enough. When a very large number of cameras is used then it might also be an option to first use only a small subset of the cameras in the second method to obtain the initial guess and then use all cameras for the first method.

ContentLicense: CC BY-SA 4.0


问:
Control Pneumatic Cylinder Position with Potentiometer and Analog Comparator on Arduino Uno
I am building a robot arm that is actuated by a pneumatic cylinder. Extending and retracting the piston would increase and decrease the joint angle respectively. This is done using a 5/3 solenoid valve controlled by a relay switch. The actual joint angle is feedback using a potentiometer connected to analog A0 pin of an Arduino Uno.

I have a basic idea of how the whole mechanism would work to control position of the piston but have some queries and also on the use of Analog Comparator to serve as interrupt.

The components I am using are:

Pneumatic Cylinder that would be fitted with speed reducing connectors to hopefully slow down the piston action enough to be controllable

5/3 Solenoid Valve

Relay Module

Potentiometer

Basic idea of how the system would function:

Potentiometer reading is mapped to joint angle range

User keys in target joint angle

If target joint angle < measured joint angle, switch on relay to power desired solenoid valve and extend the piston and the opposite when target joint angle > measured joint angle

If target joint angle = measured joint angle, switch off relays and solenoid valve would be in closed position, i.e.: no air input and piston stays in position

Queries:

Interrupt vs Polling

The control loop needs to know when the actual joint angle = target joint angle so as to switch off the relay and power down the solenoid valve. This requires an interrupt signal when the potentiometer reading reaches a certain value correct?

Polling of the potentiometer using analogRead() may miss a reading? Or would polling simply be the more straightforward way to get joint angle feedback?

Analog Comparator

If interrupt is the way to go, this would mean needing to use the in-built analog comparator on Uno. I read up on it and the idea is to put a reference voltage at D7 of Uno, while the potentiometer values are input at D6. When the input voltage passes the reference voltage, an interrupt (either falling or rising edge) would occur.

But this would mean that there can only be one fixed reference voltage right? Or is there a means to have variable reference voltage sent in to D7 according to user input desired values?

And the Uno only has these two pins for analog comparator, it would not be able to support a two-joint robot arm with angles measured by two different potentiometers correct?

Or are there smarter ways to achieve control of the piston position?

答:
Answering Your questions:

It doesn't require any interrupt signal. You can just check if measured joint angle is equal to the desired one.

I have no idea why analogRead() would "miss" a reading. If the software will be properly written (no redundant code inside interrupts, that might cause the software to hang on the interrupt), then analogRead() should work as expected.

As for analog comparator answers, let's check out the ATMega328P documentation.

ATMega328P supports only one analog comparator, so only one reference voltage should be supplied. Therefore, using more potentiometers with this method will require usage of external comparators.

Morever, analog comparator output will only give You the information if measured voltage is "higher or equal" or "lower" than the voltage on the other input - there is no "equal" signal, so Your three step regulator would be always rocking around the desired point.

Taking everything into consideration, software measurement of the potentiometer voltage for the negative feedback of the control loop will be best for Your application.

One thing for You to remember: arm, relays, valves, pistons etc. have delays and inertia, as these are moving physical objects. Moreover, voltage measurement on the potentiometer always have some uncertanities and is never super steady, as we'd like to. Therefore, your robotic arm with Yours regulation algorithm will have a very big problem with going exactly to the point, where potentiometer voltage is correct. Probably it will oscillate around the desired angle. Adding hysteresis to Your control algorithm should solve that problem - it will get to the angle near desired one without oscillation, if the hysteresis will be big enough. With that, You'll get a double-setpoint controller.

However, please consider usage of the PID algorithm. For Your hardware configuration it will function at rather low frequencies (as relays and valves need some time to be open), but properly tuned it should give You satisfying results, reaching desired joint angle fast and with small regulation error.


问:
Creating linear end effector motion using joint speeds: Converting tool speed to joint speeds
Background Information: I'm new to robotics and my school currently has access to a 6DOF Universal Robot (UR-10). I'm programming it using its scripting language URscript and the arm has these two commands...

speedl(vector of speeds [x, y, z, Rx, Ry, Rz])

where the list of speeds are linked to the end effector.

speedj(joints speeds[base, shoulder, elbow, wrist1, wrist2, wrist3]), given in rads/s

The built-in speedj is by far superior in terms of smooth motion, however using a PS3 controller it is much harder to control and thus I would like to be able send controls linear commands (left, right, fwd, back, up, and down) and have them be converted inappropriate joint speeds.

Problem: I want to move the arm linearly, but I don't know how to convert linear motion into an equivalent representation in terms of the joint speeds. Where should I start researching? Is there a topic that covers my question?

I doubt there's an immediate answer to my problem, but I'm unsure where to start looking. Any keywords that might facilitate my research would be awesome.

答:
Joint velocities and tool velocities are directly related through the following equation
$$
\dot{x} = J(q)\dot{q},
$$
where $\dot{x} \in \mathbf{R}^6$ is the tool (linear and angular) velocities, $\dot{q} \in \mathbf{R}^n$ is the joint velocities ($n$ is the number of joints), and $J(q)$ is the Jacobian matrix, which depends on the robot joint values $q$.

I think this Jacobian is the mapping that you want. Maybe you want to search for robot Jacobian, etc.


问:
Do servos stop at their limits automatically?
I'm moving from controlling a robot arm with basic time based motors controlled using a raspberry pi and python to a more advanced robotic arm that has servos (e.g HS-425BB). With the time based motors I must constantly keep track of the arms position (guess work) and make sure it doesn't over turn.

Do servos automatically stop if you give them a position that is outside of their boundaries rather than grinding the gears?

答: Most PWM servos (including the one you indicated, the HS-425BB) do stop at their limits automatically. This can be useful for initial calibration as it allows you to move the servo to a known point.</p>

OwnerDisplayName: GreenGiant

ContentLicense: CC BY-SA 3.0

OwnerDisplayName: quinxorin


问:
Is a small time locally controllable system holonomic?
If you define a wheel that can only rotate and move in the direction it is pointing to but using a combination of motions (arbitrarily short) it can be moved sideways, does the system still remain holonomic, by definition?</p>

答:
In robotics, a holonomic chassis is one that can move in an arbitrary direction regardless of the robot's facing. Such a robot can move in interesting ways. For example, if you have a fixed camera on a wheeled holonomic robot, the robot could smoothly move, turn, park, etc. without turning the camera.

So if the wheel has to change direction before moving in a given direction, then the robot is nonholomic.

The only ones I've seen use omni-wheels or Mecanum wheels. Different programming is needed for both types.


问:
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>

答:
The location of the homing position does not make any theoretical difference, you can zero (or set to any constant value) your axis positions at any desired position.

From a pracitcal point of view, you can consider the following aspects:

switches might get in the way of chips, switches might be damaged or the other way around, switches might get in the way of chip evacuations. From this point of view, the exteremity of the axes is probably a good option.

homing position should be easy to find, even if encoder values are not to be trused (e.g. axes can be ofset manually, without power). From this point of view, an axis extremity is a good option, since you can just drive the axis in one direction until you hit the switch.

The toolchainge position, if you have automated toolchange is an important position, having a precise toolchange position is important. Colocating the toolchange position with the homing position might be also a good idea (event better when the above criteria are also met with the toolchange position).


问:
Pressure Sensors for Robot Bumper
I'm building an omni-directional robot base and want to add some kind of low-level obstacle detection. The complete robot will have LIDAR and camera for navigation but I'd like to add something at the low level to stop the motors in case the high-level navigation fails/crashes.

The issue I have is because it's omni-directional the sensors have to have all directions, which for even cheap sonar sensors starts to get pretty pricey. I was thinking of adding pressure sensor bumpers similar to what Kiva/Amazon uses: Meet the drone that already delivers your packages, Kiva robot teardown. It's a cool idea just a flexible tube attached to a pressure sensor, if anything bumps into the tube you get a small pressure change in the tube. This means I could cover the entire robot with a ring of tube and use a single pressure sensor!

The main issue I have is figuring out what type of pressure sensor to use. The Kiva robot appears to have a single pressure sensor connected to one end of the tube. I found this example, Air pressure based bumpers
by Axbri on Lets Make Robots which uses a pair of differential pressure sensors.

The main question I have is around the type of sensor should it be absolute, gauge or differential (as in the LMR example). And maybe to have a rough idea how to calculate the pressure range required for the sensor? I guess the static pressure would be based on the length and diameter of the tube and the dynamic pressure (caused by the obstacle) would also depend on the size of the obstacle and how much the tube is compressed?

答:
There are more things you should consider:

Air pressure change will be caused by a force acting on
the tube. Now the elasticity of the tube will be an important factor also. A very rigid tube will only allow small deformations which will lead to small changes in air pressure.

Resolution of the sensor is important to consider. You want to be able to detect small pressure changes.

Maximum range is only a problem if the sensor will be damaged above the maximum treshold. Since you only want to detect a presence, saturating your sensor is not a problem, given that there is no damage from the overpressure.

the type of pressure sensor used is not important if you can corelate their measurement range and resolution to the above parameters

So, you should start with the tube. You can probably coralate a tube elasiticity to sensitivity and range if you define the minimum obstacle shape  (area) that can collide with the robot and the threshold force at which you want to trigger something, and a variation of acceptable tolerance on that force. In may cases with "toy" robots, this could be done through trial and error, for indusrial deployment, you would need a risk analysis and risk mitigation measures (and all connected task, which you should know about if you are doing industrial deployment).

Title: Pressure Sensors for Robot Bumper


问:
Which controller to use for custom servo?
I am trying to build a microcontroller based higher payload version of a servo motor using geared induction motor with VFD as a control device.

For this purpose I have selected a 1HP motor running at 1800RPM which is geared down to 30RPM. The position feedback is captured using AS5048 14bit magnetic encoder and Cortex M4 microcontroller.

Since I don't have any idea about State Space Controller and it's implementation using microcontroller, I am planning to implement it using PID controller. I have the following questions related to this

1) Is it possible to implement it using PID controller for varying load without affecting the tuning parameters for a reasonable range of load or does it require changing the parameters on the fly depending on the load?

2) How to select the update rate of PID control loop for motor position control? I am a communicating with the encoder using 400KHz I2C interface and the controller output is given as a voltage signal to the VFD for frequency/speed control.

答:
Accounting for variable load

In a properly tuned system, the effect of load should mainly affect following error, i.e. how closely actual movement follows desired movement.

Managing load is more about not planning moves which exceed the capabilities of the motor, load and tuning. Ask your system to accelerate too hard, or change acceleration too quickly (high jolt/jerk) and the load could cause the motor to fall behind where it needs to be.

Typically the integral term in your PID is what contributes most to correcting for load induced following error.

Consider a heavy weight on the rim of a lightweight wheel that we want to turn at a constant velocity at 60rpm. Starting with the weight at bottom, we plan 360 waypoints of 1 degree each, with a speed of 360 degrees/second.

At each waypoint, the P term tries to make the motor turn by 1 degree and the D terms tries to keep the speed at 360 degrees/second. With the weight at the bottom, there is no extra load due to gravity, but as the the wheel turns, the action of gravity on the weight will cause the wheel to fall behind where it needs to be.

Since the wheel hasn't quite got as far as it should, the P term will be a little higher than it would be otherwise, similarly as it is running a little slower than it should, the D term will be a little higher. Neither will typically be enough to to completely compensate though.

Note: If you tune P and D aggressively enough to compensate completely for a given load, those terms will almost certainly result in terms which are not aggressive enough for heavier loads and may over-compensate and go unstable for lighter loads. This is one of the reasons why a PID controller is preferable to a PD controller.

This is where the integral term comes in. You tune your PD terms so they don't go unstable at the lightest expected load, and then use the accumulated error to provide the additional lifting force, and limit the following error. As you get closer to peak gravity effect  (around 90 degrees), the contribution of the I term will ramp up, and as the wheel turns further and the effect of gravity diminishes, the error will drop and the contribution of the I term will ramp down.

Note that this example also demonstrates that 'following error' is signed - it can be negative.

As the wheel takes the weight over the top, gravity will start accelerating the wheel, rather than decelerating it. Assuming friction is negligible, acceleration due to gravity will mean that the wheel goes slightly further than it should, so the P term will be a little lower than it would be otherwise, similarly as it is running a little faster than it should, the D term will be a little lower, but again it's the mainly accumulated error and the I term which reduces motor torque to compensate for the load.

To summarise, the I term should help compensate for load.

The range of possible loads will be determined by how aggressively you tune your PID terms, and how close your desired performance characteristics (in speed, load and following error) are to the capabilities of your motor - i.e. how much headroom your system has.

The more headroom you have, the softer you can tune your motors and the greater the range of possible loads the system will be able to handle.

PID control rate

Some people say your PID control rate should be as high as possible, but in my experience it's a balancing act depending on your system.

The theory is that the higher the rate of control, the more closely your control loop can track and react to your inputs.

The trouble is, that's fine until you reach the noise floor of the system. If you are working with low resolution encoders, aggressive tuning, a PID loop implemented with integer arithmetic, and your PID control rate is too high, quantisation noise can become significant and your system may not react smoothly to commands to move at slow speeds.

Individually these can all be ameliorated, you can implement PID with floating point arithmetic, tune less aggressively or swap in higher resolution encoders, but don't chase a higher PID control rate than you need.

Note that you cam implement PID loops whose terms are independent of control loop period, but it adds more complexity and more mathematical operations to for normalisation, so it all depends on how much processing headroom your system has.


答:
In general, servos don't stop unless you command them to (remove power). I'm not familiar with this model and the spec sheet is not clear.

hope you get a better answer soon.

Title: Do servos stop at their limits automatically?

Body:
I'm moving from controlling a robot arm with basic time based motors controlled using a raspberry pi and python to a more advanced robotic arm that has servos (e.g HS-425BB). With the time based motors I must constantly keep track of the arms position (guess work) and make sure it doesn't over turn.

Do servos automatically stop if you give them a position that is outside of their boundaries rather than grinding the gears?

OwnerDisplayName: edprochak


问:
Could a quadrocopter still be controllable if its payload was wider than the quadrocopter?
Lets say a quadrocopter's rotors are 2 feet apart, and 2 feet beneath it is attached a symmetrical, balanced payload that was x feet wide (with space for air from the rotors to move through) - if the rotors are powerful enough, would it still be somewhat controllable laterally if x was greater than 2 feet, or would that configuration ruin all ability to control regardless of the rotors' power? </p>

答:
While the payload will affect contols (as each payload do) with enough powerful rotors it will be controlablle.

We know, that quadrocopter with rotors inside rings is contollable.
Even if you make those ring longer, it would be still controllable.
Even if those rigs are long pipes, it would be still controllable.
And even if those pipes are bend to sides, it would be still controllable.

So if you put the payload well down under the bend pipes, it would be still controlable. And so you even do not need such rings/pipes.

There will be problem with the weight, with wind moving the payload, if the payload is near the rotors, then it will be harder to control and would need more power, but while the rotors can pull air from above with enough force (and dispose the air somehow, just to be able pull more of air from above) it would be controllable. Maybe you would need computer for fast response to make that stable, but this is just technicality, not principaial problem.

Also another view: imegine, that you have 100 m long rope (as for flying kite) and attach it under the quad, then fly it up - it will be contollable ofc. Even when it reach the rope limit, it could be contolled to take nearly any position on the half-spere allowed by the rope.

If the rotor would be powerfull, it would take you to the air. If you fix it to the ground, then if would still be controllable, just not able to lift whole Earth. But if you attach it to really big desk, it would lift such desk up.

Even if you would attach it to really wide payload (like parachute under it) it would be controllable on the 100m rope for sure. Also on 99m, 98m and so .. as the rope would be shorter (like 10, 5, 2, 1m), it would be harder to make it fly in stable manners, but it would be still controllable.

So it is just function of rotor power and controller speed of reactions.

The quad works such, that if takes air from above, climbing inside it as a srew to nut. The rocket (on the other hand - it is opposite) works such, that it put weight fast under it (the burned gas) - so rocket may not be able pull wide payload under it, but would be able push wide load above it.


问:
Getting position from joint angles in Matlab RigidBodyTree
I want to use matlab for estimating the position of end effector given joint angles. I saw convenient tool to build robot model using RigidBodyTree. My manipulator is planar, with only revolute joints with N number of joints. I want for a given manipulator (where N can be changed) to give as an input angles for manipulator's joints and to get position of the end effector.

I only found InverseKinematics which does exactly the opposite. But nothing about Forward Kinematics. How could I possibly do that in Matlab?

答:
There is the gettransform() function for this. It gives you the transformaation matrix of the entire robot, from base to end-effector (if you inpput the paremeters accordingly).

It returns a 4x4 transformation matrix, you can convert the 3x3 rotation part of the 4x4 matrix using the dcm2angle() function to euler angles, the first three rows of the last column of the 4x4 matrix are your positions.


问:
How to model the noise in a range sensor's return?
Range sensors (for example sonar, infrared, and lidar) are notoriously noisy.  How can I characterize the noise characteristics to include these in a probabilistic localization sensor model?</p>

答:
This subject is covered quite nicely in the Probabilistic Robotics book by Thrun et. al. I don't have a direct reference, but there are some of his papers (such as Robust Monte Carlo Localization for Mobile Robots, pdf) essentially include the same information. Usually what is used is a mixed error model, where the probability density function consists of different parts

A Gaussian error around the true distance reading

A part which accounts for false positives like dynamic obstacles and so on. This is larger with smaller distances.

A constant part which accounts for false negative readings, where the sensor gives an out of range reading.

The model needs to be fitted to your sensor and application.


问:
Practicality of using magnetometer inside AUV
I have an AUV with a 12 inch diameter, 29 inch long capsule. Inside the capsule sits an Intel NUC computer, an NVIDIA Jetson GPU, an Arduino Mega, a Sparton IMU (9 DOF) as well as a custom voltage regulator. Given the noise, would it be practical to attempt to use my magnetometer, even with calibration and filtering? If so, what should I keep in mind regarding the placement of my IMU in the AUV's capsule, given that I have already read this post?

I have tried moving it as far away from the sources of noise as possible but the noise persists. I looked into shielding, but that looks like it would block the Earth's magnetic data as well, which would render the shield pointless.

答:
Mags are used in almost all UAVs. It will be useful and it will be a unique source of information.

Adding a some shielding between the mag and your computers and power lines will greatly reduced the noise. Noise can be further reduced by twisting all of the wires that carry significant current (wires to motors and ESCs).

Be aware that the measurement will still be noisy. It should be incorporated into your estimated state using a Kalman filter. Look into fusing measurements from the mag with measurements from an IMU . This will give far superior results compared to treating the measurements as your real state.


问:
Are there standard angular velocities when it comes to robotic arms?
for manipulators that lift heavy loads, e.g. a car or a cow, what would be the ideal angular velocity?

Are there any standards for arm safe moving speed? (of course I know it depends on the project and use, the question is a yes or no)

Is there any difference when the manipulator works around people ? (since in some cases people can be moving around it, so should it move slower ?)

答:
Ideally, angular velocity would be provided in radians per second.

Other than suggesting the use of the metric system, there are not pre-specified values for what is best for a robot arm.

These numbers are highly dependent on the current task and robot. Even your term "heavy" is not specific enough- is it heavy for an industrial arm that can lift up cars?  Or is it a heavy gallon of milk?

Lastly, not knowing the robot arm geometry also makes this answer impossible.  If the robot arm is extremely long then a small angular velocity would result in a very high linear velocity which might not be desirable for your current task. If there are multiple joints, then you probably want each individual joint moving at different velocities, which is again, dependent on the current task.

If you absolutely have to take a random guess at the best angular velocity to use, I would suggest 0 rad/s.


答:
First of all there is nothing like an ideal angular velocity. There might be an optimal one based on some cost function you defined, there might be a nominal one related to you operational ranges, there might be a typical one related to the task in general.

Usually the manipulators moving heavy loads are moving rather slowly because of the dynamics effects induced by the load and the manipulator itself. If the load was to me moved faster, it will require more energy and generate way more strains on the manipulator structure.
Also typically if you design a manipulator you thing at the level of forces and moments, which implies considering joint torque more than joint velocity.

Lastly concerning the human-robot interactions there are some norms to be followed by industry, ISO 10218 and more recently ISO/TS 15066. Both are rather restrictive in terms of end-effector velocity. Additionally you can look at the work of Pr. Haddadin on human-robot interactions and how to consider different metrics than just end-effector velocity and take into account the shape (and associated trauma) of the end-effector.

Title: Are there standard angular velocities when it comes to robotic arms?

Body:
for manipulators that lift heavy loads, e.g. a car or a cow, what would be the ideal angular velocity?

Are there any standards for arm safe moving speed? (of course I know it depends on the project and use, the question is a yes or no)

Is there any difference when the manipulator works around people ? (since in some cases people can be moving around it, so should it move slower ?)


问:
What propeller to use for in-pipeline robot?
Currently im working on an in-pipeline inspection robot that can navigate through narrow pipeline. My design is to use a propeller at the back to push the robot forward.

The front part of the robot will have a camera to inspect the pipeline interior. Additionally, the robot will have support wheels to provide stability, braking and enable the turning of the robot, either right or left.

I need help in determining what type of propeller will provide enough force to push the robot forward through the pipeline.Also, what type of motor to use for that propeller.

Thank you for your effort and time.

答:
First of all an important parameter is if the pipe is filled with some liquid or with air or with vacuum (to be extreme). The nature of the environment will impact the type of propeller (and if vacuum you will need to think about something else)

Typically propeller are powered by brushless motor, as suggest you to look for hobby airplanes. Then if you want to have bi-directional forces you have two choices, revertible ESCs (scare on the market, poor controllability at low speed) or variable pitch propellers (more complex, additional payload to carry).

Last remarks, based on your illustration you will have terrible performance as the propeller is 'hidden' behind your body ... It might be better to use a couple of motorized wheels along the body of your pod. Also if you want to do inspection you might need to go slow, and for that motorized wheel might be better suited.


问:
How to avoid matrix singularity in GraphSLAM
I am trying to implement GraphSLAM from Sebastian Thrun's paper, The GraphSLAM Algorithm with Applications to Large-Scale Mapping of Urban Structures.

When I compute the inverse of my information matrix, $\Omega^{-1}$, I get an error, Matrix is Singular, because $\Omega$ is singular. How could I avoid matrix singularity when implementing GraphSLAM?

Please don't suggest me pinv() method it cannot give me actual answer.

I had considered using a pseudo-inverse, but, instead, I want to prevent $\Omega$ from becoming singular so that I can compute the exact inverse.

Below is where $\Omega$ is computed (see line 7), from Table 2. Calculation of  and ξ in GraphSLAM:

答:
If $\Omega$ is singular, you cannot avoid a matrix singularity.   This is like saying you want to solve the system of equations $$x = 1$$ $$x = 7$$

There are many techniques to avoid robotic singularities, but if the math represents a pose whereby a degree of freedom is lost in the mechanism, there is no way to get around a singular (and therefore non-invertible) matrix.


问:
How can I limit the current sent to my 6V servos to ensure they don't burn out?
I'm using an adjustable desktop power supply (0-30 volt DC, 0-10 amp) to power my robot which has 7 standard 6-volt servos. There are some situations where the robot gets jammed, and power draw increases to 6A and recently I've even seen it hit 9.5A. I think my servo controller is only rated for around 5 amp continuous, and the servos are not intended to hit anywhere near that for any length of time. A servo burnout would be a big problem because I'd need to deconstruct, rebuild, and re-calibrate - none of which are easy operations.

So, is there any device that can set a maximum current and can be easily reset? I could use a traditional fuse, but may end up replacing those far too often. It's fine if the device affects voltage moderately, as I can easily adjust the power supply up a bit and honestly I'm happy if it lowers voltage when it needs to lower current as well - that would further help prevent damage.

答:
use circuit breakers. That is the route I go. I really like the following: Allen Bradely 1492-ghXXX where XXX is the amp rating. Ex: a 4 amp fuse would be 1494-gh040, and a 10 amp 1494-gh100. they are slim profile, but are expensive as hell (as if sold by Lucifer himself - $120CAD!!!). Try to find cheap ones on Amazon or ebay. Another manufacturer, whose name does not come to mind also makes them. Another option is 'auto' circuit breakers:

Just get a base and you resetting like a Boss! Those are all compact circuit breakers as that is what I prefer. You can also find non compact circuit breakers. There are tons of those.

All that is left is to decide if you will fuse every motor, or just the group. I would do the whole group... I won't bore you with electrical selectivity charts.

Peace.


问:
Data saving/sharing standards for objects, actions and senses
I am working on a language (computer language) for robotics to communicate with each other.

I am looking for naming standards that is unique and usable for robotics, for example when two robots are communicating with this language, they will use a word(standard) for an object like "door" that is understandable for both because they are using one unique naming standard.

As I searched the internet I couldn't find something helpful for naming objects, senses and actions may robots share with each other and they understand what are they meaning for.

Syntax of my language

```<code>SEND BY loc ON object = door
</code>```

This language is a query language like SQL that programmer based on programming conditions writes communication queries to archive some data from destination robot or requesting some actions from it.

In the code above, loc and door are names that should be declared by a standard that both robots can understand them.

I'm asking you if you can suggest any naming standard for saving and sharing names on robots and if there is robotics communication standard to suggest especially scholars. thanks.

答:
Dude, don't reinvent the wheel. If you are smart do something useful... Stand on the shoulders of giants! ROS is a middle-ware that solved this issue. They basically have message types that are user defined... just drop in the data type into a file in a specifically named directory structure, and two "softwares" (nodes) can communicate. It makes communication very easy, and there you go, a real problem for a robot solved.

This is hard to really understand (for me), but give it a read: http://wiki.ros.org/msg


答:
"ontology" is the search term you are looking for. There are a few. You will have to review them to see if any meet your needs.

A little background learning about ontologies will help you navigate the options.

You may be tempted to only look at ontologies made by roboticists or with the word robot in the title, but each ontology is created with a set of assumptions or contexts in mind. You may miss a useful ontology if you only look at robotics.

Title: Data saving/sharing standards for objects, actions and senses

Body:
I am working on a language (computer language) for robotics to communicate with each other.

I am looking for naming standards that is unique and usable for robotics, for example when two robots are communicating with this language, they will use a word(standard) for an object like "door" that is understandable for both because they are using one unique naming standard.

As I searched the internet I couldn't find something helpful for naming objects, senses and actions may robots share with each other and they understand what are they meaning for.

Syntax of my language

```<code>SEND BY loc ON object = door
</code>```

This language is a query language like SQL that programmer based on programming conditions writes communication queries to archive some data from destination robot or requesting some actions from it.

In the code above, loc and door are names that should be declared by a standard that both robots can understand them.

I'm asking you if you can suggest any naming standard for saving and sharing names on robots and if there is robotics communication standard to suggest especially scholars. thanks.


问:
Fixing robot orientation using AR
I am creating a project where a robot needs to face a control panel and do some specific tasks. Some reference tags will be placed on the panel.

I want to use the tags as AR reference and fix my robot's orientation. But I am new in AR and I need to learn more, can you give me some hint on how to do this? I want to use OpenCV Python.

答:
I recommend using april tags. They are similar to qr codes but were specifically designed with robotics in mind. There is a library on the april tag website. The library can be used to solve for the position and orientation of each april tag in a given image.

https://april.eecs.umich.edu/software/apriltag/

Title: Fixing robot orientation using AR


问:
ROS: Sensor data via USB
Im working on a project and i want to use a sensor. I can plug in the sensor via usb. I do not need any driver for the sensor. My task is to have an access to the sensor data. I have followed the tutorial on this page:
http://clearpathrobotics.com/assets/guides/ros/Udev%20Rules.html
But i dont know if this is my soution. I dont know what to do now. How can i have access to the data in ROS? Do i have to create a publisher? </p>

答:
The use of udev rules is orthogonal to the publishing of sensor data. Look at the publisher side of the Writing a Publisher and Subscriber tutorial, but instead of pushing string messages to the topic, push data from your sensor instead.

If there is not already a standard message type to encapsulate your data, you can define a custom message type.

Title: ROS: Sensor data via USB

OwnerDisplayName: Paul Belanger


答:
Most of the published papers are from the area of computer animation, for example the JACK system which was developed by Norman Badler in the 1990s. It is some kind of virtual agent with a natural language interface. Only in recent years, some efforts are ongoing to use robotics together with an animation language. A general standard is called the RDF-triple notation. Every situation is expressed with “subject verb object”. That means, we have three words, separated by a space sign. A scene could be described for example with “robot is-on placeA”.

The most dominant problem is not the robot-to-robot communication. This can be done in case of doubt with a simple Json / XML / API interface. Instead the real challenge is the human-to-machine communication. Like you mentioned in the Original post natural language is a good starting point. This makes it easier to debug existing scripts and control the robot interactively.


问:
Why does the low variance resampling algorithm for particle filters work?
I am studying and coding particle filters and I am using the Low variance sampling algorithm suggested in the Probabilistic Robotics book. I understand the procedure for the algorithm. A random number r is picked from the interval (0, 1 / M) and a variable U, calculated based on r is used to navigate the sample space systematically. A variable c(cumulative sum) is initialized with the first weight, and incremented by adding weights until it is higher than U. Once the cumulative sum is higher than U, it picks the sample corresponding to the weight last added.

The problem that I have is that I don't see how this picks up a good sample set for the next iteration. This seems very random or at least favorable to lower valued weights. If the initial value of r is very low, U is also low initially and it may pick a sample whose weight is low, unless weight vector is sorted from high to low (Is it sorted?). However, this video suggests that particles with higher weight have a better chance of getting picked. The algorithm doesn't convey this idea to me. Please help if you have an explanation.

答:
The algorithm does seek to favour picking samples with a greater weight.

If you think about the samples arranged in a line (actually a circle), and the length of each sample is proportional to it's weight. Then if you move along the line in small random increments and pick samples, because the higher weight samples are longer you will more often pick a higher weight sample.


问:
Do robots usually have databases?
I am a junior web developer working mainly with Bash, Javascript, and Drupal. I'm more fascinated writing scripts and programs that do certain concrete actions instead of querying and manipulating databases.

I do desire to step into robotics in the future (after completions) and had the following question in my mind:

Do robots usually have databases (similar to these of websites in quality and quantity) and if so, please give a practical example what are they using for? Maybe in the context of machine vision or machine motion.

Update (13/11/19):

All the answers here are good in my opinion. If I could I would accept all of them, I suggest to start by reading the answer of user16549 which makes an introduction to DBs in robots, then continue to the answer by FooTheBar, and then read other answers.

答:
Robots manipulate data. Some data they get from sensors, but unless the robot is using algorithms that have no state, they have to store data somehow.

Sometimes this is just held in variables, sometimes stored to a more permanent medium.

It doesn't matter if it uses SQL or not, anything that stores data uses database concepts.

Some things that a robot might want to store include maps, visual prototypes (data structures to be matched against by camera images), vocabulary elements (one robot I know of remembers simplified sentences and uses comparisons in order to talk and does it very well), and position information for later debugging. If it is necessary for the robot to retrieve these bits of information, then the code to do so is a database.

Some robotics programs do specifically use SQL databases. For example, the OpenCog project uses an SQL database to hold cognition elements.

Title: Do robots usually have databases?


问:
Alternative to ROS?
This might be a tricky question, but having dug in deep with ROS I am noticing the complexity that one has to deal with.

Simple Arduino programming is much simpler but of course can’t do many useful things. No threading, IPC, and many many more. To be clear, I am not planning on using an Arduino, I am just using it as the extreme end point of a spectrum.

So my question is, is there another package or library or framework that does some of the things that ROS does but perhaps not at the level of sophistication?

Additional

Thanks to the responses so far, and the feedback. I've added below and updated above.

As an example application, let's say an experimental (i.e I am not trying to build a commercial product - yet) mobile robot, with a depth camera, Lidar, and wheels, that can navigate indoors and be controlled over WiFi. It would likely include slam navigation and/or fiducials. Obviously I am OK with buying the hardware or the hardware components and doing a lot of programming. I would prefer something other than C++ but that's not a strict requirement.

答:
I think you are getting confused between the basic ROS possibilities and some more advanced libraries which are integrated but do not need to be used by users without 'advanced' requirements. If you find it too difficult most likely those are functionalities which are not necessary for your project.

That being said, ROS is a middleware that makes the glue between several modular pieces of software by providing interfaces and taking care of communication.
There exist other middlewares for robotics like YARP, POCOLIBS, OROCOS,  ROCK (but there are many more). Some are targeted more for real-time, some more with specificity target at their original application.

If you want to program in a middleware independent way, you can look into genom3, which is an additional abstraction layer allowing to choose middleware at compilation time.

Title: Alternative to ROS?


答:
ROS is still a good framework, even if you just use a little of it. However, if I just needed the message passing, I'd probably just use MQTT. But ROS has a lot of useful components that I'd otherwise have to create or integrate myself. These include message passing, SLAM, path control, and many other components.

That being said, there are quite a few alternatives out there. Most of the ones I've heard of were listed in this Wikipedia article on Open Source Robotics.

The alternative that I'm most familiar with is Gobot, available here. This framework is much smaller than ROS, but it's working on producing cross-platform code.

There are sister projects, Artoo (Ruby) and Cylon (Javascript).

Title: Alternative to ROS?

Body:
This might be a tricky question, but having dug in deep with ROS I am noticing the complexity that one has to deal with.

Simple Arduino programming is much simpler but of course can’t do many useful things. No threading, IPC, and many many more. To be clear, I am not planning on using an Arduino, I am just using it as the extreme end point of a spectrum.

So my question is, is there another package or library or framework that does some of the things that ROS does but perhaps not at the level of sophistication?

Additional

Thanks to the responses so far, and the feedback. I've added below and updated above.

As an example application, let's say an experimental (i.e I am not trying to build a commercial product - yet) mobile robot, with a depth camera, Lidar, and wheels, that can navigate indoors and be controlled over WiFi. It would likely include slam navigation and/or fiducials. Obviously I am OK with buying the hardware or the hardware components and doing a lot of programming. I would prefer something other than C++ but that's not a strict requirement.


问:
How can I get the distance from a robot to a beacon?
I'm planning to create a Raspberry Pi robot to map a room. I intend to use a particle filtering algorithm as one of the central points of the project, that will allow me to work out my position relative to a 'beacon'. This beacon will be placed near the centre of the room and the robot needs to be able to work out the distance from itself to the beacon, accurate to within <1 metre. The direction to the beacon doesn't matter.

I'm struggling to work out what technology I should use for the beacon. It could be powered by a portable battery, and it needs to work fairly well through table/chair legs (I don't expect it to work through a wall though).

I've considered:

Infra-Red

Ultrasound

Ultra-Wide-Band

Wifi networks

Bluetooth

Image analysis to determine range from known object (won't work through table/chairs)

Is there a way to determine the distance from the robot to a fixed point? If so, what is the best way?

This question is not a duplicate of this question, even though they look similar. I want a distance to an object, the other question is about tracking movement.

答:
I would suggest using ultrasonic beacons sending a coded message. These beacons would be triggered by radio signals of some kind. My suggestion is to use Bluetooth.

By experimentation you could discover how long your beacons take to receive and process the BT signal before sending out their sonic reply. The rest of the delay would be due to the time it takes for the sound to travel.

Difficulties include such things as the sound bouncing, multiple beacons sounding at the same time, multiple robots attempting to use the beacons.

Another way is to use bar codes. Around 15-20 years ago, I built a small robot that had a webcam attached that found and read these oversized and simplified bar codes. Yes, I printed out stickers which I attached to doorways within reach of the robot.

I think that a better solution would be to use a simplified form of QR codes. There are open source programs to read and write them, so it should be possible to modify the code to make something easier to read though containing less information.

With the proper ink, these could be seen with IR illumination. Or perhaps we can assume that the light is on.

There is an implementation of the simplified qr codes called "April Tags." Each tag can hold 4-12 bits of information, which is enough to enumerate almost anything I can think of that fits into a normal house.


答:
i have found the solution. I had to do it like that:
https://github.com/garyservin/serial-example/blob/master/src/serial_example_node.cpp</p>

Title: ROS: Sensor data via USB

Body:
Im working on a project and i want to use a sensor. I can plug in the sensor via usb. I do not need any driver for the sensor. My task is to have an access to the sensor data. I have followed the tutorial on this page:
http://clearpathrobotics.com/assets/guides/ros/Udev%20Rules.html
But i dont know if this is my soution. I dont know what to do now. How can i have access to the data in ROS? Do i have to create a publisher? </p>


问:
How to move a Stepper Motor to a desired angle with raspberry pi?
I will be using stepper motor in 6 DOF robotic arm along with Servo motors. Unlike Servo motor ,I find difficult to control Stepper motor. I was earlier using only Servo Motors but due to lack of Torque I had to use stepper motors. I read that in Stepper Motors there is no initial position or reference (0 degrees) position unlike servos.
I searched on various links also where I came to know about rotary encoders but these wont be any good for my robotic arm.
I will be using raspberry pi to control stepper motor.
I need to know a way so that I can control the stepper motor so that there is some reference angle to the stepper motor.</p>

答:
You could add an angle sensor to the joint and make your stepper motor into servo.

You could add limit switches to the joint, then at start up move the joint until the limit switch is reached and then you will know the position of the stepper.


问:
Using Lidar data to detect distance of nearest obstacle, and rate of change
What's the statistically and mathematically correct way to process lidar data so that I can find out a good current estimate of the closet obstacle and its rate change?

Should I be learning about Kalman filters or is that the wrong kind of processing?

答:
I am supposing you have a mobile robot moving around and you want to track its position and/or the position of obstacles nearby. Then the answer is yes, you need to learn some filtering, more precisely you should learn about Extended Kalman Filter (EKF) since your measurement (the LIDAR measurement) is non-linear as it is defined by range and angle of the ray.

There are many resources online, but I leave this link to
Slides from University of Freiburg about EKF.

Note: In the case you do not have time to learn filtering and you just want (for pure undefined experimental purposes) to do some closest obstacle avoidance in a simple way, you can still use the raw measurement of the LIDAR (assuming is precise enough for your application) in order to build a map with obstacles to avoid.

Hope this helps.


问:
Multiple View Triangulation method used by COLMAP
I'm looking at how COLMAP does multi-view triangulation. I can't work out what this function is doing. I can't find any formulas which look similar. The input "proj_matricies" come from pose data, the "points" are from the mono camera measurements. Seems like it is reducing an error in the projection matrices themselves? Is it trying to find some sort of overall projection error for all the observations? Any point in the right direction would be greatly appreciated!!</p>

```<code>Eigen::Vector3d TriangulateMultiViewPoint(
const std::vector<Eigen::Matrix3x4d>& proj_matrices,
const std::vector<Eigen::Vector2d>& points) {

    CHECK_EQ(proj_matrices.size(), points.size());

    Eigen::Matrix4d A = Eigen::Matrix4d::Zero();

    for (size_t i = 0; i < points.size(); i++) {
        const Eigen::Vector3d point = points[i].homogeneous().normalized();
        const Eigen::Matrix3x4d term =
        proj_matrices[i] - point * point.transpose() * proj_matrices[i];
        A += term.transpose() * term;
  }

  Eigen::SelfAdjointEigenSolver<Eigen::Matrix4d> eigen_solver(A);

  return eigen_solver.eigenvectors().col(0).hnormalized();
}
</code>```

答:
This method is minimizing the reprojection error of the triangulated point. How to see this: Let $P_i$ be the $3 \times 4$ projection matrices, and let $x_i \in \mathbb{R}^3$ be the (homogenized coordinates of the) observations. This method is computing the matrix

$$
A = \sum_{i=1}^n A_i^T A_i,
$$
where
$$
A_i = P_i - x_i x_i^T P_i;
$$
and then it returns the eigenvector $X^* \in \mathbb{R}^4$ corresponding to the smallest eigenvalue of $A$.

It is a well-known fact in linear algebra that finding this eigenvector is equivalent to solving
$$
X^* = \operatorname{argmin}_{X \in \mathbb{R}^k} X^T A X
$$
where in our case $k=4$ because $A$ is $4 \times 4$. Hence
\begin{align}
X^* &= \operatorname{argmin}_{X \in \mathbb{R}^4} X^T A X \\
&= \operatorname{argmin}_{X \in \mathbb{R}^4} \sum_{i=1}^n (A_i X)^T (A_i X) \\
& = \operatorname{argmin}_{X \in \mathbb{R}^4} \sum_{i=1}^n \| P_i X - x_i x_i^T P_i X \|_2^2.
\end{align}
Hence it's a least squares minimization, where each residual is $\| P_i X - x_i x_i^T P_i X\|_2^2$. Now, $P_i X$ is the projection of the triangulated point $X$ into image coordinates via the camera $P_i$, and the map $x \mapsto x_i x_i^T x$ is the (linear) projection of $x$ onto the linear subspace spanned by $x_i$. So, the $i$-th residual is the distance in image space between $P_i X$ and $x_i$, which can be interpreted as a reprojection error.


问:
How exactly does sensor fusion work in Kalman filters?
I've been looking into implementations of Extended Kalman filters over the past few days and I'm struggling with the concept of "sensor fusion".

Take the fusion of a GPS/IMU combination for example, If I applied a kalman filter to both sensors, Which of these will I be doing?

Convert both sensors to give similar measurements (eg. x, y, z), apply a kalman filter to both sensors and return an average of the estimates

Convert both sensors to give similar measurements (eg. x, y, z), apply a kalman filter, and return an estimate of the sensor I trust more based on a certain parameter (measurement noise covariance)?

答:
As far as I'm aware, the second approach is generally preferred. The 'certain parameters' you mention are used to define a 'context' or 'validity domain' in which each one sensor or the other should be trusted more. These domains are often inherently fuzzy, due to the characteristics and limitations of the sensors involved.

An article titled 'GPS/IMU data fusion using multisensor Kalman filtering: introduction of contextual aspects', published in the June 2006 issue of Science Direct, describes the development of a multi-sensor fusion algorithm using GPS and an IMU exactly like the one you describe in the question.


问:
measurement model of the accelerometers in IMU
I am new to IMU. About the measurements from IMU, different materials give different explanations.

From the link:

https://www.it.uu.se/edu/course/homepage/systemid/vt14/tokp2.pdf

Here the b maybe indicate body frame of IMU. Maybe e indicate earth frame.
I can't understand the rotation matrix R(be) in the second equation means.
Is R(be) from camera-IMU calibration to represent the extrinsic paramter between
camera and IMU. Is the measurement from the accelerometer expressed in the IMU frame or not?

答:
There's no camera. An IMU doesn't have a camera. $R^{b\mbox{e}}$ is the rotation matrix that describes the orientation of the sensor body $b$ with respect to the Earth $\mbox{e}$. The equations are simply stating that the sensors are outputting the body forces $f^b$ and body angular velocities $\omega^b$, plus some sensor bias $\delta$ and some sensor noise $e$.

The accelerations on the sensor body, in the body frame, are equivalent to taking the body acceleration in the Earth's frame, $\ddot{b}^\mbox{e}$, and the gravitational acceleration in the Earth's frame, $g^\mbox{e}$, and transforming them from Earth frame to body frame with $R^{b\mbox{e}}$.


答:
You said,

I came to know about rotary encoders but these wont be any good for my robotic arm.

But why won't they be any good for your robotic arm?

There are several approaches to position control. From best to worst, your options are generally:

Use an absolute encoder. On power-on, the robot will know the exact joint angle. You can immediately control the arm.

Use a relative encoder. Relative encoders typically have a "home index" that will indicate a known position, then you get to count encoder pulses. A typical startup routine is to seek for the home index, zero your internal encoder count when you find it, and then you can begin operating as if it were an absolute encoder. Depending on your arrangement, you might be able to get by with the assumption that the arm didn't move while the robot was powered off, and you can resume operation if you saved the previous encoder position in nonvolatile memory.

Count stepper motor steps. As with the relative encoder, you'll need some way to find a "known" or "home" position. You'll still need a startup routine. You could have a hard stop and rotate the motor one revolution, counting on the hard stop to prevent the motor shaft from continuing to rotate. Then you can assume that motor steps will increment up from the hard stop position. You could also use a "soft stop," like a limit switch as @RobertSutton mentioned. Again, once you "find" that position, zero your count and then begin operating normally.

The difference between (2) and (3) above is that you must always assume the arm traveled the correct number of steps if you don't have any encoder. If the torque applied to the arm exceeds the running or cogging torque of the stepper motor, then the arm will not be in the position you think it's in. If you use a relative encoder, then you will at least be able to detect that something moved the arm. A stepper motor is completely open loop and you have no means of determining if you're in the correct position unless (if) you happen to pass the soft stop/limit switch.

Title: How to move a Stepper Motor to a desired angle with raspberry pi?

Body:
I will be using stepper motor in 6 DOF robotic arm along with Servo motors. Unlike Servo motor ,I find difficult to control Stepper motor. I was earlier using only Servo Motors but due to lack of Torque I had to use stepper motors. I read that in Stepper Motors there is no initial position or reference (0 degrees) position unlike servos.
I searched on various links also where I came to know about rotary encoders but these wont be any good for my robotic arm.
I will be using raspberry pi to control stepper motor.
I need to know a way so that I can control the stepper motor so that there is some reference angle to the stepper motor.</p>


答:
Arduino is not really relevant since its output is a bare-metal microcontroller code. You can gain experience with more complex microcontroller systems by using a realtime OS on your arduino board.

I have used ROS in several large projects and have an informed understanding of it. While I disagree with many of the choices that the core authors of ROS made, I still recommend using ROS when it is an appropriate choice made with full awareness of the other approaches that can be taken.

ROS is a poor choice in many robotics situations. Real-time systems and distributed systems with unreliable communications for example.

ROS has a list of alternative frameworks, thought they leave out ROCK which arguably has a better design but uses Ruby instead of Python as its scripting language of choice.

Some of the things that ROS provides are things that are already provided by your operating system and the OS version is probably better developed.

Deploy your software using your OS's package manager instead of rospack.
Start your processes using (b)ash and your OS's service manager instead of roslaunch.
Use LDAP instead of rosparameters.
Use DNS instead of roscore for service discovery.

You can also cherry pick the parts of ROS that work for you.

Most of the software that is distributed with ROS is developed such that it can be used without ROS.

Title: Alternative to ROS?


问:
Integrating GPS into Graph SLAM (how orientation fixed?)
I'm working on Graph SLAM to estimate robot poses (x, y, z, roll, pitch, yaw). Now I want to integrate GPS measurement (x, y, z, of course no angles).

I implemented GPS as pose's prior. But I have a problem.

Position(x, y, z) is perfectly corrected by graph optimization

But orientaiton(roll, pitch, yaw) is very unpredictable(unstable) after optization.

i.e. It looks like position is fitted by the sacrifice of orientation.

I'm very confused about what's the right way of integrating GPS into graph SLAM. GPS should be handled as prior? or landmark? or one of pose-vertices?

...Thanks for your help in advance.

PS

I use g2o as a graph-optimization library. In g2o, I implemented GPS measurement with EdgeSE3_Prior. GPS's quality is RTK so it's enough precise.

答:
You can try this paper "The GraphSLAM
Algorithm with Applications to Large-Scale Mapping of Urban Structures" </p>


问:
rosservice via Python
I have a drone which has certain services, say random.srv. I want to use this service via Python. Now I know that there is a page in ROS wiki that tells you how to create a service client in Python. Unfortunately that is not sufficient for me. Here goes my case:

Once I start the drone node, the service is listed as

```<code>/main/random_task
</code>```

Now an important point to note is that the name of the service is as stated above

```<code>random.srv
</code>```

The function that I am writing is:

```<code>from random.srv import *
import rospy

def enableRandom():
    rospy.wait_for_service('main/random_task')
    try:
        droneRandom = rospy.ServiceProxy('main/random_task', random)
        doSomething(1)  # something seems to be missing

    except rospy.ServiceException:
        print('Service call failed')

if __name__ == '__main__':

    enableRandom()
</code>```

The thing is it gives an error saying random is undefined. But that is the name of the srv file.

Can someone also explain why it doesn't work the way it should. You can guess by this question that I am new to this.

Edit 1:
Now I understand that in the statement

```<code>from random.srv import *
</code>```

the 'random' should be the package name. This is not the case. The package name is, lets call it my-package1. The service random.srv that I want to use is in

```<code>src/my-package1/main/srv/
</code>```

Another thing to clear up is that /main/random_task is the name with which random.srv is shown in rosservice list. The new code now is

```<code>from my-package1.srv import random
import rospy

def enableRandom():
    rospy.wait_for_service('/main/random_task')
    try:
        droneRandom = rospy.ServiceProxy('/main/random_task', random)
        doSomething()

    except rospy.ServiceException:
        print('Service call failed')

if __name__ == '__main__':

    enableRandom()
</code>```

Now I get my-project1 as having invalid syntax (I guess due to having '-'symbol). If I use

```<code>from main.srv import random
</code>```

it says it cannot find 'main'.

First if I have to use 'my-project1.srv' how to I get around the syntax issue with '-'.

Secondly, if I have to use the subfolder name i.e. main.srv, why does it not recognize the package if it can recognize the services inside it (when using rosservice list on the terminal).

I think there is an issue with the syntax.

答:
What is the exact error you're getting? You have random in two locations - your module import (from random.srv import *), and when you setup the service proxy (rospy.ServiceProxy('main/random_task', random).

An import error would probably mean Python can't find random.srv, where the service proxy error would probably mean that Python can't find random.srv.random, which means that it can't find the random service definition inside your random.srv file.

Maybe this is enough to point you in the right direction, but if not, could you edit your question to provide a link to the random.srv file?

:EDIT:

First, you need to get your naming straight. See this question on Stack Overflow, "How to import module when module name has a '-' dash or hyphen in it?" The two top answers are, in short:

you can't. foo-bar is not an identifier. rename the file to foo_bar.py

And

If you can't rename the module to match Python naming conventions, create a new module to act as an intermediary:

```<code> ---- foo_proxy.py ----
 tmp = __import__('foo-bar')
 globals().update(vars(tmp))

 ---- main.py ----
 from foo_proxy import *
</code>```

Second, you might have a naming conflict with main/srv. Check out the tutorial on creating messages and services. Specifically, I noticed:

Also you need the same changes to package.xml for services as for messages, so look above for the additional dependencies required.

Remove # to uncomment the following lines:

```<code># add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )
</code>```

It would seem to me that, if you already had a main.srv declared in your package.xml file, then it might be chance that your services are getting read, because your my-package1 folder happens to be in the src folder (so it's on the path) and then main.srv shares a name with something else. Sharing names is bad, especially when you're importing all, because of the same reason import * or using namespace std is bad - you can/might/will overwrite something and then it's not clear which function/service/method you're actually using.

My suggestions would be:

Rename your my-package1 to my_package1.

Put all of the services for my_package1 in the my_package1\srv folder - don't use \main\ as a subfolder if possible.

Try these, see if it helps. If it does, and you have a related question, please start a new question and link to this one if you feel it provides context for the new question. If this isn't the answer you're looking for, please edit your question to reflect what happened when you tried the steps above.

Title: rosservice via Python

Body:
What is the exact error you're getting? You have random in two locations - your module import (from random.srv import *), and when you setup the service proxy (rospy.ServiceProxy('main/random_task', random).

An import error would probably mean Python can't find random.srv, where the service proxy error would probably mean that Python can't find random.srv.random, which means that it can't find the random service definition inside your random.srv file.

Maybe this is enough to point you in the right direction, but if not, could you edit your question to provide a link to the random.srv file?

:EDIT:

First, you need to get your naming straight. See this question on Stack Overflow, "How to import module when module name has a '-' dash or hyphen in it?" The two top answers are, in short:

you can't. foo-bar is not an identifier. rename the file to foo_bar.py

And

If you can't rename the module to match Python naming conventions, create a new module to act as an intermediary:

 ---- foo_proxy.py ----
 tmp = __import__('foo-bar')
 globals().update(vars(tmp))

 ---- main.py ----
 from foo_proxy import *

Second, you might have a naming conflict with main/srv. Check out the tutorial on creating messages and services. Specifically, I noticed:

Also you need the same changes to package.xml for services as for messages, so look above for the additional dependencies required.

Remove # to uncomment the following lines:

# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )

It would seem to me that, if you already had a main.srv declared in your package.xml file, then it might be chance that your services are getting read, because your my-package1 folder happens to be in the src folder (so it's on the path) and then main.srv shares a name with something else. Sharing names is bad, especially when you're importing all, because of the same reason import * or using namespace std is bad - you can/might/will overwrite something and then it's not clear which function/service/method you're actually using.

My suggestions would be:

Rename your my-package1 to my_package1.

Put all of the services for my_package1 in the my_package1\srv folder - don't use \main\ as a subfolder if possible.

Try these, see if it helps. If it does, and you have a related question, please start a new question and link to this one if you feel it provides context for the new question. If this isn't the answer you're looking for, please edit your question to reflect what happened when you tried the steps above.


问:
How to detect loop in robot movement observing odometer data
I have some odometer data. This data are based upon robot movement. I can transfer those raw data to a motion equation from where I get  x,y,and theta co-ordinate of a Robot. If I plot those x,y coordinate I get a path which show me robot movement. This path show me that the Robot move back and forth through a corridor. So there is a looping. Now how could I determine from the raw data which consist of forward and angular velocity that in a particular time stamp robot back to its previous position? </p>

<p>What is residual uncertainty in context of Robotics? </p>

答:
I haven't heard of residual uncertainty in the context of robotics, but I would imagine what you're getting at is the fact that odometry data has an inherent amount of uncertainty because of minor variations in things like friction, wheel diameters, chassis weight distribution, variations in motor fabrication, etc.

The best that you could probably do would be to run some baseline tests to determine first how accurate your odometry estimates are. You should wind up with something like the KITTI odometry scores, where visual odometry and/or SLAM algorithms are scored on a percent error for translation and for rotation. The rotation scores are given there as error in degrees per meter.

Once you can quantify the performance of your odometry estimates, then you can begin to build a cone of uncertainty around your position estimate, just like weather forecasters do with hurricane projections.

For example, say your robot has a rotational error of one degree per meter and a translational error of 5 percent. At the end of one meter of travel, your robot could be anywhere between 0.95 to 1.05 m, and the heading could be anywhere from -1 to +1 deg. When you advance a second meter, you compound the estimates. You could have been at 0.95 meters, with a heading of -1 deg, and traveled another 0.95 meters. Or you could have been at 1.05 meters, with a heading of +1 deg, and traveled another 1.05 meters.

Depending on how detailed you want to get, you could analyze your odometry versus truth testing and find the standard deviation of your error, and then you could do 1, 2, and 3 $\sigma$ estimates for your cone of uncertainty.

Then, once any portion of your cone of uncertainty overlaps the start position, you must assume that you have completed a lap.


答:
I think you are thinking in the wrong direction. Loop Closing techniques where invented (and are used) exactly for the reason that you cannot trust your odometry over a longer time. </p>

<p>Loop closing relies on being able to re-recognize a part of your world so you need a sensor that can sense the environment (e.g. a camera or a laser scanner). Your odometry cannot sense the environment so the robot has no way to know where it is globally. </p>

Title: How to detect loop in robot movement observing odometer data

Body:
I have some odometer data. This data are based upon robot movement. I can transfer those raw data to a motion equation from where I get  x,y,and theta co-ordinate of a Robot. If I plot those x,y coordinate I get a path which show me robot movement. This path show me that the Robot move back and forth through a corridor. So there is a looping. Now how could I determine from the raw data which consist of forward and angular velocity that in a particular time stamp robot back to its previous position? </p>

<p>What is residual uncertainty in context of Robotics? </p>

Body:
I think you are thinking in the wrong direction. Loop Closing techniques where invented (and are used) exactly for the reason that you cannot trust your odometry over a longer time.

Loop closing relies on being able to re-recognize a part of your world so you need a sensor that can sense the environment (e.g. a camera or a laser scanner). Your odometry cannot sense the environment so the robot has no way to know where it is globally.


问:
Why can Humans single out audio in a crowd? What would it take for a robot to do the same?
I was at a Robotics conference earlier today and one of the speakers mentioned robots not being able to function as well in a crowd because they can't single out audio like a person can.

Why can people single out audio so well?  And what would it take for a robot to do the same?

I'm aware of Active Noise Reduction (ANR) like on Bose Aviation headset, but that is not what I'm talking about.  I am thinking about the ability to take everything in but process only what you feel is important.

答:
I think there are at least three things going on:

Filtering that is dependant on the location the sound is coming from.  Our stereo hearing combined with certain attributes of how our ears are built helps us isolate sound coming from a particular location/direction.

Filtering that is dependant on the frequency/amplitude of the audio.

The redundancy in the audio allows us to reconstruct the input.  If multiple people are speaking over each other (or generally in the presence of noise) we only need to catch a fraction of what's being said (or sometimes even observe visually) to know what is being said.

I would think that a robot can outperform humans on #1 and #2.  With a microphone array one would think you could effectively focus on a single point in space and eliminate all other interference.  That may be made more complicated by reflections and various other disturbances.  #3 is probably something that is harder for computers to do.


问:
Graph Slam Landmark remove and then again add it
I try to implement Graph Slam in real dataset. My data set have some data that describe that the Robot observe same landmark over and over with a large amount of time difference. Prof. Sebastian Lectures(Udacity: https://classroom.udacity.com/courses/cs373) is not enough to understand this type of situation. So I study " The Graph Slam Algorithm with Application to Large - Scale MApping of Urban Structure" by Sebastian Thrun and Michael Montemerlo.(http://robots.stanford.edu/papers/thrun.graphslam.pdf) In this paper page number 414 at Table 4: Algorithm for Updating the Posterior mu" is written. I cannot understand this algorithm. First I remove all the landmark location then again I add it. But how could I add this? This is not clear to me. Also what is the need to first remove all landmarks then again add it? If any one know that please help me.</p>

答:
Let me start by saying that SLAM and other algorithms like that are beyond the scope of the work I've done. I am okay with the math, though, so I'll point out what I think is happening:

First, it appears that Table 3 on page 414 is not removing landmarks, it's collapsing them. Consider a hypothetical scenario where you have a bunch of measurements $x$ and $y$. If you want to do some operation on that data set, you have to carry those measurement vectors around everywhere and work on the entire set every time.

It might be easier, if the scenario you're in allows, to just use the average value of those sets. This appears to be what Table 3 is doing. It's important to notice the difference between the full set of data, $\Omega$ and $\xi$, and the reduced (averaged, conceptually) data $\tilde{\Omega}$ and $\tilde{\xi}$.

Second, it appears that there's a typo in Table 4. The equations given are:

$$
\begin{array}{c}
2: & \Sigma_{0:t} & = & \tilde{\Omega}^{-1} \\
3: & \mu_{0:t} & = & \Sigma_{0:t}\tilde{\xi} \\
\end{array}
$$

However, this is contrary to the statement on page 410 which says,

The posterior over the robot path is now recovered as $\tilde{\Sigma}=\tilde{\Omega}^{-1}$ and $\tilde{\mu}=\tilde{\Sigma}\xi$.

and additionally the equations (43) and (44) on page 417, which says:

The algorithm GraphSLAM_solve in Table 4 calculates the mean and variance of the Gaussian $\mathcal{N}(\tilde{\xi},\tilde{\Omega})$:
  $$
\begin{equation}
\tilde{\Sigma} = \tilde{\Omega}^{-1} \\
\end{equation}
\tag{43}
$$
  $$
\begin{equation}
\tilde{\mu} = \tilde{\Sigma}\tilde{\xi}
\end{equation}
\tag{44}
$$

So, in both locations (410 and 417), it is said that the equation given in Table 4 should be:

$$
\begin{array}{c}
2: & \tilde{\Sigma}_{0:t} & = & \tilde{\Omega}^{-1} \\
3: & \tilde{\mu}_{0:t} & = & \Sigma_{0:t}\tilde{\xi} \\
\end{array}
$$

This would then make line six of Table 4 make more sense:

$$
\begin{array}{c}
6: & \mu_j = \Omega^{-1}_{j,j}\left(\xi_j + \Omega_{j,\tau\left(j\right)}\tilde{\mu}_{\tau\left(j\right)}\right) \\
\end{array}
$$

So, in summary:

Table 3 shows how to reduce the full information matrix $\Omega$ and full information vector $\xi$ to a reduced information matrix $\tilde{\Omega}$ and a reduced information vector $\tilde{\xi}$.

Table 4 takes the reduced information matrix $\tilde{\Omega}$ and reduced information vector $\tilde{\xi}$ and uses that to generate a reduced map esimate $\tilde{\mu}$.

Table 4 goes on to use the reduced map estimate $\tilde{\mu}$ and the full information matrix $\Omega$ and the full information vector $\xi$ to generate a full map estimate $\mu$.


问:
GraphSLAM equation doubt
I have question about GraphSLAM implementation.

To find out the path and map using GraphSLAM we rely on this equation:

$$\mu=\Omega^{-1}\xi$$

where $\Omega$ is our information matrix which determine the link between two nodes of graph and link between a landmark and a node. The $\xi$ vector give us the value of constraint between two consecutive robot pose or a robot pose and landmark.

I want to clarify that why a matrix inversion multiplied by a vector give us path and map. What is the mathematical logic, algorithm or assumption behind this?

Is it related to Floyds' shortest path algorithm or any other graph based algorithm related to it?

For reference I studied The GraphSLAM Algorithm with Applications to Large-Scale Mapping of Urban Structures and listened to the lecture series of Udacity.

However, I cannot understand where this equation came from. Also, I have a little bit of doubt about implementing GraphSLAM in a real dataset for the huge dimension on $\Omega$ Matrix and its inversion. Is it possible for a 75000 dataset?

答:
As I mentioned previously, this isn't my topic of expertise, but I'll again point out the passage on page 417 of the Thrun paper:

The algorithm GraphSLAM_solve in Table 4 calculates the mean and  variance of the Gaussian $\mathcal{N}\left(\tilde{\xi},\tilde{\Omega}\right)$:

$$
\begin{equation}
\tilde{\Sigma} = \tilde{\Omega}^{-1} \\
\end{equation}
\tag{43}
$$
  $$
\begin{equation}
\tilde{\mu} = \tilde{\Sigma}\tilde{\xi}
\end{equation}
\tag{44}
$$

In particular, this operation provides us with the mean of the
  posterior on the robot path; it does not give us the locations
  of the features in the map.

(emphasis added on that last bit). Bear in mind also that a mathematical map and a human-readable map are two different things entirely.

Here is a link to a video that appears to be by Sebastian Thrun. The video is published by Udacity and links to their CS 271 course. This is where I would probably go to learn more about the Graph SLAM algorithm.

Title: GraphSLAM equation doubt


问:
Calculating thrust generated from electric engines
I wanted to calculate the amount of thrust generated from the engines. I am using the blade 180 cfx model.

http://www.bladehelis.com/Products/Default.aspx?ProdID=BLH3450#quickSpecs

After some research I have found a way to calculate the thrust using:

T = ( pi D^2 rho P^2)/2 where P is the Power multiplier and can be calculated using: P= prop constant * (rpm/100)^power factor

I am unable to find the values for the Prop constant and the power factor. Is there a way I can get this information? Or an alternative way to calculate the thrust generated?

答:
After using ecalc (which is an awesome tool!) I discovered that I could approximate the results using Disk Area * RPM.

It's not useful for getting thrust in grams, but good for comparing changes in Blade size and RPM.


问:
how to implement trapezoidal velocity profile in code
I want to use a trapezoidal velocity profile(cartesian) but I struggle with implementing the equations to code(c++/python). Does anyone have an example for this?
UPDATE
more details about my problem.
I want to create a Cartesian trajectory with a trapezoidal velocity profile from point A to point B. The start and end velocities must be zero</p>

答:
Not sure how you're choosing to structure your code, but typically I'll have a master reference, in percent, and a rate limit, in percent per second. You can have different rates for acceleration or deceleration, but I'll post a generic snippet that uses the same rate limit for both.

In the code, the master reference is the unramped (typically square) input, and then the ramped reference is the trapezoidal output. I'm a heavy Matlab user and only dabble in C++, so I'll write in Matlab, but you should get the gist of it:

```<code>persistent rampedRef; % 'static' in most other languages
dT = ElapsedTime(); % You need to know the time between function calls. How you get this information varies by language and platform.

desiredAcceleration = (masterRef - rampedRef)/dT;
if abs(desiredAcceleration)>rateLimit
    desiredAcceleration = sign(desiredAcceleration)*rateLimit;
end

rampedRef = rampedRef + desiredAcceleration*dT;
</code>```

There you go! Pretty straightforward. First, calculate a "test acceleration" between your ramped reference and the desired master reference. If your test acceleration exceeds your acceleration limit, then use the acceleration limit.

:EDIT:

Position is the integral of speed. Integral just means "area," so if you can find the area of the speed curve then you can find the total distance traversed.

For a trapezoidal speed profile, this is pretty straightforward. Acceleration and deceleration both form triangular regions, then constant speed forms a rectangular region.

The area for a triangle is:

$$
A_{\mbox{triangle}} = \frac{1}{2}bh \\
$$

Where, in this case, $b$ is the base, or the time spent accelerating, and $h$ is the height of the triangle, or the top/final speed for the vehicle. Acceleration and deceleration will both have the same $h$ term, because you accelerate to a speed and then decelerate from that speed. I'll substitute $v_{\mbox{top}}$ for $h$ and $t_{\mbox{accel/decel}}$ for $b$, and since the area under the curve is the change in position, I'll use $dS$ instead of $A$. Now you can see that the total distance traversed during the acceleration and deceleration transients are:

$$
dS_{\mbox{accel and decel}} = \left(\frac{1}{2}t_{\mbox{accel}}v_{\mbox{top}}\right) + \left(\frac{1}{2}t_{\mbox{decel}}v_{\mbox{top}}\right) \\
$$

If you have the same rate limit for acceleration and deceleration then $t_{\mbox{accel}} = t_{\mbox{decel}}$, and the equation above reduces to:

$$
dS_{\mbox{accel and decel}} = \left(\frac{1}{2}t_{\mbox{ramp}}v_{\mbox{top}}\right) + \left(\frac{1}{2}t_{\mbox{ramp}}v_{\mbox{top}}\right) \\
\boxed{dS_{\mbox{accel and decel}} = t_{\mbox{ramp}}v_{\mbox{top}}}\\
$$

The other part of the formula is now just the "rectangle" of constant motion;

$$
dS_{\mbox{constant speed}} = v_{\mbox{top}}t_{\mbox{constant speed}} \\
$$

Again, simply put, position is (speed) x (time). Now, the total distance traversed is:

$$
dS = dS_{\mbox{accel and decel}} + dS_{\mbox{constant speed}} \\
$$

So, finally, to solve the problem of generating the speed profile, you would:

Get the distance to travel, $dS = s_{\mbox{end}} - s_{\mbox{start}}$.

Find out how far you travel by only accelerating to top speed then immediately decelerating back to zero speed - $dS_{\mbox{accel and decel}} = t_{\mbox{ramp}}v_{\mbox{top}}$

If the accelerate/decelerate profile causes you to travel further than you want, then solve for a lower top speed by solving $dS =
t_{\mbox{ramp}}v_{\mbox{top}}$ for $v_{\mbox{top}}$.

If the accelerate/decelerate profile does not get you far enough, then solve for the amount of time you need to be at top speed by solving $dS - dS_{\mbox{accel and decel}} = v_{\mbox{top}}t_{\mbox{constant speed}}$ for $t_{\mbox{constant speed}}$.

Body:
Not sure how you're choosing to structure your code, but typically I'll have a master reference, in percent, and a rate limit, in percent per second. You can have different rates for acceleration or deceleration, but I'll post a generic snippet that uses the same rate limit for both.

In the code, the master reference is the unramped (typically square) input, and then the ramped reference is the trapezoidal output. I'm a heavy Matlab user and only dabble in C++, so I'll write in Matlab, but you should get the gist of it:

persistent rampedRef; % 'static' in most other languages
dT = ElapsedTime(); % You need to know the time between function calls. How you get this information varies by language and platform.

desiredAcceleration = (masterRef - rampedRef)/dT;
if abs(desiredAcceleration)>rateLimit
    desiredAcceleration = sign(desiredAcceleration)*rateLimit;
end

rampedRef = rampedRef + desiredAcceleration*dT;

There you go! Pretty straightforward. First, calculate a "test acceleration" between your ramped reference and the desired master reference. If your test acceleration exceeds your acceleration limit, then use the acceleration limit.

:EDIT:

Position is the integral of speed. Integral just means "area," so if you can find the area of the speed curve then you can find the total distance traversed.

For a trapezoidal speed profile, this is pretty straightforward. Acceleration and deceleration both form triangular regions, then constant speed forms a rectangular region.

The area for a triangle is:

$$
A_{\mbox{triangle}} = \frac{1}{2}bh \\
$$

Where, in this case, $b$ is the base, or the time spent accelerating, and $h$ is the height of the triangle, or the top/final speed for the vehicle. Acceleration and deceleration will both have the same $h$ term, because you accelerate to a speed and then decelerate from that speed. I'll substitute $v_{\mbox{top}}$ for $h$ and $t_{\mbox{accel/decel}}$ for $b$, and since the area under the curve is the change in position, I'll use $dS$ instead of $A$. Now you can see that the total distance traversed during the acceleration and deceleration transients are:

$$
dS_{\mbox{accel and decel}} = \left(\frac{1}{2}t_{\mbox{accel}}v_{\mbox{top}}\right) + \left(\frac{1}{2}t_{\mbox{decel}}v_{\mbox{top}}\right) \\
$$

If you have the same rate limit for acceleration and deceleration then $t_{\mbox{accel}} = t_{\mbox{decel}}$, and the equation above reduces to:

$$
dS_{\mbox{accel and decel}} = \left(\frac{1}{2}t_{\mbox{ramp}}v_{\mbox{top}}\right) + \left(\frac{1}{2}t_{\mbox{ramp}}v_{\mbox{top}}\right) \\
\boxed{dS_{\mbox{accel and decel}} = t_{\mbox{ramp}}v_{\mbox{top}}}\\
$$

The other part of the formula is now just the "rectangle" of constant motion;

$$
dS_{\mbox{constant speed}} = v_{\mbox{top}}t_{\mbox{constant speed}} \\
$$

Again, simply put, position is (speed) x (time). Now, the total distance traversed is:

$$
dS = dS_{\mbox{accel and decel}} + dS_{\mbox{constant speed}} \\
$$

So, finally, to solve the problem of generating the speed profile, you would:

Get the distance to travel, $dS = s_{\mbox{end}} - s_{\mbox{start}}$.

Find out how far you travel by only accelerating to top speed then immediately decelerating back to zero speed - $dS_{\mbox{accel and decel}} = t_{\mbox{ramp}}v_{\mbox{top}}$

If the accelerate/decelerate profile causes you to travel further than you want, then solve for a lower top speed by solving $dS =
t_{\mbox{ramp}}v_{\mbox{top}}$ for $v_{\mbox{top}}$.

If the accelerate/decelerate profile does not get you far enough, then solve for the amount of time you need to be at top speed by solving $dS - dS_{\mbox{accel and decel}} = v_{\mbox{top}}t_{\mbox{constant speed}}$ for $t_{\mbox{constant speed}}$.


问:
Motor driver selection
I am building a 2 wheel robot to carry 7KG of load. I used this link to get the torque required for each motor which is 11Kg-cm. So I choose 2 of these motor which has 36Kg-cm(2x more) torque. I noticed that the stall current is 14A.

Can I use Adafruit Motor Shield for Arduino which is rated 3A peak current capability?

If not what current rating driver should look into?

Thanks!!

答:
The Adafruit Motor Shield for Arduino should work, if two conditions are satisfied:

the Adafruit Motor Shield for Arduino can limit its own current, or there's enough data available so that you can.

the motor you want to use can generate sufficient torque on 3 amps

The answer to (1) should come from the data for the Adafruit Motor Shield for Arduino.  The answer to (2) should come from the motor data (look for the motor torque constant.  It should be in (torque units)/(amp).  Given what the motor uses for torque units, it'll probably be in kg-cm/amp, however improper those units may be as a measure of torque.  Multiply that torque constant by 3A, and you have your answer for the motor.

Title: Motor driver selection