问:
EKF over-correcting?
I've been implementing an extended kalman filter, following Thrun's Probabilistic Robotics implementation. I believe my correct step may be wrong, as the state appears to be corrected far too much.

Here's a screen capture showing the issue https://youtu.be/gkSpFK27yvg

Note, the bottom status reading is the 'corrected' pose coordinates.

This is my correct step:

```<code>    def correct(self, reobservedLandmarks):
    for landmark in reobservedLandmarks:
        storedLandmark = self.getLandmark(landmark.id)

        z = Point(landmark.dist, math.radians(landmark.angle))
        h, q = self.sensorModel(storedLandmark)

        inv = np.array([[z.x-h.x], [wrap_radians(z.y-h.y)]])

        JH = np.zeros([2, 3 + (self.landmarkCount*2)])
        JH[1][2] = -1.0/q

        JH[0][0] = -((self.X[0] - storedLandmark.x) / math.sqrt(q))
        JH[0][1] = -((self.X[1] - storedLandmark.y) / math.sqrt(q))
        JH[1][0] = (storedLandmark.y - self.X[1]) / q
        JH[1][1] = -((storedLandmark.x - self.X[0]) / q)

        JH[0][3+(landmark.id*2)] = -JH[0][0]
        JH[0][4+(landmark.id*2)] = -JH[0][1]
        JH[1][3+(landmark.id*2)] = -JH[1][0]
        JH[1][4+(landmark.id*2)] = -JH[1][1]

        R = np.array([[landmark.dist*self.sensorDistError, 0],[0, self.sensorAngleError]])

        Z = matmult(JH, self.P, JH.T) + R
        K = matmult(self.P, JH.T, np.linalg.inv(Z))

        self.X = self.X + matmult(K, inv)
        self.P = matmult((np.identity(self.X.shape[0]) - matmult(K, JH)), self.P)
</code>```

h = The range and bearing of state landmark.

q = (landmark.x - self.X[0])^2 + (landmark.y - self.X[1])^2

My sensor covariance errors are 1cm per meter, and pi/180 for the bearing. My assumption was that the correction should be relative to the size of the robot's pose error. Which is very small in this example, as it only moved forward less than 30cm.

Is the kalman gain applied correctly here, and if yes, what other factors would result in this 'over-correcting'?

Thanks.

答:
I think you have a number of errors:

Your R matrix is the covariance of the measurement.  You are using a diagonal matrix which is fine.  The elements along the diagonal should be the variance of each input variable.  It looks like you are passing a deviation instead.  You would need to square those values to turn them into variances.

Your Jacobians look wrong.  The matrix terms should be the derivatives of the measurement variables with respect to the state variables.  Your measurement variables are range and bearing, not x and y.  You should end up with some trig functions in your Jacobian matrix due to the rotation of the robot.  The bearings are measured relative to the heading of the robot so you should have a rotation in the measurement function to cancel the rotation of the robot.  The Jacobian for the landmark variables is also more complex as q is not static with changes in self.X.

Edit:

I looked some more at your Jacobians.  I actually think they are pretty close.  The J[1][2] term should just be -1.0 I think which it sounds like you have already fixed.  I think you might have a sign error in JH[0][0] and JH[0][1].  I was coming up with the negative of the expression you have.  I find calculating the derivatives for the Jacobians to be error prone as I have trouble seeing my own errors for any mistakes I make.  I always try to test my Jacobians with a small test function to make sure I did it right.  This is very easy to do by comparing the analytical Jacobian versus numerical derivatives.  You can trivially calculate the numerical derivatives via (f(x+dx) - f(x))/dx for an appropriate delta dx doing each input variable separately.  Appropriate here means small enough to be a local value and large enough to not run into numerical error.

Title: EKF over-correcting?


问:
Micro Quadcopter PID problem
I designed a mini quadcopter which is about 4.5x4.5cm(Main Body). The main body is the PCB.

![enter image description here][1]

It weighs about ~20 grams with the battery. I'm using the MPU6050 with the DMP using the i2cDevLib. I am using raw radians for pitch, roll, and yaw these measures are read from the MPU6050's DMP. The motors are attached to the body using electrical tape(Black thing  around motors). The motors are 8.5mm in diameter and are driven by a n-channel mosfet. The mode of control right now is bluetooth(HC-05 module). The code being used is my own.
I have a control loop on all axes, the pitch and roll have the same values since the quadcopter is symmetrical. The problem I have is that PID tuning is next to impossible, the best I got was a ~2 second flight ([Video in slow-motion][2]).

At first I was using my own code for the control loop, but it wasn't as effective as the Arduino PID library.

The output of the PID loops are mapped to -90 to 90 on all axes. This can be seen in the code

```<code>myPID.SetOutputLimits(-90, 90); //Y angle
myPID1.SetOutputLimits(-90, 90); // X angle
myPID2.SetOutputLimits(-90, 90); // Yaw angle
myPID.SetMode(AUTOMATIC);
myPID1.SetMode(AUTOMATIC);
myPID2.SetMode(AUTOMATIC);
</code>```

My full code is below, but what do you think the problem is?

Code

http://pastebin.com/cnG6VXr8

答: It could be a number of things.  You are clearly in a positive feedback loop.  You can see this with the way the amplitude of the oscillation increases with time in your video.  The most likely problem is that your gain is too high.  You should be able to get flight that doesn't crash quickly with just P control.  I would start with zero I and D and a low P value, then ramp up P value to get reasonable responsiveness without too much overshoot, then increase I to remove steady state error, and throw in a little D if necessary to reduce overshoot.  You probably won't even need D if you back off the aggressiveness of P and I.  Measuring the derivative of the error can also have a lot of noise in it.</p>

ContentLicense: CC BY-SA 3.0

Title: Micro Quadcopter PID problem


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

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

答:
It really depends on the project.

For a line follower robot ( in your case ), using the Atmel's AVR series is the best choice. Specially ATMEGA16 or even ATMEGA32.

Because the line-follower is a small project and the Arduino is too much for it. And the other advantage of Atmega16 is that it is cheap. If it is broken or faulty then you can change it easily. and it also provides PWM for controlling the speed of motors.

So with atmega series you can build the most powerful line-follower . No need to spend money on getting prebuilt boards and ...


问:
Standalone (or capable of being) Robotics Simulator
I'm a software engineer who volunteers with a non-profit that introduces young girls to technology. We have recently been talking about methods of introducing these children to the world of robotics, and I am curious what types of low-cost options we have.

One very appealing idea would be to have an online simulator, or (more preferable) an off-line standalone-simulator that we can build and program simple robots with. Perhaps nothing more than dragging components together, and then programming the interactions between those components.

What solution(s) exist that I might be able to make use of in our outreach?

答:
RobotC has a simulator available, although both are products at some costs. However, they are very geared towards younger students and education. This would be the easiest, and most appropriate route if costs are not a blocking factor (around \$100 per license for both for single user, \$300 for 6 users, \$600 for 30 users).

If you buy the student version ROBOTC for MINDSTORMS NXT of LEGO the price can be 49\$ for each or 40$ (more than 20 licences)


问:
Quadcopter frame design
Quadcopter frames seem to consistently follow the same X design. For example:

I'm curious to know why that is. It certainly seems like the most efficient way to use space but is it the only frame design that would work for quadcopters?

For instance, would a design like this work?

Why or why not?

答: A frame in that configuration or any other witch holds the props in a square without being unbalanced would work, the reason that most people do it with cross bars is because the FC batteries and ESCs must go somewhere. For your proposed solution you would have to balance all of that equipment around the ring running power and control lines all around possible causing interference and inefficiencies. Not to say it doesn't or couldn't work, but it will not be ideal. </p>

Title: Quadcopter frame design


问:
How to calculate Euler Angles from gyroscope output?
I am using a tri-axis accelerometer and tri-axis gyroscope to measure the linear acceleration of a body. I need to get the orientation of the body in euler form in order to rotate the accelerometer readings from the body frame into the earth frame. Please help I'm so stuck</p>

答:
First you need to integrate the output from the gyro to get the actual X, Y and Z angles.

angleX = gyroAngleX + gyroInputX
angleY = gyroAngleY + gyroInputY

However this value will drift over time so you will need to use a complementary filter or kalman filter. Personally, I would recommend a complementary filter because it is much simpler to implement.

First you must find the angle from the accelerometer using a little bit of trigonometry.

accelAngleX = atan2(accelY, accelZ) * 180/M_PI;
accelAngleY = atan2(-accelX, sqrt(accelY*accelY + accelZ*accelZ)) * 180/M_PI;

Then get the actual angle using this formula.

angleX = 0.98*angleX + 0.02*accelAngleX
angleY = 0.98*angleY + 0.02*accelAngleY

The variables above must be the same variables used when calculating the gyro angle. The 0.98 and 0.02 can be tuned to get the best output, but they should always add up to one.


问:
Shallow underwater wireless sensor network
I need to make shallow (max 2m) underwater wireless sensor network. Data payload is about 10kB/s. I know that VLF band (~3-30kHz)could be the best solutions for that, but cause of time-to-market I cannot make hardware and software from the ground.

Maybe someone could share own-self experience in this filed.
If band 100-900MHz could be enough to send 10kB/s from one device to another - from 2m underwater to over a dozen cm from water surface?
 Maybe some IC for ultrasonic communication exist?
 Another ideas?

答:
There are plenty of solutions for underwater communication. Here is an example - http://www.dspcomm.com/products_aquacomm.html

You can also make one using underwater radios that divers use to communicate. Perhaps coupling a pair of them with a voice modem to keep them in the right frequency range might do the trick. Here is an example of a diver comm http://www.scuba.com/US/scuba-gear-168/131893/Ocean-Reef-GSM-G.divers-Wireless-Diver-Communication-Unit.html?gclid=CjwKEAjwjKOpBRChjsTyicbFy3QSJADP1gTNEDQ5dheaIjcUQWq4ouOJgy7uYA8azzrWg5KCf6PPrhoCrRbw_wcB

One of the problems you may encounter when designing or choosing a system is that high frequency which is necessary for high bandwidth communication is more prone to attenuation in water especially salt water. You maybe limited to some few hundred feet range with Ghz range. There are acoustic modems that use sonic waves to communicate which have longer range but do not have a decent bandwidth.


问:
Euler’s Method Or ode45 for solving ODE for control systems
The dominant approach for solving ODE in control systems books is ode45 since the majority of these books use Matlab. I'm not acquainted with how the ode45 works but lately I started reading about Euler's method in this book Numerical Methods for Engineers. If the step size is very small, then the results are satisfactory. For simulation, one can actually set the step size to be very small value. I've used ode45 in here for regulation and tracking problems. I faced some difficulties for using ode45 for tracking problem since the step size is not fixed. Now for the same experiment, I've used the Euler's method with step size 0.001 sec. The results are amazing and so friendly in comparison with ode45. This is a snapshot from the result

And this is the code

```<code>clear all;
clc;

dt = 0.001;
 t = 0;

% initial values of the system
 a = 0; % angular displacement
da = 0; % angular velocity

% PID tuning
Kp = 50;
Kd = 18.0;
Ki = 0.08;

error  = 0;

%System Parameters:
m = 0.5;       % mass (Kg)
d = 0.0023e-6; % viscous friction coefficient
L = 1;         % arm length (m)
I = 1/3*m*L^2; % inertia seen at the rotation axis. (Kg.m^2)
g = 9.81;      % acceleration due to gravity m/s^2

% Generate Desired Trajectory
y = 0:dt:(3*pi)/2;
AngDes = y; % Ang: angle , Des: desired
AngDesPrev = 0;

for i = 1:numel(y)

   % get the first derviative of the desired angle using Euler method.
   dAngDes  =  ( AngDes(i) - AngDesPrev )/ dt;
   AngDesPrev = AngDes(i);

   % torque input
   u = Kp*( AngDes(i) - a ) + Kd*( dAngDes - da ) + Ki*error;
   % accumulated error
   error = error + ( AngDes(i) - a );

   %store the erro
   E(i) = ( a - AngDes(i) );
   T(i) = t;

   dda = 1/I*(u - d*da - m*g*L*sin(a));

   % get the function and its first dervative
   da = da + dda*dt;
    a = a  +  da*dt;

   %store data for furhter investigation
   A(i) = a;
   dA(i) = da;

   t = t + dt;

end

plot(T, AngDes, 'b', T, A, 'g', 'LineWidth', 1.0)
h = legend('$\theta_{d}(t)$', '$\theta(t)$');
set(h, 'Interpreter','LaTex')
</code>```

My question is why ode45 is preferred in many control books assuming the step size is very small.

答:
Euler method is horrible for general ODE timestepping because it is globally only first order accurate.  This means that to decrease the error by a factor of 1/2, you'll need to decrease the timestep by half.  Effectively, this also means that you'll need twice as many timesteps to improve your accuracy at the same final timestep.  Furthermore, the error tends to increase quite dramatically as you take more and more timesteps.  This is especially true for more complex systems.

The system you posted in your code appears to be very well behaved; no extreme oscillations or sharp changes in the gradient of the solution.  It doesn't surprise me that euler and runge-kutta yield nearly the same solution in this case.  I caution you that this is generally not the case for most systems.  I highly discourage the use of forward euler method for general purpose ode timestepping.

The Runge-Kutta (ode45) method is more popular because it is fourth order accurate globally (and fifth order locally, hence the numbers 45 in the name).  This means that if you decrease your timestep by 1/2, your error decreases by a factor of 1/16.  The extra accuracy you gain from the 4th order accuracy of runge-kutta far outweighs the extra computational cost.  This is especially true if you need adaptive timestepping, as @fibonatic suggests, because you may not need as many refinement steps if you use a higher order accurate method like runge-kutta.


答:
As it has been said in other answers it would still work any other configurations. But the X is practical for several reasons:

having a centre point adding the electronics, battery, etc. These add a lot of weight so it's better to have them in the centre, otherwise your quad will spend a lot of energy trying to remain horizontal.

when adding a camera, the frame is not in the field of view.

there is something cool about the X... ;-)

Title: Quadcopter frame design

Body:
Quadcopter frames seem to consistently follow the same X design. For example:

I'm curious to know why that is. It certainly seems like the most efficient way to use space but is it the only frame design that would work for quadcopters?

For instance, would a design like this work?

Why or why not?


问:
How to decide between LiPo or LiFePo for robot battery
When choosing a battery for a robot, should you use a LiPo or LiFePo?

For LiFePo, the pros:

can deliver higher sustained amps

many are built to be drop-in replacements for lead-acid batteries and can use the same charger

The cons:

enormously expensive (about $1/watt*hour/kg)

lower energy density than LiPo (around 110 watt*hour/kg)

For LiPo batteries, the pros:

cheaper (about $0.2/watt*hour/kg)

over twice the energy density than LiFePo (around 250 watt*hour/kg)

The cons:

more complicated and unsafe to charge (see videos of LiPos catching on fire)

most can't safely deliver high amps

Is there anything I'm missing? I see LiFePo batteries used on a lot of larger platforms, probably due to the higher continuous amp rating. I see Ebay flooded with tons of cheap high-capacity Chinese LiPos, but almost none of them have documentation, which probably means they're junk.

When should I use LiFePo vs LiPo?

答: Lots of robots safely use LiPo batteries, see almost all multicopter setups. There are plenty of batteries designed for the RC market that are capable of high sustained amperage, along with a plethora of pre-made chargers for LiPo batteries and plenty of options of chips designed to be integrated that do all of the charging logic for you as well. What applications are you targeting? It is true that LiPo batteries can be very dangerous if mishandled, but unless there is a pressing reason to use LiFe batteries I would not.</p>


答: May be it is a bit pricy (CHF 75) but I still suggest Colobot. It is a nice, almost game-like environment where robots need to help humans to make a space base habitable. Robots are programmed by the kids while increasingly complex tasks are performed. The program teaches the fundamentals of programming in a goal-oriented, funny way.</p>

Title: Standalone (or capable of being) Robotics Simulator

Body:
I'm a software engineer who volunteers with a non-profit that introduces young girls to technology. We have recently been talking about methods of introducing these children to the world of robotics, and I am curious what types of low-cost options we have.

One very appealing idea would be to have an online simulator, or (more preferable) an off-line standalone-simulator that we can build and program simple robots with. Perhaps nothing more than dragging components together, and then programming the interactions between those components.

What solution(s) exist that I might be able to make use of in our outreach?


问:
Low power computer for stereo vision
I would like to build a motorized robot with stereo vision that sends visual input to a PC over wifi for processing. A Raspberry Pi would have been perfect for the task if it would be possible to connect 2 cameras. The Pi 2 would be powerful enough for two USB webcams (with minimum 8fps) I guess, but the shared USB seems to be a bottleneck (2 cameras + wifi dongle).

What other options are there to send input from 2 cameras and control a motor (or an arduino)?

答: The lowest cost options for stereo vision that I have used are the Nvidia K1 boards (around 200$), with integrated GPU that can be taken advantage of by the OpenCV GPU libraries I can get 30+ fps with 2 720p streams doing just stereo depth mapping.</p>

Title: Low power computer for stereo vision


问:
Denavit-Hartenberg parameters for SCARA manipulator
I'm going through the textbook Robot Modeling and Control, learning about the DH convention and working through some examples.

I have an issue with the following example. Given below is an image of the problem, and the link parameter table which I tried filling out myself. I got the same answers, except I believe there should be a parameter d1 representing the link offset between frames 1 and 2. This would be analogous to the d4 parameter.

If anyone could explain why I might be wrong, or confirm that I have it right, that would be great. I hate it when it's me against the textbook lol.

Cheers.

答:
If the axes zi−1 and zi are parallel,A common method for choosing oi
is to choose the normal that passes through oi−1 as the xi axis; oi is then the
point at which this normal intersects zi. In this case, di would be equal to zero.
Once xi is fixed, yi is determined, as usual by the right hand rule. Since the
axes zi−1 and zi are parallel, i will be zero in this case.</p>


问:
algorithm Simple Stereo Vision
I'm working in a project implementing a vision system. I'm a student and this is the first time I'm doing something like this, it has been a challenge.

I'm using a controller (Netduino+2, .Net MicroFramework) and a camera (CmuCam5 - Pixy) and for now it's working well. I'm communicating with the robot(Fanuc M430iA) using Modbus, and aquiring the data from the camera using I2C.

But, the next challenge is using 2 cameras to implement stereo vision and I'm not shure how to achieve that. I'm reading a lot about that and I understand the process and generally how it works, but I think my case is very specific.

My cameras detect the center of an object and give me the coordinates, so, I have that, and that's good.

What do you think it's the more reasonable approach?

(sorry for my english, let me know if I'm not being explicit, I'll edit the question if I see there's not enough information)

答:
The first thing is to make sure that the cameras will get the coordinates of the object at the same time (I don't know if Pixy has a FREX or STROBE signal for synchronization), or that the object is not moving.

Then, have a look at OpenCV, it has a section on 3D calibration and reconstruction (i.e. find the depth of an object based on the coordinates of two pictures or frames, taken at the same time, from two different (known) angles).

As you start with the 2D coordinates and not the whole image, I guess you will have to dig in and adapt the examples (especially for the calibration part), but it might be a good place to start with

The official doc:
http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

Other links worth checking:

http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration

Title: algorithm Simple Stereo Vision


答:
I'm working in a project where I'm using a Netduino+2 and 2 Cameras (maybe it will be more than that), I'm working with I2C. I can connect all the cameras I want.

I don't know if it is an option for you, because in my case I only need positions. The image processing is on the camera side.

Title: Low power computer for stereo vision

Body:
I would like to build a motorized robot with stereo vision that sends visual input to a PC over wifi for processing. A Raspberry Pi would have been perfect for the task if it would be possible to connect 2 cameras. The Pi 2 would be powerful enough for two USB webcams (with minimum 8fps) I guess, but the shared USB seems to be a bottleneck (2 cameras + wifi dongle).

What other options are there to send input from 2 cameras and control a motor (or an arduino)?


答: If you're working with the K1 and stereovision you might be interested by this http://jetsonhacks.com/2015/03/25/stereolabs-zed-camera-3d-depth-sensing-gtc-2015/</p>

Title: Low power computer for stereo vision


问:
Line following robot with EV3 Colour Sensor
I am trying to build an advanced coloured lines following robot with the ability to differentiate between many different coloured lines and follow them. I am looking for the right sensor that will help my robot achieve its objective.

As I was researching I came across the EV3 Colour Sensor which can detect up to 7 colours.

Is this sensor suitable for my project?

What other sensors can I use and how?

Thank You

答:
The EV3 Color Sensor will work great if you're using the Mindstorms platform, if not it will be a pain it uses a non standard connection style and a not quite standard I2C communication protocol. If you are using an arduino then I would recommend something like this from sparkfun which still uses the I2C bus but will be far easier to integrate into a project. </p>

<p>In order to use it you will have to profile the color of the lines you want to follow in the exact same conditions that you will use for your robot to get best results. </p>

Body:
The EV3 Color Sensor will work great if you're using the Mindstorms platform, if not it will be a pain it uses a non standard connection style and a not quite standard I2C communication protocol. If you are using an arduino then I would recommend something like this from sparkfun which still uses the I2C bus but will be far easier to integrate into a project.

In order to use it you will have to profile the color of the lines you want to follow in the exact same conditions that you will use for your robot to get best results.


问:
Learning Algorithms for Walking Quadruped
I'm building a 4 legged robot (quadruped) with 3 Degrees of freedom per leg.
The goal of my project is to make this robot able to learn how to walk.
What learning algorithms will I need to implement for it to work?

I'm using an Arduino Uno for the microcontroller.

答: A simplified method for learning would be to make the robot into one random position and then another and tweak the second position until it moves forward. Using this position as a start do the process again n times and then you will have n positions to move through that make the robot move forward.</p>


问:
How to connect HC-sr04 ultrasonic sensor to APM 2.6?
I am working on my final project by autonomous Quadcopter. my tasks are to make a quadcopter  which should do object avoidance and it should auto land using ultrasonic sensors.
any possible ans to it, how should i connect HC-sr04 ultrasonic sensor to my APM 2.6 board?
Even APm 2.6 has a port I2C.</p>

答: The APM has a I2C port on it (see here) (pinout here) it operates at 3.3v so you will need a 5v to 3.3v level shifting board like the one sold by sparkfun however the HC-SR04 (datasheet) does not use I2C, in order to use it over I2C you will need an additional microprocessor such as an arduino to read the data from it and send it to the APM. You could connect it up to the GPIO pins that are available and write some custom drivers for the rangefinder subroutine  but it would be much simpler to simply use a supported ultrasonic sensor as described on the APM wiki.</p>


问:
Using 3DR Radio to communicate ArduPilot Data
I am trying to send some data over to my PC from the Arduipilot, I used a Normal USB connection to send over a recurring string like this:-

```<code>const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;

void setup()
{
   hal.uartA->begin(38400);
}

void loop()
{
    hal.scheduler->delay(20);
    hal.console->println("Recd_String");
}
AP_HAL_MAIN();
</code>```

I receive the string just fine when I open a serial monitor with baud of 38400 bits/sec. But, when I remove the USB port and plug in the 3DR radio module to the ardupilot and the PC, it gives me garbage. I know that the 3DR radios use MAVLink communication protocol, but I was wondering if it's possible to change this protocol and use a normal SPI so that I receive the data in the same format I receive when connected via USB.

If this is not possible, is there a way to convert this garbled data from the radio module to a useful string.
It would be greatly appreciated if someone can help me with this.

答: The 3DR radios by default use 57600 baud, be sure that it is set properly on both the sending and receiving side, this has been the source of many problems for me.</p>


问:
Quadcopter multiple ESC angles glitch
I'm developing my fligth controller board on Tiva Launchpad for quadcoper and while calibrating PID I discovered an unexpected behaviour: sometimes quadcopter seems to experience random angle errors. While trying to investigate it, I've figured out that my code if fairly trying to compensate tham, as soon as they appear - but do not cause them. Even more - i've discovered that such behaviour appears only when two (or more) motors are adjusted, while one motor system shows pretty good stabilisation.

Here is code for PMW output for different motors:

```<code>torque[0] = (int16_t)(+ angles_correction.pitch - angles_correction.roll) + torque_set;
torque[1] = (int16_t)(+ angles_correction.pitch + angles_correction.roll) + torque_set;
torque[2] = (int16_t)(- angles_correction.pitch + angles_correction.roll) + torque_set;
torque[3] = (int16_t)(- angles_correction.pitch - angles_correction.roll) + torque_set;
</code>```

and here is recorded angles for system with one motor and two motors:

To be sure that it's not the algorithm problem, while recording this angles only Integral part of PID was non-zero, so angles were not even stabilised.

My question is - could esc noise each other (in my quad they are quite close to each other - just few sentimeters away) to cause such behaviour?
Thanks a lot!

答: It looks like your PID is oscillating, have you tried turning down the P gains in your controllers? Most PIDs are tuned P first by turning all terms to zero and turning up the P to just above the point where it oscillates then for the I gain adjust it till it "snaps" into position, the D gain can be trickier  to get but you should start there. Here is a good reference for tuning PIDs on a Multicopter.</p>

Title: Quadcopter multiple ESC angles glitch


问:
What main factors/features explain the high price of most industrial computer vision hardware?
I am a student who is currently working on a computer science project that will require soon computer vision and more specifically stereoscopy (for close depth detection). I am now looking for a great camera to do the job and I found several interesting options:

1- A custom built set of two cheap cameras (i.e. webcam);

2- The old, classic, economic and proven Kinect;

3- Specialized stereo sensors.

I found a couple months ago this sensor: https://duo3d.com/product/duo-mini-lv1

I tought it was interesting because it is small, stereoscopic and brand new (encouraging a fresh USA company). However, if we take apart the additional APIs that come with it, I just don't understand why you would buy this when a Kinect (or "cheap" cameras) are at least 4-5 times less expensive and still have great if not better specifications.

Same applies for this one: http://www.ptgrey.com/bumblebee2-firewire-stereo-vision-camera-systems

Can someone please explain to me why I would need such a device and if not, why they are needed for some?

答: So the Kinect uses a set of IR points to determine depth, not true stereoscopy. the DUO M and the Bumbee both use two cameras to achieve this, I am not familiar enough with them to give a good comparison between them and the Kinect but I am familiar with a new product that I have been using for a little bit called the ZED It has a detection range of approximately 30M vs the Kinect's 1.2–3.5 m, the ZED can operate outdoors, the Kinect cannot due to it's IR based ranging. However the difference is that the ZED needs significant processing power to do the image processing at a reasonable rate, it uses the GPU functions in OpenCV to accomplish this, I am using it with an nvidia K1 board on a Quadcopter. The advantages I outlined with the ZED hold true for most dual camera stereoscopic  setups.</p>


答:
As Mark Omo mentioned, the Kinect is a fundamentally different technology than a simple stereo pair.  There are also other technologies such as a "standard" time-of-flight cameras like the Swiss Ranger and PMD, and infrared stereo with projected texture of the Intel RealSense.

I believe each technology has its own strengths and weaknesses.  For example, standard stereo cameras typically can't get depth information on a single-color featureless plane (like a large wall).  But time-of-flight cameras have no issue with that.  However, time of flight cameras will have trouble with materials that absorb light (like very dark objects) or objects with other interesting optical properties (like snow).  Many optical based sensors will have trouble with clear and colored glass, so you may need to completely change domains and use a 3D ultrasonic sensor.

Furthermore, all sensors have min and max ranges, however active sensors (like the Kinect and time-of-flight cameras) will typically have smaller max ranges due to power requirements.  Whereas increasing the max range of a stereo pair is as easy as increasing the baseline.

So you should pick your sensor based on your target application.  There is no one-size-fits-all 3D sensor.

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

Body:
I am a student who is currently working on a computer science project that will require soon computer vision and more specifically stereoscopy (for close depth detection). I am now looking for a great camera to do the job and I found several interesting options:

1- A custom built set of two cheap cameras (i.e. webcam);

2- The old, classic, economic and proven Kinect;

3- Specialized stereo sensors.

I found a couple months ago this sensor: https://duo3d.com/product/duo-mini-lv1

I tought it was interesting because it is small, stereoscopic and brand new (encouraging a fresh USA company). However, if we take apart the additional APIs that come with it, I just don't understand why you would buy this when a Kinect (or "cheap" cameras) are at least 4-5 times less expensive and still have great if not better specifications.

Same applies for this one: http://www.ptgrey.com/bumblebee2-firewire-stereo-vision-camera-systems

Can someone please explain to me why I would need such a device and if not, why they are needed for some?


答:
To answer your questions directly, the X-shape is not the only design that will work.  There are many variations of frame design around a number of rotors that can range from 3 to (in some cases) 8.

Since it hasn't been mentioned in the other answers, I want to point out that perhaps the biggest reason for the X shape is to keep the weight in the center, which decreases the moment of inertia of the vehicle -- the vehicle will pitch and roll more easily in response to the thrust.

Title: Quadcopter frame design


问:
What is the link between a quadcopter transmitter pulse and the roll/pitch/yaw angles?
I want to design a data logger for my quadcopter using the Arduino Mega board. I want to record the roll, pitch and yaw angles each second or 5 seconds, so they can be viewed later after a flight has ended. There's just one thing I don't understand, and that's how to translate the pitch/roll/yaw angles into a pulse of a specific length that the flight controller receives.

For example, when I press the control for the pitch, the transmitter sends out a pulse to the receiver of the drone and the speed of the drones' motors change accordingly for it to pitch either forward or backward. I can tap into these commands between the flight controller and the transmitter, and be able to record the length of the pulse that was sent out. However, what is the link between the pitch angle and the size of the pulse? Basically, how can I convert the pulse that was recorded by the Arduino board and convert it into the pitch angle in degrees?

Generally, for the transmitter I use, a 1500us-pulse means zero pitch; from 1501-2000 means pitch forward, and from 1000-1499 means pitch backwards (of course, the actual values vary slightly, but this is just a general reference for this question). So for instance, if I sent a pulse of 1400us, how would that translate into an angle in degrees? What's the formula to convert it?

I hope I'm clear, and if this question sounds stupid, please excuse me, but I haven't been able to find good information on it!

Thanks!

答:
The pulse you're talking about is pulse position modulation.  Whether this is being used to set the throttle speed of each of your motors (separately), or to convey some other meaning to your flight controller is unclear from your question (i.e. I'm not sure if the PPM signal is being evaluated as a "desired forward thrust" which is in turn being converted into separate motor signals).

In any case, the pitch angle will depend on the motor speeds (relative to each other) over time, and the motor speeds come from the flight controller (which may or may not be doing its own calculation) and the flight controller gets its data from your transmitter pulse.

So you may not be able to log this by looking at your transmitter pulses.  I would instead look into an IMU to directly measure the pitch angles.


问:
How to make a robot move using Arduino other than timing to predefined locations?
How to make a robot move using Arduino other than timing to predefined locations? and without the use of sensors?? I want to make my car move to different locations on a board..want to know the possible options without using sensors and encoders??
And how does cartesian robot work for predefined locations..does it require sensor too?</p>

答:
Without sensors or encoders, there is no way to know where you are.  Without timing, there is no way to guess how far you may have travelled.

Without sensors, encoders, or timing, it is impossible to do what you are asking.

ContentLicense: CC BY-SA 4.0


问:
Difference between planetary and precision gear motors
i'm working on a building a rover and would like some advice on selecting motors. In particular, i want to understand the difference between precision and planetary gear motors.  My robot will way about 10-15lbs i think and would like it to be responsive and quick. I have two sabertooth 2x12 motor controllers (which can supply up to 12amps). I have been looking at these motors and i am not sure which is better choice for my application.

These are the two sets of motors i am thinking about.
https://www.servocity.com/html/precision_robotzone_gear_motor.html
https://www.servocity.com/html/3-12v_precision_planetary_gear.html

googling does provide some info on planetary gears, but the application of these two is still is unclear to me.

Thanks

答:
"Precision motors" and "planetary gear motors" aren't really describing the same attribute of the motor.  It's like comparing "fine-point pencils" to "red pencils" -- they could be both fine-point and red, either fine-point or red, or neither.

Planetary gears are generally used to convert high RPM at low torque to low RPM at high torque.  Because each rotation of the motor shaft results in a very small movement of the gear system's output shaft, you could also say that planetary gears offer you very fine precision in the output.  It's unclear from these links whether that's the case (and it's possible that both of them are using planetary gears).

Perhaps "precision" is just being used a marketing term.  Are there specific requirements you have for your motors that aren't being shown in these listings?


问:
What was the earliest concept of a robot?
I'm a highschool student studying electronics and for an assessment task on the history of electronics I have decided to focus on the history of robotics. I want to begin with the earliest possible concept of a robot and progress through major developments in robotics to the current day. Where should I begin my research?</p>

答:
One major development milestone was the first functioning robot to use electricity. As mentioned in Jordan Brown's link, Nikola Tesla demonstrated a radio-controlled robotic boat (more of an ROV I suppose) in a specially-built pool in Madison Square Garden in 1898. He even implemented a crude logic gate designed to prevent other transmitters from taking control from him.

Radio being a not exactly well-known technology in 1898 (Marconi had not even filed for any patents in the US yet), disbelieving onlookers gave such explanations as witchcraft, telepathy, and a tiny trained monkey hidden inside the vehicle.

Related US patents:

Patent 613,809: Method of and Apparatus for Controlling Mechanism of Moving Vessels or Vehicles
Patent 725,605: System of Signaling


答:
As others mentioned the Kinect is a different technology which has different trade offs.  Stereo performs better in sunlight than a Kinect and it is easier to adapt the range, particularly if longer range is desired.

The reason that the stereo modules are more expensive than a couple of web cams is because they are not the same thing.  The technology itself isn't that much more expensive, but it doesn't have the pricing from large commodity volumes.  For the stereo modules, they typically have global shutter cameras.  Almost all web cams are rolling shutter cameras.  The difference is that global shutter cameras expose every pixel at the same time.  Rolling shutter cameras capture each pixel line at different points in time.  Web cams tend to be very bad with motion, particular of the camera.  This doesn't work well for stereo if things are moving for many applications.  Typically people want to get a point cloud or similar from the stereo but if it is captured while the things are moving it won't be consistent.  Stereo modules also have synchronization of the camera captures.  If things are moving, it is important that both cameras capture the images at the same time.  In a lot of stereo modules, this is done by sending a pulse to both cameras to start each capture so that they happen at the same time.  Another factor is that for stereo to work, the cameras need to be in a known position relative to each other.  Typically this means that there is a rigid mount between the cameras that keeps the relative position fixed.  Then this relative position is calibrated.  For some stereo modules this is done at the factory.  This can also be done pretty easily with open source software tools, but if the cameras move relative to each other it has to be redone.  Finally, some stereo modules also have hardware acceleration to do the stereo calculations on the stereo module.  The cheapest alternative is to build your own with 2 global shutter cameras with appropriate lenses that support external triggering and put into your own rigid mount.  It isn't so easy to find the appropriate cheap parts to do this for less than the cost of the cheaper stereo modules.  If nothing is moving when the stereo ranging is desired, than cheaper technologies like web cams become viable again, but that is why the stereo modules cost more than a couple web cams (along with the low volumes needing to cover development expenses).


问:
Why I'm getting very long terms in the inertia matrix (or dynamics model) of the robot using matlab script?
I'm working on the dynamics model of a RRRR articulated robot, I'm following Euler-Lagrange approach and developing my code in m-file in matlab; I'm looking for dynamic model of this form: $$
D(q) \ddot{q} + C(q,\dot{q})\dot{q}+ g(q) = \tau
$$
where $D$ and $C$ are $4 \times4$ matrices and $g$ and $\tau$ (torque) are $4\times1$ vectors; by formulating the kinetic and potential energies;;

The problem is that, I'm getting very long equations, and the term in $D$ matrix are very huge and nonlinear, involving sin and cos; I'm talking about a several pages per equation;
After I published the code - 7 pages - and the output I got around 45 pages in total;
I searched around there was some guy he faced the same problem before, but there was no helpful proposal.

Any Suggestions ??

答: You can use the 'simplify' command , e.g : a=simplify(A*B) .This command is calculating some trigonometric functions thus making your expression shorter .</p>


问:
ROVER 5 with 2 encoders help
am 2 weeks old to arduino projects..i had been using timing all this while to control my rover...now, i wanted to shift to using encoders..am facing quite some problems..am using arduino uno and a two amp motor shield..this is code i am trying to use..am using a 8V Li-po battery

http://www.myduino.com/index.php?route=product/product&product_id=170&search=rover+5 (link to rover)

http://www.myduino.com/index.php?route=product/product&product_id=131&search=motor+shield (link to motoshield)

my question is there are four pins coming out of encoders from each side...what i did was connected the red and black to 5V and GND respectively and the white and yellow of the first encoder to pin 2 and the white and yellow of second encoder to pin 3...is what am doing correct??

and sometimes when i use this code, in the motorshield both the green and red light starts thereby stalling the motor..why does that happen?

can anyone of you suggest a link to a simple encoder code to make the motors move forward in a straight using feedback..

thanks

```<code>    // interupt 0 -> pin 2
    // interupt 1 -> pin 3

    volatile unsigned long positionL = 0;  //vehicle position count from left encoder
    volatile unsigned long positionR = 0;  //vehicle position count from right encoder

    int motorLa = 5;
    int dirLa = 4;
    int motorRa = 7;
    int dirRa = 6;

    void setup(){
      pinMode (motorLa, OUTPUT);
      pinMode (dirLa, OUTPUT);
      pinMode (motorRa, OUTPUT);
      pinMode (dirRa, OUTPUT);
      Serial.begin(9600);
    }

    void loop(){
      moveFWD(5300);
      delay(2000);
      moveREV(3000);
      delay(2000);
      while(1);
    }

    void encoder1(){
      positionR++;
    }

    void encoder2(){
      positionL++;
    }

void moveFWD(unsigned int x){
      positionL=0;
      positionR=0;
      attachInterrupt(0, encoder1, CHANGE);
      attachInterrupt(1, encoder2, CHANGE);
      digitalWrite(dirLa, LOW); // Left a Forward
      digitalWrite(dirRa, HIGH); //Right a Forward
      while((positionL <= x) || (positionR <= x)){

        if (positionL > positionR){
          analogWrite(motorLa, 220);
          analogWrite(motorRa, 255);
          }

        else if (positionR > positionL){
          analogWrite(motorRa, 220);
          analogWrite(motorLa, 255); // Sets the motor speed at a value of 180            }

        else {
          analogWrite(motorRa, 255);
          analogWrite(motorLa, 255); // Sets the motor speed at a value of 180            }

        Serial.print(positionL); // This prints the current value of positionL in the serial monitor on the computer.
        Serial.print("\t"); // This creates a tab on the monitor
        Serial.print(positionR);
        Serial.println(); // This creates a new line to print on
      }

      // Stop all motors
      analogWrite(motorLa, 0);
      analogWrite(motorRa, 0);

      // Disables the encoders interrupt
      detachInterrupt(0);
      detachInterrupt(1);
    }

void moveREV(unsigned int x){
      positionL=0;
      positionR=0;
      attachInterrupt(0, encoder1, CHANGE);
      attachInterrupt(1, encoder2, CHANGE);
      digitalWrite(dirLa, HIGH); // Left a Forward
      digitalWrite(dirRa, LOW); //Right a Forward
     while((positionL <= x) || (positionR <= x))
      {

       if (positionL > positionR){
          analogWrite(motorLa, 20);
          analogWrite(motorRa, 200);
        }

      else if (positionR > positionL){
          analogWrite(motorRa, 20);
          analogWrite(motorLa, 200); // Sets the motor speed at a value of 180           }
        else{
          analogWrite(motorLa, 200); // Sets the motor speed at a value of 180           analogWrite(motorRa, 200);
          }
       Serial.print(positionL); // This prints the current value of positionL in the serial monitor on the computer.
        Serial.print("\t"); // This creates a tab on the monitor
        Serial.print(positionR);
        Serial.println(); // This creates a new line to print on
        }
      // Stop all motors
      analogWrite(motorLa, 0);
      analogWrite(motorRa, 0);

      // Disables the encoders interrupt
      detachInterrupt(0);
      detachInterrupt(1);
    }
</code>```

答:
I believe your encoders provide incremental quadrature.  Yes, red and black are probably power and ground, (but please consult your data sheet!) and the other two wires provide a pattern of square waves that indicate the direction of motion as well as an incremental count of distance traveled.

Typically, microcontrollers provide a quadrature decoder in hardware so you can just read off the distance traveled as a number.  But it isn't too hard to write yourself.  However, you will need 4 interrupts and i believe the Arduino Uno only provides 2.  You could probably poll the I/O lines, as long as the quadrature pulses aren't too short or your code is too slow to keep up.

If you don't care about the direction.  For example if your gear-train is non-backdrivable.  You can simply use a single quadrature wire under the assumption that the motor is always spinning in the direction you commanded.  You should set up the ISR to trigger on a change.  then increment (or decrement) a variable for distance traveled.  You should probably also record the time so you can turn it into a speed.  Note that this is not a very good way of doing things because of debouncing.  Think about if the encoder is right on the edge between two states, it will bounce back and forth between high and low.  Your code will assume each transition is some distance traveled, when in reality no motion occurred.

After you iron out all the encoder business, you need to implement speed control.  Basically, you want both motors to travel at the same measured speed.  I will only describe proportional control, but you may want to add the other terms.  Here is the gist of it:

```<code>  float error = target_speed - measured_speed;
  int control_value = (P * error) + last_control;
  last_control = control_value
</code>```

Note that control_value is the PWM value to give to the motor.  So you should cap it appropriately.  target_speed and measured_speed are in the units of some speed, whatever makes sense for your system.  And P is the gain.

Title: ROVER 5 with 2 encoders help

Body:
I believe your encoders provide incremental quadrature.  Yes, red and black are probably power and ground, (but please consult your data sheet!) and the other two wires provide a pattern of square waves that indicate the direction of motion as well as an incremental count of distance traveled.

Typically, microcontrollers provide a quadrature decoder in hardware so you can just read off the distance traveled as a number.  But it isn't too hard to write yourself.  However, you will need 4 interrupts and i believe the Arduino Uno only provides 2.  You could probably poll the I/O lines, as long as the quadrature pulses aren't too short or your code is too slow to keep up.

If you don't care about the direction.  For example if your gear-train is non-backdrivable.  You can simply use a single quadrature wire under the assumption that the motor is always spinning in the direction you commanded.  You should set up the ISR to trigger on a change.  then increment (or decrement) a variable for distance traveled.  You should probably also record the time so you can turn it into a speed.  Note that this is not a very good way of doing things because of debouncing.  Think about if the encoder is right on the edge between two states, it will bounce back and forth between high and low.  Your code will assume each transition is some distance traveled, when in reality no motion occurred.

After you iron out all the encoder business, you need to implement speed control.  Basically, you want both motors to travel at the same measured speed.  I will only describe proportional control, but you may want to add the other terms.  Here is the gist of it:

  float error = target_speed - measured_speed;
  int control_value = (P * error) + last_control;
  last_control = control_value

Note that control_value is the PWM value to give to the motor.  So you should cap it appropriately.  target_speed and measured_speed are in the units of some speed, whatever makes sense for your system.  And P is the gain.


问:
Irobot create 2 C# connection
My department recently purchased Irobot create 2. We want to recreate the code from the Csharp create 2 driving Tether program to use as a base for our intro to computer science course. Currently the code we are using to talk to the Irobot is http://www.robotappstore.com/Knowledge-Base/How-to-program-Roomba-for-NET-developers/23.html. Not sure if the irobot is getting the commands as well as if the serial port is making a connection. We are using Visual Studio 2012 as the programming environment. Any recommendation and or input would be appreciated.

Thank you

答: Please see the last page of the Open Interface Spec.  There are some notable changes between the Create 2 and the old Create.  For example the default baud rate changed.</p>

Title: Irobot create 2 C# connection


问:
Mapping algorithm without noise
I have a simulated robot moving in a discretized 2D grid world that (for various simplification and time-restriction reasons) has no noise. The problem is how the robot creates its initial map of the world. Algorithms like SLAM and occupancy grid mapping are based on uncertainty, but in this case there is no uncertainty.

So I'm wondering if there is a relatively simple algorithm for mapping the environment with noiseless position.

答:
As Kamek said in a comment, all that needs to be done is to transform the coordinates of the sensor hits to the world frame.  For a 2D grid world, this shouldn't be too hard to do with a little trigonometry.

You asked about the "initial" map.  Typically, the robot wakes up and knows nothing about the world or where it is.  So it starts in the middle of an empty map.  Make sure your map is large enough to accommodate your entire grid world even if the robot starts at the edge of the world.  (So if your grid world is (N x N), your map will be (2N x 2N).

Title: Mapping algorithm without noise


答:
As @Kuzi said, look into OpenCV for the camera calibration and you'll need to either sync your cameras or make sure things aren't moving.  You will probably want to do the camera calibration connecting your sensor to a PC.  Once you get the calibration parameters, then you can use them on your microcontroller.

To actually calculate the 3D position of the object, the following steps need to happen:

Get (x,y) position on real image for each camera

Convert (x,y) position on real image to (x,y) position on ideal camera.  This uses the intrinsics camera calibration to compensate for lens distortion.  You will be running the distortion correction in reverse so you will probably need an iterative solution like Gauss-Newton

Calculate ray through (x,y) position in ideal camera to get ray in camera reference frame.  This is just the ray originating at (0,0,0) and going through (x,y,1).

Transform the ray from camera B into the reference frame for camera A using the extrinsics calibration which is just the transform between the cameras

Find the intersection of the 2 rays.  Typically, the rays won't quite intersect because of noise.  That means you will actually be finding the location on each ray where the rays get the closest and then probably averaging them.

Title: algorithm Simple Stereo Vision

Body:
I'm working in a project implementing a vision system. I'm a student and this is the first time I'm doing something like this, it has been a challenge.

I'm using a controller (Netduino+2, .Net MicroFramework) and a camera (CmuCam5 - Pixy) and for now it's working well. I'm communicating with the robot(Fanuc M430iA) using Modbus, and aquiring the data from the camera using I2C.

But, the next challenge is using 2 cameras to implement stereo vision and I'm not shure how to achieve that. I'm reading a lot about that and I understand the process and generally how it works, but I think my case is very specific.

My cameras detect the center of an object and give me the coordinates, so, I have that, and that's good.

What do you think it's the more reasonable approach?

(sorry for my english, let me know if I'm not being explicit, I'll edit the question if I see there's not enough information)


答:
To further explain my comment, I've decided to turn it into an answer.

Using the law of sines to calculate distance.

First mount the cameras on the robot parallel like this ---¦---   ---¦---

¦ is the lens. Mount them 100mm apart - measuring from the lenses.

Second find the viewing angle of your camera, in this case 75*.

Third get data from the camera: Cam1 : (50, 50); Cam2 : (10, 50);

Fourth (optional depending on the co-ordinate system used) Normalize the data (transform the co-ordinate system) to center the origin and re-map your co-ordinates.

Fifth Calculate your degrees per division - take your viewing angle and the range of the supplied co-ordinate system and calculate how many degrees are represented per division.

Sixth multiply this Degrees per division by each of your co-ordinate values. To get the degrees from center line to the object for each camera.

Seventh using the Law of Sines you can calculate the distance from each camera to the object using both of the angles you calculated plus the distance between the camera lenses. Optionally average them to get the distance from the camera mounting mid-point to the object.

There are many optimizations that can be applied to this process, especially calibrating the camera lens but that's another question. I would say that errors do creep in and taking multiple readings and averaging the result can improve reliability.

Title: algorithm Simple Stereo Vision


问:
Question about dynamic window approach?
I have a my mobile robot and plan to use the dynamic window approach to collision avoidance. I have read the paper ,but have one inequality i can't derive it.

could you tell me? thanks!

答:
This falls out of the basic equations of motion for a body under constant acceleration.  The simplest thing is to start with this equation:
$$
v^2 = v_o^2 + 2ad
$$
Where we are starting at some velocity $v$, and decelerating at $a$ (or $\dot{v}$ in your equation) to a stop.  (So $v_o$ = 0).  The distance traveled, $d$, must be less than the distance to the obstacle, $dist(v,w)$.</p>

Title: Question about dynamic window approach?


问:
How to calculate the real time RPM of motor with rotary encoder?
I want to measure the real time RPM of the wheels. I think incremental rotary encoder would be good. But i am confused on how to interface it with DC brushless geared motors. From the images i am not quite sure if only one rotary encoder would suffice or do i need any other sensor also with it?<br>
I am doing my project on arduino uno.  </p>

答:
Different encoders will attach to the motor or shaft differently.  Typically, the motor has a small shaft coming out the back of motor for this purpose.  And you buy the motor with the encoder already installed.

Actually, now i see you asked about a brushless motor.  Typically, these have added hall effect sensors by the manufacturer.  Because you energize the 3 coils of the motor in a specific sequence to spin it, it is easy to use these hall effect sensors as an incremental encoder.


问:
Simple way of 3d perception
I wonder is there any simple (can be computed in microcontroller level) option which is suitable for 3d object perception (depth, position, pose or coordinate estimation) of flying robots except LIDAR, stereovision, omnidirectional camera, laser scanner or any other machine vision based techniques

答: The best answer is probably going to be an ultrasonic sensor on a servo, you can get them in a huge range of values, from very close to very far range depending on your application, and varying beam widths depending on your accuracy needs. If you need more than 255 steps you could go with a motor and a encoder but that will be slightly more complex. </p>

Title: Simple way of 3d perception


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

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

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

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

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

答: The easiest way to calculate this will probably be by using the ecalc helicopter calculator, they have done all these calculations for you and take into account far more factors in my experience they are very accurate. I know that most props have a Prop Constant in the 1.1 to 1.3 range, but for your specific situation according to ecalc gives a thrust to weight ratio of 2.49:1 for a 190g helicopter giving 283.1g of payload capacity or 473g of lift.</p>


问:
Denavit-Hartenberg convention or the product of exponentials formulation, when dealing with the manipulator kinematics?
Though, Denavit-Hartenberg notation is commonly used to describe the kinematics of robot manipulator, some researcher prefer the product of exponential instead; and even the claim that it's better.

Which one should I use, and which one is generally better; is final solution same for both kinematics and dynamics?

Any suggestions?
A mathematical introduction to robotic manipulation

答:
I recently worked with DH parameters to define kinematics of my Dual Arm Robot. As per my knowledge and experience, for kinematics I can say that DH Param will be good to use it since that gives you exact location and orientation (provided the table you made is correct) of each link of the robot. I had to work for collision detection between both the arms of the robot. So using Forward Kinematics, I calculated Cartesian location of each joint and compared all joints of one arm to the other's. You can calculate it with matrix multiplication in a sequence starting from the base of the manipulator to the end.
At last, you will need to identify the Coordinate axes of Manipulator and the one in your analysis, and take values accordinngly.
Also, there is a freeware called "Roboanalyzer" . Use that software, you will understand the application of DH parameters to calculate matrices. Though there are minor flaws, but it is awesome for basic understanding.

Hope it will help you a bit.


问:
What is the best software/package to draw the robot manipulator and indicate DH parameters and different axes?
I'm wondering about good software/package to draw the robot manipulator and indicate DH parameters and different axes?

Any suggestions!

答: Use RoboAnalyzer. It will help you understand what you need.


问:
How to tune the two PIDs for quadrotor
I'm trying to implement two PIDs for stabilizing quadrotor for position tracking. The inputs are $x_{d}(t), y_{d}(t), z_{d}(t)$ and $\psi_{d}(t)$. For position tracking, usually the small angle assumption is assumed. This assumption allows for acquiring $\theta_{d}$ and $\phi_{d}$. These are the results

The x-axis position is driving me crazy. After alot of attempts for tuning the PIDs, I felt something wrong is going on. Is this a normal behavior for PID controller? Also, what I've noticed is that once $\psi$ reaches to zero, the platform starts oscillating (after 1.5 second in the figure).

For solving ODEs and computing the derivatives for the velocities, I use Euler methods.

It is simulation in Matlab.

答:
is it real or simulation application?

If simulation there is good examples in matlab codes/models you can look deeper

If real:

1- filter the sensor data

2- use tan2 function for angular error calculations

3- begin PID calculations with all P, I and D constants. if you use just one of them stabilization is not possible. PI or PD control is possible. Be carefefull first constants P>I>D than you can use :

http://sts.bwk.tue.nl/7y500/readers/.%5CInstellingenRegelaars_ExtraStof.pdf

or

http://www.expertune.com/tutor.aspx

Title: How to tune the two PIDs for quadrotor


问:
Mindsensor Motor Multiplexer jump on run_unlimited
I am trying to run a nxt motor using the mindsensors motor multiplexer at a slow speed.  When I turn it on, it tends to jump approx 20 to 40 degrees before moving at a slow speed.  Has anyone seen this behavior?

I am using NXT 1.0 with firmware down loaded from lms_arm_mindsensors_129.rfw.  Sample code in NXC (I am using Bricx Command Center as my IDE) is as follows:

```<code>MMX_Run_Degrees (SensorPort, Addr, MMX_Motor_2, MMX_Direction_Reverse,
     MMX_Speed_Slow, 220, MMX_Completion_Wait_For, MMX_Next_Action_Brake);
Wait(500);

MMX_Run_Unlimited( SensorPort, Addr, MMX_Motor_2,MMX_Direction_Forward, 5);
// The jump happens here.
while(Sensor(IN_2)< SENSORTHRESHOLD);
</code>```

答: I have seen this behaviour using the NxtMMX with the EV3 (while writing the driver for ev3dev). I am fairly certain that this is the speed regulation PID overshooting and then slowing down. In NXC you can use MMX_SetPerformanceParameters to change the PID parameters and possibly get rid of the overshoot.


问:
Questions regarding 3D scanning and camera choice
A few days ago, I just shared my concerns about the price of computer vision hardware on this same exact forum (see What main factors/features explain the high price of most industrial computer vision hardware?) and I think a new but related post is needed. So here we go.

Here are some details to consider regarding the overall scanner I want to build:

Restricted space: my overall scanner can't be larger than 3 feet cube.

Small objects: the objects I will be scanning shouldn't be larger than 1 foot cube.

Close range: the camera would be positioned approximately 1 foot from the object.

Indoor: I could have a dedicated light source attached to the camera (which might be fixed in a dark box)

Here are the stereo cameras/sensors I was looking at (ordered by price):

Two Logitech webcams (no model in particular)

Cheap

Harder to setup and calibrate

Need to create your own API

Built for: what you want to achieve

Intel RealSense: http://click.intel.com/intel-realsense-developer-kit.html

$100

High resolution: 1080p (maybe not for depth sensing)

Workable minimum range: 0.2 m

Unspecified FOV

Built for: hands and fingers tracking

Kinect 2.0: https://www.microsoft.com/en-us/kinectforwindows/

$150

Low resolution (for depth sensing): 512 x 424

Unworkable minimum range: 0.5 m

Excellent FOV: 70° horizontal, 60° vertical

Built for: body tracking

Structure Sensor http://structure.io/developers

$380

Normal resolution with high FPS capability: 640 x 480 @ 60 FPS

Unspecified minimum range

Good FOV: 58° horizontal, 45° vertical

Built for: 3D scanning (tablets and mobile devices)

ZED Camera: https://www.stereolabs.com/zed/specs/

$450

Extreme resolution with high FPS capability: 2.2K @ 15 FPS (even for depth sensing) and 720p @ 60 fps

Unviable minimum range: 1.5 m

Outstanding FOV: 110°

Built for: human vision simulation

DUO Mini LX: https://duo3d.com/product/duo-minilx-lv1

$595

Normal resolution with high FPS capability: 640 x 480 @ 60 FPS

Workable minimum range: 0.25 m (see https://stackoverflow.com/questions/27581142/duo-3d-mini-sensor-by-code-laboratories)

Phenomenal FOV: 170° (with low distortion)

Built for: general engineering

Bumblebee2: http://www.ptgrey.com/bumblebee2-firewire-stereo-vision-camera-systems

Too much expensive (not even worth mentioning)

Note: All prices are in date of April 18th 2015 and might change overtime.

As you can see, some have really goods pros, but none seems to be perfect for the task. In fact, the ZED seems to have the best specifications overall, but lacks of minimum range (since it is a large baselined camera designed for long range applications). Also, the DUO Mini LX seems to be the best for my situation, but unlike the ZED which generates really accurate depth maps, this one seems to lack of precision (lower resolution). It might be good for proximity detection, but not for 3D scanning (in my opinion). I could also try to build my own experimental stereo camera with two simple webcams, but I don't know where to start and I don't think I will have enough time to deal with all the problems I would face doing so. I am now stuck in a great dilemma.

Here are my questions:

What good resources on the internet give you a good introduction on 3D scanning concepts (theoretically and programmatically)? I will be using C++ and OpenCV (I already worked with both a lot) and/or the API provided with the chosen camera (if applies).

Should you have a static camera capturing a moving object or a moving camera capturing a static object?

Should I use something in conjunction with stereo camera (like lasers)?

Is it profitable to use more than two cameras/sensors?

Are resolution, FPS and global shuttering really important in 3D scanning?

What camera should I get (it can also be something I didn't mention, in the range of $500 maximum if possible)? My main criteria is a camera that would be able to generate an accurate depth map from close range points.

Thanks for your help!

答:
My favorite is the Learning OpenCV book.  It has a fantastic stereo / 3D section that introduces concepts from the ground up.  If you're at a university, you might be able to find the digital version available from the library website.

Depends, especially on how you are going to combine scans into a full 3D pointclound (if you need 360 degree views.)  Overall, moving the camera is usually harder than moving the object in my opinion.

Lasers can help a ton.  Take a look at the MakerScanner from a few years ago (disclaimer, I designed it).

Extra cameras can reduce ambiguities in stereo (from, say, horizontal symmetry).  In such a controlled environment, I doubt it's worth it.

Resolution, yes, depending on your scan technique.  With something like the MakerScanner, you can use sub-pixel interpolation on the laser line to get surprisingly good accuracy, reducing the need for high resolution images.  If you're in a controlled environment, FPS probably isn't much of a concern (ie just scan slower.)

You might consider pairing gPhoto2 with a point and shoot camera like one of the Cannons on this page, which can give you incredibly nice images for very little money.  Not much in the way of realtime, but it's unclear to me that you need that.


问:
Typical method for integrating a neural net into a PLC
How would one typically integrate a neural network into an online automation system?

As an example, we have developed a neural network that predicts a difficult to measure variable within a reactor using multiple sensors. We then use this predicted variable to tell the automation system to, for example, increase/decrease the stirrer speed.

How would someone implement this idea into a commercial system. Would they develop a function block that can simulate the neural network? Would they run a software on the server that reads and writes to the PLC control tags?

答:
Normally for a control system like this one would have a couple options:

Run the code on a co-processor that feeds data to and from the PLC over serial

Run the code on a server that sends data to and from the PLC over ethernet or serial

Run the code directly on the PLC if it has a general purpose processor or an integrated FPGA ect...

Normally for reactors and other high risk systems they have a redundant architecture so you will need to have either two (or more) coprocessors or two (or more) servers running the code. but all this will be directed by the current infrastructure that exists and how it is set up, and the computational requirements of the code. But before anything like this is used in the control loop of something as high risk as a reactor it will have to have some real improvement over the current setup, and be rigorously validated to ensure it works as expected in all situations.


问:
An architecture for testing autonomous flight and sensors
I'm designing a simple autopilot software on top of Ardupilot, my goal is to possibly interface an Raspi on top of ArduPilot Mega (APM). I am stuck on setting up a simulation environment using either V-Rep or Gazebo.
The quadcopter will have basic sensors plus advanced sensors. basic sensors talks directly with ArduPilot, while advanced sensors talks with my own autopilot software. I am trying to wrap my head around a feasible setup to test the software while using ArduPilot Mega in the Hardware-In-The-Loop. I am planning on having three stages of Simulation:

Stage 1. Simulate quadcopter physics in Gazebo/V-Rep, run ArduPilot software and my autopilot software in a VM (not sure if it's even do-able)

Stage 2. Simulate quadcopter physics in computer, run my autopilot software in a VM, and run APM in a hardware-in-the-loop fashion.

Stage 3. deploy my autopilot onto Raspi and interface with APM then run both hardwares in Hardware-in-the-loop fashion.

答: Adrucopter already has it's own HITL simulator, I would set up your flight system as you expect it to be setup in hardware, and depending on your sensors extend the APM HITL to include them and send the data from them back to the raspberry pi/APM in order to debug not just the operation of the autopilot system but any integration issues on both the hardware and software sides at the same time. I setup a similar system by using the HITL and adding an extension that emulated data from a pixy camera tracking a virtual object and it worked great!</p>


问:
How to set up binocular cameras on a car?
I am trying to set up my stereo vision system on a car. However, I meet several problems and do not know how to solve them.

How to select the baseline? I want the distance measurement to be far at 30 or 50 meters and near at around 5-10m. Is it possible to choose a baseline that meets my requirement?

I have tried stereo calibration of two cameras and also learned how to compute depth value from disparity map. However I don't know how to compute depth value if the focal lengths of the two cameras are different. It seems all the theorems I can find on the Web only concern cameras of the same focal length.

答: Why would you use two cameras of different focal lengths? that is just asking for trouble and will add so many issues and much unneeded complexity to the calculation of the depth map. Selecting a baseline set up a relationship between the size of the detected object in pixels and the distance of that object, you want to ensure when you detect the image that there is at least a couple of pixels of separation between the pairs (I shoot for greater than 10) as a rule of thumb I use 1:50 - 1:150 ratio for the ratio between the camera separation to the detection distance for basketball sized objects, but this will vary wildly depending on the cameras and the resolution.</p>


问:
Wifly Shield Not Connecting
I recently asked a question about the juniper WiFi shield, and am now working with wifly from spark fun. I've been using an updated version of their experimental library, and have been attempting to set up a webserver. Unfortunately, when I attempt to connect through a web browser, I get an error saying that the page sent no data. Here's my code:

```<code>#include <SPI.h>
#include <WiFly.h>

WiFlyServer s(80);
boolean current_line_is_blank=true;
void setup() {
  Serial.begin(9600);
  WiFly.begin();
  if(!WiFly.join(placeholderssid, placeholderpass,WPA_MODE)) {
    Serial.println("Connection Failed.");
  } else {
    Serial.println("Connection Succesful!");
    Serial.println(WiFly.ip());
    Serial.println("Receving Client Input...");
    s.begin();

  }
}
void loop() {
   WiFlyClient c = s.available();
   if(c) {
   Serial.println("Server Ready.");
   current_line_is_blank=true;
   while(c.connected()) {
     Serial.println("Client Connected.");
     if(c.available()) {
       Serial.println("Client Available for data.");
       char tmp = c.read();
       Serial.println(tmp);
       if(tmp == '\n' && current_line_is_blank) {
         Serial.println("Sent OK Response.");
         c.println("HTTP/1.1 200 OK");
         c.println("Content-Type: text/html");
         c.println();
         c.print("WiFly Webserver Running!");
         c.println("<br />");
         break;
       }
      if (tmp == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (tmp != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
       }
   }
   }
    delay(2000);
    c.stop();
}
</code>```

I am using Arduino Uno, and the serial monitor looks like this:

```<code>Connection Succesful!
10.100.1.173
Receving Client Input...
</code>```

Is there anything obviously wrong with my code?

EDIT:
I now have a new shield, but I'm still working with the same problem. Is it a malfunction in the hardware? I just can't figure this out!

答:
I've never programmed an Arduino or used this module, but from a quick look at the code and its output, it looks like only setup() is getting run, while loop() is the source of the problem (sort of expected). Try adding a println statement before checking for c to see if the loop gets run at all.

```<code>...
void loop() {
  WiFlyClient c = s.available();
  Serial.println("Looping...");
  if(c) {
    Serial.println("Server Ready.");
    ...
</code>```

Assuming the above checks out, my hunch is that the problem is in the first line of the loop:

```<code>...
WiFlyClient c = s.available();
...
</code>```

Why are you initializing the client, c, with the server's availability? This seems to imply that the if statement is essentially testing for the server's availability, instead of the client's availability. What's more, you then also run c.connected(), c.available(), and c.println(), which is somewhat at odds with c's initialization.

Try checking what you need to initialize c with and then probably switch the if statement as follows:

```<code>...
if(c.available()) {
...
</code>```

Just my 2c.

Title: Wifly Shield Not Connecting

Body:
I've never programmed an Arduino or used this module, but from a quick look at the code and its output, it looks like only setup() is getting run, while loop() is the source of the problem (sort of expected). Try adding a println statement before checking for c to see if the loop gets run at all.

...
void loop() {
  WiFlyClient c = s.available();
  Serial.println("Looping...");
  if(c) {
    Serial.println("Server Ready.");
    ...

Assuming the above checks out, my hunch is that the problem is in the first line of the loop:

...
WiFlyClient c = s.available();
...

Why are you initializing the client, c, with the server's availability? This seems to imply that the if statement is essentially testing for the server's availability, instead of the client's availability. What's more, you then also run c.connected(), c.available(), and c.println(), which is somewhat at odds with c's initialization.

Try checking what you need to initialize c with and then probably switch the if statement as follows:

...
if(c.available()) {
...

Just my 2c.


问:
H-Bridge using atmega8 microcontroller
I want to use my atmega8 uC as a h-bridge.

Can anybody give me the source code using C, so that the microcontroller acts as an H-Bridge.

答:
Just for completeness -- although you will typically need an external H bridge to drive motors, you can use just the AVR pins directly if you are certain that the current will be low enough (for driving a really tiny motor, or maybe a LED pair).

The code would look something like this:

```<code>DDRB |= _BV(PB0) | _BV(PB1); // This sets PB0 and PB1 as output.
// After setting it as output, both the pins are driven low.

PORTB |= _BV(PB1); // This sets PB1 high and start spinning the motor in one direction
PORTB ^= _BV(PB0) | _BV(PB1); // This toggles state of both PB0 and PB1 -- change direction of the rotation
PORTB &= ~(_BV(PB0) | _BV(PB1)); // This sets both pins to low -- stop the motor
</code>```

Title: H-Bridge using atmega8 microcontroller

Body:
Just for completeness -- although you will typically need an external H bridge to drive motors, you can use just the AVR pins directly if you are certain that the current will be low enough (for driving a really tiny motor, or maybe a LED pair).

The code would look something like this:

DDRB |= _BV(PB0) | _BV(PB1); // This sets PB0 and PB1 as output.
// After setting it as output, both the pins are driven low.

PORTB |= _BV(PB1); // This sets PB1 high and start spinning the motor in one direction
PORTB ^= _BV(PB0) | _BV(PB1); // This toggles state of both PB0 and PB1 -- change direction of the rotation
PORTB &= ~(_BV(PB0) | _BV(PB1)); // This sets both pins to low -- stop the motor


问:
How does a robot efficiently store a map it makes?
From what I understand, you can create a map using sensors and storing values in an array.  For example, the array can have 0's for places not visited, and 1's for places visited, or 0's for open spaces and 1's for occupied spaces, etc.

The map I'm thinking of making will have about 1000 x 2000 members.  This means I need an array of 2 million members.  That seems like a lot.  If I have eight attributes about each member (like temperature, light level, sound level, etc.), then I have 16 million pieces of information to capture.

Is this correct, or is there a better way to create a map for a robot using software?

答: Since the robot is unlikely to visit all the locations you have a sparse data set that you can most simply store in a hash table.  You would have to think of a good way of hashing the x and y locations together.  You need a function hash(x,y) and feed that into a hash table.</p>


问:
Detect polyethylene
First of all, I am in high school[to tell you that I am a newbie and lack knowledge]

What I want to achieve for now is a thing that can differentiate between poly bags[polyethylene] and other stuffs. Or a thing that could detect polyethylene.

I have to built a robot and therefore we have only a few method accessible.

Anyway any knowledge or suggestion or external links provided by you, about this topic would be welcomed by me.

答: You could measure the change of capacitance when you put a sheet of plastic between 2 metal plates but it then does depend on the thickness of the sheet of plastic as well as its type.</p>

Title: Detect polyethylene


问:
Including a RaspberryPi within a robot... Does this allow for a "universal API"?
I know this is a broad statement, but when you've got support for both TCP as well as a full fledged computer on board (to integrate/run an arduino), does this essentially allow for anything that would run on a linux box (raspberryPi) to run and operate your robot?

I know clock speed as well as the dependency libraries for a given code base (on the Pi) would add some complexity here, but what are some of the big issues that I'm overlooking in such a vertically-integrated control system?

Including a RaspberryPi within a robot... Does this allow for a "universal API"?

答:
To offer an answer that (specifically) addresses the question, as I understand it, the RaspberryPi offers (either as part of the standard Pi distros, as add-ons or compilable from source) pretty much anything and everything that the Linux operating system provides.

However, for those that are not part of the distro (or from the repositories) there are portability issues, due to the specific hardware platform.

does this essentially allow for anything that would run on a linux box
  (raspberryPi) to run and operate your robot

As such, I'm of the opinion that "Maybe" is the answer... but whether I'd trust a robot to a Pi is another question entirely.

That having been said, now some personal opinion:

Yes I have a couple of Pis that I'm experimenting with, but I've rapidly broken through the hype surrounding the Raspie.  I've come to the conclusion that it is so general purpose that it is, in effect, a solution looking for a problem.

As an embedded prototyping system, one is better off with an Arduino or a PIC dev-kit, in my humble opinion.


问:
How can I communicate wirelessly between a RasPi and servo?
I want to use a Raspberry Pi to pan a camera mounted on a servo wirelessly from ~100 feet away. What are some good servos and transceivers for this?
To clarify, there should be no physical connection between the RasPi and servo.
Do I need an additional RasPi on the servo end?</p>

答:
No matter what, you will have to have a device physically sending a pulse width modulated signal to the servo.  It doesn't necessarily have to be a raspberry pi, and honestly you probably shouldn't use one in this case.  Raspberry Pi's do not have a hardware implementation of PWM.  Software PWM is unreliable because of the precise timing needed for the motor.

I would recommend learning some Arduino as well in this case.  You can still have a RPi talking wirelessly via Radio Packet Communication (i.e. XBee, Bluetooth, 802.11, etc.) to the Arduino.  It will just take a little extra learning if you're not familiar with C coding and setting them up.

If you do want to go the double RPi route.  Look into using these for easy motor control: Adafruit 16-Channel PWM / Servo HAT for Raspberry Pi - Mini Kit

For a good explanation of software PWM and what can go wrong, watch this:
https://www.youtube.com/watch?v=ddlDgUymbxc


答:
Use rasp-pi, arduino ,servo and transceiver set (like nrf24l01 or XBee)

Wifi: 10-30m

Bluetooth: 10m

nrf24l01: 15m

XBee 1mW: 300ft

Title: How can I communicate wirelessly between a RasPi and servo?

Body:
I want to use a Raspberry Pi to pan a camera mounted on a servo wirelessly from ~100 feet away. What are some good servos and transceivers for this?
To clarify, there should be no physical connection between the RasPi and servo.
Do I need an additional RasPi on the servo end?</p>


答:
As TomSchober said,  you will need to send a PWM signal to your servo either way. Tom has already covered Arduino, so I'll make two other suggestions:

Texas Instruments MSP430 with a CC2500 radio (or maybe a newer version of this). It has a 2.4GHz radio with an antenna that you can configure to work as you like. The downside is it is harder to program than, say, an Arduino, but it is definitely doable. The kit is also kind of expensive. If you max out the signal strength, the range is fairly good. If you are interested, I can edit this post with a link to my github code for the radio.

STM32 Discovery board. You would need to get a bluetooth or a Wi-Fi dongle for it, but it has hardware PWM. It is fairly easy to program - there is lots of application code available through STM, and it is quite inexpensive at about 12-20 dollars per board. You will also get a fairly capable ARM processor that you can use to do lots of fun stuff. The F3 variant that I linked comes with a build in accelerometer and gyro.

The only warning I would have is: make sure the servo can get sufficient current from whatever you use to power it. For example, connecting the servo power line of a high-torque servo directly to the STM32 power pins blows the power circuit of the board (cough  cough) - it is not a particularly hard fix, but still. If your camera is heavy enough and the servo is torque-y enough, I would recommend a separate power supply for the servo.


问:
What is the technology used for no-resistance robot arms?
I saw a high end robot arm once that I could move and bend it to any form I wanted with no resistance, as if the robot arm didn't have any weight. I'd like to know more about them. What is this class of robot arm design called? Where can I get some more information about its design and applications?</p>

答:
This capability is called "gravity compensation".  Simply put, the robot arm only exerts enough torque to cancel out the effects of gravity.  So, any extra force that you exert on the arm allows the arm to be moved easily.  Note that the required torques are highly dependent on the arm's configuration (i.e. joint angles). This is mainly a feature of the software and the control system rather than the hardware (although there is a minimum set of required hardware functionality, see below).

I believe PD control is typically used. Gravity compensation requires a very good model of the arm's kinematic and dynamic properties.  This goes well beyond just the center of masses for each link.  Frictions, inertias, and other non-linear affects are typically taken into account.  (I heard a story from a friend that the friction properties of the arm he was working on changed dramatically as it warmed up, which made controller tuning a nightmare).  The controller must also be tuned very well.

While this is a software feature, I think it would be difficult to impossible without certain hardware features.  For example you need high precision joint encoders, some manner of joint or motor torque sensing, good resolution torque control, and typically back-drivable motors.

I believe you can implement a kind of poor-man's gravity compensation without some of these hardware features if you have a good force-torque sensor at the wrist.  The limitation being that the user can only move the arm by touching the force-torque sensor.  Basically, this is zero-force control.  The arm can hold its position with as much torque as it wants, but tries to keep zero force on the sensor.  So if you push the sensor, the arm will move away as if it is weightless.


答:
1.

The baseline you want is going to depend on the resolution you want to process the images at.  The minimum range is determined by two things.  First, both cameras have to able to see the object of interest.  Second, there is typically a minimum range due to the processing.  Most stereo algorithms have a maximum disparity that they will search up to.  Since disparity is proportional to inverse distance, a larger maximum disparity gives you a closer minimum range.  Since the maximum disparity is a pixel amount, you can decrease your minimum range by reducing resolution at the cost of accuracy and resolution.  It will also depend on the field of view of your cameras.  You can calculate the minimum range by calculating the ray through f_1(x,y) and the ray through f_2(x+d,y) where f_1 projects a ray through point (x,y) in camera 1 and f_2(u,v) projects a ray through point (u,v) in camera 2 and d is the maximum disparity.  You can usually choose the maximum disparity to search, but it often results in a narrower field of view and usually the computation increases linearly with maximum disparity.

Maximum range is ill-defined.  A range of infinity corresponds to a disparity of 0.  The disparity is proportional to 1/distance so farther distance provides less range accuracy.  You can never be out of range though.  If you pick a minimal range accuracy, then you could calculate a maximum range.  Typically, a stereo algorithm will achieve disparity accuracy of around 0.25 pixels.

2.

For stereo, usually the images are dewarped to correct for lens distortion.  In addition, one camera is warped to be aligned with the other camera such that the axis of the cameras are pointing in the same direction and the camera position differs only in x.  During this process, any differences between the focal lengths of the cameras are also corrected such that the dewarped images have the same effective focal length.

Title: How to set up binocular cameras on a car?

Body:
I am trying to set up my stereo vision system on a car. However, I meet several problems and do not know how to solve them.

How to select the baseline? I want the distance measurement to be far at 30 or 50 meters and near at around 5-10m. Is it possible to choose a baseline that meets my requirement?

I have tried stereo calibration of two cameras and also learned how to compute depth value from disparity map. However I don't know how to compute depth value if the focal lengths of the two cameras are different. It seems all the theorems I can find on the Web only concern cameras of the same focal length.


问:
How to get the projection matrix from odometry/tf data?
I would like to compare my results of visual Odometry with the groundtruth provided by the KITTI dataset.
For each frame in the groundthruth, i have a projection matrix.
For example:

```<code>1.000000e+00 9.043683e-12 2.326809e-11 1.110223e-16 9.043683e-12 1.000000e+00 2.392370e-10 2.220446e-16 2.326810e-11 2.392370e-10 9.999999e-01 -2.220446e-16
</code>```

Here the instructions provided by the readme:

Row i represents the i'th pose of the
  left camera coordinate system (i.e., z
  pointing forwards) via a 3x4
  transformation matrix. The matrices
  are stored in row aligned order (the
  first entries correspond to the first
  row), and take a point in the i'th
  coordinate system and project it into
  the first (=0th) coordinate system.
  Hence, the translational part (3x1
  vector of column 4) corresponds to the
  pose of the left camera coordinate
  system in the i'th frame with respect
  to the first (=0th) frame

But I don't know how to produce the same kind of data for me.
What I have for each frame in my case:

The Tf transformation from the init_camera (the fix one from the (0,0,0)) to the left camera which is moving. So I have the translation vector and the quaternion rotation.

The odometry data: the pose and the twist

Camera calibration parameters

With those data, How I compare with the groundtruth ? So I need to find the projection matrix from the data above but don't know how to do it.

Can someone help me ?

Thank

答:
I'm not sure what reference frame the KITTI ground truth data is in, but I'm going to guess the robot frame.  The ground truth data looks to just be a transformation matrix for a homogenous point.  The transform is represented in the form such that P' = T * P where P' is a point in the world coordinate frame, T is the "projection" matrix (I'm not sure, but I don't think this is the right term for this matrix), and P is the point in the robot coordinate frame.  Here the points are represented as [x,y,z,1]^T.  The transformation has the form [R t; 0 1] where R is the rotation of the robot and t is the translation of the robot.  The [0 1] row has been elided in the KITTI data.  To convert this transform to translation + quaternion form, the translation is just the rightmost column.  The quaternion can be found by converting the rotation matrix R to a quaternion.  See http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion for formulas for this conversion.

The ground truth data is probably in the robot reference frame.  To convert it to the camera reference frame, you'll need to use the camera extrinsics.  If the camera extrinsics which maps points from robot space to camera space is E, then the ground truth in the camera frame is E * T * E^(-1) where T is the ground truth in the robot frame.  This is just composing the transforms (robot->camera) o (robot->robot) o (camera->robot).  If the extrinsics is given as the transform from camera space to robot space, then the inverse will be on the left side instead.


问:
How to approach an object
My question is more on a basic/conceptual level.

I'm looking into a way to approach an object in map, that I have detected earlier. My robot is localized in a map using SLAM. And object position is 2D point that I recieve from my algorithm. (Object is actually a face picture on a wall). Is there a smart way to approach the point and "look" at it?

答:
I wasn't totally sure what you meant by "draw and arc and check where the arc is on valid map position. Then move the robot there and calculate the angle to rotate the robot". Perhaps you mean something like this:

You draw an arc starting at the face, coming straight out of the all (tangent to the face's normal vector), and ending at the robot.

That's certainly one way to plan the path, and it works well if there's no obstacle in the way.

However, my own favourite path planning method is more computationally intensive, but works very well in many cases, handles acceleration and cornering, initial and final direction, and in many cases handles obstacle avoidance.

Iterative Finite Element Path Planning

Start by defining a path as a sequence of points from the face to the robot. The first 2 points should be along the line of the robot's forward travel direction, and the last 2 points should be along the Face's surface normal vector.

Now we will iteratively adjust the path:

```<code>while(path_is_not_OK())
{
    n = number of points of path

    // Loop through all the blue points
    for(i=2; i<n-2; i++)
    {
        // move this point in the direction which reduces acceleration

        prev_velocity = point[i]   - point[i-1]
        next_velocity = point[i+1] - point[i]

        acceleration = next_velocity - prev_velocity

        point[i-1] -= acceleration * 0.01
        point[i]   += acceleration * 0.02
        point[i+1] -= acceleration * 0.01
    }
}
</code>```

I just wrote out that code from memory, so I don't guarantee its correctness.

After some number of iterations (about 50 - 500), you should see a nice smooth path from the robot to the target.

Feel free to add other adjustments into the loop to satisfy other constraints to may have on the path (for example wall or obstacle avoidance).

Title: How to approach an object

Body:
I wasn't totally sure what you meant by "draw and arc and check where the arc is on valid map position. Then move the robot there and calculate the angle to rotate the robot". Perhaps you mean something like this:

You draw an arc starting at the face, coming straight out of the all (tangent to the face's normal vector), and ending at the robot.

That's certainly one way to plan the path, and it works well if there's no obstacle in the way.

However, my own favourite path planning method is more computationally intensive, but works very well in many cases, handles acceleration and cornering, initial and final direction, and in many cases handles obstacle avoidance.

Iterative Finite Element Path Planning

Start by defining a path as a sequence of points from the face to the robot. The first 2 points should be along the line of the robot's forward travel direction, and the last 2 points should be along the Face's surface normal vector.

Now we will iteratively adjust the path:

while(path_is_not_OK())
{
    n = number of points of path

    // Loop through all the blue points
    for(i=2; i<n-2; i++)
    {
        // move this point in the direction which reduces acceleration

        prev_velocity = point[i]   - point[i-1]
        next_velocity = point[i+1] - point[i]

        acceleration = next_velocity - prev_velocity

        point[i-1] -= acceleration * 0.01
        point[i]   += acceleration * 0.02
        point[i+1] -= acceleration * 0.01
    }
}

I just wrote out that code from memory, so I don't guarantee its correctness.

After some number of iterations (about 50 - 500), you should see a nice smooth path from the robot to the target.

Feel free to add other adjustments into the loop to satisfy other constraints to may have on the path (for example wall or obstacle avoidance).