答:
I think I see where you're confused, and you're correct in noticing that the motor variables are a little different than regular variables.

The #pragma config( ) is actually doing a lot of heavy lifting for you because it is a "preprocessor directive".  In other words, there is a hidden step — preprocessing — between the code you wrote and the code that the compiler sees.  The preprocessor is why you have access to the motor[ ] array (which you didn't need to declare before using), and why assigning a value to a motor causes your real-world motors to move (which does not happen when assigning to a "normal" variable).  The code generated by the preprocessor is saving you from writing a lot of setup code yourself, but it is also making some normal-looking variables do some unexpected things.

In your case, this is the motor config line that you wrote:

```<code>#pragma config(Motor,  port7,           light_blue,    tmotorVex393, openLoop)
</code>```

This tells the preprocessor to generate some code that does the following:

Declare a variable of type tMotor and store it in motor[light_blue]

Set the port of motor[light_blue] to port7

Add a function that gets called when you assign a value to motor[light_blue], which converts that value directly to a power-level signal understood by Vex 393 (and outputs this signal on port7).  In other words, use open loop control instead of PID control.

(Other things not relevant to this question)

So, light_blue is not an "alternate name" for motor[port7], and in fact neither of those names are correct.  The correct way to refer to this motor in code is motor[light_blue].   In other words, light_blue is an index into the motor[ ] array.

The code that Spiked3 posted would be the proper way to set up your function:

```<code>#pragma config(Motor,  motorA,          light_blue,    tmotorNXT, PIDControl, encoder)

void testThing (tMotor  motor_name)
{
    motor[motor_name] = 20;   // set power to 20
}

task main()
{
    testThing(light_blue);
}
</code>```

Title: Confused about the variables in RobotC?

Body:
I'm trying to program advanced functions in RobotC but I'm not too sure I'm doing it right. I want to specify the motor port I'm using, but I assigned names to all the motors. Funny thing though, they don't exactly work the same as regular variables.

For instance, motor[port7]'s alternate name is light_blue.

```<code>#pragma config(Motor,  port7,           light_blue,    tmotorVex393, openLoop)
</code>```

I'm not really sure if these are new variables, or just specifications.  Anyway, here is the variable's signature:

```<code>int motor[tMotor motor]
</code>```

My code plans on doing something similar to this:

```<code>void testThing (Motor motorName)
{
  motorName = someValue;
}

testThing(light_blue);
</code>```

But with the int/motor hybrid variable/unidentified I'm not sure how well that would work out. Or at all.

Body:
I think I see where you're confused, and you're correct in noticing that the motor variables are a little different than regular variables.

The #pragma config( ) is actually doing a lot of heavy lifting for you because it is a "preprocessor directive".  In other words, there is a hidden step — preprocessing — between the code you wrote and the code that the compiler sees.  The preprocessor is why you have access to the motor[ ] array (which you didn't need to declare before using), and why assigning a value to a motor causes your real-world motors to move (which does not happen when assigning to a "normal" variable).  The code generated by the preprocessor is saving you from writing a lot of setup code yourself, but it is also making some normal-looking variables do some unexpected things.

In your case, this is the motor config line that you wrote:

#pragma config(Motor,  port7,           light_blue,    tmotorVex393, openLoop)

This tells the preprocessor to generate some code that does the following:

Declare a variable of type tMotor and store it in motor[light_blue]

Set the port of motor[light_blue] to port7

Add a function that gets called when you assign a value to motor[light_blue], which converts that value directly to a power-level signal understood by Vex 393 (and outputs this signal on port7).  In other words, use open loop control instead of PID control.

(Other things not relevant to this question)

So, light_blue is not an "alternate name" for motor[port7], and in fact neither of those names are correct.  The correct way to refer to this motor in code is motor[light_blue].   In other words, light_blue is an index into the motor[ ] array.

The code that Spiked3 posted would be the proper way to set up your function:

#pragma config(Motor,  motorA,          light_blue,    tmotorNXT, PIDControl, encoder)

void testThing (tMotor  motor_name)
{
    motor[motor_name] = 20;   // set power to 20
}

task main()
{
    testThing(light_blue);
}


问:
Adding an Actuator or Force to a (Featherstone) Articulated Rigid Body Model
I'm working on a project where I need to model a system that is essentially comprised of a series of ball-and-socket joints attached to a base, which is attached in turn to a prismatic joint (rail).

I've read Roy Featherstone's Rigid Body Dynamics Algorithms cover-to-cover, and I've also read the Dynamics section from the Springer Handbook of Robotics (also written by Featherstone).

It took me a long time to get acclimated to using his "spatial vector" and "spatial matrix" notation, but after re-creating all of his notation by hand as an exercise it works out to just be a nice way of concatenating 3x3 and 3x1 matrices and vectors into 6x6 and 6x1 matrices and vectors. The maths he invents to perform operations can be a bit tedious to read as he hijacks some standard notation, but overall everything is very compact, very easy to implement in MATLAB.

My problem is this: How do I add actuators to the model? He walks through explicitly configuring the joint definitions, link definitions, etc., but when it comes to actuators or applied forces he says something like, "Just add a $\tau_a$ here and Bob's your uncle!" - it's not discussed at all. In the Handbook of Robotics he suggests introducing a false acceleration to the fixed base to add the gravitational force term, but doesn't show how to add it in local coordinates nor does he mention how to add the actuator input.

Any help would be greatly appreciated. I've considered starting over with a different book, but it's going to be a great expense of my time to re-acclimate myself to a different set of notation. I'd like to move forward with this, but I feel like I'm just a few inches shy of the finish line.

答:
Actuators Forces

Do I get this right: you have a theoretical model of a rigid multibody system and would like to perform rigid body dynamics computations. You have implemented the model and now would like to compute how the model behaves when driven by an actuator.

However what is an actuator for you? Is it simply a force acting at that joint? Is it a DC motor model? Is it a PID controller?

The dynamics algorithms in the book are described in terms of generalized positions $q$, generalized velocities $\dot{q}$, generalized velocities $\ddot{q}$, and generalized forces $\tau$. If you have a prismatic joint whose's translation is described by $q_i$ then the linear force at that joint is described by $\tau_i$. If you have a revolute (hinge) joint whose's rotation is described by $q_j$ then $\tau_j$ represents a torque at that joint.

It is up to your understanding of an actuator how $\tau$ is computed. If you simply want to apply forces or torques then put the values into the corresponding values of $\tau$. Once you have that they serve as an input to the forward dynamics algorithms to compute the systems response to the applied forces.

Note beside: Featherstone uses $\tau^a$ to denote the active loop closure forces. From your model description there does not seem to be any kinematic loops and therefore $\tau^a$ does not apply.

Gravitational Acceleration:

Featherstone applies the gravitational acceleration at the base and lets it propagate by the algorithms through the tree. This is done in the RNEA, Table 5.1 in the line

$a_0 = -a_g$.

Instead of doing that you can also modify the line

$f_i^B = I_i a_i + v_i \times^* I_i v_i$

to

$f_i^B = I_i (a_i - {}^iX_0a_g) + v_i \times^* I_i v_i$

to apply the gravitational effects individually on each body. This introduces additional computations and I do not see any benefits in doing so.

Spatial Algebra vs. Concatenation of 3-D Vectors

Spatial Algebra is not just concatenation of 3-D vectors. The former expresses rigid body motions at a fixed coordinate frame, whereas the latter is expressed at points that move with the body. As a result spatial accelerations are the time derivatives of spatial velocities. In the classical notation using two 3-D equations this is not the case (Section 2.11 of Featherstone's book):

If a body has a constant angular velocity $\omega$ then all points on that body that are not on the axis of rotation have an acceleration towards the axis of rotation (center of rotation in the planar case). In Spatial Algebra this body has zero spatial acceleration independent of the frame the acceleration is expressed in.

Spatial velocity describes linear and angular velocity of the body point that currently coincides with the origin of the (fixed) reference frame. If that frame is expressed at the center of mass and oriented with the global reference frame then it appears to be a simple concatenation of 3-D linear and angular velocity, however this is only the case for this specific choice of reference frame. Expressed at a different frame you get different values but it still represents the same spatial velocity.

Spatial acceleration describes the flow of the linear and angular velocity of the point that coincides with origin. "Flow" here means how the vector quantities (linear and angular velocity) change over time.

ContentLicense: CC BY-SA 3.0


问:
Digital Controller Design for System with variable sample time
Basically I got system with a sensor and an output. I want to apply a digital implemented feedback controller. The problem in this setup is the sensor. The specifications of the module says that the sampletime of the sensor does change in wide range, depending on the usecase; from 1.3 second to 10 second. But it stays constant until the system is disabled.

My first approach was tuning a digital PID-Controller for the longest sampletime. This works fine. Even if I change the sampletime to the shortest the system stays stable, which was expected because I'm still in ROC.
The problem now is that the system's response is pretty slow.

If I design the controller for my fastest samplingrate the results are satisfying but become instable for the slowest samplerate, which can be explained again by the ROC

I could use some kind of adaptive predefined gains which I change depending on the samplerate but I was wondering if there are  control strategies which are able to handle the sampletime changes?

EDIT:

To give a better overview I will add some details:

I'm talking about a heating system which heats with radiation. As a sensor I use a pyrometer module with a samplingrate of up 1kHz. The problem is, that the pyrometer is not able to produce reasonable readings whenever the radiator is turned on. (Yes there are other alternatives to the pyrometer, but they start at $50k and are too expensive). The radiator has to be pulsed to operate it. So to maintain a decent heat up time and steady-state temperature the "duty-cycle" has to be at a decent rate(target is 95%). The minimum "off-time" of the radiator is 0.2 seconds before the measured values are reasonable. So at the end my sensor got an effective sampletime of 1-10seconds (by varying the duty cycle).

The hardware is hard too change, radiator and sensor have been evaluted for months right now. Therefore I try to improve the results by "just" changing the control algorithm.

答:
If what you are sensing can be modeled easily, you might be able to get away with feeding the sensor into the model and using the output of the model as your sensor.

For example: assume you want to control the position of a train on a track by controlling the power (-100% to 100%) to its motors.  You have a sensor that can only measure the position once every 10 seconds.  Since you know the power of the motor and the mass of the train, you can create a fairly accurate estimation of where you are even without the sensor.  And every 10 seconds, you are guaranteed that the error of the model will be re-calibrated to 0.

Many GPS units use this technique to provide sensor "readings" faster than they receive fixes.


问:
Need help regarding EKF in MonoSLAM
I am trying to understand the implementation of Extended Kalman Filter for SLAM using a single, agile RGB camera.

The vector describing the camera pose is
$$
\begin{pmatrix}
r^W \\
q^W  \\
V^W \\
\omega^R \\
a^W \\
\alpha^R
\end{pmatrix}
$$

where:

$r^W$ :   3D coordinates of camera w.r.t world

$q^W$ :   unit quaternion describing camera pose w.r.t world

$V^W$ :   linear velocity along three coordinate frames, w.r.t world

$\omega$ :   angular velocity w.r.t body frame of camera

The feature vector set is described as
$$
\begin{pmatrix}
y_1 \\
y_2  \\
\vdots \\
y_n
\end{pmatrix}
$$
where, each feature point is described using XYZ parameters.

For the EKF acting under an unknown linear and angular acceleration $[A^W,\psi^R] $ , the process model used for predicting the next state is:

$$
\begin{pmatrix}
r^W + V^W\Delta t + \frac{1}{2}\bigl(a^W + A^W\bigr)\Delta t^2 \\
q^W \bigotimes q^W\bigl(\omega^R\Delta t + \frac{1}{2}\bigl(\alpha^R + \psi^R\bigr)\Delta t^2\bigr)   \\
V^W + \bigl(a^W + A^W\bigr)\Delta t\\
\omega^R + \bigl(\alpha^R + \psi^R\bigr)\Delta t \\
a^W + A^W \\
\alpha^R + \psi^R
\end{pmatrix}
$$

So far, I'm clear with the EKF steps. Post this prediction step, I'm not clear how to perform the measurement update of the system state.

From this slide, I was under the impression that we need to initialize random depth particles between 0.5m to 5m from the camera. But, at this point, both the camera pose and the feature depth is unknown.

I can understand running a particle filter for estimating feature
depth if camera pose is known. I tried to implement such a concept in this project: where I read the camera pose from a ground truth file and keep triangulating the depth of features w.r.t world reference frame

I can also comprehend running a particle filter for estimating the
camera pose if feature depths are known.

But both these parameters are unknown. How do I perform the measurement update?

I can understand narrowing down the active search region for feature matching based on the predicted next state of the camera. But after the features are matched using RANSAC (or any other algorithm), how do I find the updated camera pose? We are not estimating homography, are we?

If you have any idea regarding MonoSLAM (or RGB-D SLAM), please help me out with understanding the EKF steps.

To be more specific: is there a homography estimation step in the algorithm? how do we project the epipolar line (inverse depth OR XYZ) in the next frame if we do not have any estimate of the camera motion?

答:
I found an answer to this question.

Homography estimation is not needed at all. The  EKF takes care of the problem of depth estimation. If you start with an initial inverse depth estimate of $\rho_0 = 0.1 $ and $\sigma_\rho = 0.5$, the depth estimate would range from [-0.9,1.1]. This depth estimate would be corrected based on the observed values, obtained through feature matching. Please refer to this paper.

Anybody trying to learn this algorithm would do well by going through this publicly available dissertation by Sven Albrecht. To my understanding, the mathematics involving MonoSLAM can't be elucidated any better than this!

Title: Need help regarding EKF in MonoSLAM


问:
How to determine the trajectory reference on the real robot trajectory tracking
I know that we can use some algorithms like LQR, MPC, or even PID to make the robot follows the trajectory references. In the simulation like MATLAB, I usually specify the trajectory reference by a function. Let say, given a sequence of points generated by a path planning algorithm, then I want to do a real experiment of trajectory tracking over those sequence of points. My question is:
- How to specify the errors towards the path in real situation. My impression is the generated path by path planning algorithm is uncertain due to the error of the robot sensing. And unlike the line following robot which has a real physical line for the reference, the generated path from path planning is virtual, e.g. it does not exist in the real world. I am really confused about these matter.</p>

答:
The error needs always to be computed against some physical quantities that can be measured, otherwise it makes no sense in practical scenarios. It is thus expressed as $e=r-y$, where $r$ is the reference whereas $y$ accounts for the measured feedback (I have used the typical notation of a control scheme).

The feedback $y$ can be the outcome of direct measurements provided by the sensors (e.g. the encoders of the wheels of the line-follower robot) or an estimation of different quantities resulting by applying a model to those actual measurements (e.g. the prediction of the 2D position of the robot on the floor given by the integration of the wheels encoders).

Similarly, the reference $r$ can also result from a direct observation of the reality (e.g. it can be the line to track as acquired by the robot's sensors) or from a plan designed to attain a task. An example of the latter context is the planning used to move the robot from the initial position A to a target position B in the 2D world. This reference can be a simple line (virtual one) connecting A to B or a more complex path (still virtual) if we are in the presence of obstacles. Here the task is to reach B, not to follow any specific line that exists traced on the floor.

From a control standpoint, there is no difference whether $r$ is "real" (i.e. measured) or "virtual" (i.e. planned). The central point is that the reference and the feedback need to be consistent between each other, meaning that they must account for the same physical quantities expressed in the same units: if $y$ is the wheels speed in [deg/s], then $r$ cannot be a spatial position in [m].


问:
How to localise a underwater robot?
I am building an autonomous underwater robot. It will be used in swimming pools. It should be capable of running in any normal sized pool, not just the pool in which I test. So I cannot rely on a particular design or feature. It has to know it's position in the pool, either with respect to the initial position or with respect to the pool. I have a IMU, which is a Pololu MiniIMU but finding the displacement with an IMU is a near impossible task.

What sensor can I use for this task? It should not be very expensive. (below 200$)

Tank size: 25x20x2.5 meters

答:
If it's actually underwater, how about a webcam looking at the tile pattern on the floor?  (Could be considered "cheating" as it will obviously fail in a natural lake, for example.)

You can find a paper using and demonstrating this method is this paper:

Carreras, Marc, et al. "Vision-based localization of an underwater robot in a structured environment." Robotics and Automation, 2003. Proceedings. ICRA'03. IEEE International Conference on. Vol. 1. IEEE, 2003.

Title: How to localise a underwater robot?


答: Localization under water was always a problem in ocean robotics as electromagnetic signals do not propagate very well in water. I think your best localization sensor in that case would be the good old sonar, which works much faster in water. You could have four of them and detect how far are the pool walls on each side then with a triangulation algorithm locate your robot approximately. You can also add one looking down for estimating the depth.</p>

Title: How to localise a underwater robot?

Body:
I am building an autonomous underwater robot. It will be used in swimming pools. It should be capable of running in any normal sized pool, not just the pool in which I test. So I cannot rely on a particular design or feature. It has to know it's position in the pool, either with respect to the initial position or with respect to the pool. I have a IMU, which is a Pololu MiniIMU but finding the displacement with an IMU is a near impossible task.

What sensor can I use for this task? It should not be very expensive. (below 200$)

Tank size: 25x20x2.5 meters


答:
If you cannot use a camera the task is nearly impossible with your money limitations.

Professionals use a scanning sonar like the tritech micron and a particle based localization like [3] based on FastSLAM: [1].

However if you experienced with underwater acoustics you can try to build your own localization system based on the idea of a USBL idea [2] e but you will hard fight with reflections of the basin itself.

[1] https://www.google.de/search?q=FastSLAM:+A+Factored+Solution+to+the+Simultaneous+...&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:unofficial&client=iceweasel-a&channel=rcs&gws_rd=cr&ei=ZYuKVdjhE4yYsAHK6JiwBA

[2] https://en.wikipedia.org/wiki/Ultra-short_baseline

[3] https://github.com/auv-avalon/uw_localization

Title: How to localise a underwater robot?


答:
One of the prime sensors for global localisation on land is GPS. This is not an option underwater because electromagnetic waves get absorbed quickly.

There are however alternatives, which provide navigation information which is not so easily available on land.

Large Baseline (LBL) - is a method based on sonar, which works very similar to GPS, just using acoustics instead. For this you need transponders that ping at known intervals. The robot can than calculate its position based on the run length intervals. Because the timings are much easier than with GPS, coming up with your own solution might be feasible.

Ultra Short Baseline (USBL) - works the same as the LBL, just that the transponders are very close to each other (usually one device). In this way you get an angle and range measurement. Less accurate, but more compact.

Doppler Velocity Log (DVL) - uses the doppler effect in multiple directions to give you the velocity against ground.

Pressure Sensor - you can directly get a measurement of your depth in the water column with this.

AHRS - based on IMU and Compass, you can get a good estimate of your orientation.

The bad news is that the sonar based methods are way off in terms of your budget. However, if you are interested in this, it might be feasible to construct a localisation method based on DIY hydrophones. Should definitely be a fun experience.

Your alternatives, especially feasible in a pool, is to go optical. You can for example use an external camera to track your robot, or use markers (e.g. Aruco) to get a relation to a known position.

Title: How to localise a underwater robot?


问:
DH-Parameters for Forward Kinematics for Translatory Motion only
I am fairly new to the DH-transformation and I have difficulties to understand how it works. Why are not all coordinates (X+Y+Z) incorporated into the parameters? It seems to me that at least one information is useless/goes to the trash, since there is only a, d (translatory information) and alpha, theta(rotatory information).

Example:
The transition between two coordinate systems with identical orientation(alpha=0, theta=0) but with different coordinates(x1!=x2, y1!=y2, z1!=z2).
DH only makes use of a maximum of two of these information.

Please enlighten me!

Greetings

:EDIT:

To clarify which part of the DH-Transform I don't understand, here is an example.

Imagine a CNC-Mill(COS1) on a stand(COS0) without any variable length(=no motion) between COS0-COS1. For some reason I need to incorporate the transformation from COS0-COS1(=T0-1) into the forward transformation of my CNC-Mill.

DH-Parameters for T0-1 would be a=5mm, alpha=90°, d=2mm and theta=90°. Assuming this is correct, the dX=10mm information is lost during this process?
If I recreate the relation between COS0 and COS1 according to the DH-Parameters, I end up like this:

As far as I understand, on non parallel axis the information is not lost because the measurement of a/d would be diagonal, therefore include either dX/dY, dX/dZ or dY/dZ(pythagorean theorem) in one parameter.

Where is the flaw in my logic?

答:
You don't need an explicit declaration for X, Y, and Z because the information is all relative to the previous joint.

For a terrific tutorial, see this video.

You don't typically use DH parameters to generate a transform from one fixed coordinate to another fixed coordinate; you use them to define joint motions.

In your example, you want to recreate the transform from COS0 to COS1. (By the way, cos is the symbol for cosine I would suggest using F for denoting different frames of reference) You use the following DH parameters:

d = 2mm

$\theta$ = 90 degrees ($\frac{\pi}{2}$)

r = 5mm

$\alpha$ = -90 degrees ($-\frac{\pi}{2}$)

The problem here is that, again, DH parameters are for joint motion, not for fixed locations, so all you are doing is defining the location and orientation of the Z-axis. In DH parameters, the Z-axis is the axis of motion. As mentioned about 1 minute into the video I linked, "DH parameters are only concerned with the motion of the links, not the physical placement of components."

You are attempting to use DH parameters to locate a physical position where DH parameters are used to define an axis of motion.

Your confusion comes from the fact that you are misusing the DH parameters.


问:
Can ROS run on a Raspberry Pi?
Can ROS run on a Raspberry Pi?

ROS is resigned to run on a network of machines, with different machines, even different cores on the same machine doing different jobs. Can one of those machines be a Raspberry Pi?

I am considering using an R-Pi as the EtherCAT master on a mobile robot, communicating with the main PC over WiFi, using a dongle.

Can an R-Pi even run ROS at all?

Would an R-Pi have enough processing power to do some 1kHz servoing?

Would it be possible to run some servoing on the host through the WiFi connecion?

答:
There is a project called ROSpberry Pi
you can check out.  And a company in Pasadena called Acrobotic is now selling SD images of ROSpberry pre-installed.</p>

Title: Can ROS run on a Raspberry Pi?


答:
In DH, the Z axis always goes along the direction of variability. For a rotational (revolute) joint, that means Z is the axis of rotation. For a translational joint (prismatic) the Z axis is in the direction that the joint can translate. For each direction the robot can be actuated, a coordinate system is needed. So your example of a gantry crane, if that crane can be actuated in 3 directions, then it will take 3 coordinate systems to define said crane.  Then the CNC mill will need 3 as well.

So, now taking a step back. Since our hypothetical 3D gantry crane has 3 coordinate systems, and in each coordinate system the Z axis is along the direction of freedom, you can imagine that from a global perspective, X,Y and Z are dealt with.

I made a quick illustration. If you look, you can see that Z2 defines a direction that the crane can be actuated, but it is in X direction of the preceding coordinate system (X1). Z1 also defines a direction of acutation, but it is in the Y direction of the preceding coordinate system (Y0). So from a global perspective, the X,Y,Z are essentially incorporated.

So the basis of your question boils down to, "why is only Z used as the axis of actuation?" I don't have an answer for that, other than probably the math would break down somewhere.

EDIT

More info based on updated description. To transform between two coordinate systems with no variability in between them, all that is required is a homogeneous transform, as shown. Reference for how these matrices are formed can be found here on page 65 of the text.

Title: DH-Parameters for Forward Kinematics for Translatory Motion only

Body:
I am fairly new to the DH-transformation and I have difficulties to understand how it works. Why are not all coordinates (X+Y+Z) incorporated into the parameters? It seems to me that at least one information is useless/goes to the trash, since there is only a, d (translatory information) and alpha, theta(rotatory information).

Example:
The transition between two coordinate systems with identical orientation(alpha=0, theta=0) but with different coordinates(x1!=x2, y1!=y2, z1!=z2).
DH only makes use of a maximum of two of these information.

Please enlighten me!

Greetings

:EDIT:

To clarify which part of the DH-Transform I don't understand, here is an example.

Imagine a CNC-Mill(COS1) on a stand(COS0) without any variable length(=no motion) between COS0-COS1. For some reason I need to incorporate the transformation from COS0-COS1(=T0-1) into the forward transformation of my CNC-Mill.

DH-Parameters for T0-1 would be a=5mm, alpha=90°, d=2mm and theta=90°. Assuming this is correct, the dX=10mm information is lost during this process?
If I recreate the relation between COS0 and COS1 according to the DH-Parameters, I end up like this:

As far as I understand, on non parallel axis the information is not lost because the measurement of a/d would be diagonal, therefore include either dX/dY, dX/dZ or dY/dZ(pythagorean theorem) in one parameter.

Where is the flaw in my logic?


答:
I studied DH transformation for industrial robotics exam. In DH procedure you consider only 1DOF joint (eventually decomposing a xDOF joint in x 1DOF with 0 link length) and you set relative z-axis parallel to joint axis and x-axis perpendicular to the plan defined by k-joint axis and k+1-joint axis. In this way you can consider every joint-to-joint transformation as a spin on relative z-axis and a spin on x-axis (the spin is defined as rotation and translation on the same axis and is the only 3D commutative tranformation).

So, for each joint you get a transformation matrix that depends on joint variable (rotation or translation on relative z-axis) and on link length and geometry(rotation and/or translation on relative x-axis) .

The total transformation matrix is the product of all single joint transformation matrix and it depends on all joint variables and on robot geometry

I hope that this fast explanation is helpful and I hope that I did not made too many grammatical mistakes!

EDIT

DH transform is normally used to compute kinematics in robotic arms and it doesn't work for all kind of motion. In some cases it needs a "patch" in order to be usable for some configuration (i.e. adding an auxiliary 0DOF link to include some geometries). In your case I think you should decompose your sistem in two different transformation T0-1 and T1-2 to include every translation. In alternative you can set x-axis parallel to diagonal in order to have only one transformation matrix T0-1


问:
Sensors' field of view in car driving
I want to develop an autonomous driving RC car. For detecting obstacles, I plan to mount 3-5 ultrasonic sensors in the front and in the back the car. What is the  minimum necessary combined field of view of the sensors so the car never hits an obstacle? I.e. what is the minimum angle of detection of the combined sensors the car should have to detect any obstacle in its path?

Some data about the car: (I don't know whether all the data is relevant)

Separation between right and left wheel : 19,5 cm

Wheelbase (distance between the front and the back wheels):  31,3cm

Steering axle: front.

Maximum angle of steering: around 30 degrees. The car uses Ackermann steering

答:
How fast are you driving the car and are you allowing slip during turning?

From this powerpoint, the turning radius is given by:

$$
R = \frac{L}{\delta}
$$
where $R$ is the turning radius, $L$ is the wheelbase length, and $\delta$ is the steering angle. Note that the equation is for low speed driving.

Given this equation, you can generate a circle around which the car will traverse. Now you need to specify a reaction/braking time. Multiply the reaction time (seconds) by the average vehicle stopping speed (meters per second) to get how many meters the vehicle will travel in the time it takes to stop. Note that if you're using a linear deceleration the average vehicle stopping speed will be half of your cruising speed.

Now, the distance around your turning circle is $d = R\theta$, where again, $R$ is the turning radius. This gives your location on the turning circle when you come to a stop to be $\theta = \frac{d}{R}$.

Finally, look at the angle the object makes with the axis of your car at that position. This should be the minimum angle you are looking to see an obstacle. Here's a (crude) image for clarity:

Assuming your 30 degree steering angle is actually +/- 15 degrees, then your steering circle might look something like the above. Given your stopping distance, you need to be able to identify something at least at the red 'X'. This means your forward-looking sensor needs to be at an angle of, in this example, 50 degrees off the center line of your car in order to be able to see it in time to stop without collision.

The faster you are going, the longer it will take to stop, so the farther "around" the turning circle you need to be able to see. As alluded to with the link at the opening of this post, though, RC cars generally have a lot of slip, so you will need to ensure that the car operates at probably a painfully slow speed to ensure the Ackerman steering radius equation above remains valid and to ensure that you don't have slip when braking.

While it is probably acceptable to assume that performance in reverse is the same as in forward this may or may not actually be the case. Braking times, speed, and slip could all perform differently in reverse than in the forward direction.

Finally, remember that the guidance I've given gives you the minimum distance for a large object and assumes instantaneous detection and reaction signalling. That is, you should add a margin to what this gives you. You should have full sensor coverage between your turning extremes (that is, sensor coverage of +/- 50 degrees in this example) to ensure you don't hit any objects, but as you probably won't hit any RC-scale light poles, people, or other relatively narrow objects, you can probably skate by with a few gaps in your sensor coverage.

Title: Sensors' field of view in car driving


答: To be short and simple, D-H notation uses third axis as the reference to the other 2 through out the calculations. </p>


问:
Homogenous Transformation Matrix for DH parameters
I'm studying Introduction to robotic and found there is different equations to determine the position and orientation for the end effector of a robot using DH parameters transformation matrix, they are :

Example: Puma 560, All joints are revolute

Forward Kinematics:

Given :The manipulator geometrical parameters.

Specify: The position and orientation of manipulator.

Solution:

For Step 4:

for step 3 :Here I'm confused

Here we should calculate the transformation matrix  for each link  and then multiply them to get the position and orientation for the end effector.

I've seen different articles using one of these equations when they get to this step for the same robot(puma 560)

What is the difference between them? Will the result be different? Which one should I use when calculating the position and orientation?

答:
Given a robotic arm, if you derive homogeneous transformation matrix for it , it will be equal to one of the above mentioned equations.

Those equations are the basic scenarios for reaching the end point, any robotic arm will satisfy one of the three equations .
The equations simply mean the order of manipulations carried out by the arm.
A translation along x axis followed by a rotation
Or
A rotation followed by a translation .

If you observe the equations you can notice that there can be two consecutive translations but not rotations.
These are the basic scenarios, however for a custom robot the equations can be different

For example,let us consider a robotic arm with a revolute base followed by  prismatic joint, and another revolute joint

The scenario of this robot is

rotation->translation->rotation.

If another robot has a prismatic base, revolute joint, and again a prismatic joint, the equation would look like

translation->rotation->translation

So, it depends on the robotic arm that you are working on. But these are the basic situations to understand that sometimes translation is followed by rotation or vice versa, or two consecutive translations but no consecutive rotations. If you understand these equations, you can build your own using them.

Additional info:
After reading back and forth in my robotics and modelling book, i forgot to tell you one thing in DH notation matrices.

The Transaltion matrices Trans(z,d), Trans (x,a) are identity matrices with just one vale in the last column.

```<code>1 0 0 0
0 1 0 0
0 0 1 d
0 0 0 1
</code>```

and

```<code>1 0 0 a
0 1 0 0
0 0 1 0
0 0 0 1
</code>```

So, they dont change the overall result even if they are multiplied before or after the rotation matrices.
I used the second equation to calculate transformation matrix for puma 560 in a java program. It was perfect.
I hope this clears your confusion, sorry for the delay.

Body:
Given a robotic arm, if you derive homogeneous transformation matrix for it , it will be equal to one of the above mentioned equations.

Those equations are the basic scenarios for reaching the end point, any robotic arm will satisfy one of the three equations .
The equations simply mean the order of manipulations carried out by the arm.
A translation along x axis followed by a rotation
Or
A rotation followed by a translation .

If you observe the equations you can notice that there can be two consecutive translations but not rotations.
These are the basic scenarios, however for a custom robot the equations can be different

For example,let us consider a robotic arm with a revolute base followed by  prismatic joint, and another revolute joint

The scenario of this robot is

rotation->translation->rotation.

If another robot has a prismatic base, revolute joint, and again a prismatic joint, the equation would look like

translation->rotation->translation

So, it depends on the robotic arm that you are working on. But these are the basic situations to understand that sometimes translation is followed by rotation or vice versa, or two consecutive translations but no consecutive rotations. If you understand these equations, you can build your own using them.

Additional info:
After reading back and forth in my robotics and modelling book, i forgot to tell you one thing in DH notation matrices.

The Transaltion matrices Trans(z,d), Trans (x,a) are identity matrices with just one vale in the last column.

1 0 0 0
0 1 0 0
0 0 1 d
0 0 0 1

and

1 0 0 a
0 1 0 0
0 0 1 0
0 0 0 1

So, they dont change the overall result even if they are multiplied before or after the rotation matrices.
I used the second equation to calculate transformation matrix for puma 560 in a java program. It was perfect.
I hope this clears your confusion, sorry for the delay.


答: Without knowing more context, the clearest answer is; the different "versions" represent different end effector configurations. Following the DH approach, you could take a robot in one configuration, assign it the DH parameters, and arrive at a transformation matrix, then rearrange the robot and come up with a new transformation matrix...But both versions could have the same parameters. There is no single solution you should use unless you're using an "off the shelf" robot such as a SCARA manipulator, which has DH solutions already worked out.</p>

Title: Homogenous Transformation Matrix for DH parameters

Body:
I'm studying Introduction to robotic and found there is different equations to determine the position and orientation for the end effector of a robot using DH parameters transformation matrix, they are :

Example: Puma 560, All joints are revolute

Forward Kinematics:

Given :The manipulator geometrical parameters.

Specify: The position and orientation of manipulator.

Solution:

For Step 4:

for step 3 :Here I'm confused

Here we should calculate the transformation matrix  for each link  and then multiply them to get the position and orientation for the end effector.

I've seen different articles using one of these equations when they get to this step for the same robot(puma 560)

What is the difference between them? Will the result be different? Which one should I use when calculating the position and orientation?


问:
Graph optimization with G2O
I'm trying to do graph optimization with G2O, mainly in order to perform loop closure. However finding minimal working examples online is an issue (I've found this project, as well as this one. The second one though has the form of a library, so one cannot really see how the author uses things.)

In contrast to online loop closure, where people update and optimize a graph every time they detect a loop, I'm doing graph optimization only once, after pairwise incremental registration. So in my case, pairwise registration and global, graph-based optimization are two separate stages, where the result of the first is the input for the second.

I already have a working solution, but the way that works for me is quite different from the usual use of g2o:

As nodes I have identity matrices (i.e. I consider that my pointclouds are already transformed with the poses of the pairwise reg. step) and

as edges, I use the relative transformation based on the keypoints of
the pointclouds (also the keypoints are transformed). So in this case
I penalize deviations of the relative pose from the identity matrix.

As Information matrix (inverse of covariance) I simply use a 6x6
identity matrix multiplied by the number of found correspondences
(like this case).

The result of the graph is an update matrix,
i.e. I have to multiply with this the camera poses.

Although this works in many/most cases, it is a quite unusual approach, while one cannot draw the graph for debugging (all nodes are identities in the beginning, and the result after optimization is a 3d path), which means that if something goes wrong getting an intuition about this is not always easy.

So I'm trying to follow the classic approach:

The vertices/nodes are the poses of the pairwise registration

The edges are the relative transformations based on the keypoints/features of the raw pointclouds (i.e. in the camera frame, not transformed by the poses of the pairwise registration)

The output are the new poses, i.e. one simply replaces the old poses with the new ones

Drawing the graph in this case makes sense. For example in case of scanning an object with a turntable, the camera poses form a circle in 3d space.

I'm trying to form all the edges and then optimize only at one stage (this doesn't mean only 1 LM iteration though).

However I cannot make things running nicely with the 2nd approach.
I've experimented a lot with the direction of the edges and the relative transformation that is used as measurement in the edges, everything looks as expected, but still no luck. For simplicity I still use the information matrix as mentioned above, it is a 6x6 identity matrix multiplied with the number of correspondences. In theory the information matrix is the inverse of covariance, but I don't really do this for simplicity (plus, following this way to compute the covariance is not very easy).

Are there any minimal working examples that I'm not aware of?
Is there something fundamentally wrong in what I describe above?
Are any rules of thumb (e.g. the first node in both approaches above is fixed) that I should follow and I might not be aware of them?

Update: More specific questions

The nodes hold the poses of the robot/camera. It is unclear though at which reference frame they are defined. If it is the world coordinate frame, is it defined according to the camera or according to the object, i.e. first acquired pointcloud? This would affect the accumulation of the pose matrices during incremental registration (before the g2o stage - I try to form and optimize the graph only once at the end, for all the frames/pointclouds).

The edge (Src->Tgt) constraints hold the relative transformation from pointcloudSrc to pointcloudTgt. Is it just the transformation based on the features of the two in the local coordinate frame of pointcloudSrc? Is there and tricky point regarding the direction, or just consistency with the relative transformation is enough?

The first node is always fixed. Does the fixed node affect the direction of the edge that departs/ends_up from/at the fixed node?

Is there any other tricky point that could hinter implementation?

I'm working in millimeter instead of meter units, I'm not sure if this will affect the solvers of g2o in any way. (I wouldn't expect so, but a naive use of g2o that was giving some usable results was influenced)

答:
The nodes hold the poses of the robot/camera. It is unclear though at which reference frame they are defined. If it is the world coordinate frame, is it defined according to the camera or according to the object, i.e. first acquired pointcloud? This would affect the accumulation of the pose matrices during incremental registration (before the g2o stage - I try to form and optimize the graph only once at the end, for all the frames/pointclouds).

-
As far as I can tell, they should be in world coordinate frame indeed. So we start with identity, and incrementally carry on moving as we compute the odometry transformations (if visual odometry is used). So basically Pose_1 = Identity, Pose_2 = Poise_1*T_12, ..., Pose_i = Pose_(i-1)*T_(i-1)i. So that's one way.

The edge (Src->Tgt) constraints hold the relative transformation from pointcloudSrc to pointcloudTgt. Is it just the transformation based on the features of the two in the local coordinate frame of pointcloudSrc? Is there and tricky point regarding the direction, or just consistency with the relative transformation is enough?

Say you were in Pose_(i-1) (your previous known pose), and you want to compute the relative transformation between Pose_(i-1) and the current unknown pose Pose_i. Then you get the previous point cloud in coordinate frame of Pose_(i-1), I will call it PC_(i-1), and you also get your current point cloud PC_i and put also with respect to Pose_(i-1).
More specifically, for all points p belonging to PC_(i-1), you transform them using Pose_(i-1), making p' = Pose_(i-1)*p, same for the points q, obtaining q' = Pose_(i-1)*q.

Given these two point clouds we can compute ICP between them
src_cloud = PC_(i-1)
tgt_cloud = PC_i
T_(i-1)i = ICP( src_cloud, tgt_cloud ).inverse();

--> Note that instead of ICP you could have some other algorithm to align two point clouds, this is just an example.

(we get the inverse of the transform that aligns src_cloud to tgt_cloud because we want the relative motion of the robot/camera, and not the relative motion of the cloud, one is the inverse of the other, just like if you move towards a tree, the tree moves towards you with the same transformation, but inverse).

The first node is always fixed. Does the fixed node affect the direction of the edge that departs/ends_up from/at the fixed node?

The first node is fixed because of the formulation of the linear system (which the whole graph optimisation equation becomes at the end, you can see g2o paper and also look for "A tutorial on Graph-Based SLAM")

Is there any other tricky point that could hinter implementation?
If you read RGBDSLAM code, and RTABMAP code, you will see that they set the information matrix as the identity multiplied by something. This something can be a proxy that reflects the inverse variance, you can compute the variance itself (average distance between the  aligned points of the point clouds aligned with T_(i-1)i). You can set it as the identity multiplied by the number of inliers in your aligned procedure of choice, the whole point is that your information matrix must say more or less how much certain you are about the correctness of the transformation T_(i-1)i, or how much information it's bringing to the system, that's the main semantic meaning.

I'm working in millimeter instead of meter units, I'm not sure if this will affect the solvers of g2o in any way. (I wouldn't expect so, but a naive use of g2o that was giving some usable results was influenced)

I don't think it should create problems either, although you should beware of numerical issues such as overflow/underflow, rounding, and such things.

Title: Graph optimization with G2O


问:
Is Lego Mindstorm a good start?
I would like to start experimenting with Robots. Is Lego Mindstorm a good start? Should I consider other platforms?</p>

答:
If you want to focus on the software only, then Mindstorms are a great start. Because you have a fixed platform and do not need to care a lot about the hardware. And if you want to mount some homebrew sensors this is also possible. The mindstorms itself are well documented and the hardware/software interfaces are relatively easy.

You can do some stuff by using the Lego-NXT Programming IDE or even write your own programms and let them run directly. At the end you can even upload your own OS to the Arm7 and do whatever you want. Just do not forget the Samba (see NXT Hardware SDK) If you have more question to the Lego-Robots, there is SE for this, too. https://bricks.stackexchange.com/

Instead of using Lego you can think about buying some Arduino/Raspy based robots, where you might need to get your hands more dirty (from hardware point of view)

Title: Is Lego Mindstorm a good start?


问:
In HRI, how is the "uncanny valley" experienced by people on the autism spectrum?
I'm familiar with the idea of the uncanny valley theory in human-robot interaction, where robots with almost human appearance are perceived as creepy. I also know that there have been research studies done to support this theory using MRI scans.

The effect is an important consideration when designing robotic systems that can successfully interact with people. In order to avoid the uncanny valley, designers often create robots that are very far from humanlike. For example, many therapeutic robots (Paro, Keepon) are designed to look like animals or be "cute" and non-threatening.

Other therapeutic robots, like Kaspar, look very humanlike. Kaspar is an excellent example of the uncanny valley, since when I look at Kaspar it creeps me out. However, people on the autism spectrum may not experience Kaspar the same way that I do. And according to Shahbaz's comment, children with autism have responded well to Kaspar.

In the application of therapeutic robots for people on the autism spectrum, some of the basic principles of human-robot interaction (like the uncanny valley) may not be valid. I can find some anecdotal evidence (with Google) that people on the autism spectrum don't experience the uncanny valley, but so far I haven't seen any real studies in that area.

Does anyone know of active research in human-robot interaction for people on the autism spectrum?  In particular, how does the uncanny valley apply (or doesn't it apply) when people on the autism spectrum interact with a humanlike robot?

答:
The short answer is no. There doesn't seem to be any study directly investigating if and how the uncanny valley applies to autistic children. At least, a Google Scholar search with the keywords autism "uncanny valley" doesn't result in anything of the sort. I agree, though, that this would be a most interesting and useful area of research.

Keep in mind, however, that, despite the fMRI and other studies, the Uncanny Valley is far from considered an established theory. This is, partly, because the Uncanny Valley is likely a great deal more complex than Mori first proposed, that is, it is probably not just human likeness that affects our sense of familiarity, nor is familiarity the only factor affected (MacDorman, 2006).

In my personal opinion, there's no doubt something like the Uncanny Valley exists, even though it may not quite take the shape Mori gave it (Bartneck et al., 2007). Artists of all ilk have long been aware of it and have deliberately used it (e.g. Chucky or any zombie movie ever) or suffered when falling into it (the Polar Express being the most notable example). Several explanations have been put forward to explain it (Brenton et al., 2005; MacDorman, 2005; Saygin et al., 2010) and it's been observed in monkeys as well (Steckenfinger and Ghazanfar, 2009), so it's very likely evolutionary in nature.

If you are interested in this area, I'd probably look at how people suffering from autism process faces in general. In this area, there have been a number of studies using real faces (e.g. Scholar search autism "facial features"), as well as artificial faces (e.g. Scholar search autism cartoon faces). This difference in decoding facial expressions might explain why they seem to not feel the effects of the uncanny valley the same way other people do.

As for Kaspar in particular, Blow et al. (2006) goes into some detail on the design decisions involved in Kaspar's face. Also, in a YouTube video, Kaspar's creators cite predictability and simplicity as some of the reasons for his particular design.

References:

SA Steckenfinger,  AA Ghazanfar. "Monkey visual behavior falls into the uncanny valley." Proceedings of the National Academy of Sciences 106.43 (2009): 18362-18366.

M Blow et al. "Perception of robot smiles and dimensions for human-robot interaction design." Robot and Human Interactive Communication, 2006. ROMAN 2006. The 15th IEEE International Symposium on. IEEE, 2006.

KF MacDorman. "Androids as an experimental apparatus: Why is there an uncanny valley and can we exploit it." CogSci-2005 workshop: toward social mechanisms of android science. 2005.

H Brenton et al. "The uncanny valley: does it exist." proc HCI Annu Conf: workshop on human-animated character interaction, Edinburgh. 2005.

KF MacDorman. "Subjective ratings of robot video clips for human likeness, familiarity, and eeriness: An exploration of the uncanny valley." ICCS/CogSci-2006 long symposium: Toward social mechanisms of android science. 2006.

AP Saygin, T Chaminade, H Ishiguro. "The perception of humans and robots: Uncanny hills in parietal cortex." Proceedings of the 32nd Annual Conference of the Cognitive Science Society. 2010.

C Bartneck et al. "Is the uncanny valley an uncanny cliff?." Robot and Human interactive Communication, 2007. RO-MAN 2007. The 16th IEEE International Symposium on. IEEE, 2007.


答:
I played quite a lot with the lego mindstorms and indeed they are interesting but I found them quite limited at the ARM level. The other point with them is that when you move to another Core like the raspberry which I find more interesting (but I am a developper) is that you can continue using the lego parts with it.

So depending where you want to focus on, lego is a good start for all the bricks, sensors and motors but if it is for more programming raspberry will be a good choice.

Tosbiak gave some link on the lego so I will just complete with a link on raspberry: https://www.raspberrypi.org/resources/ (for exemple the butler is quite and interesting robot to make)

Title: Is Lego Mindstorm a good start?

Body: I would like to start experimenting with Robots. Is Lego Mindstorm a good start? Should I consider other platforms?</p>


答:
In addition to Mindstorms being a good start for software, there are competitions for younger students such as FIRST robotics, and Botball where Legos plays a large role(may not be found everywhere though). You learn software, and also how to design a robot to perform a specific task or tasks. </p>

<p>However you will not learn the electronics side thus missing out on a huge part of the experience. While I haven't tested it, I started with a kit similar to this Parallax BOEBot from Adafruit. It serves as not only an introduction to software, but also the parts involved and assembly. The downside here is that you're not working with Legos and so the ability to reconfigure and build something new is lacking. </p>

Title: Is Lego Mindstorm a good start?

Body:
In addition to Mindstorms being a good start for software, there are competitions for younger students such as FIRST robotics, and Botball where Legos plays a large role(may not be found everywhere though). You learn software, and also how to design a robot to perform a specific task or tasks.

However you will not learn the electronics side thus missing out on a huge part of the experience. While I haven't tested it, I started with a kit similar to this Parallax BOEBot from Adafruit. It serves as not only an introduction to software, but also the parts involved and assembly. The downside here is that you're not working with Legos and so the ability to reconfigure and build something new is lacking.


问:
Troubleshooting Xbox Kinect 360
I recently got libfreenect running on my mac and was able to test out freenect-glpclview which uses some of the 3D capabilities of the depth sensor.

I noticed that the Kinect would only respond / pick up movement that happened within a range of about 3-6 inches in front of the sensor.

I thought this may be because the lights where on so I turned them off. It seemed to get a little better but it still only "works" if something is block the sensor almost completely.

Does anyone know if this is something that can be solved? I know it's an old sensor but I got it for $20 so I could do some prototyping with it.

Notes:

laser project is ON

light starts out blinking then goes solid green

when not level light goes red

RGB camera works but is a little choppy and sometimes shows tears in the picture.

freenect-glcplview output (snippet):

```<code>[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 70] Expected 1748 data bytes, but got 948
[Stream 70] Expected max 1748 data bytes, but got 1908. Dropping...
[Stream 70] Expected max 1748 data bytes, but got 1908. Dropping...
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
</code>```

freenect-regview output (snippet)

```<code>[Stream 70] Invalid magic 2dc5
[Stream 70] Invalid magic aaf5
[Stream 70] Invalid magic dddb
[Stream 70] Invalid magic 9272
[Stream 70] Invalid magic 9873
[Stream 70] Invalid magic 9b8b
[Stream 70] Invalid magic 59eb
[Stream 70] Invalid magic 88f1
[Stream 70] Invalid magic 75ee
[Stream 70] Invalid magic ffff
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Lost 1 packets
[Stream 80] Lost 15244 total packets in 514 frames (29.657587 lppf)
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Expected 1908 data bytes, but got 948
[Stream 80] Invalid magic 3b46
[Stream 80] Lost 1 packets
</code>```

Found this which gives me the idea that this may be a USB issue: Regular receipt of undersized packet.

答:
Well, from the last post in the thread you linked states it's a USB speed issue, then says you need 20 MB/s to do depth and RGB, which means you cannot do it on a USB 1.0 port; you need 2.0 or 3.0.

See this support page on Apple's site for how to determine the speed of your USB ports. You didn't give the model of your computer, but if it's an older laptop you might have 1.0 ports.

Try checking your port speed and switch to a 2.0 port (or just a different 2.0 port) and see if you have the same issue.

Title: Troubleshooting Xbox Kinect 360


问:
Question for those who have experience using stereo cameras/module (e.g. ZED, DUO M, Bumblebee, etc.)
This is a question for those of you who have experience using stereo cameras/modules like the ZED, DUO M, Bumblebee cameras, etc. (not TOF cameras). I can't find any sample disparity outputs out there on the internet, and I can't find any information on how they perform. Basically here are a few things I'd like to know to those of you who used any of the cameras mentioned above (and others)

What resolution and no. of disparities did you work with?

How was the framerate?

On what hardware?

Did the camera have an ASIC of some sort to produce the disparity maps, or did it require a host?

How was the quality?

For those who used the ZED camera, there is a promotional video on youtube. Are the disparity maps really that good?

答:
I can't speak for the others, but the Bumblebee2 simply gives you a synchronized pair of images, and some calibration parameters.  You need a host computer to compute the stereo correspondence.

For all stereo cameras, the quality of output and "number of disparities" will greatly depend on the scene.  Stereo matching requires salient features to be found in both images.  So looking at large solid color walls, tabletops, and things like that return very few matches.  However, natural scenes, and scenes with texture and clutter perform much better.

FYI, the Intel RealSense gets around some of these limitations by projecting an IR texture in the scene, then doing regular stereo matching.


问:
How frequently should a PID controller update?
I am developing a quadcopter platform on which will be extended over the next year. The project can be found on Github. Currently, we are using an Arduino Uno R3 as the flight management module.

At present, I am tuning the PID loops. The PID function is implemented as:

```<code>int16_t pid_roll(int16_t roll)
{
    static int16_t roll_old = 0;
    int16_t result =
    (KP_ROLL * roll) +
    (KI_ROLL * (roll_old + roll)) +
    (KD_ROLL * (roll - roll_old))
    ;
    roll_old += roll;
    result = constrain(result, PID_MIN_ROLL, PID_MAX_ROLL);
    return -result;
}
</code>```

I am having trouble interpreting the system response on varying the constants. I believe the problem is related to the questions below.

How frequently should a PID controller update the motor values? Currently, my update time is about 100-110 milliseconds.

What should be the maximum change that a PID update should make on the motor thrusts? Currently, my maximum limit is about +-15% of the thrust range.

At what thrust range or values, should the tuning be performed? Minimum, lift off, or mid-range or is it irrelevant?

答:
Your code assumes that the CPU is running at a constant clock. However, in real life it will change, and sometimes even drastically! So it is required to insert a Delta Time (dt) factor to your KI and KD terms in the computations.

i.e.

```<code>(KI_ROLL * (roll_old + roll) *dt) +
(KD_ROLL * (roll - roll_old) *dt)
</code>```

(dt = time_now - time_previous)

By the way, your Integral term is a wrong one! As it stands, it's probably destabilizing the whole system. An integral controller should use a Integral_Roll_error variable, which is the addition of errors in time. For example:

```<code>Integral_Roll_error = Integral_Roll_error + roll - roll_old;
</code>```

Running fast is important, but running a stable rate is required, especially if you want to be able to analyse your system, or do tests, compare different control logics, to add a Navigation algorithm, or payload control algorithm later on, etc.

Coming back to the question:

```<code>"I am having trouble interpreting the system response on varying the constants."
</code>```

It would be beneficial to elaborate a little bit more on what sort of funny or difficulties you ran into. Adding some response charts from your tests would probably let the community help many in practical ways.

The second question asks about the rate limit of the motor control output command. This depends a lot on what sort of a performance you are expecting. The code is only computing the roll_command. How it is turned to motor commands is a relevant topic. In general, as long as the motor accelerations do not cause harm, you could make them as fast as you could.

The performance requirement of the controller (how fast it should stably bring the system to the desired state, how far it should/could overshoot, what sort of a damping it should have), derives the required motor_rate_limit. For example, lift off could be one of the performance requirements. From a standing position to leving the ground, if it takes 30 seconds, is it acceptable? or if the vehicle is tilted by 60 degrees in 2 seconds, (the lift will drop to half if not compensated), you need more Lift all of a sudden. So angular agility of the vehicle is indirectly affecting the lift_agility of the vehicle, and in turn the motor_control_rates.

```<code>3) At what thrust range or values, should the tuning be performed? Minimum, lift off, or mid-range or is it irrelevant?
</code>```

It is relevant. At the limits of thrust, you are not able to accelerate the motors that are already at their maximum. (unless you never allow to go beyond a specific total_Thrust, which is a workaround, by giving up some performance.) So the gains of the controller must be tuned at the maximum, as well as some other points of the operational envelope (forward flight, hover). Reminder: Max thrust and similarly min thrust tests would not be easy to achieve with normal flights.

Body:
Your code assumes that the CPU is running at a constant clock. However, in real life it will change, and sometimes even drastically! So it is required to insert a Delta Time (dt) factor to your KI and KD terms in the computations.

i.e.

(KI_ROLL * (roll_old + roll) *dt) +
(KD_ROLL * (roll - roll_old) *dt)

(dt = time_now - time_previous)

By the way, your Integral term is a wrong one! As it stands, it's probably destabilizing the whole system. An integral controller should use a Integral_Roll_error variable, which is the addition of errors in time. For example:

Integral_Roll_error = Integral_Roll_error + roll - roll_old;

Running fast is important, but running a stable rate is required, especially if you want to be able to analyse your system, or do tests, compare different control logics, to add a Navigation algorithm, or payload control algorithm later on, etc.

Coming back to the question:

"I am having trouble interpreting the system response on varying the constants."

It would be beneficial to elaborate a little bit more on what sort of funny or difficulties you ran into. Adding some response charts from your tests would probably let the community help many in practical ways.

The second question asks about the rate limit of the motor control output command. This depends a lot on what sort of a performance you are expecting. The code is only computing the roll_command. How it is turned to motor commands is a relevant topic. In general, as long as the motor accelerations do not cause harm, you could make them as fast as you could.

The performance requirement of the controller (how fast it should stably bring the system to the desired state, how far it should/could overshoot, what sort of a damping it should have), derives the required motor_rate_limit. For example, lift off could be one of the performance requirements. From a standing position to leving the ground, if it takes 30 seconds, is it acceptable? or if the vehicle is tilted by 60 degrees in 2 seconds, (the lift will drop to half if not compensated), you need more Lift all of a sudden. So angular agility of the vehicle is indirectly affecting the lift_agility of the vehicle, and in turn the motor_control_rates.

3) At what thrust range or values, should the tuning be performed? Minimum, lift off, or mid-range or is it irrelevant?

It is relevant. At the limits of thrust, you are not able to accelerate the motors that are already at their maximum. (unless you never allow to go beyond a specific total_Thrust, which is a workaround, by giving up some performance.) So the gains of the controller must be tuned at the maximum, as well as some other points of the operational envelope (forward flight, hover). Reminder: Max thrust and similarly min thrust tests would not be easy to achieve with normal flights.


问:
Stereo camera Vs Kinect
Any one can advice me on the ideal perception sensors for pick and place application using a robotic manipulator with ROS support. I have generally looked at things like Kinect and stereo cameras (Bumblebee2) which provide depth that can be used with PCL for object recognition and gripper positioning. Are there any other sensors would be preferred for such application and if not what are the drawbacks of stereo cameras in comparison to Kinect or other sensing capability.

Thanks,

Alan

答:
The Kinect is certainly a popular choice these days for robotics.  However, time-of-flight, structured light, and stereo cameras all have their own strengths and weaknesses.  These two threads have a good discussion:

What main factors/features explain the high price of most industrial computer vision hardware?

Question for those who have experience using stereo cameras/module (e.g. ZED, DUO M, Bumblebee, etc.)

I think the simple answer is that stereo requires visual texture in the scene, and you can alter your baseline for different min/max ranges.  TOF cameras might have trouble with certain materials, and can give you false readings when an object is too close to the camera.

Title: Stereo camera Vs Kinect


问:
Extend robotic arm with wrist rotation
I got an OWI Robotic arm, but was slightly disappointed at it having only horizontal position for gripper. What would be the easiest way to extend with gripper/wrist rotation, i.e. 6th degree of freedom?

答:
Unfortunately you cannot do that. I have a OWI robotic arm too.  I purchased it for my semester project to demonstrate inverse kinematics for 5 DOF.
Since OWI is designed as a toy to play with, we cannot expect more from it. It just does basic movements to give us an idea how a robotic arm functions.
If you are looking for a 6DOF arm i suggest you purchase another 6 DOF arm like this arm by DFRobot.

Title: Extend robotic arm with wrist rotation


问:
Using an Arduino to control an ON / OFF connection between two pins
I've got this driver: http://www.pololu.com/catalog/product/1182

... a A4988 stepper motor driver carrier

I'm attempting to control a connection between the RESET and SLEEP pins with logic ( code ) running on my Arduino. The motor runs perfectly when these two pins are connected however I'd like to control when the stepper is powered off from my Arduino ( and thus not generating extra heat )

I'd like to:

designate a pin to control the connection between these two pins

use a "digitalWrite" to the above pin with a HIGH or LOW to
switch power on and off from the stepper

NOTE: The data sheet mentioned that for the driver to be powering the stepper both RESET and SLEEP needed to be in switched on ( HIGH )

答:
You are going about this incorrectly.  The reason why pololu is telling you to connect the two pins is because the sleep pin has a pullup resistor on their breakout board.

Connecting reset to the sleep pin is equivalent to connecting the reset pin to high.

You can achieve your goal by connecting reset pin to high (5V through pullup resistor) and connect the sleep pin directly to your arduino just like the step/dir pins.


问:
STM32_OC_Timing and IRQHandler
I created a program to simple time base delay (in seconds). I have problem:

How to read a interrupt flag from channel 1 etc.?

When I use if(__HAL_TIM_GET_FLAG(&htim2, TIM_FLAG_CC1) != RESET) an error occurs.

When the interrupt occurred , uC should clear flag and set Blue LED in Discovery Board.

Here is my program:

Main.c

```<code>/* Includes */
#include "stm32f3xx_hal.h"

/* Private variables */
TIM_HandleTypeDef htim2;

/* Private function prototypes */
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_TIM2_Init(void);

int main(void)
{

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
 HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_TIM2_Init();

  /* Infinite loop */

  while (1)
  {
      HAL_GPIO_WritePin(GPIOE,GPIO_PIN_11,GPIO_PIN_RESET);
  }
}

/** System Clock Configuration*/

void SystemClock_Config(void)
{

  RCC_OscInitTypeDef RCC_OscInitStruct;
  RCC_ClkInitTypeDef RCC_ClkInitStruct;

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
  HAL_RCC_OscConfig(&RCC_OscInitStruct);

  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);

  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

}

/* TIM2 init function */
void MX_TIM2_Init(void)
{

  TIM_ClockConfigTypeDef sClockSourceConfig;
  TIM_MasterConfigTypeDef sMasterConfig;
  TIM_OC_InitTypeDef sConfigOC;

  htim2.Instance = TIM2;
  htim2.Init.Prescaler = 7199; //72Mhz/7200
  htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim2.Init.Period = 65535;
  htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  HAL_TIM_Base_Init(&htim2);

  sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);

  HAL_TIM_OC_Init(&htim2);

  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);

  sConfigOC.OCMode = TIM_OCMODE_TIMING;
  sConfigOC.Pulse = 20000; //0.0001[s] * 20000 = 2 [s] DELAY
  sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
  sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
  HAL_TIM_OC_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);

  sConfigOC.OCMode = TIM_OCMODE_TIMING;
  sConfigOC.Pulse = 30000;
  sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
  sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
  HAL_TIM_OC_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2);
  HAL_TIM_Base_Start_IT(&htim2);

  HAL_TIM_OC_Start_IT(&htim2,TIM_CHANNEL_1 );
  //HAL_TIM_OC_Start_IT(&htim2,TIM_CHANNEL_2 );
}

/** Configure pins as
        * Analog
        * Input
        * Output
        * EVENT_OUT
        * EXTI
     PC9   ------> I2S_CKIN
*/
void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct;

  /* GPIO Ports Clock Enable */
  __GPIOF_CLK_ENABLE();
  __GPIOC_CLK_ENABLE();
  __GPIOE_CLK_ENABLE();

  /*Configure GPIO pin : PC9 */
  GPIO_InitStruct.Pin = GPIO_PIN_9;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
  GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

 /*
  * Configure GPIO pin : PE8 BLUE LED
  */

  GPIO_InitStruct.Pin=GPIO_PIN_8;
  GPIO_InitStruct.Mode=GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull=GPIO_NOPULL;
  GPIO_InitStruct.Speed=GPIO_SPEED_HIGH;
  HAL_GPIO_Init(GPIOE,&GPIO_InitStruct);

  GPIO_InitStruct.Pin=GPIO_PIN_12;
  GPIO_InitStruct.Mode=GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull=GPIO_NOPULL;
  GPIO_InitStruct.Speed=GPIO_SPEED_HIGH;
  HAL_GPIO_Init(GPIOE,&GPIO_InitStruct);

/*
 * COnfigure GPIO pin : PE11 GREEN LED
 */

  GPIO_InitStruct.Pin=GPIO_PIN_11;
  GPIO_InitStruct.Mode=GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull=GPIO_NOPULL;
  GPIO_InitStruct.Speed=GPIO_SPEED_HIGH;
  HAL_GPIO_Init(GPIOE,&GPIO_InitStruct);
}
</code>```

low level implementation:

```<code>void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
{
  if(htim_base->Instance==TIM2)
  {
    /* Peripheral clock enable */
    __TIM2_CLK_ENABLE();
    /* Peripheral interrupt init*/
    HAL_NVIC_SetPriority(TIM2_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(TIM2_IRQn);

  }

}

void TIM2_IRQHandler(void)
{

  /* USER CODE BEGIN TIM2_IRQn 0 */
  HAL_GPIO_WritePin(GPIOE,GPIO_PIN_8,GPIO_PIN_SET);

  // HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_12);
  HAL_TIM_IRQHandler(&htim2); //THis function is implemented by StmCubeMX , WHAT IS THIS?
}
</code>```

So how should my TIM2_IRQHandler look like? Each channel generate delay in +1 sec. When I am debugging this program, when LED is set the period is equal to 1s (time for set LED).

答:
(This really should be a comment, but I don't have enough reputation to comment, my apologies)

I'm not very familiar with this "HAL" version of ST's library, but how I normally do timers with STM32 is the following:

```<code>void TIM2_IRQHandler()
{
     if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)
     {
          TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);

          // TODO: Your code
     }
}
</code>```

Hopefully that translates to your environment.  In terms of your error, you'll need to be more descriptive about what the error is for us to help you.

Title: STM32_OC_Timing and IRQHandler

Body:
(This really should be a comment, but I don't have enough reputation to comment, my apologies)

I'm not very familiar with this "HAL" version of ST's library, but how I normally do timers with STM32 is the following:

void TIM2_IRQHandler()
{
     if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)
     {
          TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);

          // TODO: Your code
     }
}

Hopefully that translates to your environment.  In terms of your error, you'll need to be more descriptive about what the error is for us to help you.


答: I am not sure if this is what is confusing you, but it is definitely something to be aware of when looking at DH parameters from different sources.  You shoudl read this paper: "Lipkin 2005: A Note on Denavit-Hartenberg Notation in Robotics".  It explains the 3 main DH parameter conventions and how they differ.  Different people use different conventions.  It makes the parameters and transformation matrices slightly different.  But as long as you stick to one convention, it all works out.  The paper is also a good background reading on DH parameters.

ContentLicense: CC BY-SA 4.0


问:
IMU rotate about one axis, other two angles change too
I am trying to use Invensense's MPU9250. I am using provided library to read euler angle. When the IMU rotates about one axis, angles about other two axes change too. What could be potential cause to it? </p>

答:
Your chip is a MicroElectronicalMechanicalSystem (short MEMS) based Inertial Measurement Unit. These chips itself are analog devices which measure your desired values. For example the gyroscope uses in most cases a moving mass which is inflenced by the coriolisforce of the rotating system. This force leads to a displacement of the mass. This displacement leads to changed capacity in a capacitor, which can be measured.

If you look at the manufacturing of a semiconductor device you will see that you have tons of different tolerances. If you group up all these different tolerances to specific worst cases you can name these groups "corners". It's more or less so:
 you got a transistor with characteristic numbers A, B and C there tolerances +/-a, +/-b and +/-c. e.g. A is set to A-a, B+b and C-0.2*c the transistor switchtime will be the fastest of all possible tolerance combinations. Then you call this the fast corner.

You have all these different corners/tolerances and at the end you do not know how your device is placed within all these tolerances.

Some tolerances have an influence on the physical structure. All the complex internal devices won't be alligned to each other prefectly orthogonal. Furthermore the internal chip has be placed into a package which is far away from perfect. It is within a specific tolerance. All these lead to a non perfect chip.

In addition an industrial grade IMU start at 2000\$ and end at several million \$ for military-naval navigation /spacehips.
These high quality IMUs do use MEMS (the 2k\$ industrial ones) but they have complex software compensation algorithms to get rid of the non-perfect chip.


问:
Single Touch Based Sensor and Odometry SLAM in Noisy Rectilinear Environment
A Co-worker said he remembered a 2011(ish) ICRA (ish)  paper which used just a touch/bump sensor and odometry to do SLAM. I can't find it - I've paged thru the ICRA and IROS agendas and paper abstracts for 2010-2012, no joy. I found a couple of  interesting papers but my coworker says these aren't the ones he remembered.

Foxe 2012 http://staffwww.dcs.shef.ac.uk/people/C.Fox/fox_icra12.pdf
Tribelhorn a & Dodds 2007:  http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.507.5398&rep=rep1&type=pdf

Background - I'm trying to make a Lego Mindstorms bot navigate and map our house. I also have a IR sensor, but my experience with these is that they are really noisy, and at best can be considered an extended touch sensor.

Regards,
 Winton

答: This reminds me of a paper (or perhaps thesis) I read way back in 2006 or 2007, where the author created equivalence classes for robot sensors.  For example a robot with wheel encoders and a bump sensor is theoretically equivalent to a robot with no encoders and only a planar laser range finder.  I forget the rest, but this kind of notion has stuck with me.  Keep in mind this was all for theoretical robots with perfect sensing.  But interesting to think about none the less.</p>


问:
KUKA Robotics API IDE
I've got Robotics API library, a demo program and a robot. I want to develop an app for it. The best solution is offline development on some kind of simulator. I'm completely new in such tasks - is there any IDE for this? Or a way do deliver byte-code to machine? Thanks in advance!</p>

答:
In school (about 8 years ago) I did some work with a Kuka KR 5 sixx robot arm.  I remember there being 2 different APIs.  One was pretty high-level and you could specify joint configurations, waypoints, etc. through XML over TCP at some slow rate (maybe 10 Hz).  They also provided a more powerful low-level interface, but I forget the specifics of that.  I don't remember Kuka allowing you to put code on their control box.  Both of these interfaces were over Ethernet.

I don't think there is any sort of IDE, the way VisualStudio or Arduino have IDEs.  However, I do know that Kuka does have some fancy work-cell simulation and analysis software.  This kind of thing is for laying out large industrial floor plans and optimizing efficiency.

Remember that by far most of the Kuka robots in existence are "programmed" using the control pendant.  People writing "real" code to move the robot is not their normal use-case.

But if Kuka gave you the API, shouldn't you know about this kind of stuff?  Or at least have a contact at Kuka.  Why are you asking us here?

Title: KUKA Robotics API IDE


问:
Can ESC be programmed to run full throttle only on one side of a quadcopter?
Can ESC in quads be programmed in such a way that only one side has throttle and no throttle at all on the other? This would cause the quad to flip I suppose?

With that, is there a way we can program the controller to like trigger a switch when we want the quad to flip? Because I was thinking of doing a waterproof quad. So initially, it flies in the air normally with the 4 channel, and then I set it to float on water. After that, I was thinking of maybe triggering a switch on the controller so that this time it's just going to flip and nothing else. After it flips, I would trigger the switch back to normal operation. Is that possible?

答:
Yes, you can do this, but you don't need a switch to do so; just command the quad copter to fly inverted. That video demos variable pitch rotors specifically, but those aren't required for inverted flight. You can buy off the shelf units capable of flying upside down for relatively cheap and modify as you see fit.

Alternatively, if you're just looking to be able to fly in the air or float, you can just build the quad copter with the motors pointing down to begin with.


问:
POMDPs in robotics
POMDPs are used when we cannot observe all the states.
However, I cannot figure out when these POMDPs can be useful in robotics. What is a good example of the use of POMDPs? (I have read one paper where they used them, but I didn't find it obvious why pomdps should be used) What would be good projects ideas based on POMDPs?</p>

答:
Partially Observable MDPs actually are very interesting to robotics, and especially for the partially observable part. Sensor signals (laser, sonar, vision, ..) are noisy, some more then others depending on several variables. We cannot trust the sensor signal completely, but we can use them to estimate the real state. The POMDP can thus be used in robotics to do planning with noisy observations. A list of applications is shown by Cassandra [1], a more general overview of planning with uncertainty in robotics is given by Thrun et al. [2], and of course there are lots of examples on the web. The big problem of POMDPs is that finding their optimal solution is intractable (i.e it easily takes too long to compute), but there are several methods which approximate the optimal solution.

[1] Cassandra, A. R. (1997). A Survey of POMDP Applications. In Uncertainty in Artificial Intelligence (pp. 472–480). Retrieved from http://www.cassandra.org/pomdp/papers/applications.pdf.

[2] Thrun, S., Burgard, W., & Fox, D. (2005). Probabilistic Robotics (Intelligent Robotics and Autonomous Agents. The MIT Press.

Title: POMDPs in robotics


答:
The drotek website refers to the github link, and in the github page, there's a disclaimer that the code is mostly broken.

From what I understand from the specs, the rates are user selectable (up to 2000 d/s), and I would expect to see some small changes in the other angles (roll and pitch) if you are rotating by hand around the z-axis, and not translating.

Small changes would be acceptable I guess.

Note: this post was a comment at first, but it was recommended to be changed into an answer, and I did.

Title: IMU rotate about one axis, other two angles change too

Body: I am trying to use Invensense's MPU9250. I am using provided library to read euler angle. When the IMU rotates about one axis, angles about other two axes change too. What could be potential cause to it? </p>


问:
Understanding the various attitude estimation methods
I am building a quadcopter using the Arduino Uno with a 6dof accelerometer and gyro. I will be adding a separate 3 axis magnetometer soon for heading. I have successfully implemented the code that reads the data coming in from these sensors and prints them out.

I have also checked for bias by averaging 100 measurements. My code calculates the pitch from the accel and pitch from the gyro respectively:

pitchAccel = atan2((accelResult[1] - biasAccelY) / 256, (accelResult[2] - biasAccelZ) / 256)*180.0 / (PI);

pitchGyro +=((gyroResult[0] - biasGyroX) / 14.375)*dt;

I am then using a complementary filter to fuse the two readings together like this:

pitchComp = (0.98*pitchGyro) + (pitchAccel*0.02);

I am stuck on how to proceed from here. I am using the same procedure for roll, so I now have readings for pitch and roll from their respective complementary filter outputs.

I have read a lot of articles on the DCM algorithm which relates the angles from the body reference frame to the earth reference frame. Should that be my next step here? Taking the pitch and roll readings in the body reference frame and transforming them to the earth reference frame? Repeat the entire procedure for yaw using the magnetometer? If yes, how should I go about doing the transformations?

I understand the math behind it, but I am having a hard time understanding the actual implementation of the DCM algorithm code-wise.

Any help is appreciated!

答:
First the answer to the main question. The readings are the pitch and roll of your sensor, at the inertial frame. As your sensor is certainly not moving in your aircraft in time, you do not have to re-convert into any other frames. The readings are the aircraft pitch-roll-yaw data.

Coming to the Pitch computation from accelerations. I don't know if this method works for aircraft that can rapidly move. In a reference of a similar application , it is explained that the accelerometer is assumed NOT TO BE UNDER LINEAR ACCELERATION. The aircraft might experience some turbulence, without pitching, and the pitch_accel calculation would calculate some pitch, which would not be real. Another short note is to use the atan2 function, to arrive at realistic angles of pitch and roll.


问:
How to efficiently do 3D mapping of an area on a MAV?
I have been researching on a cost-effective way to scan an area on a MAV (exploraton) and later use it for CAD/civil purposes(use the point cloud data for CAD) but the major sensors available have their own problems.

kinect - can't use outside,high computation power

stereo - high computation power,somewhat expensive

lidar - very expensive + not real time + heavy

I need a system(on the MAV/quadrotor) that can work over wifi/wireless, can scan outdoors , not very expensive and that gives data real-time.Please suggest a system that can be as close to the above requirements.

Also can stereo be operated over wifi?

答:
In your case I would suggest using the stereo version because:

- You already said Kinect is technically not a possible solution because of the sun's IR light

- A reasonable good lidar sensors costs a fortune even for a 2D version

- Stereo vision is not expensive. You get 2 webcams for 100$, which is even less then a Kinect.

The major problem with the stereo is the computational requirement which is almost impossible to achieve on the UAV. I suggest sending the videostreams to an external computer and analyze the data (and send it back if necessary at all). wifi is able to handle this datarates easily, especially the 5GHz version (802.11n). You might even think about compresing the data with h264 codec, which can be accelerated by specifc chips.

I guess your plan is using it for a SLAM application. This is possible, but you have to keep in mind that the wifi connection is not reliable at all. Maybe a nearby weather radar station is interfering your connection and UAV gets no data update anymore until the connection is reastablished. Anyway a good UAV-software will be able to handle the wifi disconnects.

So relying on this might not the best solution. alternativly you can stack all your computational power directly onto the UAV, like I do it for my research project. Therefore you need a decent UAV which is able to carry a complete motherboard with modern CPU and maybe a GPU; the GPU is a sake for stereovision.

At the end (if SLAM is your final goal) you can look at other options like MonoSLAM.

Note: This answer does not say you should do this. I got way too less information about your project to give a high quality answer. This is more a collection of thoughts/ideas to your problem, which should help to find a feasable solution.


问:
Problem with acceleration sensor
I’m using the BMA020 (from ELV) with my Arduino Mega2560 and trying to read acceleration values that doesn’t confuse me.
First I connected the sensor in SPI-4 mode. Means

CSB <-> PB0 (SS)

SCK <-> PB1 (SCK)

SDI <-> PB2 (MOSI)

SDO <-> PB3 (MISO)

Also GND and UIN are connected with the GND and 5V Pins of the Arduino board.

Here is the self-written code I use

```<code>#include <avr/io.h>
#include <util/delay.h>

#define sensor1     0
typedef int int10_t;

int TBM(uint8_t high, uint8_t low)
{
    int buffer = 0;
    if(high & (1<<7)) {
        uint8_t high_new = (high & 0x7F);
        buffer = (high_new<<2) | (low>>6);
        buffer = buffer - 512;
    }
    else
        buffer = (high<<2) | (low>>6);

    return buffer;
}

void InitSPI(void);
void AccSensConfig(void);
void WriteByteSPI(uint8_t addr, uint8_t Data, int sensor_select);
uint8_t ReadByteSPI(int8_t addr, int sensor_select);
void Read_all_acceleration(int10_t  *acc_x, int10_t *acc_y, int10_t *acc_z, int sensor_select);

int main(void)
{
    int10_t S1_x_acc = 0, S1_y_acc = 0, S1_z_acc = 0;
    InitSPI();
    AccSensConfig();
    while(1) {
        Read_all_acceleration(&S1_x_acc, &S1_y_acc, &S1_z_acc, sensor1);
    }
}

void InitSPI(void) {

    DDRB |= (1<<DDB2)|(1<<DDB1)|(1<<DDB0);

    PORTB |= (1<<PB0);

    SPCR |= (1<<SPE);
    SPCR |= (1<<MSTR);
    SPCR |= (0<<SPR0) | (1<<SPR1);
    SPCR |= (1<<CPOL) | (1<<CPHA);
}

void AccSensConfig(void) {

    WriteByteSPI(0x0A, 0x02, sensor1);
    _delay_ms(100);

    WriteByteSPI(0x15,0x80,sensor1);    //nur SPI4 einstellen
}

void WriteByteSPI(uint8_t addr, uint8_t Data, int sensor_select) {

    PORTB &= ~(1<<sensor_select);
    SPDR = addr;
    while(!(SPSR & (1<<SPIF)));

    SPDR = Data;
    while(!(SPSR & (1<<SPIF)));

    PORTB |= (1<<sensor_select);
}

uint8_t ReadByteSPI(int8_t addr, int sensor_select)
{
    int8_t dummy = 0xAA;

    PORTB &= ~(1<<sensor_select);

    SPDR = addr;
    while(!(SPSR & (1<<SPIF)));
    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));

    PORTB |= (1<<sensor_select);

    addr=SPDR;
    return addr;
}

void Read_all_acceleration(int10_t  *acc_x, int10_t *acc_y, int10_t *acc_z, int sensor_select)
{
    uint8_t addr = 0x82;
    uint8_t dummy = 0xAA;
    uint8_t high = 0;
    uint8_t low = 0;

    PORTB &= ~(1<<sensor_select);

    SPDR = addr;
    while(!(SPSR & (1<<SPIF)));

    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    low = SPDR;
    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    high = SPDR;
    *acc_x = TBM(high, low);

    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    low = SPDR;
    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    high = SPDR;
    *acc_y = TBM(high, low);

    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    low = SPDR;
    SPDR = dummy;
    while(!(SPSR & (1<<SPIF)));
    high = SPDR;
    *acc_z = TBM(high, low);

    PORTB |= (1<<sensor_select);
}
</code>```

And now here is what really confuses me. I got 5 of this sensors. One is working with this code perfectly fine. The Data I get is what I expect. I measure earth gravity in z-component if Iay the sensor on the table, if I start turning it I measure the earth gravity component wise in x-, y- and z- direction depending on the angle I turn the sensor.

From the other 4 sensors I receive data that is different. The values jump from -314 (about -1.2 g) to +160 (about 0.5g). With the same code, the same wires and the same Arduino.

I checked the register settings of all sensors, they are all the same. I checked the wire connection to the first component at the sensors, they are all around 0.3 Ohm. I used an Oscilloscope and made sure CSB, SCK and MOSI work properly.

Am I missing something? What causes this similar but wrong behavior of 4 out of 5 sensors?

答:
Earlier answer, regarding the self-test

Section 3.3.2 describes how to do the self test, section 3.4.1 describes how to read the result.

There is a note about not overwriting bits 5, 6, and 7 of register 14h at the start of chapter 3, so read that and then check that you have scaling set correctly (bits 0 and 1 of register 14h).

As the chips that are suspect all also fail the self test and voltages on the board are normal, I would blame physical damage (were dropped/thrown during shipping, etc) and ask for an RMA for the parts.

A caution

While the board linked in the question accepts an input voltage of up to 6V, the board features a regulator and level shifters. The chip itself operates at a much lower voltage.

Title: Problem with acceleration sensor


问:
Using 2x UARTs on STM32F072RB
I am trying to use 2x UARTs with ChibiOS on the STM32F072RB Nucleo Board.

I initialized UART2 but I am still getting output on UART1 pins, which is totally weird.

```<code>#include "ch.h"
#include "hal.h"

/*
 * UART driver configuration structure.
 */
static UARTConfig uart_cfg_1 = {
    NULL,   //txend1,
    NULL,   //txend2,
    NULL,   //rxend,
    NULL,   //rxchar,
    NULL,   //rxerr,
    800000,
    0,
    0,      //USART_CR2_LINEN,
    0
};

static UARTConfig uart_cfg_2 = {
    NULL,   //txend1,
    NULL,   //txend2,
    NULL,   //rxend,
    NULL,   //rxchar,
    NULL,   //rxerr,
    800000,
    0,
    0,
    0
};

/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device      drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the serial driver 1, PA9 and PA10 are routed to USART1.
   */
  //uartStart(&UARTD1, &uart_cfg_1);
  uartStart(&UARTD2, &uart_cfg_2);

  palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(1));  // USART1 TX.
  palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(1)); // USART1 RX.
  palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(1));  // USART2 TX.
  palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(1));  // USART2 RX.

  /*
   * Starts the transmission, it will be handled entirely in background.
   */
  //uartStartSend(&UARTD1, 13, "Starting...\r\n");
  uartStartSend(&UARTD2, 13, "Starting...\r\n");

  /*
   * Normal main() thread activity, in this demo it does nothing.
   */
  while (true) {
    chThdSleepMilliseconds(500);
    uartStartSend(&UARTD2, 7, "Soom!\r\n");
    //uartStartSend(&UARTD1, 7, "Boom!\r\n");
  }
}
</code>```

The line uartStartSend(&UARTD2, 7, "Soom!\r\n"); gives output on UART1.

Is there anything else I need to do?

mcuconfig.h reads

```<code>#define STM32_UART_USE_USART1               TRUE
#define STM32_UART_USE_USART2               TRUE
#define STM32_UART_USART1_IRQ_PRIORITY      3
#define STM32_UART_USART2_IRQ_PRIORITY      3
#define STM32_UART_USART1_DMA_PRIORITY      0
#define STM32_UART_USART2_DMA_PRIORITY      0
</code>```

答:
Perhaps try UART3? UART2 might be in use for something else as the manual says,

"By default the USART2 communication between the target MCU and ST-LINK MCU is enabled..." on page 23, section 5.8.

Manual for reference

Title: Using 2x UARTs on STM32F072RB