问:
Evaluating the similarity of two 7 Degree of Freedom Arms
I am working on the Baxter robot where I have a first arm configuration and a bunch of other arm configurations, where I want to find the closest arm configuration to the first among the many other arm configurations. The trick here is that the end effector location/orientation is the exact same for all the arm configurations, they are just different ik solutions. Can anyone point me towards the right direction towards this? Thank you.</p>

答:
When you have a 6 DOF manipulator, you must choose a "pose" such as elbow-up or elbow-down, etc.  Combining the waist, elbow, and wrist options leads to  eight different configurations to choose from - sixteen if the end effector can be flipped 180 degrees and still function.  Inverse kinematics must have specific trigonometric solutions that will select a pose and stick with it so that the manipulator does not try to flip among the many possible solutions.  These pose choices are often hard-coded into the inverse kinematics, in my experience.

With a redundant manipulator, the challenge is much greater.  There is now an infinite number of possible solutions, each with the eight or sixteen distinct poses.  NASA, Oak Ridge, and others who were controlling redundant telerobotic manipulators published a lot of work in this area in the 1990s.  My favorite approach is to define an optimization criteria, and use the gradient of the null space Jacobian to optimize that criteria while maintaining the end effector inverse kinematic solution.  Prof. Williams explains the procedure well, for an 8 DOF arm (but the approach applies to any redundant manipulator) here:  http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19940023270.pdf

EDIT (to provide specific example):

For instance, you could set your optimization criteria to be to keep the joint angles as close to the current pose as possible (minimize the norm of the least-squares vector $||\vec x_{i+1} - \vec x_{i}||$ ).  The algorithm will try to minimize this norm, thus keeping the "average" joint change as small as possible when going to the next commanded position.


问:
Is it better to have batteries distributed at the rotors or the center of the multicopter?
I've seen 3 approaches to mounting batteries on a multicopter:

All the batteries rigidly mounted near the center of the airframe

All the batteries in a bag hanging under the center of the airframe

Each rotor has its share of the batteries rigidly mounted near/under it. (For example, a quadcopter with 1/4 of all the batteries mounted underneath each motor).

Which design is the best, and why?
If there is no one best design, what are the advantages/tradeoffs between the designs?
Is there some other design I'm overlooking that is better in some way?

(This question focuses on multirotor flying machines.
For ground vehicles, see " Is it better to have weight distributed over the wheels or the center of the robot? ").

答: You want to mount the batteries as close to the center of the hub and as close to the center both horizontally and vertically.  The closer it is, the less the controller has to work to keep the craft horizontally balanced and the less battery power you will use.</p>

ContentLicense: CC BY-SA 3.0


答:
To compare two different arm configurations, Euclidean distance in joint space is usually sufficient.

$$
d = \sqrt{\sum_{i=0}^n(q_i - q_{i_{ref}})^2}
$$

Where $q_i$ is joint $i$ of the test configuration, and $q_{i_{ref}}$ is the same joint in the reference configuration.  This will work even if the end-effector has a different pose.  But its usefulness goes down as the difference in end-effector poses grows.  I believe you can combat this effect somewhat by using a weighted distance metric.

Note that in general, you might want to have some global notion of the quality of an IK solution when you don't have a reference configuration.  The rest of this post deals with this scenario.

There are a few metrics for comparing IK solutions.  The first, that I have found to be most useful is manipulability measure.  Which is defined as:

$$
\mathit{w}(q) = \sqrt{det(\mathbf{J}(q)\mathbf{J}^T(q)}
$$

This is a rough measure of how easy it is for the arm to move in any direction.  It vanishes as singular configurations.  In the image below, it is a measure of the roundness of the manipulability ellipsoid.

Interesting side note: an arm's (velocity) manipulability is orthogonal to it's force manipulability.  Which kind of makes intuitive sense.  Where your arm can move quickly, it can't lift very much, and vice versa.

Distance from mechanical joint stops is another common metric:

$$
\mathit{w}(q) = -\frac{1}{2n}\sum_{i=1}^{n}\Big(\frac{q_i - \bar{q}_i}{q_{iM} - q_{im}}\Big)^2
$$

Where $q_{iM}$ and  $q_{im}$ are the maximum and minimum joint angles, and $\bar{q}_i$ is the middle value of the joint range.  Note that because this is just a unitless metric, you can tweak to suit your needs.  For example, using a higher exponent to have a flatter curve in the middle, and sharper penalties near the edges.

I have also seen something called the condition number used.  Which is the ratio of the first and last eigen values of the SVD of the Jacobian.  Which is kind of another measure of the roundness of the arm's Jacobian.  But I have found this metric to be less useful.

If you are only interested in forces or velocities in a specific direction $u$, you can compute the manipulability ellipsoid like so:

$$
\alpha(q) = \Big(u^T\mathbf{J}(q)\mathbf{J}^T(q)u\Big)^{-1/2}
$$
$$
\beta(q) = \Big(u^T\big(\mathbf{J}(q)\mathbf{J}^T(q)\big)^{-1}u\Big)^{-1/2}
$$

Where $\alpha$ is the force component, and $\beta$ is the velocity component.

You could also calculate the theoretical current draw for each arm configuration to find the most power efficient one.

Or you can make your own metric and combine some of these.

Note that you can use these approaches while treating IKFast as a black box.  IKFast gives you a number of potential solutions for the given end-effector pose.  You can simply iterate through them, evaluating the desired metric on each, then pick the best.  (Side note: IKFast works slightly differently in Python and C.  In Python, OpenRave automatically iterates your fixed joints through their entire range with some discretization.  So you can potentially get hundreds of solutions.  But in C, it only gives you the few permutations of joint flips.  So you only get a handful of solutions.  You are forced to call it multiple times to iterate through your fixed joint range.)

Title: Evaluating the similarity of two 7 Degree of Freedom Arms

Body: I am working on the Baxter robot where I have a first arm configuration and a bunch of other arm configurations, where I want to find the closest arm configuration to the first among the many other arm configurations. The trick here is that the end effector location/orientation is the exact same for all the arm configurations, they are just different ik solutions. Can anyone point me towards the right direction towards this? Thank you.</p>


问:
Solar Cells Charging a Li-Po Battery
Is there a way to charge a Li-Po battery using solar panels to increase the flight time of a quadcopter during its flight?</p>

答:
The short answer is no. This is not to say that someone won't extend the flight time of a copter using solar energy one day. But if you attach off the shelf solar panels to off the shelf LiPo batteries and use an off the shelf or quickly fabricated custom power conversion electronics, then the reduction in flight time from the extra mass will be similar to any energy gained from the solar panels.

You can review further discussion on this topic here: How do I create a portable solar panel lipo charger?

Title: Solar Cells Charging a Li-Po Battery


问:
Syncing camera with other signals
I am not sure if this is the best place to ask this question, but hopefully someone here can give me some advice. I have a device hooked up to a data acquisition system that can provide sync out signal and record sync in signals. I need to synchronize my recordings with this device to a video feed. I am having trouble finding a camera that can provide a sync signal or any other good way to accomplish this. Thanks for your help.</p>

答:
Cameras that support syncing will probably do so via an external signal. Google "genlock" or "timecode sync" or "external trigger" to get started.  For instance, here's a link to external trigger modes for Point Grey cameras whose image sensors a lot of research roboticists use.

For the sync signal, if the sync out on the DAQ is not sufficient, google "sync generator". You should get relevant hits from the video & audio recording as well as electronics test worlds.

Title: Syncing camera with other signals


问:
Unscented Kalman Filter for Dummies
I need some help here because I can't figure how the Unscented Kalman Filter works.
I've searched for examples but all of them are too hard to understand.

Please someone can explain how it works step by step with a trivial example like position estimation, sensor fusion or something else?

答:
I'm going to give you a high-level overview without going into much math. The purpose here is to give you a somewhat intuitive understanding of what is going on, and hopefully this will help the more mathematical resources make more sense. I'm mostly going to focus on the unscented transform, and how it relates to the UKF.

Random variables

Alright, the first thing you need to understand is that modern (mobile) robotics is probabilistic; that is, we represent things we aren't sure about by random variables. I've written about this topic on my personal website, and I strongly suggest you check it out for a review. I'm going to briefly go over it here.

Take the (one-dimensional) position of a robot for example. Usually we use sensors (e.g., wheel encoders, laser scanners, GPS, etc.) to estimate the position, but all of these sensors are noisy. In other words, if our GPS tells us we are at $x = 10.2$ m, there is some uncertainty associated with that measurement. The most common way we model this uncertainty is using Gaussian (also known as Normal) distributions. The probabilistic density function (don't worry about what this means for now) of a Gaussian distribution looks like this:

On the $x$ axis are different values for your random variable. For example, this could be the one dimensional position of the robot. The mean position is denoted by $\mu$, and the standard deviation is denoted by $\sigma$, which is a sort of "plus/minus" applied to the mean. So instead of saying "the robot's position is $x = 9.84$ m", we say something along the lines of "the mean of our estimate of the robot's position is $x = 9.84$ m with a standard deviation of $0.35$ m".

On the $y$ axis is the relative likelihood of that value occurring. For example, note that $x = \mu$ has a relative likelihood of about $0.4$, and $x = \mu - 2\sigma$ has a relative likelihood of about $0.05$. And let's pretend that $\mu = 9.84$ m and $\sigma = 0.35$ m like the above example. That means

$$
\mu = 9.84 \text{ m}, \quad \mu - 2\sigma = 9.84 - 2(0.35) = 9.14 \text{ m}
$$

What the $y$-axis values are telling you is that the likelihood that the robot is at $9.84$ is eight times higher than $9.14$ because the ratio of their likelihoods is $0.4/0.05 = 8$.

The takeaway point from this section is that the things we often most interested in (e.g., position, velocity, orientation) are random variables, most often represented by Gaussian distributions.

Passing random variables through functions

An interesting property of Gaussian random variables is that the result of passing one through a linear function results in a Gaussian random variable. So if we have a function like

$$
y = 12x - 7
$$

and $x$ is a Gaussian random variable, then $y$ is also a Gaussian random variable (but with a different mean and standard deviation). On the other hand, this property does not hold for nonlinear functions, such as

$$
y = 3\sin(x) - 2x^2.
$$

Here, passing the Gaussian random variable $x$ through the function results in a non-Gaussian distribution $y$. In other words, the shape of the PDF for $y$ would not look like the above plot. But what do I mean by "passing a Gaussian random variable through a function". In other words, what do I put in for $x$ in the above equation? As we saw in the above plot, $x$ has many possible values.

As before, let's say $x$ has mean $\mu = 9.84$ m and standard deviation $\sigma = 0.35$ m. We are interested in approximating $y$ as a Gaussian random variable. One way to do this would be calculating a whole bunch of $y$s for different $x$s. Let's calculate $y$ for $x = \mu$, $x = \mu + 0.1\sigma$, $x = \mu - 0.1\sigma$, $x = \mu + 0.2\sigma$, etc. I've tabulated some results below.

$$
\begin{array}{|c|c|}
x & y = 3\sin(x) - 2x^2 \\
\hline
\mu & -194.5 \\
\mu + 0.1\sigma & -195.9 \\
\mu - 0.1\sigma & -193.0 \\
\mu + 0.2\sigma & -197.3 \\
\mu - 0.2\sigma & -191.6 \\
\vdots & \vdots \\
\mu + 10\sigma & -354.5 \\
\mu - 10\sigma & -80.3
\end{array}
$$

Although the values of $y$ do not form a Gaussian distribution, we create one by taking the mean of all the $y$ values to get $\mu_y$ (in this case $\mu_y = -201.8$), and we calculate the standard deviation the usual way:

$$
\sigma_y = \sqrt{\frac{1}{n-1}\sum_{i=1}^n(y_i-\mu_y)^2} = 81.2.
$$

So voila! We have come up a way to pass Gaussian random variables through nonlinear functions. Problem solved, right? Well not necessarily. It took a lot of computations to come up with our solution, so solving problems this way when our data is streaming in many times per second may not be possible. And how did we choose how spread out our values of $x$ were? And why did we stop at $\mu \pm 10\sigma$?

The unscented transformation

The unscented transformation is a method of passing Gaussian distributions through nonlinear functions. It is not dissimilar to the brute force method I described above. In fact, it uses the exact same approach, but is really smart about how it chooses which values of $x$ to choose to pass through the nonlinear function.

In fact, for the problem I described, the unscented transformation requires you to pass exactly three points (called sigma points) through the nonlinear function:

$$
x = \mu, \quad x = \mu + \alpha\mu, \quad x = \mu - \alpha\mu,
$$

where $\alpha$ depends on the dimensionality of the random variable (one in this case) and other scaling factors. In other words, you pass the mean and one point on each side of the mean through the nonlinear function. Then you calculate the mean and standard deviation of the result to approximate $y$ as a random variable.

The unscented Kalman filter

Under the assumption that you have a basic understanding of Kalman filters, you'll recall that there are essentially two steps: prediction and correction. In the prediction step, you have a motion model that propagates the state forward in time. It might look something like

$$
x_{k+1} = f(x_k, u_k)
$$

where $u_k$ is the input, and both $x_k$ and $u_k$ are (Gaussian) random variables. Now in a regular Kalman filter, $f(x_k, u_k)$ is a linear function, which results in $x_{k+1}$ being a Gaussian random variable. However, it is often the case that $f(x_k, u_k)$ is nonlinear. So what do we do? We calculate sigma points, pass them through the motion model, and then calculate the mean and variance of the result. This gives us our approximate estimate of $x_{k+1}$ as a Gaussian random variable.

The correction step mostly works the same way. This time you have a measurement model that looks something like

$$
z_k = h(x)
$$

where $h(x)$ may be nonlinear. So how do we get calculate our predicted measurement $z$? You guessed it, we use an unscented transformation again. I won't go into details on how you update the state from here (it's outside of the scope of my "intuitive" description), but it's relatively straightforward.

Summary

The state (what we are estimating) and the measurements come from "real-life" sensors, which all have noise. We model this uncertainty by representing them as Gaussian random variables.

Passing Gaussian random variables through linear functions results in other Gaussian random variables. Passing them through nonlinear functions does not.

One method of approximating the result of passing a Gaussian random variable through a nonlinear function as a Gaussian random variable is by sampling the input variable at a bunch of different points, passing those through the nonlinear function, and then considering the mean and standard deviation of the resulting output as a Gaussian distribution.

The unscented transformation strategically picks points from distribution of the input variable that keep the most information about the distribution and passes them through the nonlinear function, then calculates the mean and standard deviation of the output.

The unscented Kalman filter uses the unscented transformation to pass Gaussian random variables through the motion and measurement models.

ContentLicense: CC BY-SA 4.0

Title: Unscented Kalman Filter for Dummies


问:
How to interrupt on a data ready trigger when communications to the sensor are interrupt driven?
Background: I'm using the L3GD20H MEMS gyroscope with an Arduino through a library (Pololu L3G) that in turn relies on interrupt-driven I2C (Wire.h); I'd like to be able to handle each new reading from the sensor to update the calculated angle in the background using the data ready line (DRDY). Currently, I poll the STATUS register's ZYXDA bit (which is what the DRDY line outputs) as needed.

General question: With some digital output sensors (I2C, SPI, etc.), their datasheets and application notes describe using a separate (out-of-band) hardware line to interrupt the microcontroller and have it handle new sets of data. But on many microcontrollers, retrieving data (let alone clearing the flag raising the interrupt line) requires using the normally interrupt-driven I2C subsystem of a microcontroller. How can new sensor data be retrieved from the ISR for the interrupt line when also using the I2C subsystem in an interrupt-driven manner?

Possible workarounds:

Use nested interrupts (as @hauptmech mentioned): re-enable I2C interrupt inside of ISR. Isn't this approach discouraged?

Use non-interrupt-driven I2C (polling)--supposedly a dangerous approach inside of ISRs. The sensor library used depends on the interrupt-driven Wire library.

[Edit: professors' suggestion] Use a timer to interrupt set to the sample rate of the sensor (which is settable and constant, although we measure it to be e.g. 183.3Hz rather than 189.4Hz per the datasheet). Handling the I2C transaction still requires re-enabling interrupts, i.e. nested interrupts or performing I2C reads from the main program.

[Edit:] Here's a comment I found elsewhere on a similar issue that led me to believe that the hang encountered was from I2C reads failing inside an interrupt handler: https://www.sparkfun.com/tutorials/326#comment-4f4430c9ce395fc40d000000

…during the ISR (Interrupt Service Routine) I was trying to read the
  device to determine which bit changed. Bad idea, this chip uses the
  I2C communications which require interrupts, but interrupts are turned
  off during an ISR and everything goes kinda south.

答:
I think you have a false assumption somewhere. A very quick scan through the atmel datasheet and arduino twi.c does not show any problems.

Why do you think the microcontroller can't handle the interrupt from an ISR using an interrupt-driven I2C subsystem?


问:
Wind flow diagram of a quadcopter
I'm trying to determine the wind flow diagram around a quadcopter when it is in action. I looked up on internet but couldn't find any reliable source.

By wind flow diagram, what I mean is when my quadcopter is in mid-air, hovering at some fixed position, how the air is moving around it? All the directions are needed to be kept in mind, from top to bottom (vertical direction) and also the horizontal direction.

答:
The question needs some clarification, but at first thought here's a sketch of an answer.

The aerodynamics of rotors of a quad rotor can be simplified as independent from each other. Just to give a glimpse, here's a simple introduction to rotor aerodynamics, including near field flow directions, and average air velocity near (down) the rotor: Helicopter momentum Analysis.

Keep in mind that this is a very simple (yet practically quite an accurate) representation of the real flow phenomena near the vehicle.

Things that should be considered for a more detailed approach:

existence and interaction of multi rotors

rotor - body interaction

unsteadiness (the propellers are in fact creating a periodic flow)

environmental changes (wind, pressure change)

control induced variations (even in perfect air conditions, if the quad rotor is moving a camera or weight, there will be control commands, changing the flow a bit)

Etc.

Title: Wind flow diagram of a quadcopter


问:
ROS tutorials no longer working
Has anyone ever run into a case where a fresh install of ROS cannot run its tutorial packages?

I am running ROS Indigo on an nVidia Jetson TK1, using the nVidia-supplied Ubuntu image. I just did a fresh install, Ubuntu and ROS, just to keep things clean for this project. I am building a kind of 'demo-bot' for some students I will be teaching; it will use both the demo files and some of my own code. Now, after setting things up, I try to run the talker tutorial just to check to make sure that everything is running, and rospack is pretty sure that the tutorials don't exist.

For example, inputting this into the terminal

```<code>rosrun rospy_tutorials talker
</code>```

Outputs

```<code>[rospack] Error: package 'rospy_tutorials' not found
</code>```

This is the case for every tutorial file; python and C++. Now, I am sure the tutorials are installed. I am looking right at them in the file system, installed from the latest versions on github. So I think it is something on ROS' side of things.

Has anyone ever bumped into something similar before, where a ROS package that supposedly was installed correctly isn't found by ROS itself? I would rather not have to reinstall again if I can avoid it.

EDIT #1

After playing with it some more, I discovered that multiple packages were not running. All of them - some turtlebot code, and some of my own packages - returned the same error as above. So I suspect something got messed up during the install of ROS.

roswtf was able to run, but it did not detect any problems. However, going forward.

EDIT #2

I double checked the bashrc file. One export was missing, for ROS directory I was trying to work within. Adding it did not solve the problem.

I am still looking for a solution, that hopefully does not involve reflashing the TK1.

EDIT #3

Alright, so I've been poking at this for a few days now and pretty much gave up trying to get ROS to work correctly, and decided a re-flash was necessary. But I think I found something when I booted up my host machine. In my downloads folder, I have the v2.0 and the v1.2 JetPack. I know I used the v2.0 for this latest install, and it has been the only time I have used it (it provides some useful updates for OpenCV and bug fixes, among other things). I'm going to re-flash using the v1.2 JetPack this time, see if things behave better with ROS under that version. Its a long shot, but it is all I have to work with at the moment, and it shouldn't lose any ROS capabilities (aside from some of the stuff I wanted to do with OpenCV). I'll update everyone if that seems to work.

EDIT #4

Ok, everything seems to be working now. The problem does seem to be an issue with Jetpack v2.0. I suspect that some change, somewhere between v1.2 and v2.0 (made to accommodate the new TX1 board), messes with running ROS indigo on a TK1. I'm going to be a more detailed explanation in an answer to this question.

答:
Have you tried roswtf? It's the first step in the ROS Troubleshooting guide:

If you don't know what the problem is yet or how to fix it, try running roswtf first, which is like a FAQ implemented in code. It will look at your configuration and what is running and try and diagnose problems. You can either run it by itself, or you can give it the name of a roslaunch file, e.g.

```<code>roswtf
</code>```

or

```<code>roswtf myfile.launch
</code>```

Title: ROS tutorials no longer working

Body:
Have you tried roswtf? It's the first step in the ROS Troubleshooting guide:

If you don't know what the problem is yet or how to fix it, try running roswtf first, which is like a FAQ implemented in code. It will look at your configuration and what is running and try and diagnose problems. You can either run it by itself, or you can give it the name of a roslaunch file, e.g.

roswtf

or

roswtf myfile.launch


问:
Simulation software for KUKA LBR iiwa robot?
I have been working with KUKA LBR iiwa 7 R800 robot, with the KUKA's IDE, which is the 'Sunrise.Workbench'. Since it does not have any virtual platform to verify the code (simulate), it's been quite difficult, as I need to test each code by deploying to the robot.

Can anyone suggest if there is any simulation software available where I can test the code written using the Robotics API in Sunrise.Workbench?

I came across V-REP simulation software, but, not sure if I can use my code in the workbench platform.

Appreciate if anyone can shed some light on it.
Thanks in advance.

答:
I suggest using ROS and related tools. If you want to simulate kinematics of the manipulator, you can visualize it in ROS, by following below steps.

1. Find a URDF description, or write a one

2. Visualize it in rviz tool

3. Write a joint state publisher node, which outputs the joint values from
your existing code to the visualizer.

look on to this

If you want to do a exact physics simulation you can consider on using Gazebo with ROS.


问:
simulation of robots
I am designing a new mechanism similar to robot arm. It would be a 6 or 7 axis with arms but not the same with traditional articulated arms. As a result, new DH matrix,and inverse kinematics involve. I would like to consult the robot professionals in this forum that do you suggest any simulation tool of this mechanism?

I plan to start with start and end points. Then I will do a trapezoid velocity plan and take sample points with sampling time along the path. After that, I would like to transfer these sampling points to motor joints by DH matrix and inverse kinematics. Finally I would do some basic 3D animation to visualize the movement temporally. I do not plan to simulate controller behavior because in my application motor drivers deal with it. I only need to focus on sending reasonable commands to motor drivers.

In my opinion, Matlab, octave, VC++, and some third-party tools are candidates. Starting from ground zero would be a time-consuming work. I would appreciate if any experts can share a tool or open source code from his or her experience. I did some search on Matlab robotics toolbox but I am not sure if it fits my need because it is expensive and optimized for ROS. In Octave there are also some robotics toolbox but I am not sure about what it can do and what it cannot.

答:
For visualization and kinematics, Gazebo works fine. You can use C++ or Python to work with it. There is lots of integration with ROS as well if you like that sort of thing.

If you want a clean and simple rigid body dynamics library, I really like RBDL, but you'll need to add your own integrator for simulation and graphics for visualization. odeint works well. For visualization, OSG has a really clean and nice design, and OGRE is what the Gazebo/ROS guys use.

If you are familiar with a CAD software such as Creo, Solidworks, Onshape, etc then it can be quick to set up your links and joints and move them around by hand to get a feel for things. Onshape is from the guys that created Solidworks and it's free github style (private data costs money).

A physical mockup, using cardboard, posterboard, particle board and tape, glue, brads, nails, screws and whatever else you need can be a quick way to understand a new mechanism. You can print out 2D sections from your favorite CAD software to scale as a template to help get complex shapes right.

The last open source automated mechanism synthesis software I kept track of and liked was Darwin2K, but that might be more hardcore optimization than you are looking for.

If you are comfortable with C++ I'd favor that over Octave. You're more likely to find C++ libraries that help you than Matlab/octave ones. (I know lots of guys that really like matlab/simulink for robotics work, but you mentioned the cost as an issue). If you are comfortable with Linux, I'd also favor that over windows; lots of open source code has a Posix base and can be a little clunky to work with on windows.

Title: simulation of robots


问:
TI ARM with stacked RAM
Do any of the TI ARM SOCs, e.g. OMAP or Da Vinci, have a version with stacked RAM? (e.g. DDR2 or mDDR) For miniature robots like micro drones, it would be really nice to not need to spend board area on an external RAM chip. Thanks!</p>

答:
According to TI's website, some of the OMAP processors (specifically the OMAP-DM5x range) have stacked RAM.

More info here (PDF).

Title: TI ARM with stacked RAM


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

答:
In my mind the hardware is just no long enought on the market to allow a shift to the hobby sector.
 You need very special designed hardware to handle those realtime protocols and on the other hand most of these protocols (Mechatrolink, SyncNet, Sercos, Ethercat) are a complete overkill to the hobby sector.

But this will change soon (except the point that those protocols are a complete overkill). There are lot of microcontrollers, which have been released recently, which can handle some of those protocols. There are even some ARM Cortex M controllers with Ethercat (Like the Infineon X4800 or some TI-Chips).
A collegue of mine just redesigned a Beaglebone Board to handle Ethercat. It is not an impossible task, just someone has to start. Give it two more years and you will see them popping up all over the place.

Title: Why cannot we find EtherCAT shields?


问:
Quadcopter PID: Controller is Saturating
Good day,

I am currently creating an autonomous quadcopter using a cascading PID controller specifically a P-PID controller using angle as setpoints for the outer loop and angular velocities for the inner loop. I have just finished tuning the Roll PID last week with only +-5 degrees of error however it is very stable and is able to withstand disturbances by hand. I was able to tune it quickly on two nights however the pitch axis is a different story.

Introduction to the Problem:
The pitch is asymmetrical in weight (front heavy due to the stereo vision cameras placed in front). I have tried to move the battery backwards to compensate however due to the constraints of the DJI F450 frame it is still front heavy.

In a PID controller for an asymmetrical quadcopter, the I-gain is responsible for compensating as it is the one able to "remember" the accumulating error.

Problem at Hand
I saw that while tuning the pitch gains, I could not tune it further due to irregular oscillations which made it hard for me to pinpoint whether this is due to too high P, I or D gain. The quadcopter pitch PID settings are currently at Prate=0.0475 Irate=0.03 Drate=0.000180 Pstab=3 giving an error from the angle setpoint of 15degrees of +-10degrees. Here is the data with the corresponding video.

RATE Kp = 0.0475, Ki = 0.03, Kd = 0.000180 STAB Kp=3
Video: https://youtu.be/NmbldHrzp3E

Plot:

Analysis of Results
It can be seen that the controller is saturating.
The motor controller is currently set to limit the pwm pulse used to control the ESC throttle to only 1800ms or 180 in the code (The maximum is 2000ms or 205) with the minimum set at 155 or 1115ms (enough for the quad to lift itselft up and feel weightless). I did this to make room for tuning the altitude/height PID controller while maintaining the throttle ratio of the 4 motors from their PID controllers.

Is there something wrong on my implementation of limiting the maximum throttle?

Here is the implementation:

```<code> //Check if PWM is Saturating - This method is used to fill then trim the outputs of the pwm that gets fed into the gpioPWM() function to avoid exceeding the earlier set maximum throttle while maintaining the ratios of the 4 motor throttles.
    float motorPWM[4] = {motorPwm1, motorPwm2, motorPwm3, motorPwm4};
    float minPWM = motorPWM[0];
    int i;
    for(i=0; i<4; i++){ // Get minimum PWM for filling
        if(motorPWM[i]<minPWM){
            minPWM=motorPWM[i];
        }
    }

    cout << " MinPWM = " << minPWM << endl;

    if(minPWM<baseThrottle){
        float fillPwm=baseThrottle-minPWM; //Get deficiency and use this to fill all 4 motors
        cout << " Fill = " << fillPwm << endl;
        motorPwm1=motorPwm1+fillPwm;
        motorPwm2=motorPwm2+fillPwm;
        motorPwm3=motorPwm3+fillPwm;
        motorPwm4=motorPwm4+fillPwm;
    }

    float motorPWM2[4] = {motorPwm1, motorPwm2, motorPwm3, motorPwm4};
    float maxPWM = motorPWM2[0];
    for(i=0; i<4; i++){ // Get max PWM for trimming
        if(motorPWM2[i]>maxPWM){
            maxPWM=motorPWM2[i];
        }
    }

    cout << " MaxPWM = " << maxPWM << endl;

    if(maxPWM>maxThrottle){
        float trimPwm=maxPWM-maxThrottle; //Get excess and use this to trim all 4 motors
        cout << " Trim = " << trimPwm << endl;
        motorPwm1=motorPwm1-trimPwm;
        motorPwm2=motorPwm2-trimPwm;
        motorPwm3=motorPwm3-trimPwm;
        motorPwm4=motorPwm4-trimPwm;
    }
</code>```

Possible solution
I have two possible solutions in mind

I could redesign the camera mount to be lighter by 20-30 grams. to be less front heavy

I could increase the maximum throttle but possibly leaving less room for the altitude/throttle control.

Does anyone know the optimum solution for this problem?

Additional information
The quadcopter weighs about 1.35kg and the motor/esc set from DJI (e310) is rated up to 2.5kgs with the recommended thrust per motor at 350g (1.4kg). Though a real world test here showed that it is capable at 400g per motor with a setup weighing at 1600g take-off weight

How I tune the roll PID gains

I had set first the Rate PID gains. at a setpoint of zero dps

Set all gains to zero.

Increase P gain until response of the system to disturbances is in steady oscillation.

Increase D gain to remove the oscillations.

Increase I gain to correct long term errors or to bring oscillations to a setpoint (DC gain).

Repeat until desired system response is achieved

When I was using the single loop pid controller. I checked the data plots during testing and make adjustments such as increasing Kd to minimize oscillations and increasing Ki to bring the oscillations to a setpoint. I do a similar process with the cascaded PID controller.

The reason why the rate PID are small because rate Kp set at 0.1 with the other gains at zero already started to oscillate wildy (a characteristic of a too high P gain). https://youtu.be/SCd0HDA0FtY

I had set the Rate pid's such that it would maintain the angle I physically placed it to (setpoint at 0 degrees per second)

I then used only P gain at the outer loop stabilize PID to translate the angle setpoint to velocity setpoint to be used to control the rate PID controller.

Here is the roll axis at 15 degrees set point https://youtu.be/VOAA4ctC5RU
Rate Kp = 0.07, Ki = 0.035, Kd = 0.0002 and Stabilize Kp = 2

It is very stable however the reaction time/rise time is too slow as evident in the video.

答:
I feel like I make the same comments every time you ask a question about your controller:

How are you tuning the gains?

I think your slack line is interfering with your results.

Your quadcopter is not pulling on the slack line, it's sitting on it. This is introducing a floating inverted (unstable!) pendulum on system to your quadcopter. The motors aren't making enough thrust to lift the quadcopter because it's sitting on the tether.

That said, I think your statement,

I could not tune it further due to irregular oscillations

is revealing because I think that those oscillations are due to your tether. Not helping anything - you're pulling on the tether. So, extra forces your quadcopter shouldn't have to account for, that is being added to it:

Spring force in the tether material itself.

You are reacting to motion, so you're applying a time-varying force.

The wooden pillar wobbles (I can see it at 34 seconds into your video), which is applying a time-varying force.

Your gains look very, very low, and I would be surprised that they're doing much of anything. To demonstrate, consider the quick simulation I ran in Simulink:

The second figure above is the output of a step response to a PID controller with your PID gains. It is far too slow of a response for you to get meaningful control of an aerial vehicle.

So, I reiterate: How are you tuning the gains? I suggested a couple months ago a method you could you to do your tuning. I would expect your gains to be probably 100x larger than they are. Kp somewhere about 10-20 maybe, Ki at 5 or 10% of that, maybe 1 or 2, and Kd maybe 25% of the Ki gain, somewhere maybe 0.25 or 0.5. Those gains would look more along the lines of what I would expect, at least.

:EDIT:

I forgot to add that it does not look like anything is saturating. Your motors never appear to hit a sustained full-speed output and your integral error never reaches a point where it is clipped, either.


问:
SLAM : Why is marginalization the same as schur's complement?
Consider the system
$$
\tag 1
H\delta x=-g
$$
 where $H$ and $g$ are the Hessian and gradient of some cost function $f$ of the form $f(x)=e(x)^Te(x)$. The function $e(x)=z-\hat{z}(x)$ is an error function, $z$ is an observation (measurement) and  $\hat{z}$ maps the estimated parameters to a measurement prediction.

This minimization is encountered in each iteration of many SLAM algorithms, e.g.one could think of $H$ as a bundle adjustment Hessian. Suppose $x=(x_1,x_2)^T$, and let $x_2$ be some variables that we seek to marginalize. Many authors claim that this marginalization is equivalent to solving a smaller liner system $M\delta x_1=-b$ where $M$ and $g$ are computed by applying Schur's complement to (1), i.e. if
$$H=
\begin{pmatrix}
H_{11} & H_{12}\\
H_{21} & H_{22}
\end{pmatrix}
$$
then
$$
M=H_{11}-H_{12}H_{22}^{-1}H_{21}
$$
and
$$
b=g_1-H_{12}H_{22}^{-1}g_2
$$

I fail to understand why that is equivalent to marginalization... I understand the concept of marginalization for a Gaussian, and I know that schur's complement appears in the marginalization if we use the canonical representation (using an information matrix), but I don't see the link with the linear system.

Edit: I understand how Schur's complement appears in the process of marginalizing or conditioning $p(a,b)$ with $a,b$ Gaussian variables, as in the link supplied by Josh Vander Hook. I had come to the same conclusions, but using the canonical notation: If we express the Gaussian $p(a,b)$ in canonical form, then $p(a)$ is gaussian and its information matrix is the Schur complement of the information matrix of $p(a,b)$, etc. Now the problem is that I don't understand how Schur's complement appears in marginalization in bundle adjustment (for reference, in these recent papers: c-klam (page 3 if you want to look) and in this (part titled marginalization). In these papers, a single bundle adjustment (BA) iteration is performed in a manner similar to what I initially described in the question. I feel like there is a simple connection between marginalizing a Gaussian and the marginalization in BA that I am missing. For example, one could say that optimizing $f$ (one iteration) is equivalent to drawing a random variable following a denstiy $$e^{-\frac{1}{2}(x-\mu)^T\Sigma^{-1}(x-\mu)}$$  where $\Sigma$ is the inverse of the Hessian $H$ of $f$, and $\mu$ is the true value for $x$ (or an approximation of that value), and that marginalizing this density is equivalent to using Schur's compelement in the bundle? I am really confused...

答:
The following are mostly based on "Factor Graphs for Robot Perception" by Frank Dellaert and Michael Kaess, with additional notes:

As a reminder, marginalization is about having a joint density $p(x, y)$ over two variables $x$ and $y$, and we would like to marginalize out or "eliminate a variable", lets say $y$ in this case:

\begin{equation}
  p(x) = \int_{y} p(x, y)
\end{equation}

resulting in a density $p(x)$ over the remaining variable $x$.

Now, if the density was in covariance form with mean $\boldsymbol{\mu}$ and covariance $\mathbf{\Sigma}$, partitioned as follows:

\begin{equation}
  p(x, y) = \mathcal{N}(
    % Mean
    \begin{bmatrix}
      \boldsymbol\mu_{x} \\
      \boldsymbol\mu_{y}
    \end{bmatrix},
    % Covariance
    \begin{bmatrix}
      \mathbf\Sigma_{xx}, \mathbf\Sigma_{xy} \\
      \mathbf\Sigma_{yx}, \mathbf\Sigma_{yy}
    \end{bmatrix}
  )
\end{equation}

marginalization is simple, as the corresponding sub-block $\mathbf{\Sigma}_{xx}$ already contains the covariance on $x$ after marginalizing out $y$, i.e.,

\begin{equation}
  p(x) = \mathcal{N}(
    % Mean
    \boldsymbol\mu_{x},
    % Covariance
      \mathbf\Sigma_{xx}
  )
\end{equation}

However, in the nonlinear least squares formulation, we don't have the covariance
$\mathbf{\Sigma}$, we can however estimate it via the following property:

\begin{equation}
  \mathbf{\Sigma} = \mathbf{H}^{-1}
\end{equation}

where $\mathbf{H}$ is the hessian in a Gauss-Newton system (approximated with $\mathbf{J}^{T} \mathbf{J}$), it just so happens that when we're trying to invert the Hessian via Schur's complement, we are actually:

Inverting a sub-block of $\mathbf{H}$: to solve $\mathbf{H} \delta\mathbf{x} = \mathbf{b}$ for $\delta\mathbf{x}$

Performing marginalization to remove old states

both at the same time. The marginalized $\mathbf{H}$ (after Schur's complement) will be equivalent to $\mathbf{\Sigma}_{xx}^{-1}.$

Derivation of Schurs Complement in Gauss-Newton

From the Gauss-Newton system, $\mathbf{H} \delta\mathbf{x} = \mathbf{b}$, we can derive the marginalization of the old states $\mathbf{x}_{2}$ algebraically. Let us decompose the system as:
\begin{equation}
  % H
  \begin{bmatrix}
    \mathbf{H}_{11} & \mathbf{H}_{12} \\
    \mathbf{H}_{21} & \mathbf{H}_{22}
  \end{bmatrix}
  % x
  \begin{bmatrix}
    \delta\mathbf{x}_{1} \\
    \delta\mathbf{x}_{2}
  \end{bmatrix}
  =
  % b
  \begin{bmatrix}
    \mathbf{b}_{1} \\
    \mathbf{b}_{2}
  \end{bmatrix}
\end{equation}
If we multiply out the block matrices and vectors out we get:
\begin{equation}
  % Line 1
  \mathbf{H}_{11} \delta\mathbf{x}_{1}
    + \mathbf{H}_{12} \delta\mathbf{x}_{2}
    = \mathbf{b}_{1} \\
  % Line 2
  \mathbf{H}_{21} \delta\mathbf{x}_{1}
    + \mathbf{H}_{22} \delta\mathbf{x}_{2}
    = \mathbf{b}_{2}
\end{equation}
Now if we want to marginalize out the $\mathbf{x}_{2}$, we simply rearrange the second equation above to be w.r.t. $\mathbf{x}_{2}$ like so:
\begin{align}
  % Line 1
  \mathbf{H}_{21} \delta\mathbf{x}_{1}
    + \mathbf{H}_{22} \delta\mathbf{x}_{2}
    &= \mathbf{b}_{2} \\
  % Line 2
  \mathbf{H}_{22} \delta\mathbf{x}_{2}
    &= \mathbf{b}_{2} - \mathbf{H}_{21} \delta\mathbf{x}_{1} \\
  % Line 3
  \delta\mathbf{x}_{2}
    &= \mathbf{H}_{22}^{-1} \mathbf{b}_{2} - \mathbf{H}_{22}^{-1} \mathbf{H}_{21} \delta\mathbf{x}_{1} \\
\end{align}
substitute our $\delta\mathbf{x}_{2}$ above back into $\mathbf{H}_{11} \delta\mathbf{x}_{1} + \mathbf{H}_{12} \delta\mathbf{x}_{2} = \mathbf{b}_{1}$, and rearrange the terms so it is w.r.t $\delta\mathbf{x}_{1}$ to get:
\begin{align}
  % Line 1
  \mathbf{H}_{11} \delta\mathbf{x}_{1} + \mathbf{H}_{12}
  (\mathbf{H}_{22}^{-1} \mathbf{b}_{2}
    - \mathbf{H}_{22}^{-1} \mathbf{H}_{21} \delta\mathbf{x}_{1})
  &= \mathbf{b}_{1} \\
  % Line 2
  \mathbf{H}_{11} \delta\mathbf{x}_{1}
  + \mathbf{H}_{12} \mathbf{H}_{22}^{-1} \mathbf{b}_{2}
  - \mathbf{H}_{12} \mathbf{H}_{22}^{-1} \mathbf{H}_{21}
    \delta\mathbf{x}_{1}
  &= \mathbf{b}_{1} \\
  % Line 3
  (\mathbf{H}_{11} - \mathbf{H}_{12}\mathbf{H}_{22}^{-1}\mathbf{H}_{21}) \mathbf{x}_{1}
  &= \mathbf{b}_{1} - \mathbf{H}_{12} \mathbf{H}_{22}^{-1} \mathbf{b}_{2}
\end{align}
We end up with the Schur Complement of $\mathbf{H}_{22}$ in $\mathbf{H}$:
\begin{align}
  \mathbf{H} / \mathbf{H}_{22} :=
    \mathbf{H}_{11}
    - \mathbf{H}_{12}\mathbf{H}_{22}^{-1}\mathbf{H}_{21} \\
  \mathbf{b} / \mathbf{b}_{2} :=
    \mathbf{b}_{1} - \mathbf{H}_{12} \mathbf{H}_{22}^{-1} \mathbf{b}_{2}
\end{align}
If you want to marginalize out $\delta\mathbf{x}_{1}$ you can follow the same process above but w.r.t $\delta\mathbf{x}_{1}$, that is left as an exercise to the reader ;)


问:
Pure Arduino Quadcopter
I recently bought a set of escs, brushless outrunner motors and propellers. I'm trying to perform a calibration on the esc, but I can't find how I can do that without using components other than the arduino uno itself. The setup I've managed to make is the one shown in the picture. The escs are a mystery, as there is no manual to be found. If it helps, the buy link is this : http://www.ebay.co.uk/itm/4x-A2212-1000KV-Outrunner-Motor-4x-HP-30A-ESC-4x-1045-prop-B-Quad-Rotor-/111282436897
There might also be a problem with the battery (LiPo 3.7V, 2500mAh).

Can andybody figure out what I'm doing wrong?
The sample arduino code I found was this:

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

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 700
#define MOTOR_PIN 9

Servo motor;

void setup() {
  Serial.begin(9600);
  Serial.println("Program begin...");
  Serial.println("This program will calibrate the ESC.");

  motor.attach(MOTOR_PIN);

  Serial.println("Now writing maximum output.");
  Serial.println("Turn on power source, then wait 2 seconds and press any key.");
  motor.writeMicroseconds(MAX_SIGNAL);

  // Wait for input
  while (!Serial.available());
  Serial.read();

  // Send min output
  Serial.println("Sending minimum output");
  motor.writeMicroseconds(MIN_SIGNAL);

}

void loop() {
}
</code>```

答:
What is the problem you're having? You ask, "Can anybody figure out what I'm doing wrong?" but you don't state clearly what your problem is. Will the motors not spin up after? Is anything happening when you do the calibration?

As an FYI, here is an answer on EE stack exchange explaining the basic startup modes for an electronic speed controller. Quoting:

Normal starup [one style of ESC]:

Turn On ESC

minimum throttle

wait 2 seconds

maximum throttle

wait 2 seconds

minimum throttle

wait 1 second

OK to Go

Normal starup [another style of ESC]:

Turn On ESC

minimum

wait 3 seconds

OK to Go

Calibration:

Turn on ESC

maximum

wait 2 sec

minimum

wait 1 sec

OK to go

From that post, typically there's a beep from the ESC between each of these steps (where you're instructed to wait, wait for the beep).

Title: Pure Arduino Quadcopter


问:
3 way check valve
I am working on a micro dispensing system, using syringe pump. The design involves a syringe on top to be moved by stepper motor. There would be one liquid reservoir form which the syringe would pull liquid from, and push it to eject liquid from other end.

When we pull the syringe, the liquid is sucked into the syringe, while the other opening is shut. When the syringe is pushed, the liquid is ejected from the other end.

The quantity of liquid to be dispensed would be very small (400mg) so i am using small syringe of 1 or 2 ml .. as per my measurement, after every 100 dispensing operations, 1 ml syringe would be empty and we would need to pull liquid from the reservoir into the syringe, and do the dispensing again.

My question is, I am unsure about the check valve here. Is there a 'Single' check valve available which would allow this kind of flow to happen ?

答: The dual check valve here should work. </p>

Title: 3 way check valve

Body: The dual check valve here should work.


答:
Two comments:

One, you don't need a double/dual check valve; one on the inlet line and one on the outlet would work. See the image below. You haven't explained why two distinct check valves are less desirable than an all-in-one solution, so I'm suggesting it in the event it was overlooked.

Two, I'm not sure how your measurements add up. You state,

"The quantity of liquid to be dispensed would be very small (400mg)"

and then later you state

after every 100 dispensing operations, 1 ml syringe would be empty.

Assuming the dispensing liquid is anywhere close to water, it will have a density of approximately 1g/cm3, or 1g/mL. So, a 400mg dispensing quantity means your 1mL syringe is empty after 2.5 doses. If you're going to get 100 doses of 400mg in a 1mL syringe, then that means that you've got 100*400 = 40,000mg, or 40g, in the 1mL syringe. That's 40g/mL, or about four times the density of lead.

Title: 3 way check valve

Body:
I am working on a micro dispensing system, using syringe pump. The design involves a syringe on top to be moved by stepper motor. There would be one liquid reservoir form which the syringe would pull liquid from, and push it to eject liquid from other end.

When we pull the syringe, the liquid is sucked into the syringe, while the other opening is shut. When the syringe is pushed, the liquid is ejected from the other end.

The quantity of liquid to be dispensed would be very small (400mg) so i am using small syringe of 1 or 2 ml .. as per my measurement, after every 100 dispensing operations, 1 ml syringe would be empty and we would need to pull liquid from the reservoir into the syringe, and do the dispensing again.

My question is, I am unsure about the check valve here. Is there a 'Single' check valve available which would allow this kind of flow to happen ?


问:
How can I send video from my Arduino camera module video to my Android screen?
I'm trying to connect a camera module to my Arduino Mega, connect my Mega to my Android phone (throught BlueTooth or other), and send the live view of the camera to the mobile phone.

I saw a video online that showed this for still images -- an image captured by the camera module on the Arduino was sent to Android and the output image was viewed after a couple of seconds (the time to send image by BT).

Is this doable with live video instead of image?  If yes, please guide me; if no, please suggest some workarounds.

答:
To answer the question "is it doable", I would say yes.  There is apparently a product called Looxcie that does this, according to this review on Slashgear.

My guess is that it's using BlueTooth's Audio / Video Control Transport Protocol (AVCTP), so you might check for devices and mobile phone software libraries that support AVCTP.


问:
Atlas Robot Reference
Boston Dynamics keeps making great robots, however, I dont see any papers that they publish.  Although now I can find papers on people using the ATLAS robot, I can not find an original paper detailing the robot or its mechanics designs.  Is there a reference for the robot, should I use youtube videos?</p>

答:
I'm sure they publish, and I bet you can't find anything because they're sponsored by the military. When I was in college, any research that was paid for by the military typically came with a rider that our theses and dissertations had to be made private for 1 year, and that was the longest the university would allow them to be withheld. I'm sure if they could have gotten more time they would have demanded it.

That said, Boston Dynamics is a company, and I'm sure they are competing for funding,  so I don't know that they are as comfortable demanding a short time line as a public university would be.

My advice would be to file freedom of information act requests to see if you can get any papers, if you're really that interested.

Title: Atlas Robot Reference


问:
Are operational space and joint space dependent on each other?
Some questions about this, my friends and I argued with this problem.

Are operational space and joint space dependent on each other?

I know that $x_e$ (end effector's pos.) and $q$ (joint var.) can be expressed by an equation with non-linear function $k$:

$x_e = k(q)$

But I don't think that it tells us operational space and joint space are dependent.

答:
What an interesting question.  It's interesting because operational space parameters are the same if a robot is in configuration 1, or configuration 2, or even if it is not present at all.  Similarly, the robot can choose any joint space configuration it desires, independent of any operational space parameters.  So it would seem these two spaces are completely independent.

It is the act of having the robot perform tasks that relates and constrains the two spaces.  Once you task a robot to "move to point A (in operational space)," you have just built an implicit constraint on the robot's joint space such that it must use the $\vec x = K (\vec q)$ kinematics to move to point A.  So any function of operational space tasks $f(\vec x$) gets mapped via inverse kinematics $K^{-1}$ to constrain joint space $\vec q$.


问:
Establishing Data Transfer between two Raspberry Pi's using GPIO
Good day

I am currently implementing an autonomous quadcopter with stereo vision using raspberry Pi. One (Let's call this Pi_1) is responsible for stereo vision the other is responsible for motor control and trajectory planning (Pi_2). I was looking for a way to transfer a 480 element float vector via GPIO from Pi_1 to Pi_2. Pi_1 stereovision program runs at 2Hz while Pi_2 motor control runs at 210Hz.

Is there any protocol fast enough to deliver this amount of information to the second raspberry pi via GPIO?

I am currently looking at SPI but I saw that the Raspberry Pi cannot be turned to a Slave making it not an option. I also looked at UART however it is too slow for my needs. All the I2c ports on the Pi are currently being used by the stereo vision cameras and the IMU's. If the gpio option is not feasible, I am also open for other suggestions such as using other hardware (middle man) or wireless options.

答: The Raspberry Pi's UART interface can handle up to 4Mbps which fits my needs as I am sending a 480 element floating vector from Pi_1 to Pi_2 </p>


问:
How to select cameras for a stereo vision system?
I am in the process of building a stereo vision system to be used on a UGV. The system is for a robot that will be used in a competition wherein the robot is teleoperated to find relatively small colored rocks in a large outdoor field. I understand how to calibrate such a system and process the data for a stereo vision system. I do not however know how to select cameras for such a system. What are the best practices for picking cameras for a stereo vision system?</p>

答:
Off the top of my head I would go by the following selection criteria

color/b&w - usually b&w is better, since the stereo algorithms only use one channel anyway

baseline - this really depends on the scene. With the baseline you control how much accuracy you get with distance. Wider baseline results in higher disparity values and thus less noise on the distance estimation. Higher baseline also means that you will get a reduced overlap between your field of views. Most importantly though, the wider the baseline the harder the matching between the two views. So the quality of the result goes down.

shutter - always use a global shutter for anything with computer vision on mobile robots

resolution - most stereo algorithms are computationally expensive. And you will likely not need that many 3d points. In the near field the sampling density is usually enough, and the far field your error from the low disparity is more of a problem than sampling density. 640x480 is fine in most cases. Some chips have a wider aspect ratio, which is favourable for the overlap, but you can get the same with using a sub-window of your chip.

lens/field of view - for mobile outdoor robots I prefer a wide field of view over narrow field of view. More or less for the same reasons as the resolution. Make sure your lenses are rigid and have a means to fixate any moving parts e.g. like adjustable focal length. In most cases a fixed focal length is fine anyway, since you are limited by the selection of your baseline.

trigger - when you create your own stereo rig, your cameras should support hardware trigger and ideally one should trigger the other.

framerate - In my opinion the least important consideration. Unless you have a lot of processing power you won't be getting much more than something like 5 Hz anyway. So your algorithm is much more likely to be the bottleneck, rather than the chip or the connection.

interface - Most cameras come with Firewire/USB2/USB3/Ethernet. USB2 is useless as it consumes a lot of CPU. Firewire is good if you have a port, but I think it seems to be on the decline in favour of USB3 these days. Didn't have much experience with USB3 yet. Ethernet is quite nice because you are more likely to find embedded systems with GigEthernet than USB3 at the moment.

housing - as rigid as possible. Recalibrating is an annoying procedure.


问:
How difficult it is to build simple robots (for example Line follower) using raspberry pi and ROS?
I want to build a low cost robot, running ROS for educational purposes. It can be a simple line follower using raspberry pi and an IR sensor. Is it overambitious as a beginner project? How difficult is it to make ROS run on custom hardware?

P.S. I am newbie in both robotics and programming and I am more interested in building actual robots than running simulations. Also, I cant afford to buy ROS compatible robots.

答:
It is not extremely difficult to achieve this. It is probably a great way to learn after you complete the main ROS tutorials. Using ROS will get you free joystick or keyboard teleoperation of your bot along potential integration with the ROS navigation stack.

You have the choice of either interfacing with your robot hardware using the GPIO onboard you raspi or using a microcontroller and interfacing that with the computer using rosserial. I would recommend using rosserial and an Arduino because controlling a small robot and reading analog sensors is better documented on the Arduino platform. Either way is totally doable though. Good Luck!


问:
Suggestions on object types (features) to track from ARDrone 2 camera

UPDATE
  I have aded 50 bounty for this question on the StackOverflow

I am trying to implement object tracking from the camera(just one camera, no Z info). Camera has 720*1280 resolution, but I usually rescale it to 360*640 for faster processing.

This tracking is done from the robots camera and I want a system which would be as robust as possible.

I will list what I did so far and what were the results.

I tried to do colour tracking, I would convert image to hsv colour space, do thresholding, some morphological transformations and then find the object with the biggest area. This approach made a fair tracking of the object, unless there are no other object with the same colour. As I was looking for the max and if there are any other objects bigger than the one I need, robot would go towards the bigger one

Then, I decided to track circled objects of the specific colour. However, it was difficult to find under different angles

Then, I decided to track square objects of specific colour. I used this

```<code>       // Approximate contour with accuracy proportional
        // to the contour perimeter
        cv::approxPolyDP(
                cv::Mat(contours[i]),
                approx,
                cv::arcLength(cv::Mat(contours[i]), true) * 0.02,
                true
        );
</code>```

and then I checked this condition

if (approx.size() >= 4 && approx.size() <= 6)

and afterwards I checked for

solidity > 0.85 and aspect ratio between 0.85 and 1.15

But still result is not as robust as I would expect, especially the size. If there are several squares it would not find the needed one.

So, now I need some suggestions on what other features of the object could I use to improve tracking and how? As I mentioned above several times, one of the main problems is size. And I know the size of the object. However, I am not sure how I can make use of it, because I do not know the distance of the object from the camera and that is why I am not sure how to represent its size in pixel representation so that I can eliminate any other blobs that do not fall into that range.

UPDATE

In the third step, I described how I am going to detect squares with specific colour. Below are the examples of what I am getting.

I used this HSV range for the red colour:

Scalar(250, 129, 0), Scalar(255, 255, 255), params to OpenCV's inRange function

HMIN = 250, HMAX = 255; SMIN = 129, SMAX = 255; VMIN = 0, VMAX = 255;
  (Would like to see your suggestions on tweaking this values as well)

So, in this picture you can see the processing; gaussian blurring (5*5),
morphological closing two times (5*5). And the image with the label "result" shows the tracked object (please look at the green square).

On the second frame, you can see that it cannot detect the "red square". The only main difference between these two pics is that I bended down the lid of the laptop (please look closer if you cannot notice). I suppose this happens because of the illumination, and this causes the thresholding to give not desired results.

The only way, I can think of is doing two separate processing on the image. First, to do thresholding based on the colour as I was doing above. Then if I find the object to move to the next frame. If not to use this opencv's find squares method.

However, this method will involve doing too much of processing of the image.

答: You could use ArUco fiducials to demonstrate robust object detection and tracking. From there, you might be able to adapt the fiducial pipeline to detect more generic objects like colored squares.</p>


问:
6D localization with 6 lasers
I have to know where a multi-rotor is, in a rectangular room, via 6 lasers, 2 on each axis.

The problem is like this:

Inputs :

Room : square => 10 meters by 10 meters

6 positions of the lasers : Fixed on the frame

6 orientations of the lasers : Fixed on the frame

The 6 measurements of the lasers

The quaternion from the IMU of my flight controller (PixHawk).

The origin is centered on the gravity center of the multi-rotor and defined as if the walls are perpendicular to each axes (the normal of the wall in X is (-1,0,0))

Output :

Position in 3D (X,Y,Z)

Angular position (quaternion)

Since I got the angular position of the multi-rotor, I rotated the laser positions and orientations via the quaternion, then extrapolate via the 6 measurements and I got the 3 walls. (orientations of the walls are trivial, then only one point is enough to determine its position.

Badly, I noticed that the yaw (rotation about z) measurement from the PixHawk is unreliable. Then I should measure the yaw from the lasers, but I do not success to do it. Event if the 2D problem is easy, I am lost in 3D.

Does someone know if it [Algorithm to know XYZ position and quaternion from 6 measurments] exists somewhere ? Or what is the right way to go on this problem ?

The question : How could I get the yaw from 2 measurements from 2 lasers which I know the original position, orientation and the pitch and roll.

NOTE : Green pointers are the origin position, Red pointers are the "final" position, but could be rotated around the red circle (due to yaw).

答:
Solution : Is there another solution without prerotating vectors ?

I finally got a solution, and here it is.

Python, ROS geometry library, numpy

My actual code/maths in short :

1) Rotate the position & orientation of lasers by roll & pitch. The axes='sxyz' means : Static axis, apply roll, pitch, yaw.

quaternion_matrix creates a 4x4 transformation matrix from the quaternion.

```<code>laser = (1,1,1,0) # laser position
orientation = (1,0,0,0) # laser orientation

roll, pitch, _ = list(euler_from_quaternion(q, axes='sxyz'))
q = quaternion_from_euler(roll, pitch, 0, axes="sxyz")
laser = numpy.dot(quaternion_matrix(q), laser)
orientation = numpy.dot(quaternion_matrix(q), orientation)
</code>```

2) Algebric solution : Rotation around Z in function of yaw

```<code>laser       = [-sin(a)*laser[1] + cos(t)*laser[0],
                cos(t)*laser[1] + sin(t)*laser[0],
                laser[2]]

orientation = [-sin(a)*orientation[1] + cos(t)*orientation[0],
                cos(t)*orientation[1] + sin(t)*orientation[0],
                orientation[2]]
</code>```

3) Algebric solution : Extrapolation from the measurments in function of yaw

Important notice : Since the rotation do not scale vectors, the denominator of the K factor is a constant. Then, we can simplify it by precompute length of the orientation vector.

```<code>M = 100 # distance
K = sqrt(M^2 / (orientation[0]^2 + orientation[01]^2 + orientation[1]^2))
PointOnWall = [ K * orientation[0] + laser[0],
                K * orientation[1] + laser[1],
                K * orientation[2] + laser[2]]
</code>```

4) Algebric solution : From this, on two laser, get walls.

The two "PointOnWall" equations should gives enough data to get the yaw. Knowing this is a (-1,0,0) normale, I can find 2 planes from the two points :

5) Algebric solution : Measure the YAW.

One plane in the other (Via XMaxima), we got :

```<code>def getYaw(position1, orientation1, measure1, position2, orientation2, measure2):
    length1 = length(orientation1)
    length2 = length(orientation2)
    k1 = measure1/length1
    k2 = measure2/length2
    numerator   = -k2*orientation2[0] + k1*orientation1[0] + position1[0] - position2[0]
    denominator = -k2*orientation2[1] + k1*orientation1[1] + position1[1] - position2[1]
    return atan(numerator/denominator)
</code>```

As expected, roll & pitch DO NOT interfere, since the positions and orientations are prerotated.

Title: 6D localization with 6 lasers

Body:
Solution : Is there another solution without prerotating vectors ?

I finally got a solution, and here it is.

Python, ROS geometry library, numpy

My actual code/maths in short :

1) Rotate the position & orientation of lasers by roll & pitch. The axes='sxyz' means : Static axis, apply roll, pitch, yaw.

quaternion_matrix creates a 4x4 transformation matrix from the quaternion.

laser = (1,1,1,0) # laser position
orientation = (1,0,0,0) # laser orientation

roll, pitch, _ = list(euler_from_quaternion(q, axes='sxyz'))
q = quaternion_from_euler(roll, pitch, 0, axes="sxyz")
laser = numpy.dot(quaternion_matrix(q), laser)
orientation = numpy.dot(quaternion_matrix(q), orientation)

2) Algebric solution : Rotation around Z in function of yaw

laser       = [-sin(a)*laser[1] + cos(t)*laser[0],
                cos(t)*laser[1] + sin(t)*laser[0],
                laser[2]]

orientation = [-sin(a)*orientation[1] + cos(t)*orientation[0],
                cos(t)*orientation[1] + sin(t)*orientation[0],
                orientation[2]]

3) Algebric solution : Extrapolation from the measurments in function of yaw

Important notice : Since the rotation do not scale vectors, the denominator of the K factor is a constant. Then, we can simplify it by precompute length of the orientation vector.

M = 100 # distance
K = sqrt(M^2 / (orientation[0]^2 + orientation[01]^2 + orientation[1]^2))
PointOnWall = [ K * orientation[0] + laser[0],
                K * orientation[1] + laser[1],
                K * orientation[2] + laser[2]]

4) Algebric solution : From this, on two laser, get walls.

The two "PointOnWall" equations should gives enough data to get the yaw. Knowing this is a (-1,0,0) normale, I can find 2 planes from the two points :

5) Algebric solution : Measure the YAW.

One plane in the other (Via XMaxima), we got :

def getYaw(position1, orientation1, measure1, position2, orientation2, measure2):
    length1 = length(orientation1)
    length2 = length(orientation2)
    k1 = measure1/length1
    k2 = measure2/length2
    numerator   = -k2*orientation2[0] + k1*orientation1[0] + position1[0] - position2[0]
    denominator = -k2*orientation2[1] + k1*orientation1[1] + position1[1] - position2[1]
    return atan(numerator/denominator)

As expected, roll & pitch DO NOT interfere, since the positions and orientations are prerotated.


答:
I will attempt to answer slightly more than your question in order to expose you to alternative tracking methods.
Note that what you are doing is essentially trying to locate and classify a certain object in an image. To do this robustly generally you need to have some training images and a label image that has each pixel labeled 0 or 1, where the pixels that are 1 are the object to be tracked. This is often done by hand. The training and label images are used to calculate a histogram of all the features of the object of interest, and those histograms are used either for simple range-based thresholding, or for use in a machine learning algorithm.

The following rely on having somehow located a region of interest that you want to describe. These ROIs may have been found by using the opencv::findContours function, or even randomly, or by testing a [100x100] window in a grid of every [60x60] pixels.

Shape descriptions: Area, perimeter, convexity, centroid, mean and standard deviation of distance of each pixel from centroid, skeleton length

Colour descriptions: mean, standard deviation, range, skew and kurtosis of intensities.

Texture descriptions: gabor filters response, standard deviation of intensities (in a local window)

Most of these are implemented in the python library scikit-image in the measure module.

In any case you will need to do the above on a 1-channel image.
That may be just a single R/G/B channel, or combined into a grayscale channel, or for instance the (R - 0.5*(G + B)) channel if you were tracking for instance red apples.

Regardless of your detection method, it would be useful to track the object in pixel space with a Kalman Filter (KF). This would then give you additional spatial features which would be the difference between each contour centroid, and the expected position of the contour that the KF estimated.

Title: Suggestions on object types (features) to track from ARDrone 2 camera

Body:
UPDATE
  I have aded 50 bounty for this question on the StackOverflow

I am trying to implement object tracking from the camera(just one camera, no Z info). Camera has 720*1280 resolution, but I usually rescale it to 360*640 for faster processing.

This tracking is done from the robots camera and I want a system which would be as robust as possible.

I will list what I did so far and what were the results.

I tried to do colour tracking, I would convert image to hsv colour space, do thresholding, some morphological transformations and then find the object with the biggest area. This approach made a fair tracking of the object, unless there are no other object with the same colour. As I was looking for the max and if there are any other objects bigger than the one I need, robot would go towards the bigger one

Then, I decided to track circled objects of the specific colour. However, it was difficult to find under different angles

Then, I decided to track square objects of specific colour. I used this

```<code>       // Approximate contour with accuracy proportional
        // to the contour perimeter
        cv::approxPolyDP(
                cv::Mat(contours[i]),
                approx,
                cv::arcLength(cv::Mat(contours[i]), true) * 0.02,
                true
        );
</code>```

and then I checked this condition

if (approx.size() >= 4 && approx.size() <= 6)

and afterwards I checked for

solidity > 0.85 and aspect ratio between 0.85 and 1.15

But still result is not as robust as I would expect, especially the size. If there are several squares it would not find the needed one.

So, now I need some suggestions on what other features of the object could I use to improve tracking and how? As I mentioned above several times, one of the main problems is size. And I know the size of the object. However, I am not sure how I can make use of it, because I do not know the distance of the object from the camera and that is why I am not sure how to represent its size in pixel representation so that I can eliminate any other blobs that do not fall into that range.

UPDATE

In the third step, I described how I am going to detect squares with specific colour. Below are the examples of what I am getting.

I used this HSV range for the red colour:

Scalar(250, 129, 0), Scalar(255, 255, 255), params to OpenCV's inRange function

HMIN = 250, HMAX = 255; SMIN = 129, SMAX = 255; VMIN = 0, VMAX = 255;
  (Would like to see your suggestions on tweaking this values as well)

So, in this picture you can see the processing; gaussian blurring (5*5),
morphological closing two times (5*5). And the image with the label "result" shows the tracked object (please look at the green square).

On the second frame, you can see that it cannot detect the "red square". The only main difference between these two pics is that I bended down the lid of the laptop (please look closer if you cannot notice). I suppose this happens because of the illumination, and this causes the thresholding to give not desired results.

The only way, I can think of is doing two separate processing on the image. First, to do thresholding based on the colour as I was doing above. Then if I find the object to move to the next frame. If not to use this opencv's find squares method.

However, this method will involve doing too much of processing of the image.


答:
From netHAT, you can find an EtherCAT shield for the Raspberry Pi:

The netHAT module developed by Hilscher adds the RaspberryPi® RealTime-communication. This enables the RaspberryPi® to be used as a slave in a PROFINET network. But not only PROFINET is possible, all other common real-time Ethernet networks such as Ethernet / IP or EtherCAT could be supported. The protocol stacks are preconfigured to 32 input and output bytes, that can be exchanged with the PLC. Hilscher provides everything which is necessary for the communication with the PLC, device description files, firmware and application example. Just attach the module and start to communicate.

Title: Why cannot we find EtherCAT shields?

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


问:
Blade 180QX :What does this red wire do?
I have a Blade 180QX quadrotor / quadcopter and I had to move a red wire shoved under the circuit board when I fixed a broken power wire. Now the red wire shown out straight from the circuit board is not in the right configuration - or at least as it was. If I understood what it was for I might know how to place it. Is this a horizon sensor (temperature)?
Ever since I had to move this wire, the quadrotor goes unstable when flying. The only appreciable change is the wire POSITION.
The red wire was not attached anywhere else on the board. It was shoved under the circuit board inside the battery holder.

答: That's not a wire, it is the antenna, which hangs loose from the side of the quad. Only one end of the antenna is soldered to the board.</p>


问:
How to guide a camera through a circular tube?
Let's say I have a 6-DOF flying camera and I want to make it move through a circular tube autonomously and let's suppose that the camera and the system that makes it fly are considered to be just a point in space. Which feature of the image I get from the camera can I use to move the camera appropriately, that is to get in one end of the tube and get out from the other?

For example, I thought I could use edge detection. As the camera moves forward through the tube, due to the fact that its far plane is not infinitely away, there is a dark circle forming where the camera sees nothing surrounded by the walls of the tube. I think that "preserving" this circle might be the way to go (for example if it becomes an ellipse I have to move the camera accordingly for it to become a circle again), but what are the features that will help me "preserve" the circle?

I would like to use image-based visual servoing to do that. However, what troubles me is the following. In most visual-servoing applications I have seen, the control objective is to make some features "look" in a certain way from the camera point of view. For example, we have the projections of 4 points and we want the camera to move accordingly so that the projections' coordinates have some specific values. But the features are actually the same.

In my case I thought that for example I could say that I want the projections of the 4 "edge points" of the circle/ellipse to take specific values so that they define a circle centered at the fov of the camera. But if the camera moves to achive this setup of features, then the 4 new "edge points" will correspond to the projections of 4 different real points of the pipe and the theory collapses. Am I right to think that? Any way to get past it?

Any oher ideas or relevant literature?

答:
If you cannot sense your closeness to the wall of the cylinder, then the image itself will have to guide you.

When the end of the cylinder is completely within the field of view of the camera, I think your approach is good.  When the circle becomes an ellipse that means the focal plane of the camera is skewed relative to the end of the pipe, and you will need to correct the UAV's orientation.  You will also need to ensure the center of the circle, or centroid of the ellipse, is centered in the camera's image space.   When it is not centered, you will need to compensate the UAV's position.

Be prepared for the circle to become an ellipse with ANY orientation in the camera's image.  That is, it won't always have the long axis of the ellipse aligned with one of your camera axes.

Finally, what will you do when you are so close to the end of the pipe that the circle is larger than your camera's field of view?   That is where your approach breaks down.   Is it possible to use a second, reward-pointing camera to keep you going straighr?

EDIT

Based on your comment, be careful about the object you are looking for obscuring some of the circle/ellipse at the end of the pipe.  You might end up having to modify your vision processing algorithm to allow for blockage of part of the pipe end.  In that case, you need at least five points on the ellipse, to determine the coefficients of the ellipse.  If the object is small and the diameter of the pipe is large, this should not be a problem.  But we don't know from the question.


问:
Papers on Algorithms in Robotics
I'm a CS student and I need to give a 30-minute lecture about 1-2 papers describing 1-2 algorithms for any of the main problems in Robotics (navigation, coverage, patrolling, etc.).

I have no background in Robotics specifically, but I did take classes such as Algorithms and AI (including some basic AI algorithms such as A*, IDS, UCS, and subjects such as decision trees, game theory, etc.).
The difference between simply describing one of the above is that I need the paper to refer to actual physical robots and their algorithms, with real problems in the physical world, as opposed to AI "agents" with more theoretical algorithms.

I am required to lecture on 1-2 academic papers, published from 2012 onward, with a "respectable" amount of citations. Any suggestions of such papers would be greatly appreciated!

答: You might like the algorithms run on PR-2 robot. Two papers I can think of are "A single planner for a composite task of approaching, opening and navigating through non-spring and spring-loaded doors" and "Motion planning for smooth pickup of moving objects". Both can be found on IEEE Xplore.</p>

Title: Papers on Algorithms in Robotics


问:
Mobile phone power packs
For my robotics project I would like to utilise readily available mobile phone 'power banks' to simplify the power system for my robot. However, such power banks output 5V, great for the logic systems but not for the motors.

I was wondering if I could wire the outputs of two power banks in series and get 10V or is this a very bad idea? Should I wire them in parallel and use a boost converter? Is a custom solution using 'ordinary' Li-Po batteries and associated charging circuit the best answer?

Additional Information:

This will be a two wheeled robot.

5V Logic

7+V Motor driver

Power Banks: 5V 2.1Amp 2100mAh

答:
Go ahead and use the phone battery for your logic supply.  Then, series wire individual, high current L-ion cells to make your motor battery.  It's good practice to keep the noisy, high-current stuff on a different buss, away from your processor.

Invest in a smart (processor driven) charger that can monitor the voltage of each cell and charge them evenly.  It can also detect a cell that is weak.  Weak cells charge and discharge very quickly, and they must be removed from the battery.

DC/DC converters are not very efficient.  They generate their own noise on the source and sink sides.  And, they get expensive for the current levels required by a pair of motors.

Title: Mobile phone power packs


答:
If 5V blocks were your only option, then I would say "yes, this is fairly safe" with the caveats:

If one cell discharges faster than the other, it will start to deteriorate much faster than the other -- it will last for fewer recharge cycles

You should re-charge them separately, not in series

However, if you're looking for an off-the-shelf 10V lithium-ion battery pack, you should consider the 10.8V batteries that are available in many models of cordless drills.

Title: Mobile phone power packs

Body:
For my robotics project I would like to utilise readily available mobile phone 'power banks' to simplify the power system for my robot. However, such power banks output 5V, great for the logic systems but not for the motors.

I was wondering if I could wire the outputs of two power banks in series and get 10V or is this a very bad idea? Should I wire them in parallel and use a boost converter? Is a custom solution using 'ordinary' Li-Po batteries and associated charging circuit the best answer?

Additional Information:

This will be a two wheeled robot.

5V Logic

7+V Motor driver

Power Banks: 5V 2.1Amp 2100mAh


答:
The visual servoing will probably be sufficient for keeping the open end of the tube in view -- keeping the proper orientation of the vehicle with respect to the tube.  The goal will be to keep the center of the detected circle in the center of the camera's view.

However, this technique will not be sufficient to tell you how far you are from the edges of the tube.  In theory, yes -- but in practice you won't have enough precision to detect the slightly misshapen circle before you crash into the side wall.

Simple horizontal range finding might be the best (safest and most accurate) way to maintain your distance from the walls.

Title: How to guide a camera through a circular tube?

Body:
Let's say I have a 6-DOF flying camera and I want to make it move through a circular tube autonomously and let's suppose that the camera and the system that makes it fly are considered to be just a point in space. Which feature of the image I get from the camera can I use to move the camera appropriately, that is to get in one end of the tube and get out from the other?

For example, I thought I could use edge detection. As the camera moves forward through the tube, due to the fact that its far plane is not infinitely away, there is a dark circle forming where the camera sees nothing surrounded by the walls of the tube. I think that "preserving" this circle might be the way to go (for example if it becomes an ellipse I have to move the camera accordingly for it to become a circle again), but what are the features that will help me "preserve" the circle?

I would like to use image-based visual servoing to do that. However, what troubles me is the following. In most visual-servoing applications I have seen, the control objective is to make some features "look" in a certain way from the camera point of view. For example, we have the projections of 4 points and we want the camera to move accordingly so that the projections' coordinates have some specific values. But the features are actually the same.

In my case I thought that for example I could say that I want the projections of the 4 "edge points" of the circle/ellipse to take specific values so that they define a circle centered at the fov of the camera. But if the camera moves to achive this setup of features, then the 4 new "edge points" will correspond to the projections of 4 different real points of the pipe and the theory collapses. Am I right to think that? Any way to get past it?

Any oher ideas or relevant literature?


问:
ROS tutorials no longer working
Has anyone ever run into a case where a fresh install of ROS cannot run its tutorial packages?

I am running ROS Indigo on an nVidia Jetson TK1, using the nVidia-supplied Ubuntu image. I just did a fresh install, Ubuntu and ROS, just to keep things clean for this project. I am building a kind of 'demo-bot' for some students I will be teaching; it will use both the demo files and some of my own code. Now, after setting things up, I try to run the talker tutorial just to check to make sure that everything is running, and rospack is pretty sure that the tutorials don't exist.

For example, inputting this into the terminal

```<code>rosrun rospy_tutorials talker
</code>```

Outputs

```<code>[rospack] Error: package 'rospy_tutorials' not found
</code>```

This is the case for every tutorial file; python and C++. Now, I am sure the tutorials are installed. I am looking right at them in the file system, installed from the latest versions on github. So I think it is something on ROS' side of things.

Has anyone ever bumped into something similar before, where a ROS package that supposedly was installed correctly isn't found by ROS itself? I would rather not have to reinstall again if I can avoid it.

EDIT #1

After playing with it some more, I discovered that multiple packages were not running. All of them - some turtlebot code, and some of my own packages - returned the same error as above. So I suspect something got messed up during the install of ROS.

roswtf was able to run, but it did not detect any problems. However, going forward.

EDIT #2

I double checked the bashrc file. One export was missing, for ROS directory I was trying to work within. Adding it did not solve the problem.

I am still looking for a solution, that hopefully does not involve reflashing the TK1.

EDIT #3

Alright, so I've been poking at this for a few days now and pretty much gave up trying to get ROS to work correctly, and decided a re-flash was necessary. But I think I found something when I booted up my host machine. In my downloads folder, I have the v2.0 and the v1.2 JetPack. I know I used the v2.0 for this latest install, and it has been the only time I have used it (it provides some useful updates for OpenCV and bug fixes, among other things). I'm going to re-flash using the v1.2 JetPack this time, see if things behave better with ROS under that version. Its a long shot, but it is all I have to work with at the moment, and it shouldn't lose any ROS capabilities (aside from some of the stuff I wanted to do with OpenCV). I'll update everyone if that seems to work.

EDIT #4

Ok, everything seems to be working now. The problem does seem to be an issue with Jetpack v2.0. I suspect that some change, somewhere between v1.2 and v2.0 (made to accommodate the new TX1 board), messes with running ROS indigo on a TK1. I'm going to be a more detailed explanation in an answer to this question.

答:
After wrestling with this one for almost a week, I believe I have found the cause; and unfortunately the only solution seems to be a re-flash.

The problem was ROS didn't seem to be linking properly to some of the shared resources (specifically, rospy or roscpp tutorials) and did not want to work with packages I had developed myself or downloaded from code repositories like Github or Bitbucket. After a few days of playing with it, and two reflashes, I believe I found the issue: Jetpack v2.0 (though I do not know the exact details).

roswtf did not find any issues, and I had already checked the exports and sources in the .bashrc file through:

```<code>gedit ~/.bashrc
</code>```

I was looking right at the tutorial folders for rospy_tutorials and roscpp_tutorials, in the right folder /opt/ros/indigo/share/. Even the individual code files within could be opened and editted. I first wanted to make sure that it wasn't the way I configured ROS, I did a couple uninstalls/reinstalls of ROS itself (leaving Ubuntu in place). I tried two methods:

First

According to this ros.answers' question about removing ROS

```<code>sudo apt-get purge ros-*
sudo apt-get autoremove
</code>```

Second

Following a different ros.answers' question as a guide

```<code>sudo apt-get purge ros-*
</code>```

Neither of these seemed to allow ROS to be installed and configured properly. So I booted up my host to re-flash, and I realized something: I had both Jetpack v1.2 and Jetpack v2.0 in my downloads folder - and I knew that I had used v2.0 for this latest flash (it provided some graphical fixes and bug fixes for OpenCV4Tegra that I thought would be helpful for what I wanted to do). The critical different between Jetpack v1.2 and v2.0 is that v2.0 was released to add support for the new TX1 development board. The TX1 uses a new, 'more standard' ARM-CPU, while the TK1 uses an ARM-CPU that was designed/heavily modified by nVidia (if I am not mistaken about my understanding of these two CPUs). They are also using different GPUs, but I suspect this was less of an issue, since I hadn't gotten to any code that utilized the GPU.

Solution

I re-flashed using Jetpack v1.2

After reflashing, I installed the Grinch Kernel following the instructions on the nVidia devtalk forums, and then installed ROS manually. Normally I just use the scripts provided by Jetsonhacks on their Github, but I wanted to see everything happening this time around. So I followed the instructions on the wiki.ros. Now, when installing ROS on an ARM-based platform or other embedded system, the desktop version WILL NOT install. I suspect something in the desktop version is looking for an x86 CPU, and it prevents the simulations (among other things) from installing correctly. Instead, what you can do is

```<code>sudo apt-get install ros-indigo-robot
</code>```

This will install what is the 'most complete' (and appropriate, in my opinion) version of ROS for the TK1 if you are developing onboard and not cross-compiling your code. I do not believe using the robot variant of ROS prevents you from cross-compiling if you feel like it. The robot variant does not include (most of) the GUI components of ROS, you'll have to install those manually as you find yourself in need of them. I'm guessing the GPU and the GUI components aren't really sure what to do with one another in this case. The robot variant also does not install the tutorials (the broken thing that started this whole mess) either. Those will need to be installed with

```<code>sudo apt-get install ros-indigo-ros-tutorials
</code>```

Once those are installed, start roscore in one terminal window, and type (in a separate terminal window):

```<code>rosrun rospy_tutorials talker
</code>```

This will start the roscore processes, and the python talker program should start up just fine. All the other tutorials and packages also seem to work as well now too.

Jetpack v2.0

So I guess lesson learned? If you are planning on running ROS on a TK1, don't use v2.0 of the Jetpack. Not sure what is going on, but I am going to send what I did learn to nVidia and hope that v2.1 fixes the issues. Unfortunately, this amounts more to 'symptoms' than any actual causes. My guess it is a case of two different, highly specialized, experimental pieces of software just not knowing how to play nice together. There is always bound to be some issues. In the mean time, if you're like me, stick to v1.2 of the Jetpack, and you should be fine.

Title: ROS tutorials no longer working

Body:
After wrestling with this one for almost a week, I believe I have found the cause; and unfortunately the only solution seems to be a re-flash.

The problem was ROS didn't seem to be linking properly to some of the shared resources (specifically, rospy or roscpp tutorials) and did not want to work with packages I had developed myself or downloaded from code repositories like Github or Bitbucket. After a few days of playing with it, and two reflashes, I believe I found the issue: Jetpack v2.0 (though I do not know the exact details).

roswtf did not find any issues, and I had already checked the exports and sources in the .bashrc file through:

gedit ~/.bashrc

I was looking right at the tutorial folders for rospy_tutorials and roscpp_tutorials, in the right folder /opt/ros/indigo/share/. Even the individual code files within could be opened and editted. I first wanted to make sure that it wasn't the way I configured ROS, I did a couple uninstalls/reinstalls of ROS itself (leaving Ubuntu in place). I tried two methods:

First

According to this ros.answers' question about removing ROS

sudo apt-get purge ros-*
sudo apt-get autoremove

Second

Following a different ros.answers' question as a guide

sudo apt-get purge ros-*

Neither of these seemed to allow ROS to be installed and configured properly. So I booted up my host to re-flash, and I realized something: I had both Jetpack v1.2 and Jetpack v2.0 in my downloads folder - and I knew that I had used v2.0 for this latest flash (it provided some graphical fixes and bug fixes for OpenCV4Tegra that I thought would be helpful for what I wanted to do). The critical different between Jetpack v1.2 and v2.0 is that v2.0 was released to add support for the new TX1 development board. The TX1 uses a new, 'more standard' ARM-CPU, while the TK1 uses an ARM-CPU that was designed/heavily modified by nVidia (if I am not mistaken about my understanding of these two CPUs). They are also using different GPUs, but I suspect this was less of an issue, since I hadn't gotten to any code that utilized the GPU.

Solution

I re-flashed using Jetpack v1.2

After reflashing, I installed the Grinch Kernel following the instructions on the nVidia devtalk forums, and then installed ROS manually. Normally I just use the scripts provided by Jetsonhacks on their Github, but I wanted to see everything happening this time around. So I followed the instructions on the wiki.ros. Now, when installing ROS on an ARM-based platform or other embedded system, the desktop version WILL NOT install. I suspect something in the desktop version is looking for an x86 CPU, and it prevents the simulations (among other things) from installing correctly. Instead, what you can do is

sudo apt-get install ros-indigo-robot

This will install what is the 'most complete' (and appropriate, in my opinion) version of ROS for the TK1 if you are developing onboard and not cross-compiling your code. I do not believe using the robot variant of ROS prevents you from cross-compiling if you feel like it. The robot variant does not include (most of) the GUI components of ROS, you'll have to install those manually as you find yourself in need of them. I'm guessing the GPU and the GUI components aren't really sure what to do with one another in this case. The robot variant also does not install the tutorials (the broken thing that started this whole mess) either. Those will need to be installed with

sudo apt-get install ros-indigo-ros-tutorials

Once those are installed, start roscore in one terminal window, and type (in a separate terminal window):

rosrun rospy_tutorials talker

This will start the roscore processes, and the python talker program should start up just fine. All the other tutorials and packages also seem to work as well now too.

Jetpack v2.0

So I guess lesson learned? If you are planning on running ROS on a TK1, don't use v2.0 of the Jetpack. Not sure what is going on, but I am going to send what I did learn to nVidia and hope that v2.1 fixes the issues. Unfortunately, this amounts more to 'symptoms' than any actual causes. My guess it is a case of two different, highly specialized, experimental pieces of software just not knowing how to play nice together. There is always bound to be some issues. In the mean time, if you're like me, stick to v1.2 of the Jetpack, and you should be fine.


答:
My solution is a workaround.

I do not send the relatively large image frames via Bluetooth but I use the Android phone with OpenCV to shoot the live video and direct the Arduino via Bluetooth with a few short commands after image processing. The phone is located near the Arduino just as an Arduino connected camera would be.

If you want to see the images - or some processed version of them - remotely you can use another phone connected to camera phone via a second Bluetooth connection.

I am not ready with the above, a Mindstorms NXT, Android, OpenCV version is here.

Title: How can I send video from my Arduino camera module video to my Android screen?

Body:
I'm trying to connect a camera module to my Arduino Mega, connect my Mega to my Android phone (throught BlueTooth or other), and send the live view of the camera to the mobile phone.

I saw a video online that showed this for still images -- an image captured by the camera module on the Arduino was sent to Android and the output image was viewed after a couple of seconds (the time to send image by BT).

Is this doable with live video instead of image?  If yes, please guide me; if no, please suggest some workarounds.