问:
Industrial Robotic Arm
I had the opportunity to work for a factory/company that is in the domain space of production and they want to use a robotic arm for part of the production line.

They want basically a robotic arm with payload of about 2 Kgs or more and an arm length of more than 1600mm

I have researched a few companies like Kuka.com but I am not sure what I should be looking for when making suggestions and researching for it.

Are there any suggestions you can give me on few good points to be careful about with robotics arms? Any innovating companies out there I should consider? How is an installation done and if I should find a supplier for it etc. Please enlighten me.

答:
Based on your requirements, I would recommend the UR5 (0.85m range, 5kg payload) or UR10 (1.3 m range, 10kg payload) from Universal Robotics. Have a friend who has used it for work, and it performs well. It may be overkill on the payload, but it is the only one I would recommend!

Would use ROS industrial to drive it.

Title: Industrial Robotic Arm


问:
Does it matter if my electronic speed controllers are close to my brushless motors?
I have built several quadcopters, hexacopters, and octacopters. Between the flight controller (I use 3DR APM2.6 or Pixhawk) and the motors I use heavy duty power wires as well as a servo-style cable carrying a PWM control signal for the ESC. Three short heavy-duty wires then connect the motor to the ESC, one for each phase.

Several times I've heard or read people saying that the electronic speed controllers (ESCs) should be mounted far away from the flight controller (FMU seems to be the abbreviation en vogue) and close to the motors. I think the idea is that this cuts down on interference (I'm not sure what sort) that could be emitted by the long ESC -> motor wires that would be required if you have the ESCs all at the center of the aircraft. Another consideration is that ESCs can be cooled by propellers if they are right under the rotor wash, as mine usually are.

So, I've always mounted ESCs close to motors, but realized that design could be much simpler if ESCs are mounted centrally. So, my question is: what are the pros and cons of mounting ESCs close to the motor versus close to the FMU?

答:
First, you can look at Mikrokopter as an example of quad with centrally mounted ESCs.

As for the various engineering reasons for ESC location, here is some rationale behind the two you mentioned

1) Interference/noise. Non-steady state current running through wire can induce current to flow in nearby conductors. Practically speaking, this means that if you have power lines wires next to signal wires, the changing current in the power wires will create noise on the signal wires.

However, this effect degrades with both distance and non-parallelism of the wires (ideal perpendicular wires don't have this coupling effect). So as long as you don't run signal wires right next to your power wires, you should be fine.

2) Cooling. ESCs contain power electronics that need to be cooled. Certainly having them under the forced air coming from the spinning rotors helps but at the theoretical cost of reduced aerodynamic efficiency. If you can keep your ESCs cool enough elsewhere , then no problems.

ContentLicense: CC BY-SA 4.0

ContentLicense: CC BY-SA 3.0


答:
2 kgs is not very much, so i would probably consider arms that are slightly less industrial than Kuka, ABB, Fanuc, Denso and the like.  However, 1.6m is pretty long and that may be hard to find in non-industrial arms.

Keep in mind there are many other factors to consider when choosing a robot arm.  human safety, accuracy, repeat-accuracy, speed, workspace envelope.

for example, for relatively planar tasks, low payload, and very fast speeds, a delta configuration robot is best.  Larger payloads, maybe a SCARA configuration is better.  super large workspace, and planar tasks, perhaps a gantry is best.  the point being, there is more than typical robot arms with spherical workspaces.

some of the arms listed below just won't survive the number of cycles industrial arms are typically driven to.  the arms listed below are slightly more human safe than standard industrial arms,  but probably less accurate.

all that being said, here are some more arms to consider:

As Pikey mentioned, Universal Robotics (http://www.universal-robots.com/) has some arms that might work.

You should also consider the WAM arm from Barrett (http://www.barrett.com/robot/products-arm.htm).  It has been around a long time, and has a longer reach than many other arms.

A lighter duty arm which is very human safe is the Kinova arm: http://kinovarobotics.com/

Another that i have seen, but never touched is the Schunk arm: (http://mobile.schunk-microsite.com/en/produkte/produkte/dextrous-lightweight-arm-lwa-4d.html)

The HDT Arm might be overkill: (http://www.hdtglobal.com/products/robotics/Adroit_Manipulator_Arm/)

and of course Baxter for very light industrial use: http://www.rethinkrobotics.com/products/baxter/

Title: Industrial Robotic Arm

Body:
I had the opportunity to work for a factory/company that is in the domain space of production and they want to use a robotic arm for part of the production line.

They want basically a robotic arm with payload of about 2 Kgs or more and an arm length of more than 1600mm

I have researched a few companies like Kuka.com but I am not sure what I should be looking for when making suggestions and researching for it.

Are there any suggestions you can give me on few good points to be careful about with robotics arms? Any innovating companies out there I should consider? How is an installation done and if I should find a supplier for it etc. Please enlighten me.


问:
Programming language?
In general, what is a good programming language for robotics? I am a starting robo nerd and don't know anyone who would know things like this.</p>

答:
The short answer is, frustratingly, "it depends".

Nearly every established language can be used to program one robot platform or another. In my short career as a roboticist I have already used Python, Java and C++ to program different robots. There are even tools to program the Lego NXT in Ada, would you believe that? So whatever programming language you already know, there's a good chance you can use just that: Google robot <language name> and see what turns up.

That said, if you have no previous programming language knowledge, C and C++ are probably the safest bets out there. Most robotics platforms support either one of them (or can be coaxed into support without too much effort), and there are plenty of useful packages available. As a bonus, C / C++ were highly influential to languages that came after them, so it would give you a head start on many a language you might want to learn later.

Title: Programming language?


问:
What UAV kit(s) would be suitable for a beginner roboticist with programming experience?
I'm really new to robotics, however I am a programmer familiar with several different languages. I don't have a ton of money to spend and I was wondering what is a really good starter kit.

My criteria is for the kit to be inexpensive and powerful, in that its functionality is extensible -- something that would allow the builder to be creative and possibly invent new ways to use it, not just a glorified model kit.

Being extendable to smartphones is a plus.

I'm not looking for something easy or introductory, just something powerful, flexible, and cost effective.

答:
Personally I feel that Parallax has a good set of offerings in this area.

For wheeled/ground prototyping, I would choose a Madeusa ($880) chassis.  This is a very good starting chassis that can carry a decent payload and is very extensible.  I've seen security guard robot prototypes and autonomous camera man robots made on top of this platform that were very impressive.  Madeusa is basically the same chassis as the Parallax Eddie but without the Propeller and PC/Kinect parts.  By removing these parts, you can substitute back in your own control system such as an Arduino based solution.

The ELEV-8 ($600) chassis is a good flying platform.  I haven't tried this one myself but it has good reviews as hitting a sweet spot of cost, performance, complexity, and capability.

In all cases I'd suggest learning Arduino as your microcontroller platform for sensor and actuator integration.  Great community, low costs, high capabilities.


问:
Neuromorphic Engineering and Robotics
I have been into a boggling paper research on neuromorphic engineering and its implications on robotics applications, lately. It is relatively a less applied field and full of academic papers and difficult to skim easily :)

There are many ongoing projects applying analog or digital circuitry design to implement neurosynaptic simulations of the brain. Consumer oriented products like IBM Synapse and Qualcomm's Zeroth focus on digital hardware whereas academic research like Standford's neurogrid or ETC Zurich's Human Brain Project focus more on actual brain study using analog hardware.

If anybody is following this engineering field, can he/she spread more light on it and explain it's implications, methodologies and toolsets to the community, in detail?

PS : Regarding toolsets, I'm talking about the most feasible engineering methodologies to commit to the field.

答: Regarding methodologies and tools, I recommend Chris Eliasmith's How to Build a Brain. It presents the Semantic Pointer Architecture (SPA), a cognitive model that has been realized in the open source Nengo toolkit. I have read the book's introduction and some of Eliasmith's papers, and so far the approach looks very promising.</p>

Title: Neuromorphic Engineering and Robotics


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

答:
1) I would try find out how fast your ESCs can update and use that as the PID update rate. Your current rate is definitely too slow (need at least 50Hz for marginal performance).

2) Putting a threshold on the maximum change should only be used to handle emergency/unexpected situations. You should NOT expect it to be part of the normal operation, and if you are see spikes during normal operation it means you need to fix something somewhere else or lower gains.

3) Tune the PIDs wherever you need best performance, which depends on your application. One strategy is to use different sets of gain values for different situations (e.g. separate takeoff gains) but each set of gains needs to be tuned separately so it adds more work.


问:
Preventing leaks in motor shafts for underwater bots
Whenever building an aquatic bot, we always have to take care to prevent leakages, for obvious reasons. Now, holes for wires can be made watertight easily--but what about motors? We can easily seal the casing in place (and fill in any holes in the casing), but the part where the axle meets the casing is still left unprotected.

Water leaking into the motor is still quite bad. I doubt there's any way to seal up this area properly, since any solid seal will not let the axle move, and any liquid seal (or something like grease) will rub off eventually.

I was thinking of putting a second casing around the motor, maybe with a custom rubber orifice for the shaft. Something like (forgive the bad drawing, not used to GIMP):

This would probably stop leakage, but would reduce the torque/rpm significantly via friction.

So, how does one prevent water from leaking into a motor without significantly affecting the motor's performance?

(To clarify, I don't want to buy a special underwater motor, I'd prefer a way to make my own motors watertight)

答:
Take it for what it's worth, I was next to the OpenROV booth at Maker Faire and their answer was 'let it leak and dry it off later'.  They said they were surprised that water getting into the motor didn't cause issues for them.

'course I haven't tried this myself and I may have misheard them -- or perhaps nothing had failed for them yet :-)

It may be worthwhile though to start with cheap motors and see if your experience matches theirs...


问:
Alternative way to perform Pole zero cancellation?
I've read a lot places that making a controller which cancels the unwanted pole or zero is not good designing practice for designing a controller..

It should make the system uncontrollable which off course isn't wanted.

But what alternatives do i have.. ??

considering i have a system in which all poles and zeros lies on RHP.

答:
Pole/zero cancellation is discouraged primarily because in practice it is almost impossible to do perfectly. Real systems have variation and uncertainty so you can't know for sure where the poles/zeros are at. So if you try to cancel them out, but they aren't where you thought they were, you have a potentially unstable pole still active.

Feedback controllers stabilize unstable plants (such as yours) by adding and modifying system dynamics such that all poles move to the LHP. (in this case, we're talking about the entire system instead of just the unstable plant being controlled) If you've heard of root locus plots, they show where the system poles move as a function of the controller gain.

--- Edit ----
(add example)

Assume your plant has transfer function $P(s)$ and your controller has transfer function $G(s)$. Using this interconnection

```<code>r -->(+/-)-->[G(s)]-->[P(s)] ----> x
       ^                       |
       |                       |
       |<-----------------------
</code>```

you have
$$
\begin{align}
X = G P (R-X)
\\
(1+G P)X = G P R
\\
\frac{X}{R} = \frac{GP}{1+GP}
\end{align}
$$
where everything is in the Laplace domain but I've dropped the $(s)$ for simplicity. For stability, we are now only concerned with the points where $1+G(s) P(s)=0$. Note that we have not made any assumptions about the specifics of $P(s)$ yet, so the results work for all plants.

Now take a plant such as $P(s) = s-1$ and assume a second order controller. We have
$$
\begin{align}
1+G(s) P(s) &= 1+G (s-1)
\\
&= 1+(as^2+bs+c)(s-1)
\\
&= as^3 + (b-a) s^2 + (c-b) s + (1-c)
\end{align}
$$
Now you just need to choose $a, b, c$ to give negative roots. For example $a=0.1, b=0.3, c=0.8$ gives roots of $-0.467, -0.767 \pm 1.92$.

As plants become more and more complex, this process gets pretty difficult and you need to either have lots of experience to understand how to shape the locus (which I don't) or use other controller design techniques. One common approach is converting to state-space models and using things like linear quadratic regulators (LQR) to design the feedback controller.

Body:
Pole/zero cancellation is discouraged primarily because in practice it is almost impossible to do perfectly. Real systems have variation and uncertainty so you can't know for sure where the poles/zeros are at. So if you try to cancel them out, but they aren't where you thought they were, you have a potentially unstable pole still active.

Feedback controllers stabilize unstable plants (such as yours) by adding and modifying system dynamics such that all poles move to the LHP. (in this case, we're talking about the entire system instead of just the unstable plant being controlled) If you've heard of root locus plots, they show where the system poles move as a function of the controller gain.

--- Edit ----
(add example)

Assume your plant has transfer function $P(s)$ and your controller has transfer function $G(s)$. Using this interconnection

r -->(+/-)-->[G(s)]-->[P(s)] ----> x
       ^                       |
       |                       |
       |<-----------------------

you have
$$
\begin{align}
X = G P (R-X)
\\
(1+G P)X = G P R
\\
\frac{X}{R} = \frac{GP}{1+GP}
\end{align}
$$
where everything is in the Laplace domain but I've dropped the $(s)$ for simplicity. For stability, we are now only concerned with the points where $1+G(s) P(s)=0$. Note that we have not made any assumptions about the specifics of $P(s)$ yet, so the results work for all plants.

Now take a plant such as $P(s) = s-1$ and assume a second order controller. We have
$$
\begin{align}
1+G(s) P(s) &= 1+G (s-1)
\\
&= 1+(as^2+bs+c)(s-1)
\\
&= as^3 + (b-a) s^2 + (c-b) s + (1-c)
\end{align}
$$
Now you just need to choose $a, b, c$ to give negative roots. For example $a=0.1, b=0.3, c=0.8$ gives roots of $-0.467, -0.767 \pm 1.92$.

As plants become more and more complex, this process gets pretty difficult and you need to either have lots of experience to understand how to shape the locus (which I don't) or use other controller design techniques. One common approach is converting to state-space models and using things like linear quadratic regulators (LQR) to design the feedback controller.


问:
Fake localization using bag file in ROS
I have a bag file that contains couple of topics needed for localization, odometry data, kinect data and /tf. What I want is watching robot's movement path in rviz after initializing robot position (even I don't know how to initial it). Any help?

All topics:

```<code>/scan
/tf
/clock
/map
/odom
</code>```

答:
Before you run rviz, you need to set use_sim_time to true:

```<code>rosparam set use_sim_time true
</code>```

Now start up rviz, then run rosbag using --clock:

```<code>rosbag play bagfile_name.bag --clock
</code>```

For setting up rviz with the navigation stack, you will want to follow this tutiorial.

Title: Fake localization using bag file in ROS

Body:
Before you run rviz, you need to set use_sim_time to true:

rosparam set use_sim_time true

Now start up rviz, then run rosbag using --clock:

rosbag play bagfile_name.bag --clock

For setting up rviz with the navigation stack, you will want to follow this tutiorial.


问:
jacobian of Abb irb140 robot
Can someone please help me with the jacobian matrix equations for Abb irb140 robot. Or an easy way by which I can derive it given the DH parameters. I need it to implement some form of control that am working on. Thanks</p>

答:
Not exaclty sure how to easily/automatically derive it from DH parmameters. Is using DH actually necessery for your project? What are the advantages of using the Denavit-Hartenberg representation?

Do you have a CAD model for the robot?

If you are using Solidworks, you could generate a URDF (Unified Robot Description Format) model based on the CAD model using sw_urdf_exporter. Then use the tool pykdl_utils to automatically fill the FK and jacobian requests with the current joint angles.

Title: jacobian of Abb irb140 robot


答:
Similar to Pikey's answer, OpenRAVE lets you input the kinematics of your arm in an XML format (different than URDF), and will give you the Jacobian, FK, IK, motion planning, etc for your arm.

If you want to do it the traditional way, many standard robotics textbooks outline how to go from DH parameters to the geometrical Jacobian.  I like this book: "Robotics: Modelling, Planning and Control" by Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani, Giuseppe Oriolo.  For all but the simplest of arms, you will want to use a symbolic algebra package to help with this...

Title: jacobian of Abb irb140 robot

Body: Can someone please help me with the jacobian matrix equations for Abb irb140 robot. Or an easy way by which I can derive it given the DH parameters. I need it to implement some form of control that am working on. Thanks</p>


问:
Forward Kinematics Two fixed standard wheels

What would the equations be for the robot's angular and linear velocity at P and also P2? I think I'm doing it wrong...

WL = left wheels angular velocity
WR = right wheels angular velocity

For P I had for example the linear velocity = (1/3)rWL + (2/3)2rWR

Am I on right track?

答:
The linear velocity $v$ of a differential drive robot is the average of the velocities of its wheels [^]. In mathematical terms:

$$
v = \frac{v_L + v_R}{2}
$$

Where $v_L$ and $v_R$ are respectively the linear velocity of the left and right wheels. These are functions of their angular velocities and radii, such that:

$$
v_L = r_L \omega_L
$$

$$
v_R = r_R \omega_R
$$

Where $r_L$ and $r_R$ are respectively the radii (not the diameters!) of the left and right wheels, and $\omega_L$ and $\omega_R$ likewise the angular velocities.

The angular velocity $\omega$, on the other hand, is the average of the opposing contributions of left and right wheels: the left wheel contributes clockwise ("negative") motion, whereas the right wheel contributes counter-clockwise ("positive") motion. In mathematical terms:

$$
\omega = \frac{\phi_R - \phi_L}{2}
$$

Where the wheel contributions $\phi_L$ and $\phi_R$ are given by:

$$
\phi_L = \frac{r_L \omega_L}{l_L}
$$

$$
\phi_R = \frac{r_R \omega_R}{l_R}
$$

And $l_L$ and $l_R$ are respectively the left and right shaft lengths between the center of rotation and the left and right wheels.


问:
How to make one robot follow the other in parallel formation
This is quite a basic question. I'm practising robot programming with VRep. I have 2 K3 robots in the scene. One robot follows a predefined path. I want the second robot to move "in parallel" with the first one so they keep same orientation and same distance at all time. When there is a turn, I want the follower to slow/accelerate a little to keep the parallel.

In my implementation, I use wireless communication. The first robot will periodically "tell" the second about its speed, orientation. The second will use these parameters to calculate two speed to its two wheel. But when I run it, it doesn't work. The orientation of the follower is wrong. The distance is not maintained. I was totally confused.

I think this is quite a rudimentary task. There must be some practise to follow. Can somebody help to provide some ideas, references? That will be highly appreciated!

答:
As is often the case in robotics, there is no universally agreed-upon approach to formation control (which is what you are trying to achieve). As explained in the introduction to this article, there are roughly three basic approaches currently in use:

Behaviour-based, where each robot moves according to a set of local rules, and the formation dynamics results from the interactions between neighboring robots;

Virtual structure, where the robots are conceived to be parts of a single body (e.g. vertices of a polygon) and trajectories are calculated to conserve the shape of that abstract body;

Leader-following, where a designated "leader" robot follows a prescribed trajectory, and the "followers" track transformed versions of the leader current pose.

Given your description of the intended scenario, I'd say leader-following would be the best approach. This could be achieved fairly easily in the following manner (see this presentation for references on terminology and formulas):

Define the intended pose $p_f$ for the follower robot in the leader's reference frame – e.g. $p_f = [0 \quad 1 \quad 0]^T$ for keeping to the left, or  $p_f = [0 \quad -1 \quad 0]^T$ for keeping to the right;

Every once in a while calculate the follower's pose in the global reference frame $g_f = Tp_f$ and relay it to the follower robot;

Have the follower robot adjust its position to comply with the received pose $g_f$.

Just for reference, the Rigid Body Transformation matrix T is given by:

$$
T =
\begin{bmatrix}
cos(\theta) & -sin(\theta) & x \\
sin(\theta) & cos(\theta) & y \\
0 & 0 & 1
\end{bmatrix}
$$

Where $[x \quad y \quad \theta]^T$ is the leader robot's current pose.


问:
How to determine quality of ICP matches?
In SLAM frontends which use the Iterative Closest Point (ICP) algorithm for identifying the association between two matching point clouds, how can you determine if the algorithm is stuck in a local minimum and returns a wrong result?

The problem is defined as matching two pointclouds which are both samples of some arbitrary surface structure, and the sampled areas have an overlap of 0-100% which is unknown. I know the Trimmed ICP variant works by iteratively trying to determine the overlap, but even this one can be stuck in a local minimum.

A naive approach would be to look a the mean square error of the identified point pairs. But without some estimate of the sampling this seems a risky thresholding. In the manual for the Leica Cyclone they suggest manual inspection of the pair error histogram. If it has a Gaussian shape the fit is good. If there is a linear fall-off the match is probably bad. This seems plausible for me, but I've never seen it used in an algorithm.

答:
Most of the straightforward ICP methods use a Least-Squares type approach. It is common and easiest to model when assuming a Gaussian error model corrupts the point cloud data. In this case the least squared fitting component of the ICP algorithm produces a Gaussian error model for its solution parameters with estimated variance.

That is, if you have access to the error's after matching, then you can estimate a Gaussian error on your transform's parameters in the same way you'd estimate the error in any other linear regression.


问:
"Smooth" inverse kinematics model for 2-wheeled differential drive robot
I have been reading about kinematic models for nonholonomic mobile robots such as differential wheeled robots. The texts I've found so far all give reasonably decent solutions for the forward kinematics problem; but when it comes to inverse kinematics, they weasel out of the question by arguing that for every possible destination pose there are either infinite solutions, or in cases such as $[0 \quad 1 \quad 0]^T$ (since the robot can't move sideways) none at all. Then they advocate a method for driving the robot based on a sequence of straight forward motions alternated with in-place turns.

I find this solution hardly satisfactory. It seems inefficient and inelegant to cause the robot to do a full-stop at every turning point, when a smooth turning would be just as feasible. Also the assertion that some points are "unreachable" seems misleading; maybe there are poses a nonholonomic mobile robot can't reach by maintaining a single set of parameters for a finite time, but clearly, if we vary the parameters over time according to some procedure, and in the absence of obstacles, it should be able to reach any possible pose.

So my question is: what is the inverse kinematics model for a 2-wheeled differential drive robot with shaft half-length $l$, two wheels of equal radii $r$ with adjustable velocities $v_L \ge 0$ and $v_R \ge 0$ (i.e. no in-place turns), and given that we want to minimize the number of changes to the velocities?

答:
While there may be an inverse kinematic solution, the most likely reason that your texts are avoiding the problem is because this sort of thing falls more naturally in the domain of AI and path planning.

In the simplest case, you should look at the Dubins path.  Balancing constraints like turning radius, maximum speed, etc, is what takes you from infinite solutions to a very reasonable set of possible movements.  Given a set of poses, you can plan Dubins paths between them for whatever cost function you prefer.

Here's an example paper on the topic: A Practical Path-planning Algorithm for a Vehicle with a Constrained
Turning Radius: a Hamilton-Jacobi Approach.


答:
I would guess that the real "interference" you'd see would be magnetic interference.  Motors draw quite a bit of current, and that will affect your compass reading.

Of course, the same applies to the ESCs that feed the motors -- the supply of current from the battery to the ESCs should also be kept away from the flight controller (which presumably has a compass).

Title: Does it matter if my electronic speed controllers are close to my brushless motors?

Body:
I have built several quadcopters, hexacopters, and octacopters. Between the flight controller (I use 3DR APM2.6 or Pixhawk) and the motors I use heavy duty power wires as well as a servo-style cable carrying a PWM control signal for the ESC. Three short heavy-duty wires then connect the motor to the ESC, one for each phase.

Several times I've heard or read people saying that the electronic speed controllers (ESCs) should be mounted far away from the flight controller (FMU seems to be the abbreviation en vogue) and close to the motors. I think the idea is that this cuts down on interference (I'm not sure what sort) that could be emitted by the long ESC -> motor wires that would be required if you have the ESCs all at the center of the aircraft. Another consideration is that ESCs can be cooled by propellers if they are right under the rotor wash, as mine usually are.

So, I've always mounted ESCs close to motors, but realized that design could be much simpler if ESCs are mounted centrally. So, my question is: what are the pros and cons of mounting ESCs close to the motor versus close to the FMU?


答:
It depends on the project. But generally you should choose the language you are most comfortable with. C/C++, Python  have the most tools and libraries available. However I'd choose Ada all the days in the week. It's an elegant and simple yet very advanced language which has a very strong typing. The latest 2014 GPL version has been release for the public recently. There are not many Ada users left but the support communities are great. To sum it up, try the popular languages first and then try Ada perhaps. Links to visit if you want more information on Ada or if you have questions:

Ada on Reddit

Comp.lang.ada

Ada on StackOverflow

Who uses Ada?

The Big Online Book of Linux Ada Programming

Building Parallel, Embedded, and Real-Time Applications with Ada

Alse check out the Robot Operating System which has many modules and packages ready to use.

Title: Programming language?

Body: In general, what is a good programming language for robotics? I am a starting robo nerd and don't know anyone who would know things like this.</p>


问:
Are there any problems with a variable frequency PID?
I am working on a quadrotor and am trying to solve the problems described here. In attempts to bring the refresh rate to 100 Hz, I did an analysis of the functions  and most of the time 35+ ms is being taken by the RC receiver input function. To tackle this, I have decided on two solutions:

Use interrupts (PinChangeInt library) instead of pulseIn

Reduce the frequency of pilot input

The second solution which is much simpler is to simply read the pilot input once in $(n+1)$  PID updates. So, for $n$ times, we have a update time of $8\;ms$, and for the $(n+1)^{th}$ time, we have an update time of T ms. $n$ will be around $10$.

This will create a system that will run on average in $(n*8 + T)/(n+1)\; ms$.

Now, how does a dual/variable frequency affect the PID system? Does the system behave as if working at the effective frequency? I have been searching for some time but I cannot find anything that discusses such a situation.

答:
Ideally, you would adjust PID gains based on sample time. The "correct" adjustment is hard to say since you would need to discretize the nonlinear quadrotor dynamics for each timestep and find gains that make them two closed loop systems equivalent; not a trivial task.

If you have access to Matlab (or maybe Octave, which is free) you could test in simulation with different ratios. If not, I would just play around experimentally. Maybe try setting the long update period gains to 2/3, 1/2, 1/4, 1/8, etc of the fast gains and see at what point, if any, you notice a difference.

Note that as the maximum sampling time decreases you need to worry about this less and less. In your case, though, the maximum time is kind of large so I would at least experiment with different adjustments.


答:
You should be fine as long as your PID algorithm understands that it's not being called at a constant rate. Currently your function doesn't take a delta time parameter. Let's add one:

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

    return -result;
}
</code>```

However, I would say that ideally you would be using a microcontroller or Arduino which had enough processing power to reliably execute the PID controller at a decent rate.

Title: Are there any problems with a variable frequency PID?

Body:
I am working on a quadrotor and am trying to solve the problems described here. In attempts to bring the refresh rate to 100 Hz, I did an analysis of the functions  and most of the time 35+ ms is being taken by the RC receiver input function. To tackle this, I have decided on two solutions:

Use interrupts (PinChangeInt library) instead of pulseIn

Reduce the frequency of pilot input

The second solution which is much simpler is to simply read the pilot input once in $(n+1)$  PID updates. So, for $n$ times, we have a update time of $8\;ms$, and for the $(n+1)^{th}$ time, we have an update time of T ms. $n$ will be around $10$.

This will create a system that will run on average in $(n*8 + T)/(n+1)\; ms$.

Now, how does a dual/variable frequency affect the PID system? Does the system behave as if working at the effective frequency? I have been searching for some time but I cannot find anything that discusses such a situation.

Body:
You should be fine as long as your PID algorithm understands that it's not being called at a constant rate. Currently your function doesn't take a delta time parameter. Let's add one:

int16_t pid_roll(int16_t roll, int16_t dT_ms)
{
    static int16_t roll_old = 0;
    int16_t result =
    (KP_ROLL * roll) +
    (KI_ROLL * (roll_old + roll)*dT_ms) +
    (KD_ROLL * (roll - roll_old)/dT_ms);
    roll_old += roll;

    return -result;
}

However, I would say that ideally you would be using a microcontroller or Arduino which had enough processing power to reliably execute the PID controller at a decent rate.


答:
I think you're solving the wrong problem.  Variable-frequency PIDs are a really bad idea because you lose control of the proportional component of force.  In other words, your force toward the setpoint stays constant even though you may have moved much closer to it in the time between updates, and the PID will need to make larger adjustments — possibly oscillating wildly.

The constraint of only being able to update your inputs once every ~35ms means that your desired setpoint will only change every ~35ms, but the PID should only care about getting to that setpoint smoothly.  To accomplish that, the PID should ideally be running at the frequency of the measurement sensor and/or motor controller.

For an extreme example, consider a PID controller for a cart on a track whose desired setpoint is constant at zero.  It would be silly to run the PID at 0Hz just because the setpoint never changes.

TL;DR, don't wait for pilot input inside your PID loop.  Let the PID loop run at constant frequency and feed it new setpoints whenever they become available.


问:
Effectiveness of a Mobile Robot In Relation To Mass
Do mobile and/or autonomous robots become more or less effective the bigger they get? For example, a bigger robot has bigger batteries, and thus bigger motors, whereas a smaller robot has the exact opposite, making it need less energy, but also have smaller motors. Is there any known theorem that models this?</p>

答:
Many rules of thumb and other scaling laws applicable to robots involve the mass of all or some part of the robot.
I look forward to other answers pointing out more of them.
One of the most surprising rules I've seen:

The batteries should weigh roughly the same as everything else on the airframe combined.

With a given aircraft -- everything known except for the mass of the batteries --
the absolute maximum flight time occurs when the weight of the batteries is twice as much as the weight of everything else on the airframe combined.
Reference: Andres 2011. Optimal Battery Capacity.
via Heino R. Pull.

This rule of thumb applies to all kinds of battery-powered aircraft -- fixed-wing, quadcopters, helicopters etc.


问:
How to define conditions for state-machines in roby?
I am searching for a way that allows me to wait for some conditions on ports before applying a new state.

My concrete Problem:
I want to make sure that my AUV aligns to the right pipeline. Therefore before starting the pipeline-tracking, I want to check for the current system heading.

My current state-machine looks like this:

find_pipe_back = state target_move_def(:finish_when_reached => false ,
  :heading => 1 ...)

pipe_detector = state pipeline_detector_def

pipe_detector.depends_on find_pipe_back, :role => "detector"

start(pipe_detector)
  forward pipe_detector.align_auv_event, success_event

roughly I am looking for a way to condition the last-forward.

答: I don't know if i understand right, but couldn't you make another condition in your state machine for a transition? So for example if you find a pipe or whatever and afterwards you get the permission from the user to follow this pipe ... these two conditions could form the transition to switch to the next state.</p>


问:
Maximum Distance using Ultrasonic sensor Arduino
What is the maximum distance (of say , a car ) you could measure using an ultrasonic sensor that would be compatible with arduino? Is there any sensor(ultrasonic or not) that could measure the distance of a car , say upto 50 meters that can be used with arduino?</p>

答:
There is a cheap LIDAR I saw on hackaday earlier this year that can connect to an Arduino over I2C (or any other micro). The sensor can detect up to 40m, and it's called LIDAR-LITE. They start shipping next month and can be ordered from here for $72 US.

As the previous comments/answers have indicated, you will get nowhere near 50m with any ultrasonic sensor, most hobbyist ones are only a meter or 2.


答:
Such "conditioning" was existing in the pre-syskit days, and it got removed as it made the state machines considerably more complex. Usually, what starts as a simple condition becomes quickly something a lot more involved.

The best way is therefore to create a dedicated composition that would do the monitoring:

```<code>class PipelineFinder < Syskit::Composition
  argument :expected_heading
  add PipelineDetector::Task, :as => 'detector'
  def heading_within_tolerance?(current, tolerance)
    # Test for tolerance
  end
  task_script do
    # Don't know the name of the relevant port, so I am making it up
    reader = detector.pipeline_state_port.reader
    wait detector.align_auv_event
    if (data = reader.read_new) && heading_within_tolerance?(data.yaw, tolerance)
      emit :success
    else
      emit :false_positive
    end
  end
end
</code>```

Note that you could also attach the task script on the detector task in a separate action:

```<code>describe('runs the pipeline detector but filters against an expected direction').
   required_arg('expected_heading')
def detect_pipeline_with_validation(arguments = Hash.new)
   detector = pipeline_detector_def
   expected_heading = arguments[:expected_heading]
   detector.task_script do
     # same script than up there, except that expected_heading
     # is in this case a local variable
   end
   detector
end
</code>```

Title: How to define conditions for state-machines in roby?

Body:
I am searching for a way that allows me to wait for some conditions on ports before applying a new state.

My concrete Problem:
I want to make sure that my AUV aligns to the right pipeline. Therefore before starting the pipeline-tracking, I want to check for the current system heading.

My current state-machine looks like this:

find_pipe_back = state target_move_def(:finish_when_reached => false ,
  :heading => 1 ...)

pipe_detector = state pipeline_detector_def

pipe_detector.depends_on find_pipe_back, :role => "detector"

start(pipe_detector)
  forward pipe_detector.align_auv_event, success_event

roughly I am looking for a way to condition the last-forward.

Body:
Such "conditioning" was existing in the pre-syskit days, and it got removed as it made the state machines considerably more complex. Usually, what starts as a simple condition becomes quickly something a lot more involved.

The best way is therefore to create a dedicated composition that would do the monitoring:

class PipelineFinder < Syskit::Composition
  argument :expected_heading
  add PipelineDetector::Task, :as => 'detector'
  def heading_within_tolerance?(current, tolerance)
    # Test for tolerance
  end
  task_script do
    # Don't know the name of the relevant port, so I am making it up
    reader = detector.pipeline_state_port.reader
    wait detector.align_auv_event
    if (data = reader.read_new) && heading_within_tolerance?(data.yaw, tolerance)
      emit :success
    else
      emit :false_positive
    end
  end
end

Note that you could also attach the task script on the detector task in a separate action:

describe('runs the pipeline detector but filters against an expected direction').
   required_arg('expected_heading')
def detect_pipeline_with_validation(arguments = Hash.new)
   detector = pipeline_detector_def
   expected_heading = arguments[:expected_heading]
   detector.task_script do
     # same script than up there, except that expected_heading
     # is in this case a local variable
   end
   detector
end


问:
Image retrieval through a multibeam imaging sonar
I would like to know if anyone here has used the Blueview SDK (Linux) for retrieval of images from the pings obtained by a multibeam sonar (P450, P900, etc.) ?
If so, I'd like to know why would anyone get a null head when I trying to retrieve the head (eventually for the pings to be converted to an image) using the BVT_GetHead() method. My snippet for retrieving the image from a .son file (some_son_data.son) is given below:

```<code>int main() {
    BVTSonar son = BVTSonar_Create();
    BVTSonar_Open(son, "FILE", "some_son_data.son");

    if (NULL != son) cout << "son not null" << endl;
    BVTHead head = NULL ;
    BVTSonar_GetHead(son, 0, &head);
    return 0;
}
</code>```

答:
We are using the P900 multibeam sonar.

So far our interface hasn't any problem. But we requested a new version of the library from teledyne which works now in our case.

```<code>sonar = new BVTSDK::Sonar();
head = new BVTSDK::Head();
int ret = sonar->Open("NET", hostAddress);
 //error handling
ret = sonar->GetHead(1, head);
//again error handling
</code>```

I will ask wether we can publish our interface within the next weeks.

Body:
We are using the P900 multibeam sonar.

So far our interface hasn't any problem. But we requested a new version of the library from teledyne which works now in our case.

sonar = new BVTSDK::Sonar();
head = new BVTSDK::Head();
int ret = sonar->Open("NET", hostAddress);
 //error handling
ret = sonar->GetHead(1, head);
//again error handling

I will ask wether we can publish our interface within the next weeks.


问:
Gears in Autodesk Inventor are looking weird
I use Autodesk inventor professional 2014. I design my gears using the design accelerator. However, whenever I create gear trains, parts of certain gears become transparent. This seems completely random because sometimes if I zoom in or out or when I pan or orbit, the gears look normal again.
I have experienced this problem using both the default and other material types.
I also have ensured that each of these gears are enabled.

Here are some example pictures

Any help or suggestions will be greatly appreciated.

答:
Might be an issue with your graphics card. Try to update to the newest drivers and check again.

Also you can try to change the Hardware settings in the Inventor options.


问:
Why cannot we find EtherCAT shields?
I have a riddle about EtherCAT in mind and I'd like to have your point of view about it...

With the rise of open platforms and hardware, and easily accessible embedded machines, it is now rather straightforward to install a RT system such as Xenomai on a raspberry PI, or a beagleboard black, or whatever cheap platform you prefer...

Now to connect these a RT bus would be really cool (e.g. EtherCAT...).

Hence my question: every hobbyist face the same problems with RT communication, so is there any good reason why there does not exist any open EtherCAT shield for raspberry PI or beagleboards? It would solve so many problems...

Any thoughts on why? Any idea?

答: There are some small EtherCAT peripherals, like Shadow's Ronex system, which gives you a great deal of I/O, although it's not in the 'shield' form factor.

Title: Why cannot we find EtherCAT shields?


问:
Why linkage-based haptic devices are much more common than cable (tension)-based ones?
According not only to this link, but in my humble opinion to common sense as well, cable-based haptic devices have got lower inertia and are less complicated mechanically. I also believe that controlling them is not that big deal - the inverse kinematics should be quite straightforward. Moreover, the play should be easy to compensate - if there occurs any at all, since the cables are tensioned. Cables should also be easy - ? just a guess from me - to be equipped with strain gauges or to become strain gauges themselves, allowing to enhance control capabilities of a device.

Where am I wrong? Why is that the links-based systems (e.g. PhaNTom or Falcon, although that latter has got cable transmission), especially with impedance control, are the only I seem to be able to buy? Is it because of cable elongation (creep)? Or too constrained workspace (esp. angles)?

答:
I think there might be different reasons for this.

First, historical reasons

The first systems with haptic feedback were mechanical systems to which vibration / force feedback functions were added (vibrations in a pilot's handle, for instance). In the early stages robotic systems were used as haptic displays for different uses (quite early, force feedback was used in telemanipulation devices for operating in nuclear power plants for instance). Naturally, the linkage-based systems became the norm.

Second, technical reasons

I see two reasons here. The first is the fact that cables can only pull and not push. Therefore, you need redundancy to generate forces and wrenches in all directions. It can become quite cumbersome and difficult to control. Also, doubling the number of motors has a direct impact on price. The second reason is related to the workspace : the larger your workspace, the longer your cables. The longer the cables, the more flexible they get. In order to be accurate, the flexibility of those cables must be compensated for, which is not necessarily a trivial problem. This links to historical reasons, as cables that could be made in the 50's were likely less good in terms of stiffness and elasticity than the ones we can make now.

All in all

I think that linkage-based systems are easier to use and to place in an experimental setup (you don't need a box the size of your workspace to use them). This being reinforced by historical reasons that made the use of linkage-based systems more or less the norm. On the other hand, cable-based mechanisms have a nice future for many applications. Also, don't forget that there are alternatives to cable and linkage-based haptic devices, with magnetic-based devices for instance.


答:
There are primary a Technical reason for this.

If you use tension based, the actual joint-angle has to be computed from all tension lengths, the inverse kinematic is as you mentioned known in general but not in detail for each user, this normally lead into a more non-precise measurements. Additionally these devices needs to be calibrated for each person by doing some gestures.

Title: Why linkage-based haptic devices are much more common than cable (tension)-based ones?

Body:
According not only to this link, but in my humble opinion to common sense as well, cable-based haptic devices have got lower inertia and are less complicated mechanically. I also believe that controlling them is not that big deal - the inverse kinematics should be quite straightforward. Moreover, the play should be easy to compensate - if there occurs any at all, since the cables are tensioned. Cables should also be easy - ? just a guess from me - to be equipped with strain gauges or to become strain gauges themselves, allowing to enhance control capabilities of a device.

Where am I wrong? Why is that the links-based systems (e.g. PhaNTom or Falcon, although that latter has got cable transmission), especially with impedance control, are the only I seem to be able to buy? Is it because of cable elongation (creep)? Or too constrained workspace (esp. angles)?


问:
Why should I still use EKF instead of UKF?
The Unscented Kalman Filter is a variant of the Extended Kalman Filter which uses a different linearization relying on transforming a set of "Sigma Points" instead of first-order Taylor series expansion.

The UKF does not require computing Jacobians, can be used with discontinuous transformation, and is, most importantly, more accurate than EKF for highly nonlinear transformations.

The only disadvantage I found is that "the EKF is often slightly faster than the UKF" (Probablistic Robotics). This seems negligible to me and their asymptotic complexity seems to be the same.

So why does everybody still seem to prefer EKF over UKF? Did I miss a big disadvantage of UKF?

答:
Here are a few possible points of consideration. Certainly the UKF has many counterpoints where it has an advantage too.

The most obvious advantage is computation power. Don't forget that traditionally, these filters are implemented on embedded systems with very limited computational resources. Also, while I don't have much experience with UKFs myself, one significant advantage of EKFs is their relative ease of implementation. For many systems, the Jacobian is very easily derived analytically which makes the EKF implementation mostly straightforward.

Another area of potential advantage is ease of tuning. I don't remember how many parameters are tunable in a UKF, but the EKF tuning parameters are already well understood because the basic Kalman Filter is ubiquitous so anybody thinking about using a UKF already knows how to tune an EKF.

Finally, don't ignore momentum. If an existing system already has a working EKF, why go through all the work of implementing and testing a UKF?


答:
Here is the traditional way.  I think this is the kinematics of your arm, but am not 100% sure.

Here are the DH parameters and transformation matrix:

DH Parameters for the anthropomorphic arm with spherical wrist
  $$
\begin{array}{c c c c c}
\\\hline
\text{Link} & a_i & \alpha_i & d_i & \vartheta_i
\\\hline
\\1 & 0   & \pi/2  & 0   & \vartheta_1
\\2 & a_2 & 0      & 0   & \vartheta_2
\\3 & 0   & \pi/2  & 0   & \vartheta_3
\\4 & 0   & -\pi/2 & d_4 & \vartheta_4
\\5 & 0   & \pi/2  & 0   & \vartheta_5
\\6 & 0   & 0      & d_6 & \vartheta_6
\\\hline
\end{array}
$$
  $$
{\Large A}_i^{i-1}(q_i) = {\Large A}_{i^\prime}^{i-1}{\Large A}_i^{i^\prime} = \begin{bmatrix}
\\c_{\vartheta_i} & -s_{\vartheta_i} c_{\alpha_i} & s_{\vartheta_i} s_{\alpha_i} & a_i c_{\vartheta_i}
\\s_{\vartheta_i} & c_{\vartheta_i} c_{\alpha_i} & -c_{\vartheta_i} s_{\alpha_i} & a_i s_{\vartheta_i}
\\0 & s_{\alpha_i} & c_{\alpha_i} & d_i
\\0 & 0 & 0 & 1
\end{bmatrix}
$$

Here are general instructions how to compute Jacobian:

It is easiest to compute the Jacobian for linear velocity and angular velocity separately.

For linear velocity:

The time derivative of $\boldsymbol{p}_e(\boldsymbol{q})$ is:

$$
\dot{\boldsymbol{p}}_e = \sum\limits_{i=1}^n \frac{\partial \boldsymbol{p}_e}{\partial q_i} \dot{q}_i = \sum\limits_{i=1}^n \boldsymbol{\jmath}_{P_i} \dot{q}_i
$$

This shows how $\dot{\boldsymbol{p}}_e$ can be obtained by summing the contributions from each joint.  Note for revolute joints, $q_i = \vartheta_i$.

$$
\dot{q}_i \boldsymbol{\jmath}_{P_i} = \boldsymbol{\omega}_{i-1,i} \times r_{i-1,e} = \dot{\vartheta}_i \boldsymbol{z}_{i-1} \times ( \boldsymbol{p}_e - \boldsymbol{p}_{i-1} )
$$
  Simplifying:
  $$
\boldsymbol{\jmath}_{P_i} = \boldsymbol{z}_{i-1} \times ( \boldsymbol{p}_e - \boldsymbol{p}_{i-1} )
$$

Now for angular velocity:
  $$
\omega_e = \omega_n = \sum\limits_{i=1}^n \omega_{i-1,i} = \sum\limits_{i=1}^n \boldsymbol{\jmath}_{O_i} \dot{q}_i
$$
  in detail:
  $$
\dot{q}_i \boldsymbol{\jmath}_{O_i} = \vartheta_i \boldsymbol{z}_{i-1}
$$
  and then:
  $$
\boldsymbol{\jmath}_{O_i} = \boldsymbol{z}_{i-1}
$$

So now the Jacobian can be partitioned into (3x1) column vectors $\boldsymbol{\jmath}_{P_i}$ and $\boldsymbol{\jmath}_{O_i}$ as such:

$$
\boldsymbol{J} =
\begin{bmatrix}
\boldsymbol{\jmath}_{P_1} & & \boldsymbol{\jmath}_{P_n}\\
 & \ldots & \\
\boldsymbol{\jmath}_{O_1} & & \boldsymbol{\jmath}_{O_n}
\end{bmatrix}
$$

Courtsey of Siciliano, Sciavicco, Villani, and Oriolo.

Hope that helps.

Title: jacobian of Abb irb140 robot


问:
Quadcopter degrees of freedom
It might be kind of a stupid question but how many degrees of freedom are there in a typical quadcopter? I say some saying 4 and some saying 6. The difference stands in translation throughout the other 2 axis (horizontal ones). Being strict to what you can directly tell the quadcopter to do, only 4 movements are possible since you cannot apply a pure lateral force. But you can tilt to start a lateral movement and align the body right after and let it hover in a horizontal axis, theoretically. So, formally, how many degrees of freedom should I consider to exist?</p>

答: Formally, a quadcopter has four degrees of freedom. As you noted, at any given instant in time you can only apply force/moment in only four directions.

Title: Quadcopter degrees of freedom


问:
Bluetooth module HC-05 giving ERROR :(0)
I am working right now with Arduino UNO and HC-05 bluetooth module.I followed the instruction given on this link for wiring. So there are 2 mode of working with this HC-05 module

Simple serial communication

Working in AT command mode so as to change the parameters of HC-05 module

As long as I work in simple serial communication mode, everything works fine but when I tried to change the parameters of module, it didn't work out. For working in At command mode, PIN NO 34 of HC-05 module needs to be high which I had taken care of. Lately I found that in mu module they had knowingly not connected the Berg strip to PIN 34, so I connected the PIN directly, even though I am not able to change the parameters of module and when I write any command on COM port of arduino IDE, I get this response

```<code>Enter AT commands:
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
</code>```

I think that garbage is due to my code

Here is my code:

```<code>#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);
}

void loop()
{
  uint8_t x;
  char CommandFromSerial[50]=" ";
  char ResponseFromBluetooth[50]= " ";

  if ((Serial.available())){
    if(Serial.available()>0){
      for(x=0;x<50;x++)
        CommandFromSerial[x]=Serial.read();
      BTSerial.println(CommandFromSerial);
    }
  }

  if ((BTSerial.available())){
    if(BTSerial.available()>0)
      for(x=0;x<50;x++)
        ResponseFromBluetooth[x]=BTSerial.read();
    Serial.println(ResponseFromBluetooth);
  }
}
</code>```

I am not able to figure out what I am doing wrong. I used this command on COM port
AT\r\n and many other commands but every time I get the same response.

Did I mess up with my bluetooth module unknowingly?

答:
I was having the same problem. I finally solved the problem. This document says that you have to put CR LF (\r\n) characters after you send something in AT mode. But in the arduino code that you use, uses the Serial.write command to send command. But  Serial.write command doesn't put CR LF characters. So I used Tera Term to send command. First connect PIN34 to 3.3V. Power the arduino and upload the code below. Open Tera Term. Start a new serial connection. Choose your arduino's serial port. And then click Setup>Terminal. Change Transmit to CR+LF and check Local Echo checkbox. Now you can send the AT commands.

```<code>#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2, 3); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());
}
</code>```

Body:
I was having the same problem. I finally solved the problem. This document says that you have to put CR LF (\r\n) characters after you send something in AT mode. But in the arduino code that you use, uses the Serial.write command to send command. But  Serial.write command doesn't put CR LF characters. So I used Tera Term to send command. First connect PIN34 to 3.3V. Power the arduino and upload the code below. Open Tera Term. Start a new serial connection. Choose your arduino's serial port. And then click Setup>Terminal. Change Transmit to CR+LF and check Local Echo checkbox. Now you can send the AT commands.

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2, 3); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());
}


答: Have you tried turning on either the "Backface Culling" or the "Polygon Transparency Sorting" settings under Shading?  Those settings affect the rendering of polygons based on view distance and can potentially speed up the rendering process as well as hide incorrectly drawn surfaces. </p>

Title: Gears in Autodesk Inventor are looking weird

Body:
I use Autodesk inventor professional 2014. I design my gears using the design accelerator. However, whenever I create gear trains, parts of certain gears become transparent. This seems completely random because sometimes if I zoom in or out or when I pan or orbit, the gears look normal again.
I have experienced this problem using both the default and other material types.
I also have ensured that each of these gears are enabled.

Here are some example pictures

Any help or suggestions will be greatly appreciated.


问:
Data association with ekf?
Given part of the following algorithm in page 217 probabilistic robotics, this algorithm for EKF localization with unknown correspondences

9. for all observed features $z^{i}  = [r^{i} \ \phi^{2} \ s^{i}]^{T} $

10.     for all landmarks $k$ in the map $m$ do

11.         $q = (m_{x} - \bar{\mu}_{x})^{2} + (m_{y} - \bar{\mu}_{y})^{2}$

12.         $\hat{z}^{k} = \begin{bmatrix}
\sqrt{q} \\
atan2(m_{y} - \bar{\mu}_{y}, m_{x} - \bar{\mu}_{x} ) - \bar{\mu}_{\theta} \\
m_{s} \\ \end{bmatrix}$

13.         $ \hat{H}^{k} = \begin{bmatrix}
h_{11} & h_{12} & h_{13} \\
h_{21} & h_{22} & h_{23} \\
h_{31} & h_{32} & h_{33} \\ \end{bmatrix}  $

14.         $\hat{S}^{k} = H^{k} \bar{\Sigma} [H^{k}]^{T} + Q $

15.     endfor

16.     $ j(i) = \underset{k}{\operatorname{arg\,max}} \ \ det(2 \pi S^{k})^{-\frac{1}{2}} \exp\{-\frac{1}{2} (z^{i}-\hat{z}^{k})^{T}[S^{k}]^{-1} (z^{i}-\hat{z}^{k})\} $

17.     $K^{i} = \bar{\Sigma} [H^{j(i)}]^{T} [S^{j(i)}]^{-1}$

18.     $\bar{\mu} = \bar{\mu} + K^{i}(z^{i}-\hat{z}^{j(i)}) $

19.     $\bar{\Sigma} = (I - K^{i} H^{j(i)}) \bar{\Sigma} $

20. endfor

My question is why the second loop ends in the line 15. Shouldn't it end after the line 19. I've checked the errata of this book but nothing about this issue.

答:
The value $S^k$ (innovation variance) needs to be calculated for all landmarks, but the subsequent update steps (post line 16 --- after argmax), need be applied to all of the map, given the landmark update that was selected on line 16 --- the argmax.

FYI, argmax searches over the list of landmarks for the landmark maximizing the equation given. It selects the index of the landmark which is most likely to be the landmark given the measurement value. Notice that the equation in line 16 is the gaussian multivariate pdf with the measurement and mean measurement for landmark k, normalized by the measurement variance, S.

There's a notation problem here, $\argmax$ should have a subscript denoting what the search is over. In this case, $\argmax$ is searching over $k$, since $i$ is the current measurement we're trying to associate with each of the $k=1...$ possible landmarks.

Title: Data association with ekf?


答: Looks like a problem with normals. I've seen this in 3d studio max. I don't know autodesk inventor, but maybe there is something similar to 'invert normals' or 'flip normals'? You ought to be able to select a single object that's adversely affected and do this to it.</p>


答:
linkage based systems can be engineered to be very stiff mechanisms, however cable based systems cannot be due to the inherent elasticity of the cable used. Also cable based systems are higher maintenance, as you have to account for cable tension changes over time as the cable stretches/creeps (ie by periodic adjustment of tension).

The real world implication is that you cannot reproduce very hard wall contacts with cable based interfaces, and the effect feels more springy then with a rigid link device.


问:
How can the inverse kinematics problem be solved?
The forward kinematics of a robot arm can be solved easily. We can represent each joint using Denavit–Hartenberg transformation matrices.

For example, if the $i^{th}$ joint is a linear actuator, it may have the transformation matrix:

$T_i = \left[\begin{matrix}
1&0&0&0\\
0&1&0&0\\
0&0&1&d_i\\
0&0&0&1
\end{matrix} \right]$
where the extension length is defined by $d_i$

whereas, a rotating link may be:

$T_i = \left[\begin{matrix}
1&0&0&L\\
0&\cos\alpha_i&-\sin\alpha_i&0\\
0&\sin\alpha_i&\cos\alpha_i&0\\
0&0&0&1
\end{matrix} \right]$ where $\alpha$ is the angle, and $L$ is the length of the link.

We can then find the position and orientation of the end effector by multiplying all the transformation matrices: $\prod{T_i}$.

The question is, how do we solve the inverse problem?

Mathematically, for a desired end effector position $M$, find the parameters $d_i$, $\alpha_i$ such that $\prod{T_i} = M$. What methods exist to solve this equation?

答:
Back in the day, when I was learning, making this up as I went along, I used simple gradient following to solve the IK problem.

In your model, you try rotating each joint each joint a tiny amount, see how much difference that makes to the end point position error. Having done that, you then rotate each joint by an amount proportional to the benefit it gives. Then you do that over and over again until you're close enough.

Generally, this is known as gradient following, or hill following. Imagine a robot arm with two degrees of freedom:

Rotating joint A a tiny bit moves the end point in direction a. Rotating joint B a tiny bit moves the end point in direction b.  Both of these move us closer to the target by about the same amount, so we should rotate both joints at about the same speed.

If we were to plot a graph of the distance to the target versus joint angles, it would look like this:

I have coloured in some contours just to help. We can see the path this algorithm takes. What you'll notice is that in joint space, the path taken does not look optimal. It takes a curve. However, in real space, you would see the end point taking a fairly straight line to the target. You can also see that there are actually two solutions to the problem, and the algorithm has just found the closest one.

This is not the only way to solve the inverse kinematics problem. It's certainly not the best way either.

Pros:

It's conceptually simple, so great if you're just learnig this.

It's easy to implement, even if the sight of Denavit–Hartenberg transformation matrices gives you the frights.

It's very general, allowing you to use all kinds of joints: rotary, linear, something else, as long as you can estimate how they cause the end point to move.

It copes well, even when there are zero or an infinite number of solutions.

Cons:

It's slow, taking many iterations to find the solution. However, it's fine if you can just have the real arm follow the progress of the algorithm as it's calculated.

It can get stuck in local minima. I.E. It might not find the best possible solution, if it finds a good enough one.

There are more details about it on my very old web site: The good-looking textured light-sourced bouncy fun smart and stretchy page.


问:
Arduino Quadcopter using bluetooth shield and android phone
I need help on how to go about building a quadcopter software from scratch with the available tools I have with me. I don't have a transmitter radio therefore the only way I can do remote control is using an android phone with the itead studio bluetooth shield that I was recently given.
How can I use the existing open source software, i.e aeroquad or arducopter. The following are parts that I have:-

Arduino Uno

Bluetooth shield

Four brushless motors

Q450 frame Four

ESC Turnigy

MPU6050

答:
First, you will need to test the communication range. Make a test app to talk between the phone and arduino/bluetooth shield and then walk around to see how far away they can still communicate. If it's not far enough you can't do much else and need to find a different communication solution.

After that, you will need to modify the source code from the open source projects you referenced as I don't believe they use the same setup as you. First, you will need to modify/replace the communication logic to use your bluetooth. Second, you won't be able to do autonomous flight with those sensors so you will need to strip out anything related to that from the code.

Finally, you just need to define your own protocol for sending movement commands from the phone to the bluetooth shield.


问:
Mahalanobis distance between 2 line features
I am implementing the ATLAS SLAM framework for a ground robot, using EKF Slam for local maps and using line segment features. The line segment features can be abstracted to their respective lines [d,α] where d and α represent the distance and angle in the distance-angle representation of lines.

In the given framework, there is a local map matching step where lines of the local maps will be matched, and there is a need for a distance metric between 2 lines. The mahalanobis distance is suggested in the literature, however strictly a mahalanobis distance is between a single measurement and a distribution and not between 2 distributions.

How do I find the mahalanobis distance between line 1 [d1,α1] with covariance matrix S1 and line 2 [d2,α2] with covariance matrix S2?

In the EKF Algorithm from the book Probabilistic Robotics by Sebastian Thrun, there is a computation during the feature update step, where it looks like the covariances (of a new measurement and an existing measurement) are multiplied to give a resultant covariance matrix, and then the inverse is used in the Mahalanobis distance computation.

That would be similar to

```<code>Mahalanobis_Distance = [d2-d1,α2-α1] * Inverse(S1*S2) * [d2-d1,α2-α1]'
</code>```

Is that correct?

答:
The Mahalanobis distance is useful because it is a measure of the "probablistic nearness" of two points.

For example, if I have a gaussian PDF with mean zero and variance 100, it is quite likely to generate a sample around the value 100. ($(100-0)/100 = 1$).  However, a gaussian PDF with mean 100 and variance 1 is more likely to be the PDF which generates samples around 100. ($(100-100)/1=0$). So we consider the point "closer to" the second one.

Thus, we need a metric to determine which PDF was a "better" choice when determining who generated the sample 100.

So in your case, it depends on which quantities were being generated by random processes.  For example, if you assumed that $d$ and $a$ were being measured, but corrupted by independent random noise, then yes, your definition of the Mahalanobis Distance is correct.

It is very unlikely that the noise on $d$ and $a$ are independent, since they probably aren't being measured independently. However, many algorithms make such an assumption. Make sure yours does.


问:
Extended Kalman Filter with Laser Scan + Known Map
I am currently working on a project for school where I need to implement an extended Kalman Filter for a point robot with a laser scanner. The Robot can rotate with 0 degree turn radius and drive forward. All motions are piecewise linear (drive,rotate,drive).

The simulator we are using does not support acceleration, all motion is instantaneous.

We also have a known map (png image) that we need to localize in. We can ray trace in the image in order to simulate laser scans.

My partner and I are little confused as to the motion and sensor models we'll need to use.

So far we are modelling the state as a vector $(x,y,\theta)$.

We are using the update equations as follows

```<code>void kalman::predict(const nav_msgs::Odometry msg){
    this->X[0] += linear * dt * cos( X[2] ); //x
    this->X[1] += linear * dt * sin( X[2] ); //y
    this->X[2] += angular * dt; //theta

    this->F(0,2) = -linear * dt * sin( X[2] ); //t+1 ?
    this->F(1,2) =  linear * dt * cos( X[2] ); //t+1 ?

    P = F * P * F.t() + Q;

    this->linear = msg.twist.twist.linear.x;
    this->angular = msg.twist.twist.angular.z;
    return;
}
</code>```

We thought we had everything working until we noticed that we forgot to initialize P and that it was zero, meaning that there was no correction happening. Apparently our propagation was very accurate as we haven't yet introduced noise into the system.

For the motion model we are using the following matrix for F:

$F = \begin{bmatrix}1 & 0 & -v*\Delta t*sin(\theta)
\\ 0 & 1 & v*\Delta t*cos(\theta)
\\ 0 & 0 & 1
\end{bmatrix}$

As its the Jacobian of our update formulas. Is this correct?

For the sensor model we are approximating the Jacobian (H) by taking finite differences of the robots $x$, $y$ and $\theta$ positions and ray tracing in the map. We talked to the TA who said that this would work but I'm still unsure it will. Our prof is away so we can't ask him unfortunately. We are using 3 laser measurements per correction step so H is a 3x3.

The other issue where having how to initialize P. We tried 1,10,100 and they all place the robot outside the map at (-90,-70) when the map is only 50x50.

The code for our project can be found here: https://github.com/en4bz/kalman/blob/master/src/kalman.cpp

Any advice is greatly appreciated.

EDIT:

At this point I've gotten the filter to stabilize with basic movement noise but no actual movement. As soon as the robot starts to move the filter diverges quite quickly and exits the map.

答:
Using EKF for localisation based on laser scans and a known map is a bad idea and will not work because one of EKF's main assumptions is not valid: The measurement model is not differentiable.

I would suggest looking into Monte Carlo Localization (Particle Filters). This will not only solve the problem with your measurement model, but also allow global localization (initial pose within the map completely unknown).

Edit: I am sorry I forgot to mention another important point:

If you want to apply EKF, your measurement model as well as your motion model may only include Gaussian noise. This means you need be able to write down your measurement model as $z_t = h(x_t) + N(0, Q_t)$.
This is is a severe limitation, since it does not allow a slightly more complex model like the beam_range_finder_model in Probabilistic Robotics, which also considers dynamic objects in front of the robot, invalid (max) measurements and completely random readings. You would be stuck with casting rays for the $h(x_t)$ part and adding Gaussian noise.


问:
What is the best way to fuse measurements from IMU, LIDAR, and Encoder information in some recursive bayesian filter?
I am doing SLAM with a four wheeled (2-wheel drive) differential drive robot driving through some hall way. The hallway is not flat everywhere. And the robot turns by spinning in place, then traveling in the resulting direction. The SLAM algorithm does not need to run online.

The robot takes measurements from a strap down IMU/gyro measuring (ax,ay,az,wx,wy,wz), where ax refers to acceleration the x direction and wx measures angular acceleration about the x-axis. The LIDAR scans the hall way with a 270-degree arc and measures ranges and angles. However, so far as I know the hall way has no discernable features except when it corners

I need to find the best way to fuse the proposed action measured by the encoder with IMU and LIDAR data. It makes sense to me that I could fuse yaw from IMU with encoder data to get a better sense of heading, but how should I incorporate LIDAR data?

In essence, what is the appropriate measurement model and how should I incorporate noise into the motion model? Beside just adding some gaussian noise at some (0,σ)?

Addendum

This somewhat orthogonal to the question but just as confusing to me. Currently I am using a particle filter to do SLAM, and I am a little confused about whether to represent uncertainty in angular acceleration in the particles themselves. I see two options:

A separate navigation filter using EKF (or anything really) to find a vector of "best-estimate" angular acceleration matrix first, then use this matrix as absolute truth for the particle filter. So that any drift in the particles is not from uncertainty in angular acceleration.

Incorporate the uncertainty into the particle drift themselves. This option appears more sensible but I am not sure what a principled way to do this is.

答:
Since you have a 2D sensor which you can not rotate in a controlled way, you can only expect to perform SLAM in a 2D plane.

Your best bet is to use the IMU for attitude estimation (roll and pitch only, since you do not have a compass) and correct each slightly rotated 2D laser scan accordingly. If your IMU does not provide you with an attitude estimate already, I would compute attitude estimates using a nonlinear complementary filter since they only need tuning of one single constant.

Even though it is theoretically possible to use Particle Filters for SLAM with laser scans (see gmapping), the current state of the art is graph-based SLAM, i.e. least squares optimization of the SLAM graph, or in your case pose graph optimization. Have a look at karto in ROS as an exemplary open source implementation.


问:
Motion Model for Holonomic Robot
We are working with an holonomic robot equipped with three (120 degree shifted) omnidirectional wheels. The relative movement is estimated by dead reckoning using wheel encoders. To improve this estimation we installed an gyroscope to measure the change in orientation. Furthermore the robot has a 270 degree laser range finder.

In order to solve the kidnapped robot problem we implemented a particle filter. In every step each particle is updated according to the odometry and gyroscope readings. Since these readings are distorted by noise we need a motion model to include these errors. As described in Probabilistic Robotics by Thrun (Page 118 - 143) there are two commonly used motion models (velocity motion model and odometry motion model). However these models seem to describe the behavior of differential drive robots not omnidirectional robots. I base this thesis on the fact that the error in relative y-direction is proportional to the error in orientation as far as the motion models by Thrun are concerned. This is appropriate for differential drive robots as the orientation and the heading of the robot are identical. For omnidirectional robots this assumption can not be made since the heading and the orientation are completely independent. Even if we assume perfect information about the robots orientation we can still obtain error in relative y-direction.

I would like to discuss if my assumption - that the velocity/odometry motion model fails for omnididrectional robots - is correct or not as i am not sure about that. Furthermore  i am curious if there are any other motion models for omnidirectional robots that might fit better.

答:
I agree that the motion models in Probabilistic Robotics are badly suited for omnidirectional robots. I always interpreted the models presented there as examples only that should enable you to devise a custom model for your own robot.

First of all you need to model and solve the forward kinematics for this kind of omnidirectional drive. I guess you already managed to do that, but just in case you might want to check Section III.b) in this paper.

Second, there are many ways of turning a kinematic model into a probabilistic model. The easiest way is to just take the kinematic model and add some "process noise" in pose space. A probably better alternative is assuming noisy wheel encoders, i.e. sample and add noise to wheel encoder readings before transforming these according to the kinematic model.

I had good results applying a particle filter to a robot with the same geometry with the latter option a while ago, but your mileage may vary.

Title: Motion Model for Holonomic Robot


答:
First of all, you mentioned nothing about which kind of localization you are using. Is it with known or unknown correspondences?

Now to acquire the Jacobian in Matlab you may do the following

```<code>>> syms x y a Vtran Vrotat t
>> f1 = x + Vtran*t*cos(a);
>> f2 = y + Vtran*t*sin(a);
>> f3 = a + Vrotat*t;
>> input  = [x y a];
>> output = [f1 f2 f3];
>> F = jacobian(output, input)
</code>```

The result

```<code>F =
[ 1, 0, -Vtran*t*sin(a)]
[ 0, 1,  Vtran*t*cos(a)]
[ 0, 0,               1]
</code>```

Extended Kalman Filter requires the system to be linear and the noise to be Gaussian. The system here means the motion and observation models must be linear. Laser sensors give the range and the angle toward a landmark from the robot's frame, so the measurement model is not linear. About P, if you assume it to be large then your EKF estimator will be poor at the beginning and it relies on the measurements because the previous state vector is not available. However, once your robot starts moving and sensing, EKF will be getting better because it uses the motion and measurement models to estimates the robot's pose.  If your robot is not sensing any landmarks, the uncertainty increases drastically. Also, you need to be careful about the angle. In C++, cos and sin, the angle should be in radian. There is nothing in your code about this issue. If you are assuming the angle's noise in degree while your calculation in radian, then you might get weird results because one degree as a noise while the calculations in radian is considered huge.

Title: Extended Kalman Filter with Laser Scan + Known Map

Body:
I am currently working on a project for school where I need to implement an extended Kalman Filter for a point robot with a laser scanner. The Robot can rotate with 0 degree turn radius and drive forward. All motions are piecewise linear (drive,rotate,drive).

The simulator we are using does not support acceleration, all motion is instantaneous.

We also have a known map (png image) that we need to localize in. We can ray trace in the image in order to simulate laser scans.

My partner and I are little confused as to the motion and sensor models we'll need to use.

So far we are modelling the state as a vector $(x,y,\theta)$.

We are using the update equations as follows

```<code>void kalman::predict(const nav_msgs::Odometry msg){
    this->X[0] += linear * dt * cos( X[2] ); //x
    this->X[1] += linear * dt * sin( X[2] ); //y
    this->X[2] += angular * dt; //theta

    this->F(0,2) = -linear * dt * sin( X[2] ); //t+1 ?
    this->F(1,2) =  linear * dt * cos( X[2] ); //t+1 ?

    P = F * P * F.t() + Q;

    this->linear = msg.twist.twist.linear.x;
    this->angular = msg.twist.twist.angular.z;
    return;
}
</code>```

We thought we had everything working until we noticed that we forgot to initialize P and that it was zero, meaning that there was no correction happening. Apparently our propagation was very accurate as we haven't yet introduced noise into the system.

For the motion model we are using the following matrix for F:

$F = \begin{bmatrix}1 & 0 & -v*\Delta t*sin(\theta)
\\ 0 & 1 & v*\Delta t*cos(\theta)
\\ 0 & 0 & 1
\end{bmatrix}$

As its the Jacobian of our update formulas. Is this correct?

For the sensor model we are approximating the Jacobian (H) by taking finite differences of the robots $x$, $y$ and $\theta$ positions and ray tracing in the map. We talked to the TA who said that this would work but I'm still unsure it will. Our prof is away so we can't ask him unfortunately. We are using 3 laser measurements per correction step so H is a 3x3.

The other issue where having how to initialize P. We tried 1,10,100 and they all place the robot outside the map at (-90,-70) when the map is only 50x50.

The code for our project can be found here: https://github.com/en4bz/kalman/blob/master/src/kalman.cpp

Any advice is greatly appreciated.

EDIT:

At this point I've gotten the filter to stabilize with basic movement noise but no actual movement. As soon as the robot starts to move the filter diverges quite quickly and exits the map.

Body:
First of all, you mentioned nothing about which kind of localization you are using. Is it with known or unknown correspondences?

Now to acquire the Jacobian in Matlab you may do the following

>> syms x y a Vtran Vrotat t
>> f1 = x + Vtran*t*cos(a);
>> f2 = y + Vtran*t*sin(a);
>> f3 = a + Vrotat*t;
>> input  = [x y a];
>> output = [f1 f2 f3];
>> F = jacobian(output, input)

The result

F =
[ 1, 0, -Vtran*t*sin(a)]
[ 0, 1,  Vtran*t*cos(a)]
[ 0, 0,               1]

Extended Kalman Filter requires the system to be linear and the noise to be Gaussian. The system here means the motion and observation models must be linear. Laser sensors give the range and the angle toward a landmark from the robot's frame, so the measurement model is not linear. About P, if you assume it to be large then your EKF estimator will be poor at the beginning and it relies on the measurements because the previous state vector is not available. However, once your robot starts moving and sensing, EKF will be getting better because it uses the motion and measurement models to estimates the robot's pose.  If your robot is not sensing any landmarks, the uncertainty increases drastically. Also, you need to be careful about the angle. In C++, cos and sin, the angle should be in radian. There is nothing in your code about this issue. If you are assuming the angle's noise in degree while your calculation in radian, then you might get weird results because one degree as a noise while the calculations in radian is considered huge.


问:
Different Particle Filter min and max particle numbers give almost the same result
I'm using amcl package in ROS to localize a mobile robot. I've changed min_particles and max_particles several times then calculated the output difference with odomotry to evaluate these parameters. The table below demonstrate results; As you see, there is no notable change in the output and if you ignore the first row of the table, output variance is small.

And this is the Particle Filter output on the map:

答:
It is not completely clear what your question is, but I assume you wanted to ask: Why does the output not change with the number of particles above a certain number of particles?

By allowing amcl to use more samples, you decrease the errors (or inaccuracies) that are caused by the fact that the particle filter approximates your probability distributions using Monte Carlo sampling. Above a certain number of samples, these errors from Monte Carlo approximation are so small that they are negligible compared to other sourceof uncertainty, e.g. measurement, system, or odometry uncertainty.

Thousands of particles are in my experience many more than you need for local localization in 2D (when the robot has a rough estimate of where it is already). You will likely only need so many particles for global localization, i.e. when the robot does not know anything (for example during initialization).


问:
How to overwrite default git source in autoproj?
I want to overwrite the git source of a package in autoproj. That package is by
default on gitorious and I forked it on spacegit to apply specific patches.
According to the autoproj documentation (http://rock-robotics.org/stable/documentation/autoproj/customization.html), I set the new repo in the overrides.yml by:

```<code>  - control/orogen/<package>:
    url: git://spacegit.dfki.uni-bremen.de/virgo/orogen-<package>.git
</code>```

But if I inspect the remotes of the newly checked out package, only the
fetch url is adapted to spacegit whereas the push url still points to
the default gitorious repo:

```<code>$ git remote -v
autobuild   git://spacegit.dfki.uni-bremen.de/<project>/orogen-<package>.git (fetch)
autobuild   git@gitorious.org:/rock-control/orogen-<package>.git (push)
</code>```

How can I overwrite both the fetch and the push source of a package in the
overrides.yml?

答:
You missed the part that autobuild can separate between push and pull urls.

See documentation at
http://rock-robotics.org/next/api/autobuild/Autobuild/Git.html

The Gitorious statement automatically set the push_to url, see here:
http://rock-robotics.org/next/api/autoproj/Autoproj.html#method-c-gitorious_server_configuration

everything you have to do is add:

```<code>- control/orogen/<package>:
  url: git://spacegit.dfki.uni-bremen.de/virgo/orogen-<package>.git
  push_to: git@spacegit.dfki.uni-bremen.de:virgo/orogen-<package>.git
</code>```

Body:
You missed the part that autobuild can separate between push and pull urls.

See documentation at
http://rock-robotics.org/next/api/autobuild/Autobuild/Git.html

The Gitorious statement automatically set the push_to url, see here:
http://rock-robotics.org/next/api/autoproj/Autoproj.html#method-c-gitorious_server_configuration

everything you have to do is add:

- control/orogen/<package>:
  url: git://spacegit.dfki.uni-bremen.de/virgo/orogen-<package>.git
  push_to: git@spacegit.dfki.uni-bremen.de:virgo/orogen-<package>.git


问:
How to request a specific Mavlink packet from Ardupilot?
I'm developing a program for communicating with Ardupilot using Mavlink. I've generated code based on the Mavlink definition for Ardupilot, and I have the basic communication working.

What I can't figure out, is how to request Ardupilot to send a specific Mavlink message. I'd like Ardupilot to send me Mavlink message Attitude (#30) every second. How can I do this?

答:
If you carefully go through Ardupilot code, you will find all the mavlink communication related function are put in file GCS_Mavlink.pde. If you wish to receive particular message you will have to look into and modify this file.

Mavlink message attitude(#30) is handled in this function within ardupliot. So you will have to modify and the ardupilot code and call this function at desired time interval. Similarly you can find relevant functions for desired messages already build within code.

If you wish to send any mavlink message on your own then I would suggest you to go through particular mavlink message file. All transfer functions related to particular message are defined within message file. For example, in order to send attitude(#30), go to mavlink_msg_attitude.h and refer to function mavlink_msg_attitude_send().

One should also refer here for more mavlink related information.


答:
Once you have enough particles to resolve your position, the effect of adding more particles shrinks to zero.  You are likely seeing the best possible results that your particle filter can achieve.

It looks like the smallest adequate number of particles for your simulation is somewhere between 120 and 1200, and my guess is that if you plotted the Odom difference vs max_particles, you would see a curve that was near-vertical at max_particles = 1, decreasing past 172 at max_particles = 120and near-horizontal at 149 by the time max_particles got to 1200.

Title: Different Particle Filter min and max particle numbers give almost the same result

Body:
I'm using amcl package in ROS to localize a mobile robot. I've changed min_particles and max_particles several times then calculated the output difference with odomotry to evaluate these parameters. The table below demonstrate results; As you see, there is no notable change in the output and if you ignore the first row of the table, output variance is small.

And this is the Particle Filter output on the map:


答:
IN CASE OF A HC05 MODULE : You could use Arduino IDE but don't forget to select "both, NL and CR" in the case nearby the baudrate selection (in the hardware serial monitor).

IN CASE OF A HC06 MODULE: choose "no line ending"

;)

With this code it is ok:

```<code>    #include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  //HC-05 pin 34 (key pin)
  digitalWrite(9, HIGH);  // 5V sur Key pour activer le mode commande AT
  Serial.begin(9600);
  Serial.println("AT commandes:");
  BTSerial.begin(38400);  // HC-05 vitesse par défaut pour la commande AT
}

void loop()
{
  // lecture des commandes AT par le serial port(9600)
  if (BTSerial.available()) Serial.write(BTSerial.read());

  // envoie à HC-05 de commandes AT saisi
  if (Serial.available()) BTSerial.write(Serial.read());
}
</code>```

Title: Bluetooth module HC-05 giving ERROR :(0)

Body:
I am working right now with Arduino UNO and HC-05 bluetooth module.I followed the instruction given on this link for wiring. So there are 2 mode of working with this HC-05 module

Simple serial communication

Working in AT command mode so as to change the parameters of HC-05 module

As long as I work in simple serial communication mode, everything works fine but when I tried to change the parameters of module, it didn't work out. For working in At command mode, PIN NO 34 of HC-05 module needs to be high which I had taken care of. Lately I found that in mu module they had knowingly not connected the Berg strip to PIN 34, so I connected the PIN directly, even though I am not able to change the parameters of module and when I write any command on COM port of arduino IDE, I get this response

```<code>Enter AT commands:
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
ERROR:(0)
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõÿýì¢^
</code>```

I think that garbage is due to my code

Here is my code:

```<code>#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);
}

void loop()
{
  uint8_t x;
  char CommandFromSerial[50]=" ";
  char ResponseFromBluetooth[50]= " ";

  if ((Serial.available())){
    if(Serial.available()>0){
      for(x=0;x<50;x++)
        CommandFromSerial[x]=Serial.read();
      BTSerial.println(CommandFromSerial);
    }
  }

  if ((BTSerial.available())){
    if(BTSerial.available()>0)
      for(x=0;x<50;x++)
        ResponseFromBluetooth[x]=BTSerial.read();
    Serial.println(ResponseFromBluetooth);
  }
}
</code>```

I am not able to figure out what I am doing wrong. I used this command on COM port
AT\r\n and many other commands but every time I get the same response.

Did I mess up with my bluetooth module unknowingly?

Body:
IN CASE OF A HC05 MODULE : You could use Arduino IDE but don't forget to select "both, NL and CR" in the case nearby the baudrate selection (in the hardware serial monitor).

IN CASE OF A HC06 MODULE: choose "no line ending"

;)

With this code it is ok:

    #include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  //HC-05 pin 34 (key pin)
  digitalWrite(9, HIGH);  // 5V sur Key pour activer le mode commande AT
  Serial.begin(9600);
  Serial.println("AT commandes:");
  BTSerial.begin(38400);  // HC-05 vitesse par défaut pour la commande AT
}

void loop()
{
  // lecture des commandes AT par le serial port(9600)
  if (BTSerial.available()) Serial.write(BTSerial.read());

  // envoie à HC-05 de commandes AT saisi
  if (Serial.available()) BTSerial.write(Serial.read());
}


问:
Our quadcopter goes forward instead of hovering in place. How to correct it?
I'm trying to do a quadcopter with some friends and we have a problem. It goes forward instead of hovering in place. We made a video to explain it, you can see it here.

As you can see, the quadcopter flight and go forward when I don't touch the controller. I need to correct it to go backward and it goes forward again.

We use the kk2.1.5.

The HobbyKing KK2.1.5 Multi-Rotor controller is a flight control board for multi-rotor aircraft (Tricopters, Quadcopters, Hexcopters etc). Its purpose is to stabilize the aircraft during flight. To do this it takes the signal from the 6050MPU gyro/acc (roll, pitch and yaw) then passes the signal to the Atmega644PA IC. The Atmega644PA IC unit then processes these signals according the users selected firmware and passes control signals to the installed Electronic Speed Controllers (ESCs). These signals instruct the ESCs to make fine adjustments to the motors rotational speed which in turn stabilizes your multi-rotor craft.

We made some test. As you can see in the video, we placed the battery backward to be sure there is no weight against. When we check values in the debug mode, all values are at 0 when nothing is pressed.

答:
You seem to be controlling the quadrotor's attitude (roll, pitch) to (0, 0) and not its position.

What you are seeing is drift in position, which is inevitable if you do not control the quadrotor's position. You might still be able to reduce the amount of drift a little:

Make sure that the center of gravity of your quadrotor is actually in the center. If it is only slightly in front, it will pull your quadrotor forward.

Make sure that the KK controller board is mounted exactly parallel to the propeller plane. This is mechanically difficult so most controller boards allow you to calibrate their orientation, but I do not know about KK. The controller board can then account for the fact that their attitude estimate is slightly off.

Also keep in mind that your quadrotor behaves differently from normal so close to the ground due to the so-called ground effect. It might get much better after takeoff.


问:
Good Microcontrollers/SOCs for a Robotics Project
I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?

Observation: I'd like to start with a simple line-following vehicle and build up afterwards.

答:
If you want to go further than using microcontrollers you could run ROS on you Raspberry Pi.

I have build several robots and a couple of other projects using a RoboCard (site in Danish, but can be translated). The RoboCard is build around an ATMega, so that certainly is a viable route.


问:
How can I integrate a smart phone with my robotics project?
Smart phones these days typically come with a gyroscope, accelerometer, compass, camera, and GPS sensor all on board. They also usually have a connection to the internet with Wifi and mobile data networks. I've seen many cases of using a phone as a remote control for a robot, but to me, it seems like the phone itself is a perfect lightweight computing and sensing platform for an autonomous robot.

The main obstacle I see is interfacing with actuators. Being able to control motors to steer even a table-top robot, or control servos, for example. Connecting and communicating to a microcontroller could be an obstacle as well.

As a robot hobbyist, I'd like to know how I can overcome these and other obstacles to be able to harness the power of my smart phone with my robotics projects.

答:
Many recent Android devices, such as the Nexus 7, support USB On The Go (OTG) which is a fancy way of saying that 'USB Host Mode' is supported.  In these cases, with the right cable which can be had for less than $1, any compatible USB device can be used.  You don't need a specialty version of the Arduino that has hardware for USB Host mode.

I've experimented with this enough to know that a 'normal' Arduino such as the Leonardo or Teensy 2 appears to an Android phone as a TTY (e.g. serial port) device when connected with an OTG cable.

This article goes into depth on how to use the Android USB Host API to communicate to the Arduino from an Android app.  It requires Android 3.1+ and does not require you to root the device.