问:
Standard equation for steering differential drive robot
I am writing a code in Arduino IDE for NodeMCU Board to control a differential drive 2 wheeled robot.

I am able to steer only one direction for some reason and the steering response time is a little awkward.

Is there perhaps a better strategy for the code that I am using?`

I am using an app called Blynk that has a virtual joystick that controls that feeds the data through Virtual Pins. V1 param 0 and 1 are x and y. x would be left to right on the joystick and y would be forward and back.

Information about the App is available here: http://www.blynk.cc/. I have it working for the most part, but there is some latency since it is through a cloud service.

The main problem I am stuck on is steering while driving forward and backward.

```<code>    //#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int motorA ;
int motorB ;
int X=0;
int Y=0;
int Steer=0;
int maximo=0;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "b41ff7f1659b4badb694be4c59601c2c";

void setup()
{
  // Set console baud rate
  Serial.begin(9600);

 Blynk.begin(auth,"100Grand","Mob4life");

 pinMode(motorA, OUTPUT);
 pinMode(motorB, OUTPUT);
 pinMode(0,OUTPUT);
 pinMode(2,OUTPUT);
 pinMode(4,OUTPUT);
 pinMode(5,OUTPUT);

}

 BLYNK_WRITE(V1)
{
  int X1 = param[0].asInt();
  X=X1;
  int Y1 = param[1].asInt();
 Y=Y1;

}

 BLYNK_WRITE(V0)//      slider  de 100 a 255!!!!
{
 int vel = param.asInt();
 maximo=vel;
}

void loop()
{

  if(X == 128  &&  Y == 128)  //  Stop
  {
   motorA = 0;
   motorB = 0;
   analogWrite(5, motorA);
   analogWrite(4, motorA);
   analogWrite(0, motorB);
   analogWrite(2, motorB);
   }

   if(Y > 130 && X > 127 && X < 129)   //Forward
  {
    motorA = Y;
    motorB = Y;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA);
    digitalWrite(0,LOW);
    motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB);
    digitalWrite(2,HIGH);
  }

  else if(Y < 126 && X > 127 && X < 129)   //Reverse
  {
    motorA = Y;
    motorB = Y;

    motorA = map(motorA, 450,maximo,126, 0);
    analogWrite(5, motorA);
    digitalWrite(0,HIGH);
    motorB = map(motorA, 450,maximo,126, 0);//something is wrong with HIGH signal
    analogWrite(4, motorB);
    digitalWrite(2,LOW);
  }

   if(Y > 130 && X < 126)   //Steer Left
  {
    motorA = Y;
    motorB = Y;
    Steer = map(X, 450,maximo, 126,0);
     Steer = X / maximo;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA * (1 + Steer));
    digitalWrite(0,LOW);
   motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB * (1 - Steer));
    digitalWrite(2,HIGH);
  }

   if(Y > 130 && X > 130)   //Steer Right
  {
    motorA = Y;
    motorB = Y;
    Steer = map(X, 450,maximo, 126,0);
    Steer = X / maximo;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA * (1 - Steer));
    digitalWrite(0,LOW);
    motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB * (1 + Steer));
    digitalWrite(2,HIGH);
  }

  Blynk.run();
}
</code>```

Any help would be appreciated. Thanks!`

答:
What is Y? What is X? What is maximo? What are the digitalWrite commands supposed to be doing? Did you notice they are the same for both turns?

Possible problems:

Your map command is changing motorA and motorB from a range of 126-0 to a range of 450-maximo. (or from 130-255 to 450-maximo).

You set motorA and motorB to Y, and you only call these turns if Y is greater than 130.

Combine #2 with #1 above, and the output of the function looks like it will set motorA and motorB to some value higher than 450. This is problematic because analogWrite only goes from 0-255.

You try to modulate the motorA and motorB values with some +/- Steer, but again not knowing what X, Y, or maximo is it's not clear what Steer is, but that doesn't matter because motorA and motorB are way over the limit for what you should be feeding to analogWrite.

Coul you revise your question to include a brief summary of what you think your code is doing? Please also include how it's called - i.e., what the inputs are (X,Y,maximo, and every other variable that's not defined in the code you explicitly post).


问:
Robot never goes straight
I am using 2 identical DC motors and a castor wheel. The motors are connected to L293D motor driver and are controlled by RPi.

The robot is not going straight. It veers off to the right. I am running both the motors at 100% PWM.

What I tried to correct the error:

I adjusted the PWM of the wheel going faster to 99%, but the robot just turns to the other side;

I adjusted the weight on the robot and the problem still persists.

I once tried to run the motor without any load. Is that the cause of this, as I was later told that, running a DC motor without any load damages them?

If that is not the cause, then please tell me how to solve this problem without using any sensors for controlling it.

答:
Well, if the problem does not lie in differences in hardware nor software for each wheel, then it is probably a problem with natural imperfections in either the way you built the robot or the way the motors were produced. The connections might not be solid or the RPI might not be outputting the same current. You probably want to be using speed controllers. Try that first. </p>

<p>If that doesn't work, your manufacturer probably didn't make identical motors and you'll probably just have to calibrate the motors. It might mean scaling the value of the stronger motor so 100% power to the strong motor matches the weak one. </p>

ContentLicense: CC BY-SA 3.0

Title: Robot never goes straight

Body:
Well, if the problem does not lie in differences in hardware nor software for each wheel, then it is probably a problem with natural imperfections in either the way you built the robot or the way the motors were produced. The connections might not be solid or the RPI might not be outputting the same current. You probably want to be using speed controllers. Try that first.

If that doesn't work, your manufacturer probably didn't make identical motors and you'll probably just have to calibrate the motors. It might mean scaling the value of the stronger motor so 100% power to the strong motor matches the weak one.


问:
In the SLAM for Dummies, why are there extra variables in the Jacobian Matricies?
I am reading SLAM for Dummies, which you can find on Google, or at this link: SLAM for Dummies - A Tutorial Approach to Simultaneous Localization and Mapping.

They do some differentiation of matrices on page 33 and I am getting different answers for the resulting Jacobian matrices.

The paper derived

$$
\left[ {\begin{array}{c}
\sqrt{(\lambda_x - x)^2 + (\lambda_y - y)^2} + v_r \\ \tan^{-1}\left(\frac{\lambda_y - y}{\lambda_y - x}\right) - \theta + v_\theta \end{array}} \right]
$$

and got
$$
\left[ {\begin{array}{ccc}
\frac{x - \lambda_y}{r},& \frac{y - \lambda_y}{r},& 0\\ \frac{\lambda_y - y}{r^2},& \frac{\lambda_y - x}{r^2},& -1 \end{array}} \right]
$$

I don't get where the $r$ came from. I got completely different answers. Does anybody know what the $r$ stands for? If not, is there a different way to represent the Jacobian of this matrix?

答:
Besides the answers posted above, you can use Matlab to acquire H.

```<code>syms my mx x y r p a
r = sqrt( (my-y)^2 + (mx-x)^2 ); % range equation (r)
p = atan( (my-y)/(mx-x) ) - a;   % bearing equation (\phi)
 input = [x y a];
output = [r p];
H = jacobian(output, input)
</code>```

The result is

```<code>H =
[ -(2*mx - 2*x)/(2*((mx - x)^2 + (my - y)^2)^(1/2)), -(2*my - 2*y)/(2*((mx - x)^2 + (my - y)^2)^(1/2)),  0]
[ (my - y)/((mx - x)^2*((my - y)^2/(mx - x)^2 + 1)),         -1/((mx - x)*((my - y)^2/(mx - x)^2 + 1)), -1]
</code>```

Body:
Besides the answers posted above, you can use Matlab to acquire H.

syms my mx x y r p a
r = sqrt( (my-y)^2 + (mx-x)^2 ); % range equation (r)
p = atan( (my-y)/(mx-x) ) - a;   % bearing equation (\phi)
 input = [x y a];
output = [r p];
H = jacobian(output, input)

The result is

H =
[ -(2*mx - 2*x)/(2*((mx - x)^2 + (my - y)^2)^(1/2)), -(2*my - 2*y)/(2*((mx - x)^2 + (my - y)^2)^(1/2)),  0]
[ (my - y)/((mx - x)^2*((my - y)^2/(mx - x)^2 + 1)),         -1/((mx - x)*((my - y)^2/(mx - x)^2 + 1)), -1]


答:
I'm posting this as an answer because it is the answer.

You can't.

As @BendingUnit22 mentions, you are attempting "open loop" control. Noise and variations will mean that your robot will never drive a perfectly straight line.

The motors could have different winding resistances (different drive currents/torque), the wheels could be different sizes, the wheels could have different traction characteristics, the caster bearing could be "stiff", the caster might not be perfectly straight when the vehicle starts, the floor might have varying surface friction characteristics (read: dust or carpet) - the list goes on and on.

The only way to account for the things outside your control (what I mention above + more) is to use feedback sensors.

You can try to get better open-loop performance by correcting the problems I listed, but there are even more and you simply can't control everything.

Title: Robot never goes straight

Body:
I am using 2 identical DC motors and a castor wheel. The motors are connected to L293D motor driver and are controlled by RPi.

The robot is not going straight. It veers off to the right. I am running both the motors at 100% PWM.

What I tried to correct the error:

I adjusted the PWM of the wheel going faster to 99%, but the robot just turns to the other side;

I adjusted the weight on the robot and the problem still persists.

I once tried to run the motor without any load. Is that the cause of this, as I was later told that, running a DC motor without any load damages them?

If that is not the cause, then please tell me how to solve this problem without using any sensors for controlling it.


答:
Since the open-closed loop issue is already mentioned, I will give a comment to the "I once tried to run a dc-motor without a load".

Yes you might damage your motor with this but you can also damage or destroy your motor with a load. The destruction is coming from the current and the resulting temperature. If there is no smoke and some obvious smell coming from the motor it is most likely not damaged. From my experience I can tell that hobby-scale dc-motors will start to degrade at temperatures way over 100°C. And you will definetly notice such temperatures

EDIT:

I did think about this again and I might got an idea which your collegue might have been talking about. There are a special kind of AC-Motor. These are non-excited synchronous motors. Basically they are build for self destruction. If you power them up, they will start accelerating until they disassemble themselves. But if you place a heavy load on them, they can't reach this state, just because of the huge moment they have to apply to the load. So you can use them for reasonable purposes. Anyway you definetly do not of a motor like this in your application.

Title: Robot never goes straight


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

答:
A few things you should be on the lookout for:

Global shutter basically means all pixels get captured at the same time, as opposed to Rolling shutter where they are captured sequentially in a line scan fashion. Since your UGV will be moving around and performing stereo algorithms over the images you capture, it could be important that you avoid aberrations that occure when camera move, such as the ones seen in the pictures below (taken from Wikipedia):

Camera synchronization in hardware is achievable by some cameras, notably firewire cameras AFAIK. That can greatly improve the results for stereo when things are moving around.

Mounting should be done in a way that changes in the extrinsic parameters (the relative pose between cameras) for the stereo pair will be unlikely to change after calibration. In your rig that might be more important, since the UGV might face uneven terrain outdoors and things will vibrate.

Dedicated stereo hardware makes it possible to acquire disparity images directly as output of your stereo vision system, which eases the load off your embedded computing. It also tends to be much faster than running the very same algorithms in software.

As usual, the more you're willing to pay the better the results. To be honest, if you're able to buy a full-blown stereo camera such as the Bumblebee2, that's what I'd do. Otherwise, if you're on the cheaper side, I would simply go with a Kinect: it's unlikely you'll be able to get a system that outperforms it for the same price.


问:
Robotic manipulator Jacobian by product of exponentials
I've taken a class and started a thesis on robotics and my reference for calculating the Jacobian by product of exponentials seems incorrect, see:

http://www.cds.caltech.edu/~murray/books/MLS/pdf/mls94-complete.pdf

Specifically the resulting Jacobian matrix for the SCARA manipulator on page 118 would have us believe that the end effector translational velocity depends on joints 2 and 3 rather than 1 and 2.

Could someone please explain me why?

答:
The Jacobian in that equation is from the joint velocity to the "spatial velocity" of the end effector.

The spatial velocity of an object is a somewhat unintuitive concept: it is the velocity of a frame rigidly attached to the end effector but currently coincident with the origin frame. It may help to think of the rigid body as extending to cover the whole space, and you're measuring the velocity by standing at the origin and looking at what is happening to the end effector where you are, instead of at the end of the arm.

In the example given, the origin is at the same location as the first joint. This means that rotating the joint will sweep the end effector in a circle, but that the frame at the origin will only pivot around the vertical axis; this is encoded by the first column of the Jacobian being [0 0 0 0 0 1]'.

Rotating joints two and three will pull the origin-overlapping frame away from the origin, and hence have translational components.

To see how this works in action, note that the Jacobian that you asked about from MLS can be simplified to

$J_{st,SCARA}^{s} =  \begin{bmatrix}
0 & \phantom{-}y_{2} & \phantom{-}y_{3} & 0\\
0 & -x_{2} & - x_{3} & 0 \\
0 &0&0&1 \\
0& 0& 0&0\\
0& 0& 0&0\\
1&1&1 &0
\end{bmatrix},
$

in which the first three columns encode the velocity at the origin of an object rotating around the corresponding axis and the fourth column gives the velocity at the origin of an object sliding up the fourth axis.

You can convert the spatial-velocity Jacobian into a world-frame Jacobian by incorporating the Jacobian from base-frame motion to motion at the end effector's current position and orientation. For the SCARA arm, this works out fairly cleanly, with the only difference between the two frame velocities being the "cross product" term that accounts for the extra motion of the end effector sweeping around the base,

$
J^{w}_{st, SCARA} = \begin{bmatrix}
%
\begin{pmatrix} 1 &&\\ &1&\\ && 1 \end{pmatrix}
%
&
%
\begin{pmatrix} 0 & & -y_{4}\\ & 0 & \phantom{-}x_{4} \\ & & \phantom{-}0
\end{pmatrix} \\ \begin{pmatrix} 0&& \\ &0&\\ &&0 \end{pmatrix} & \begin{pmatrix} 1 &  &  \\  & 1 &  \\ && 1 \end{pmatrix} \end{bmatrix} J^{s}_{st,\text{SCARA}}.
$

This product evaluates to

$
J_{st,SCARA}^{w} =  \begin{bmatrix}
-y_{4} & -(y_{4}-y_{2}) & -(y_{4}-y_{3}) & 0\\
\phantom{-}x_{4} & \phantom{-}x_{4}-x_{2} & \phantom{-}x_{4}- x_{3} & 0 \\
0 &0&0&1 \\
0& 0& 0&0\\
0& 0& 0&0\\
1&1&1 &0
\end{bmatrix},
$

which matches what we would expect to see: Each of the rotary joints contributes to the end effector velocity by the cross product between its rotational velocity and the vector from the joint to the end effector (note that $x_{4}-x_{3}$ and $y_{4}-y_{3}$ are both zero).

===

In the general case, where the rotations are not only around the $z$ axis, you would want to use the full form of the matrix mapping between the spatial to world Jacobians,

$
J_{w} = \begin{bmatrix}
%
\begin{pmatrix} 1 &&\\ &1&\\ && 1 \end{pmatrix}
%
&
%
\begin{pmatrix} \phantom{-}0 & \phantom{-}z & -y\\ -z& \phantom{-}0  & \phantom{-}x \\ \phantom{-}y& -x & \phantom{-}0
\end{pmatrix} \\ \begin{pmatrix} 0&& \\ &0&\\ &&0 \end{pmatrix} & \begin{pmatrix} 1 &  &  \\  & 1 &  \\ && 1 \end{pmatrix} \end{bmatrix} J^{s},
$

which encodes the cross product terms for all three rotation axes when the end effector is at $(x,y,z)$ relative to the base frame.


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

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

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

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

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

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

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

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

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

Any help is appreciated!

答: I personally found very useful the procedure described at the following link, in order to have a total 3D estimation, without suffering any gimbal lock or other problems.</p>


问:
How many DOFs required to define a 3D pose
I understand that to be able to define point in 3D space, you need three degrees of freedom (DOFs). To additionally define an orientation in 3D space, you need 6 DOFs. This is intuitive to me when each of these DOFs defines the position or orientation along one axis or an orthogonal X-Y-Z system.

However, consider a robot arm such as this: http://www.robotnik.eu/robotics-arms/kinova-mico-arm/. This too has 6 DOFs, but rather than each DOF defining a position or orientation in an X-Y-Z system, it defines an angular rotation of one joint along the arm. If all the joints were arranged along a single axis, for example, then these 6 DOFs would in fact only define one angular rotation.

So, it is not true that each DOF independently defines a single position or orientation. However, in the case of this robot arm, it can reach most positions and orientations. I'm assuming this is because the geometry of the links between the joints make each DOF define an independent position or orientation, but that is a very vague concept to me and not as intuitive as simply having one DOF per position or orientation.

Can somebody offer some help in understanding these concepts?

答:
A 6-DOF robotic arm may not always be able to manipulate an object in all the directions and orientations in 3-D space from a particular position and orientation. Such a pose(position + orientation) is called as a singular position of the robotic arm. Mathematically, the robotic arm attains a singularity when the determinant of its Jacobian goes to zero. For eg., consider your arm itself which is a 7-DOF mechanism. When the human arm is fully stretched, the arm can no more move in certain directions in 3D space, an obvious one being in the direction along the arm. Such a position is called as singular position. A much simpler case is to imagine a planar robotic arm with 2-DOF with both being revolute joints. When this is completely stretched, it can only manipulate objects along a circle. All the points on the circle are points of singularity. If the arm moves slightly inside the circle, then it regains its ability to move along all the direction. </p>

<p>As you say, it is not true that each joint of the robotic arm contributes to one of the 6DOFs in space. All the joint motions contribute together in manipulating the object in 3D space. These concepts are covered in any introductory book on robotics. To get an in-depth mathematical understanding, you may go through the topics on forward kinematics and inverse kinematics. Getting a mathematical understanding will certainly improve your intuition and further the imagination of the motion of such robotic arms. </p>

Body:
A 6-DOF robotic arm may not always be able to manipulate an object in all the directions and orientations in 3-D space from a particular position and orientation. Such a pose(position + orientation) is called as a singular position of the robotic arm. Mathematically, the robotic arm attains a singularity when the determinant of its Jacobian goes to zero. For eg., consider your arm itself which is a 7-DOF mechanism. When the human arm is fully stretched, the arm can no more move in certain directions in 3D space, an obvious one being in the direction along the arm. Such a position is called as singular position. A much simpler case is to imagine a planar robotic arm with 2-DOF with both being revolute joints. When this is completely stretched, it can only manipulate objects along a circle. All the points on the circle are points of singularity. If the arm moves slightly inside the circle, then it regains its ability to move along all the direction.

As you say, it is not true that each joint of the robotic arm contributes to one of the 6DOFs in space. All the joint motions contribute together in manipulating the object in 3D space. These concepts are covered in any introductory book on robotics. To get an in-depth mathematical understanding, you may go through the topics on forward kinematics and inverse kinematics. Getting a mathematical understanding will certainly improve your intuition and further the imagination of the motion of such robotic arms.


答:
The explanation here is similar to the Cartesian vs Polar coordinate system.

I think that, for most people, the Cartesian coordinate system is the most intuitive. You move linearly some distance, then linearly some other distance, etc. The ending X/Y coordinates are related linearly to the distances you traveled initially.

In Polar coordinates, you turn some angle $\theta$, and then "walk" out some distance $r$ from the origin. In the end, the X/Y coordinates are not linear; the ending positions is given by $(r\cos{\theta},r\sin{\theta})$. You still have two degrees of freedom, but it's harder to inituitively know where the ending position is without practice, and each degree of freedom - $r$ and $\theta$ - can move both the x- and y-coordinate.

Similarly, you could have a robot with three linear actuators to navigate an end effector to an X/Y/Z spot in space. This is intuitive - the ending position is the distance traveled on each axis.

A robot like the one you mention is like polar coordinates for 3D space - this is referred to as a "spherical" coordinate system. In spherical coordinates you have two angles and a distance. Imagine pointing at the sun - you point SE or SW (azimuth angle) to the sun's projection on the horizon, then you point "up" (elevation angle) to where the sun's height is in the sky, then the sun is some distance $r$ away from you.

The robot you link doesn't have a means to telescope its arm, so instead of a true spherical coordinate system ($\theta,\phi,r$), you wind up with a purely angular coordinate system. Link distances still exist though, so it is possible to reach most coordinates within a sphere of radius $r_{\mbox{sphere}} = r_1 + r_2$, where $r_N$ is the length of each arm segment. It is most coordinates and not all coordinates because, if the arms are not the same length, then it cannot reach an interior sphere of radius $r_{\mbox{interior}} = \mbox{abs}(r_1 - r_2)$.

You are correct in that, if two axes are aligned, then one degree of freedom becomes essentially redundant and you get into a condition referred to as gimbal lock.

For an example, consider only two rotational degrees of freedom for a moment. Each has an arm of length $r_N$. Motion in the plane for the end effector is the sum of the motions of each arm link because the two arms are connected (read about vector addition for more information).

So, the first actuator moves some rotation $\theta_1$. This moves the end of the first arm link to a position of $(r_1 \cos{\theta_1}, r_1 \sin{\theta_1})$. The second actuator is located at the end of the first arm link. It rotates some other angle $\theta_2$, putting the end of the second link at a position of $((r_2 \cos{\theta_2}, r_2 \sin{\theta_2})$ RELATIVE TO the end of the first link. This means that the end effector is actually at:

$$
x = r_1 \cos{\theta_1} + r_2 \cos{\theta_2} \\
y = r_1 \sin{\theta_1} + r_2 \sin{\theta_2} \\
$$

In this way, you can vary $\theta_1$ and $\theta_2$ to add or subtract portions of $r_1$ and $r_2$ to achieve the desired $<x,y>$ positions. The third actuator sweeps that position around the y-axis to achieve the desired location in 3D space.

Title: How many DOFs required to define a 3D pose

Body:
I understand that to be able to define point in 3D space, you need three degrees of freedom (DOFs). To additionally define an orientation in 3D space, you need 6 DOFs. This is intuitive to me when each of these DOFs defines the position or orientation along one axis or an orthogonal X-Y-Z system.

However, consider a robot arm such as this: http://www.robotnik.eu/robotics-arms/kinova-mico-arm/. This too has 6 DOFs, but rather than each DOF defining a position or orientation in an X-Y-Z system, it defines an angular rotation of one joint along the arm. If all the joints were arranged along a single axis, for example, then these 6 DOFs would in fact only define one angular rotation.

So, it is not true that each DOF independently defines a single position or orientation. However, in the case of this robot arm, it can reach most positions and orientations. I'm assuming this is because the geometry of the links between the joints make each DOF define an independent position or orientation, but that is a very vague concept to me and not as intuitive as simply having one DOF per position or orientation.

Can somebody offer some help in understanding these concepts?


答:
What you are describing is called open loop control, and to do this you need two motors which are exactly the same, two wheels exactly the same, the robot center of gravity to be in the center between the wheels, a perfect symmetrical electrical circuit, and finally a perfect uniform level surface to run on.

To accomplish this you typically order tens or hundreds of each part, and then perform significant testing to find two motors that are the closest match to each other in terms of power and speed vs voltage and PWM. Do the same for the wheels, the motor controllers and other parts.

This process is called binning - after these tests you sort them according to their capability or characteristics.  It's considered much more expensive in both time and resources to do properly than changing to a closed loop model, and doesn't even account for poor ground conditions.

It is, however, one way to achieve your requirements without additional sensors.

Title: Robot never goes straight


答:
Though it will never be perfect, there may be a simple way to get it to go more straight.

If at 100%-100% the car always turns left, and at 100%-99% the car always turns right, you should be able to improve on that by trying values in between.

Start with 100%-99.5% and continue with 100%-99.75% or 100%-99.25% depending on the outcome. This should soon converge to a situation where you will go straight 'on average'.

Title: Robot never goes straight


答:
Inertial Navigation Systems (INSs) with 9DOF IMUs allow you to extract not only pitch and roll values but also yaw and most importantly are able to do so under sustained turns, where Coriolis acceleration is not negligible.

However, you'll have to completely overhawl your algorithm, instead of building it up incrementally.

DCM, as you said, is a traditional method. Ardupilot was using it until recently so the code is still in the repo and its initial author has written some good background reports. Start here and follow the relative links and publications of the author.

Another spinnoff of the Mahoney filter is the Madgwick filter which also works well and I have personally encoded it into arduino successfully, albeit for a plane. Here is the relevant report. You'll find more resources online.

Finally, Extended Kalman Filters are also making a comeback, thanks to cheaper, smaller more powerful computers. Ardupilot is using it lately as its main filter. However, EKF filters are usually tailor-made and I can't point to you to some ready-to-go code solution. I'm afraid you'll have to do a bit of searching. As a background read, this one seems fine.

Title: Understanding the various attitude estimation methods

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

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

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

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

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

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

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

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

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

Any help is appreciated!


问:
Measuring speed of movement in Webots
I have been experimenting with different fitness functions for my Webots robot simulation (in short: I'm using genetic algorithm to evolve interesting behaviour).

The idea I have now is to reward/punish Aibo based on its speed of movement. The movement is performed by setting new joint position, and currently it results in jerky random movements. I have been looking at the nodes available in Webots, but apart from GPS node (which is not available in Aibo) I couldn't find anything relevant.

What I want to achieve is to measure the distance from previous location to current location after each movement.  How can I do this?

答:
Some years ago I have used the supervisor to know the position of a simulated Khepera robot in Webots 4.
The main components of the C code was the following:

Declarations:

```<code>  #define STEP 64

  NodeRef robot_node;
  float robot_data[4]={0,0,0,0};
</code>```

Getting the node named Khepera:

```<code>  robot_node=(NodeRef)supervisor_node_get_from_def("KHEPERA");
</code>```

Getting data from the node in every STEP milliseconds:

```<code>supervisor_field_get(robot_node,SUPERVISOR_FIELD_TRANSLATION|SUPERVISOR_FIELD_ROTATION_ANGLE,&robot_data,STEP);
</code>```

All the above was called before the main cycle of the supervisor. The main cycle contained a robot_step(STEP); call to let the system fill the elements of the robot data structure (x,y,z,head coordinates) regularly.

Again it was Webots 4 may be there are better ways in Webots 7 to fulfill the task but it could be a starting point.

Title: Measuring speed of movement in Webots

Body:
Some years ago I have used the supervisor to know the position of a simulated Khepera robot in Webots 4.
The main components of the C code was the following:

Declarations:

  #define STEP 64

  NodeRef robot_node;
  float robot_data[4]={0,0,0,0};

Getting the node named Khepera:

  robot_node=(NodeRef)supervisor_node_get_from_def("KHEPERA");

Getting data from the node in every STEP milliseconds:

supervisor_field_get(robot_node,SUPERVISOR_FIELD_TRANSLATION|SUPERVISOR_FIELD_ROTATION_ANGLE,&robot_data,STEP);

All the above was called before the main cycle of the supervisor. The main cycle contained a robot_step(STEP); call to let the system fill the elements of the robot data structure (x,y,z,head coordinates) regularly.

Again it was Webots 4 may be there are better ways in Webots 7 to fulfill the task but it could be a starting point.


问:
How to connect Phone to Robot while charging phone from external battery?
I am controlling a robot via usb from an Android phone running the robot's code. This phone has a poor battery and I need to extend its life with a USB charger (can't change phones). How can I charge an android phone via usb, while maintaining a USB connection to the robot? I can solder wires together if needed, or can buy adapters as needed.

答:
You just need a DC-DC converter. This will take care of stepping down the voltage from battery to USB power specs. You may buy the ICs online and solder them or look for a breakout boards for quick setup.

Alternatively, you can look for USB car chargers or LiPo BEC (Battery Elimination Circuit).
You can break open the Car USB charger (which has the cigar lighter mount), and solder the battery leads to those terminals (https://www.youtube.com/watch?v=2IOs3g-52Zo , Omit the variable voltage part. You can just use the USB power)

LiPo BEC Option: https://www.youtube.com/watch?v=Uj4bSOg27T0


问:
How does one calculate distance and angle using a target with known measurements?
The target is in the shape of a U where the horizontal segment is 20 inches, and the two vertical segments are 14 inches. We are using a camera to image the target, and then using vision processing to isolate the target from the rest of the image. We know the vertical field of view, and the horizontal field of view of the camera. The resolution of the camera is 640x480 pixels.

The vertical distance between the camera on the robot and the target is constant but as of yet unknown because the robot hasn't been constructed yet. It is known, however, that the target will always have a higher elevation than the camera.

How can we use this data to calculate in real time the robot's distance to the target, and the angle to the target?

答: I would suggest model based pose estimation. DeMenthon and Davies describes a method for finding the pose of an object using 25 lines of Code! </p>


问:
Is there a way to measure 3 axis orientation without a magnetometer?
I have bought an STM iNEMO evaluation board in order to monitor the inclination of a separate magnetic sensor array as it moves in a linear scan outside of a (non-magnetic) stainless steel pipe. I want to measure the inclination of the sensor along the scan and ensure that it does not change. The problem I have found is that the measured magnetic field from the integrated magnetometer varies greatly with position along the pipe, and in turn, causes a large, position dependent error in one axis of the inclination reported by the iNEMO IMU. In fig. 1 below I show the set up of the test, I measured the inclination from the IMU while moving it along the length of the pipe and back again. The board did not change inclination throughout the measurement. In Fig 2 I show the magnetometer and inclination measurements recorded by the "iNEMO application" showing the large error in one of the inclinations.

My question is whether you know if there is any way of correcting for the magnetic field variation so that I can still accurately determine the inclination in all three directions? My data suggests to me that the magnetic field variation measured from the magnetometer is much greater than the geomagnetic field, so the inclination measurement will always be inaccurate. A follow up question I then have is: Is there a way to measure 3 axis orientation WITHOUT using a magnetometer?

答: You can incorporate an Inertial Measurement Unit.  Often they are a combination of a 3-axis accelerometer and a 2- or 3-axis gyroscope.  Here is a link to a description of one family of such devices: https://www.sparkfun.com/pages/accel_gyro_guide</p>


问:
Cost of material to 3D print
Can someone please share the typical cost of material to 3D print an object like a raspberry pi case?  Thank you.</p>

答:
This depends on what you mean by "cost". If you've got your own (or access to a) 3D printer and you're just paying for raw material then you can calculate the raw material cost per cubic distance (cubic inches, cubic centimeter, whatever your preferred units are), then determine the volume of the part to be printed, then multiply the two together.

Typically the CAD software used to create the 3D model will have a button that gives you the volume of the part.

Sometimes, as in selective laser sintering (SLS), the high temperatures involved degrade the unused nylon powder. This means that some percentage of the powder needs to be exchanged after some number of builds, and you'll wind up paying a higher cost than strictly the cost per unit volume of the powder (to pay for the replacement of the unused powder).

If you don't have access to the printer, then you'll wind up paying the same costs mentioned above, plus whatever their going rate is for time on the machine, time to setup the part, time to inspect/depowder/clean the part, shipping, and markup.

If you're interested in getting someone else to 3D print the part (and give you an instant quote), try a site like Shapeways.

Title: Cost of material to 3D print


答:
Calibration procedures for magnetometers exist, to compensate for soft iron (nearby ferromagnetic objects) and hard iron (nearby magnetic fields) offsets, which skew the measurements. However, these procedures usually map a static disturbance correction and apply it to all new measurements.
On the contrary, your environment changes from one end of the tube to the other.

If your magnetic sensor is allowed to move (relatively) slowly over the pipe under inspection, then you could use a 6-DOF IMU (Accelerometer + gyroscope) or even a 3-DOF accelerometer to find the orientation of the sensor but only in the pitch and roll axes.
If the magnetic sensor is expected to be under sustained accelerations, then a 6-DOF IMU won't be adequate.

Are roll and pitch values adequate for your application?

Title: Is there a way to measure 3 axis orientation without a magnetometer?

Body:
I have bought an STM iNEMO evaluation board in order to monitor the inclination of a separate magnetic sensor array as it moves in a linear scan outside of a (non-magnetic) stainless steel pipe. I want to measure the inclination of the sensor along the scan and ensure that it does not change. The problem I have found is that the measured magnetic field from the integrated magnetometer varies greatly with position along the pipe, and in turn, causes a large, position dependent error in one axis of the inclination reported by the iNEMO IMU. In fig. 1 below I show the set up of the test, I measured the inclination from the IMU while moving it along the length of the pipe and back again. The board did not change inclination throughout the measurement. In Fig 2 I show the magnetometer and inclination measurements recorded by the "iNEMO application" showing the large error in one of the inclinations.

My question is whether you know if there is any way of correcting for the magnetic field variation so that I can still accurately determine the inclination in all three directions? My data suggests to me that the magnetic field variation measured from the magnetometer is much greater than the geomagnetic field, so the inclination measurement will always be inaccurate. A follow up question I then have is: Is there a way to measure 3 axis orientation WITHOUT using a magnetometer?


问:
How do I select the best configuration for a known workspace, load and task?
Given workspace constraints, load and task to be done, how do I select the best configuration of my robot? How do I select between a cartesian or Scara robot for instance? How do I select a manipulator? How do I determine how many axes that I need?

Most of what I have seen is based on experience, rules of thumb and readily available standard devices, but I would like a more formal answer to quantify my choice. Is there some technique (genetic algorithm?) which describes the task, load, workspace, budget, speed etc. and rates and selects an optimal robot configuration or maybe even multiple configurations? How can I be mathematically ensure I ultimately chose the optimal solution?

The only thing I found online was a thesis from 1999 titled Automated Synthesis and Optimization of Robot Configurations: An Evolutionary Approach (pdf, CMU-RI-TR-99-43). It is a synthesis and optimization tool called Darwin2K presented in a thesis written by Chris Leger at CMU. I am surprised no one has updated it or created a tool similar to it.

To provide some context for my question, we are developing a robot to assist the elderly with domestic tasks. In this instance, the robot identifies and picks food items from a previously stored and known location. The hand opens the package and place it in the oven. The pick and place locations are fixed and nearby so the robot is stationary.

答:
I'll just show why heuristics and experience are relevant in this problem by showing that is nearly impossible to solve optimally.  Note, genetic algorithms cannot necessarily always solve a problem optimally, they are just another heuristic-based search.

Defining the manipulator
Let's simplify things. According to Craig 2005, robot manipulators can be reasonably decomposed into prismatic and revolute joints. Each such joint is one degree of freedom in your input space. That is, a hand on the end of the robot can be specified by a vectors of length $N$, where the robot has $N$ joints of types prismatic or revolute. OK. we can now specify the manipulator position. The set of all possible configurations is called the configuration space. Let's assume we know this completely, as you stated.

Defining the task
Let's assume that the task consists of moving the manipulator through a series of stages. For example, suppose the manipulator must drill 30 holes in a sheet, then place the sheet on a pallet, or whatever. Since we have the manipulator positions as a vector of length $N$, we can specify each task as a desired position, $X_1, X_2 ... X_M$ for task length $M$. What we've just done is specified a series of points in the configuration space which we defined above.

OK break time to verify the terminology if anyone is confused. Watch this video. The robot has 3 degrees of freedom (each rotation point), so the configuration space is all sets of 3 real numbers (in the range 0-$2\pi$, corresponding to the 3 angles of the 3 revolute joints). The task is to cause the end-effector (the pen) to visit all points on a circle. If this isn't clear, I can clarify.

Defining the cost Now that we know the configuration space and the series of points, let's talk about cost. The cost is typically the force exerted by the joints. So suppose (a huge assumption), that we can model this directly as $f(X_1,X_2)$, a function which returns the energy to go from state $1$ to $2$. If we're lucky, the function is a metric. If not, it defines a complete graph with $N\choose 2$ links (the cost to go from any state to any other state).

Defining the problem Find the optimal ordering of manipulator states and paths between manipulator states to minimize the cost, $f(X_i,X_{i+1})$ for each sequential task $i$. This is clearly a Travelling Salesperson Problem (See: TSP). Since TSP is NP-Hard, this problem is NP-Complete*.

What does the above mean? Well, for a given robot design, we have arrive at an NP-Complete problem to derive the optimal task sequence: movements, manipulator positions, etc. To optimize the robot itself is even more difficult. First, we have to search over all possible robot configurations (subject to what??), and for each, solve an NP-Complete problem. The best result is the robot configuration we want.  For a small-dimensional workspace (say one joint, or $N=1$), and a simple task (say a small number of possitions like $M$=3 or so) this is not too difficult. However, in general, $N$ is unbounded, and $M$ is large.

Even if there is some ordering property on $N$, like a robot of 2 joints is better than a robot of 1 joints, etc, you still have to do $\log(n^\star)$ TSP solutions, where $n^\star$ is the perfect number of robot joints. Remember a TSP solution is incredibly difficult to solve optimally. This gets even worse if we want to say "Well, what about two arms with two joints versus one arm with four joints."  I don't want to talk about that complexity ... It's exploding.

So, because you can't solve it perfectly using computers, people pay big money to have an experienced engineer do it for them. Win-win?

*well not really, but along the way we show a polynomial time reduction, so it sorta counts.

EDIT What we actually did here was describe the algorithm to select the optimal manipulator design. That should answer your first question. However, it is computationally infeasible to run on a computer, and so heuristics and other design choices are necessary, that should answer your second question.

What this means: We're also having this problem in our lab. Manipulators are very expensive, and we want one that is just good enough to perform some task. What we converged to was an extremely minimal set of joints for each task, instead of one large and capable manipulator for all tasks. My advice: I would design the robot based on budget and programmability, rather than trying to make a claim about the optimal configuration.


问:
CC3D - Replacing RC emitter with an RPi
I am trying to control a quadcopter using te OpenPilot CC3D board and a RaspberryPi. The main idea was first replace the signals from the RC emitter to the CC3D RC receiver for an RPi connected directly to the RC receiver inputs of the CC3D.

As far as I know the RC signals to the CC3D are PWM so the RPi should be able to control the channels using RPIO library to create the PWM by software.

But after make some tests I haven't find any way to move the motors. I am using the Ground Control System (OpenPilot Software) to configure the CC3D.

I am not sure whether I need to send the PWM signals in any order or something like that. I am also not sure how the Flight Mode Switch works, I suposse it works the same way as the other channels, using PWM.

Anyone have made anything similar to this?

答:
I could finally control the CC3D from the RPi.

The problem was a bad configuration from a RC input.
I also upgrade the CC3D firmware from the new Groung Control System software developed by LibrePilot, another community that wants to give support for the OpenPilot boards.

Title: CC3D - Replacing RC emitter with an RPi


问:
The logic of implementing an Auto-level function in a PID flight controller
So I have multi-rotor with a basic PID controller, that keeps its axis stable through the gyroscope. However, the multi rotor, does not keep its height or position. So I would like to use an accelerometer for keeping its rough position (auto level). I want to use both the gyro and accelerometer, but how would the accelerometer values be used, is it implemented through the PID the same ways the gyro values are (degrees per second, which is the rate I used to calculate PID)? And then adjusting the esc through that?? I am confused at that part (the basic logic for using the accelerometer values) </p>

答:
A gyro gives angular velocity in degrees or radians per second.

An accelerometer gives acceleration in feet or meters per second squared.

The key to keeping a reference position is getting from an acceleration to a position. This is done with by integrating the acceleration twice. The first integration gets from acceleration to velocity, then the second integration gets from velocity to distance.

So, if you were interested in implementing these integrations on a digital device, then you would use numerical integration in a manner as follows:

```<code>velocity = 0; % Set initial velocity
position = 0; % Set initial position
startTime = <get timer data>;
<main loop>
    endTime = <get timer data>;
    sampleTime = endTime - startTime;
    startTime = endTime;

    acceleration = <get accelerometer data>;
    velocity = velocity + acceleration*sampleTime;
    position = position + velocity*sampleTime;

    positionProportionalError = positionReference - position;
<loop>
</code>```

Once you have the positionProportionalError, you can integrate/derive the other two errors for PID and use that for your PID control.

Body:
A gyro gives angular velocity in degrees or radians per second.

An accelerometer gives acceleration in feet or meters per second squared.

The key to keeping a reference position is getting from an acceleration to a position. This is done with by integrating the acceleration twice. The first integration gets from acceleration to velocity, then the second integration gets from velocity to distance.

So, if you were interested in implementing these integrations on a digital device, then you would use numerical integration in a manner as follows:

velocity = 0; % Set initial velocity
position = 0; % Set initial position
startTime = <get timer data>;
<main loop>
    endTime = <get timer data>;
    sampleTime = endTime - startTime;
    startTime = endTime;

    acceleration = <get accelerometer data>;
    velocity = velocity + acceleration*sampleTime;
    position = position + velocity*sampleTime;

    positionProportionalError = positionReference - position;
<loop>

Once you have the positionProportionalError, you can integrate/derive the other two errors for PID and use that for your PID control.


问:
Do walking robots use accelerometers?
My understanding of walking robots (e.g. https://www.youtube.com/watch?v=xJlkBBdyBYI) is that they use a gyroscope to determine the current orientation of the robot, or each joint of the robot. This is because if you just put encoders on each joint, the cumulative error over the entire robot will be too large to maintain stability. Therefore, a gyroscope measures the "real" orientation, and this is used for feedback when the robot is walking.

However, I'm also aware that some walking robots use accelerometers to maintain stability. What would be the benefit of using an accelerometer in this case? Would it be used instead of a gyroscope, or together with a gyroscope?

My guess is that gyroscopes do not measure acceleration directly (unless you were to numerically calculate this based on lots of orientation readings), but accelerometers do measure it directly (and more reliably than this numerical method). Know the acceleration as well as the position then enables to robot to more accurately predict its future position, and hence the feedback loop is more robust. Is this correct, or am I missing the point?

答: You need both:  gyroscopes react quickly to fast changes in orientation, but lose accuracy in the long run.  Accelerometers are better in the long run, but are too sensitive to short term.  Combining them both using a "complimentary filter" gives a much better result than using only one or the other.</p>

Title: Do walking robots use accelerometers?


问:
What does "6 degrees of freedom" mean?
I am looking at this page that describes various characteristics of gyroscopes and accelerometers. Close to the end (where they speak about IMUs), the names of the items have something like this:

9 degrees of freedom

6 degrees of freedom

Can anyone explain what does this mean?

答:
Most "meters" of all varieties include up to three degrees of freedom simply to observe all three dimensions of reality we find ourselves in.

That said, every object in our three space has three additional dimensions of rotation.  Therefore an unconstrained object is typically said to have six degrees of freedom.

I had to search nine to understand.  Apparently, magnetometers are somehow considered a third set of dimensions, which to me is odd marketing.

Title: What does "6 degrees of freedom" mean?


答: n degrees of freedom of an object means it requires n unique parameters to completely define itself. For eg., a 3-DOF arm requires 3 joint parameters with which each and every position on the arm can be evaluated. Similarly in an IMU with 9 degrees of freedom, it is capable of measuring 9 independent readings. Now these 9 readings correspond to 3 from the accelerometer which gives linear acceleration along the 3 principal axes, 3 from the gyroscope which gives the orientation, and 3 from the magnetometer which gives the strength of the magnetic field. If you are an amateur in using IMUs you may be wondering the use of a magnetometer for acceleration and position estimation. But the onboard processor in an IMU is equipped with sensor fusion algorithms which even take the readings of the surrounding magnetic field and correct the readings in acceleration and gyroscope. However, in a 6-DOF IMU, the 3-DOF magnetometer is absent which gives readings of lower accuracy. </p>

Title: What does "6 degrees of freedom" mean?

Body:
I am looking at this page that describes various characteristics of gyroscopes and accelerometers. Close to the end (where they speak about IMUs), the names of the items have something like this:

9 degrees of freedom

6 degrees of freedom

Can anyone explain what does this mean?


答:
In IMUs, the number of degree of freedom is the number of independent readings they can do.

For 9 DOF IMU it is typically 3 for the accelerometer, then 3 for the gyroscope and 3 others for the magnetometer.

Title: What does "6 degrees of freedom" mean?


问:
3D Mapping from a quadcopter with KINECT
I have a quadcopter robot that has a KINECT on it and i want to do 3D mapping with it.

Is KINECT reliable on a moving robot (i.e., can it give me stable images and maps with this movement)?

Is there an SDK for producing 3D maps from KINECT data?  Will SLAM algorithms work?

Is the arduino board on the copter (ATmega 2560) powerful enough to handle this?

答:
After reviewing the original post and the posted answers, I agree, the task is absolutely infeasible in real-time with Arduino.  Don't even bother - Arduino is off by orders of magnitude.

Have you considered strapping a larger USB stick/flash drive on board, and then simply using the copter as a "sensor"?  Fly the craft around, gather your 3D data, store it in flash, bring it home, and then aggregate/register/process your data offline. Very, very cool in my opinion.


问:
Metal shaft design for a 6mm plastic bevel gear
I have a small POM bevel gear with these dimensions:

It has a 6mm hole for the shaft and a M4 hole for the set screw.

Suppose this bevel gear is meshed with a 45T bevel gear and give a max. output torque of 0.4kg/cm. How should the design of the 6mm shaft be? Should the diameter be precisely 6mm? Should it be flattened into a 'D' shape (so that the set screw can hold the shaft)? I'm planning to use a metal shaft.

Any help will be appreciated.

Thanks

答:
Since the bevel gear itselt is made out of plastic, you don't need to do a lot of considerations about the shaft.

Basically you are talking about a relationship between a hole and a shaft. This relationshift is called a fit. Usually you are defineing your fit by assining special tolerancefields and tolerancesizes to your nominal size.

In this case you have some cheap plastics, where you are almost unable to apply any special tolerances. This comes from the nature of those plastics, they are pretty flexible and can't stand lot of forces, in addition they are very hard to maschine.(I have never seen a broach made for plastics) Therefor most of this plastic parts are made by injection moulding (which is most likely true for your parts).

So let's this excursion into construction theory end and come back to your question. Just buy a cheap metal pin with 6mm (in most cases it is 6h7). If you measure the pin, you will see it will have somewhere between 5.97 and 6.00mm.
Create a flatspot ( use  a file or an electric driller), to prevent twisting between the gearing and the shaft and you are done.


问:
How can I switch between Autonomous mode and usercontrol?
I want to switch from usercontrol to autonomous. When I have the program running for 120 seconds, how come it wont automatically switch in autonomous mode? Thanks!</p>

```<code>#pragma config(Motor,  port1,           driveBR,       tmotorVex393, openLoop)
#pragma config(Motor,  port2,           driveFR,       tmotorVex393, openLoop)
#pragma config(Motor,  port3,           driveFL,       tmotorVex393, openLoop)
#pragma config(Motor,  port4,           flyRight,      tmotorVex393, openLoop)
#pragma config(Motor,  port5,           driveBL,       tmotorVex393, openLoop)
#pragma config(Motor,  port6,           flyLeft,       tmotorVex393, openLoop)
#pragma config(Motor,  port10,          Belt,          tmotorVex393, openLoop)

//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)
#pragma competitionControl(Competition)
#pragma autonomousDuration(15)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"

//Main competition background code...do not modify!

void pre_auton() {
}

task autonomous() {
    while(true == true) {
        motor[flyLeft] = -127;
        motor[flyRight] = 127;
        wait1Msec(500);
        motor[Belt] = -127;
    }
}

task usercontrol() {
    while (true == true) {
        motor[driveFR] = -vexRT[Ch2];
        motor[driveFL] = vexRT[Ch3];
        motor[driveBR] = vexRT[Ch2];
        motor[driveBL] = vexRT[Ch3];

        if(vexRT[Btn6D] == 1) {
            motor[flyRight] = -127;
            motor[flyLeft] = -127;
        }
        if(vexRT[Btn6D] == 0) {
            motor[flyRight] = 0;
            motor[flyLeft] = 0;
        }
        if(vexRT[Btn5D] == 1) {
            motor[Belt] = -127;
        }
        if(vexRT[Btn5D] == 0) {
            motor[Belt] = 0;
        }
    }
}
</code>```

答:
It has been a while since worked with VEX, but if memory serves, it was always more picky about syntax than plain C# usually is. Try swapping lines from:

```<code>#pragma autonomousDuration(15)
#pragma userControlDuration(120)
</code>```

To:

```<code>#pragma userControlDuration(120)
#pragma autonomousDuration(15)
</code>```

If you are trying to swap into autonomous from user control, you usually have them in that order inside of the code itself. If only to help someone else to understand what your code is doing, and in what order it is doing it.

On top of that, it is possible that you are telling the program to run user control for 120 milliseconds, and autonomous to run for 15 milliseconds. I remember most VEX programming tended to use milliseconds for timing, instead of 'plain' seconds, so unless that has changed, your software system is doing exactly what you told it to do - but you've told it to do it for such a short period of time, that the mechanical system doesn't even have time to response in any noticeable way before the loop times-out. Try increasing the time values to 120,000 and 15,000 respectively, and see if that helps.

Again, it has been a while since I've worked with VEX, and a lot has probably changed since then, but I hope this is answer you are looking for.

Body:
It has been a while since worked with VEX, but if memory serves, it was always more picky about syntax than plain C# usually is. Try swapping lines from:

#pragma autonomousDuration(15)
#pragma userControlDuration(120)

To:

#pragma userControlDuration(120)
#pragma autonomousDuration(15)

If you are trying to swap into autonomous from user control, you usually have them in that order inside of the code itself. If only to help someone else to understand what your code is doing, and in what order it is doing it.

On top of that, it is possible that you are telling the program to run user control for 120 milliseconds, and autonomous to run for 15 milliseconds. I remember most VEX programming tended to use milliseconds for timing, instead of 'plain' seconds, so unless that has changed, your software system is doing exactly what you told it to do - but you've told it to do it for such a short period of time, that the mechanical system doesn't even have time to response in any noticeable way before the loop times-out. Try increasing the time values to 120,000 and 15,000 respectively, and see if that helps.

Again, it has been a while since I've worked with VEX, and a lot has probably changed since then, but I hope this is answer you are looking for.


答:
To understand what these gyroscopes and accelerometers are measuring, you first need to know the physics and geometry behind "Degrees of Freedom". In terms of physics, each degree of freedom (DoF) in a motion that can exist in 3-dimmensional space. For example, 1DoF is moving along a straight line, or "axis"

Each time you increase the DoF, you exponentially increase the number of possible positions. A 2DoF system is usually (but not always) two axes that are perpendicular to one another and in the same plane. Picture a typical X-Y plane. A 3DoF system is similar, but it adds the 'z' axis as well, allowing for movement inside of a field, instead of just on a plane.

Once you get beyond 3DoF systems, to four through six, you usually start talking about rotation around each of the previous three axes. Picture a free-spinning wheel, that can move up and down the axle (guess the engineer forgot the collars and bearings). So if you have a 3DoF system where an object can also rotate about each axis, you really have six degrees of freedom. This can be visually demonstrated by the "Right Hand Rule"

Take you right hand in front of you and make a fist. Now give a thumbs-up. Keeping the thumb up, point your index finger out. Finally, keeping your thumb up and index finger out, point you middle finger parallel to your chest, perpendicular to both your index finger and thumb. Imagine that each of these fingers is an axis, with your thumb being "Y", middle finger being "X", and index finger being "Z". Move your hand up, and you're moving along the Y-axis. Move away from you, and it is the Z-axis. To the left and right is the X-axis. This is a full 3DoF system. But you can rotate your hand as well, and 'around' each finger too. This gives you three more degrees of freedom, so it is a full 6DoF system.

Usually, when you start talking about a system that is greater than 6DoF, you are almost always talking about multi-jointed system. I'll use a robotic arm as an example. In robotics, each time you add one joint to an arm, you increase the degrees of freedom of the system by one. As you get higher and higher degrees of freedom, the math gets exponentially more complicated and the system gets harder to control as a result. This is part of the reason why we don't have bionic limbs just yet.

But in this case, when these chips talk about "9DoF", they really mean they can measure acceleration, instead of just change in position. They do this by monitoring inertia and doing some calculus to figure out how quickly and how far it just moved. Because the movements they are measuring are pretty small, they are probably only measuring linear motion along its X-Y-Z axes (instead of rotation around any axis).

SHORT VERSION

The 6DoF chips measure motion along 3 perpendicular linear axes, as well as rotation around of each of these axes. The 9DoF chips do all this, plus measure linear acceleration along each of these axes.

Title: What does "6 degrees of freedom" mean?


问:
Create 2 Cable with 700 Series Roomba
For the last few months I have been playing with ROS on an nVidia Jetson TK1 development board. Up until this point, it has mostly been playing with the GPIO header, an Arduino Uno, a couple physical contact sensors, and a few custom motor and servo boards that I slapped together. But lately I've been eyeing an old 700 series Roomba that has been gathering dust (was replaced by an 800 series).

Does anyone know if the Communication Cable for Create 2 will work with a 700 series Roomba?

I know there are DIY designs out there, but I have always been a fan of using off-the-shelf components if they exist - you rarely save more money than your time is worth if it is something like a cable or similar component. So if the Create 2 cable will work, I'll use that. If not, I'll see what I can do to make my own.

答:
Yes, it will work! The electrical interface is the same between the Create 2 and the 700 series Roomba; however, the position of the mini-DIN is changed. Instead of being to the right, under the top cover, the connector can be found under a rubber gasket under the handle. As long as any Create cable can physically fit in that location (and the one iRobot sells can), it will work the same as it does on a Create.
 Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.

Title: Create 2 Cable with 700 Series Roomba

ContentLicense: CC BY-SA 4.0


问:
Joystick Rate Limit Filter For FRC Java Programming
I am a programmer for my school's FRC robotics team and have received the request from our hardware/driving department to limit the speed at which the robot's motors can accelerate given a joystick input telling it to increase the speed of the motor. For example, when the robot first starts up and the driver decides to move the joystick from the center to the fully up position (0 to full motor power), we don't want it to literally go from 0 to full motor power in an instant - it obviously creates some rather jerky, unstable behavior. How might I receive the target joystick position from the joystick, save it, and build up to it over time (and if any other inputs are sent in this process — like telling it to turn around — stop the current process and enact the new one)?

I am using Java with WPILib's 2016 robotics library: here's the API http://first.wpi.edu/FRC/roborio/release/docs/java/, and here's the tutorials http://wpilib.screenstepslive.com/s/4485/m/13809.

I am using the "IterativeRobot" template class, and teleop is being run in the method teleopPeriodic(), which is continuously called every few milliseconds in the program (it's where i'm receiving joystick input and calling the method RobotDrive.tankDrive() with the inputs).

I realize this is more of a programming question than a robotics question, but I figured it would be better to put it here than in stack overflow, etc. If someone could give me some simple pseudocode or just a conceptual idea of how this might be done (not necessarily as it pertains directly to the library or the language I'm using), that would be great.

答:
Well without knowing any of the libraries you are using I suggest using a low-pass filter on your input signal.
 Let's assume you fill use a standard filter of first order with a time coefficient of 0.1seconds (meaning in 0.1 seconds 68% or your input change was send to the output and in 0.5 seconds the input is switched to 99.9% to you output)
and your are reading those the joystick every 10ms, then your filter will look like this: $$G_z=\frac{0.09516}{(z-0.9048)}$$.
or:
$$y_k=0.09516 \cdot u_{k} + 0.9048 \cdot y_{k-1}$$ Transformed into code this is something like this:

```<code>
double GetPositionFiltered(double RawValueReadFromHw){
  static double OutputOld=0;
  double FilteredPosition = 0.09516*RawValueReadFromHw-0.9048*OutputOld;
  OutputOld=FilteredPosition;
  return FilteredPosition;
}
</code>```

Body:
Well without knowing any of the libraries you are using I suggest using a low-pass filter on your input signal.
 Let's assume you fill use a standard filter of first order with a time coefficient of 0.1seconds (meaning in 0.1 seconds 68% or your input change was send to the output and in 0.5 seconds the input is switched to 99.9% to you output)
and your are reading those the joystick every 10ms, then your filter will look like this: $$G_z=\frac{0.09516}{(z-0.9048)}$$.
or:
$$y_k=0.09516 \cdot u_{k} + 0.9048 \cdot y_{k-1}$$ Transformed into code this is something like this:

double GetPositionFiltered(double RawValueReadFromHw){
  static double OutputOld=0;
  double FilteredPosition = 0.09516*RawValueReadFromHw-0.9048*OutputOld;
  OutputOld=FilteredPosition;
  return FilteredPosition;
}


问:
High voltage motor control with arduino
I'm trying to control a higher voltage motor than an arduino can source with a pin, with an arduino. I am trying to hook it up to a transistor. The battery pack is not supposed to be 4.8V, it's 6V, 4 D batteries.

Here is the setup:

Here is the arduino code I'm trying to run to it:

```<code>int motorpin = 2;

void setup()
{
    pinMode(motorpin, OUTPUT);
}

void loop()
{
    digitalWrite(motorpin, HIGH);
    delay(500);
    digitalWrite(motorpin, LOW);
    delay(500);
}
</code>```

Code gives me no errors, but no motor movement happens. What would make this work? Thanks.

答: I actually just ran into this and I found that my resistor going from my Arduino pin to the base was wrong. You might want to watch this video. It was very useful for me. http://www.youtube.com/watch?v=DLl7-CmVT7w</p>

Title: High voltage motor control with arduino


问:
How modular arm joints work
Hello I'm trying to figure out how modular arm joints are designed and what kind of bearings/shafts are used for a modular-type robotic arm. Take "UR arm" for example. I believe those 'T-shaped pipes' include both a drive and bearing system. And as you can see from second image, it can be detached easily. So I think it's not just a simple "motor shaft connecting to the member that we want to rotate" mechanism. I'm wondering which type of mechanism and bearing system is inside of those T-shaped pipes. How can i transfer rotational motion to a member without using shafts?

答:
Like Andy said, a Harmonic drive seems to be the most likely answer. But your final question is very vague. The other option is that it is a direct-drive system (with a clutch to protect the motor), and they are using a very high-torque motor. They certainly seem to have the diameter, as long as you aren't trying to lift something too heavy.

As for your last question, if you must avoid shafts while trying to achieve rotational motion, you're probably going to have to use a pneumatic/hydraulic system. Most companies avoid this - I know of only two that use hydraulics for rotational motion, leaks will be the bane of your existence. The other option is to start playing with some pretty advanced materials (say some electro-reactive ones, that change shape with electrical current)

Title: How modular arm joints work


问:
How many DOFs required to define a 3D pose
I understand that to be able to define point in 3D space, you need three degrees of freedom (DOFs). To additionally define an orientation in 3D space, you need 6 DOFs. This is intuitive to me when each of these DOFs defines the position or orientation along one axis or an orthogonal X-Y-Z system.

However, consider a robot arm such as this: http://www.robotnik.eu/robotics-arms/kinova-mico-arm/. This too has 6 DOFs, but rather than each DOF defining a position or orientation in an X-Y-Z system, it defines an angular rotation of one joint along the arm. If all the joints were arranged along a single axis, for example, then these 6 DOFs would in fact only define one angular rotation.

So, it is not true that each DOF independently defines a single position or orientation. However, in the case of this robot arm, it can reach most positions and orientations. I'm assuming this is because the geometry of the links between the joints make each DOF define an independent position or orientation, but that is a very vague concept to me and not as intuitive as simply having one DOF per position or orientation.

Can somebody offer some help in understanding these concepts?

答:
Chuck's mathematical explanation is correct, but to provide a parallel to help illustrate the point, think about 3D FDM printers.

Right now, there are two main types of FDM printers: standard 'X-Y-Z' printers and "Delta" printers (pictured):

A Delta printer works by changing the angle of all three arms to achieve a desired position of the printing head. Mathematically, they are more complex machines to build and control than a 'typical' X-Y-Z printer. But their advantages in print volume (and sometimes quality:speed ratios) can outweigh this to the determined maker/engineer.

The basic principal between a delta printer and your arm is the roughly the same. The system knows it is dealing with a fixed number of levers, all at fixed lengths, and all interacting with one another. Knowing this information, it can manipulate these levers simultaneously to change the position of a single point.

In the case of the printer, if it raised one arm, the printer head will move towards it, and the other two will compensate to maintain the appropriate height (by lowering the necessary amount).

In the case of the arm, the 'bicep' will move to place the fulcrum of the 'forearm', forearm mores to place the 'wrist', and so on, and this is usually done in a single motion. Each of these joints is usually a single DoF in the system.

Chuck's explanation about the math for these joints is correct, but also incomplete - in that once things start moving, a lot more calculus becomes involved. You can determine a single position using the math he went over, but you couldn't really find the path between two points. Going over it would really too complex for here. If you would like to know more, I suggest picking up copies of "Engineering Mechanics Dynamics" by R.C. Hibbeler and "Control Systems Engineering" by Norman S. Nise. Tackle Hibbeler first, that will set you with a very solid understanding of mechanical dynamics. Nise is a much 'thicker' read, but control systems isn't a friendly topic to learn, and Nise does a decent job of breaking it down. Someone else here may have a better suggestion for a good control systems and feedback text to read.


问:
Alternative to BeagleBone Black for Node.js based remote control project?
I am working on a remote control project that involves using Node.js and Socket.io to transmit joystick data from a webpage to my BeagleBone Black.

However, I am somewhat disappointed with the BeagleBone - it seems like what should be such simple tasks such as connecting to Wi-Fi can be quite tricky...

My question is: Are there alternative boards I should be looking at? Boards that also have Node.js libraries with PWM support, could stream video from a webcam, but are easier to set up and have a larger developer community?

答: You will find only two boards with a larger developer community and one of them is supporting node.js, PWMs and USB-interfaces. It is the raspberry Pi.</p>


问:
Is AllJoyn a good ROS alternative regarding message passing cross multiple devices?
I've used ROS for a while, my environment is Raspberry Pi + Ubuntu + OpenCV + ROS + C/C++. I also use several ROS packages (tf2, usb_camera, slam related, and laser scanner capture.) Also, in my projects, nodes are in multiple devices, and I'm using multiple master package for one project.

I did review some tutorials about AllJoyn, but no handon experience so far.

The questions are:

regarding to message (especially, ROS image) passing cross devices, is AllJoyn a good ROS alternative? (devices are connected by wifi or bluetooth.)

For AllJoyn, does it still need single master (like roscore in ROS) to coordinate the nodes (or similar)?

Thanks.

答:
I suppose if you really wanted it, you could - but it seems to be designed for smart home/building applications. I also suppose if you really wanted to, you could use ROS for a smart home too.

But I am not really seeing an advantage to AllJoyn over ROS, in terms of robotics. ROS is structured in an almost 'P2P network', any device can subscribe and publish topics. But AllJoyn seems to be more of a 'hub-and-spoke' network model, some devices listen, fewer think and talk.

For example, on an AllJoyn network, it seems that any device can publish its present state, but it is a central computer that is making the decisions and publishing those decisions. The whatever circuit is controlling that light bulb, or thermostat, is taking all of its directions from the computer running AllJoyn. There doesn't seem to be any leeway for 'independent thought' in the network. But in a ROS network, you do not need to use a 'central-anything'. I can have my nVidia Jetson (which is the piece actually running ROS) control an Arduino, which in-turn is controlling motors based on its own code. The Arduino is making decisions based on what its motors are doing, and what the Jetson is telling it to do, and the Jetson is making decisions based on what the Arduino is telling it and its motors are doing (among other pieces as well).

AllJoyn would be perfect if you wanted to do an IoT or smart home project with your RasPi, but it doesn't seem to make a lot of sense for robotics since it doesn't have a lot of flexibility when it comes to defining feedback into the network devices.

To answer your questions succinctly:

Probably not, not for robotics at least. But it would be good for an IoT project.

Yes. It sounds like it needs a 'master' even more so than ROS. The ROS master is mainly to keep track of what is actually on the network and what it is doing. AllJoyn's master is actually making all the decisions too (unlike ROS, where you write nodes for each item on the network, and those do the work).

Now I might be mistaken about AllJoyn's network structure, but this was my impression on it after reading up on it last night and this morning.


问:
Is this supposed to be a bearing?
I'm looking at the assembly of a tail rotor that should look like this

original image

I wonder if the "tail output shaft stopper" (circled in red) is meant to be a bearing or just a piece of metal stopper:

My reading is that, since it's held by 2 set screws, the whole part should rotate with the rod. While rotating, it'd rub against the bevel gear on the tail drive though. Am I missing something?

答: You can see exactly this part in your image. It won't rub anywhere. Since your second pictures shows a so called exploded drawing you cant tell a lot about exact metrics.

Title: Is this supposed to be a bearing?


答:
The answer by Josh is excellent but here is an industrial perspective.

In my experience, industrial robot design always starts with the requirements of the load and the design decisions ripple back from there.

You need to look at the size, shape and weight of the object (or objects) to be manipulated, how fast you need to move the object and how accurate the control needs to be. Then you can marry this with details of how the object is to be moved. At each stage you work out the worst case and give yourself a little wriggle room in case something doesn't perform up to spec.

Although you can attempt to use average case rather than worst case, it is risky to do so. Just because you think that no-one will ever drive both axis A and B to it's full extent at the same time, doesn't mean that someone won't accidentally try to do it, and if arm AB isn't able to carry the weight in this configuration, it could be dangerous, both to the machine and any people nearby.

If you are lucky, your mechanical designer has access to not only CAD tools, but also CAE tools such as Finite Element Analysis, but many small, specialist robotics firms can't afford expensive CAE systems and rely entirely on experience, judgement and judicious over-engineering.

Even where a company does have access to CAE tools, they will often be used sparingly. Since it is infeasible to simulate the whole of a complex system in one go, subsystems are instead analysed independently of each other.

Ultimately as with many areas of expertise, there is no one-size-fits-all robotics solution. Every requirement has implications on a whole bunch of design decisions, and the effectiveness of the system is limited by the intersection of those design decisions.

Title: How do I select the best configuration for a known workspace, load and task?

Body:
Given workspace constraints, load and task to be done, how do I select the best configuration of my robot? How do I select between a cartesian or Scara robot for instance? How do I select a manipulator? How do I determine how many axes that I need?

Most of what I have seen is based on experience, rules of thumb and readily available standard devices, but I would like a more formal answer to quantify my choice. Is there some technique (genetic algorithm?) which describes the task, load, workspace, budget, speed etc. and rates and selects an optimal robot configuration or maybe even multiple configurations? How can I be mathematically ensure I ultimately chose the optimal solution?

The only thing I found online was a thesis from 1999 titled Automated Synthesis and Optimization of Robot Configurations: An Evolutionary Approach (pdf, CMU-RI-TR-99-43). It is a synthesis and optimization tool called Darwin2K presented in a thesis written by Chris Leger at CMU. I am surprised no one has updated it or created a tool similar to it.

To provide some context for my question, we are developing a robot to assist the elderly with domestic tasks. In this instance, the robot identifies and picks food items from a previously stored and known location. The hand opens the package and place it in the oven. The pick and place locations are fixed and nearby so the robot is stationary.


答:
A shaft stopper like that is made to let you assemble the device more precisely.  The bearings look like they are in the "Tail Gear Case Plate" subassemblies.  By using a shaft stopper you can insert the shaft into the bearings, but keep the shaft stopper set screws loose.  Then add whatever preload you want and locktite it in place (notice the "red" instructions in the drawing).

Regarding your additional question about how to secure the bearing: attaching a shaft and bearing can be a challenge.  Often a press is used if they are smaller components.  For large items the bearing is often heated, and, less commonly in my experience, the shaft may be cooled in dry ice.  A press may still be needed.  The tight clearance between the inner race of the bearing and the shaft helps to ensure the load is spread along the ID of the bearing.

Title: Is this supposed to be a bearing?

Body:
I'm looking at the assembly of a tail rotor that should look like this

original image

I wonder if the "tail output shaft stopper" (circled in red) is meant to be a bearing or just a piece of metal stopper:

My reading is that, since it's held by 2 set screws, the whole part should rotate with the rod. While rotating, it'd rub against the bevel gear on the tail drive though. Am I missing something?


答:
As SteveO suggested, it is clear from the exploded diagram that a bearing is part of each Tail Gear Case Plate, and the Tail Output Shaft Stopper is locked to the output shaft using the set screws, which sit in the D grooves in the shaft.

The Washer and Poly Slider precisely set the distance between the left bearing and the mesh gear (actually a mitre gear), while stopping the shaft from sliding up/left on the exploded diagram and disengaging the leader and follower.

The purpose of the Tail Output Shaft Stopper is to stop the shaft being pulled in the opposite direction, which is the direction the blades are going to be causing the shaft to be pulled when rotating.

With the stopper in place, the sideways force would be applied from the shaft to the bearing, through the Stopper, with very little force applied to the mesh gear.

Without the Tail Output Shaft Stopper all of the sideways force would be applied via the mesh gear, potentially wearing it out sooner, and possibly even causing it to bind and stop rotating altogether.

This sort of arrangement is fairly common in robotics application.

Title: Is this supposed to be a bearing?


答:
In addition to the RPi, as TobiasK suggests, the Arduino boards have:

PWM support;

USB support is possible with the addition of an inexpensive USB shield, and;

node.js is possible, see:

Arduino Experimenter's Guide for NodeJS;

A Practical Introduction to IoT using Arduino, Node.js and Plotly, and;

Controlling a Motorbot Using Arduino and Node.js

to mention but a few links.

However, before you abandon your BeagleBone, have you looked at:

Working with PWM on a BeagleBone Black;

Can the Beagle OTG port work in host mode? on the USB FAQ

the BoneScript Library for node.js?

Title: Alternative to BeagleBone Black for Node.js based remote control project?

Body:
I am working on a remote control project that involves using Node.js and Socket.io to transmit joystick data from a webpage to my BeagleBone Black.

However, I am somewhat disappointed with the BeagleBone - it seems like what should be such simple tasks such as connecting to Wi-Fi can be quite tricky...

My question is: Are there alternative boards I should be looking at? Boards that also have Node.js libraries with PWM support, could stream video from a webcam, but are easier to set up and have a larger developer community?


问:
iRobot Create 2 IR bump light sensor specifications
Can someone tell me where can I find some specifications about the iRobot Create 2 IR bump light sensors?

We have an SDF model of the Create 2 that uses the Hoyuko laser range finder sensor and we have to simulate the behavior of the IR sensors starting from the laser scan data.

Hence we would like to have some additional information on the IR sensors which we can't find anywhere on the web - such as their exact position in the robot chassis, their maximum range, the shape of the obstacle detection field and so on.

答:
I highly doubt iRobot will share too detailed info with you, but I can from my own experiments. I've found that the forward facing IR sensors in the bumper seems to be able to see around three feet away. The downward facing IR cliff sensors can only see about six inches. The top mounted IR sensor that is used for docking and lighthouse/virtual wall detection can see the furthest, around six feet and is the only one that can see a full 360 degrees.

I wish I could offer more, but I can really only tell by playing with it by hand.


问:
How to load a PUMA robot in the existing environment in OpenRAVE 0.9
I have a PR2 robot in an environment, which can be seen on the GUI of OpenRAVE.

Now, how can I load a PUMA robot arm in the same environment?

答:
Multiple robots and environments can be loaded.  Simply load them and position the robots.  Here is a Python example:

```<code>#! /usr/bin/env python

from openravepy import *

env = Environment()
env.SetViewer('qtcoin')

env.Load("pr2-beta-sim.robot.xml")
env.Load("puma.robot.xml")

pr2 = env.GetRobot('pr2')
puma = env.GetRobot('PumaGripper')

puma.SetTransform([1,0,0,0,0,1,0])
</code>```

Run this with something like: ipython -i my2robots.py

For an example in C++, see this example.

Body:
Multiple robots and environments can be loaded.  Simply load them and position the robots.  Here is a Python example:

#! /usr/bin/env python

from openravepy import *

env = Environment()
env.SetViewer('qtcoin')

env.Load("pr2-beta-sim.robot.xml")
env.Load("puma.robot.xml")

pr2 = env.GetRobot('pr2')
puma = env.GetRobot('PumaGripper')

puma.SetTransform([1,0,0,0,0,1,0])

Run this with something like: ipython -i my2robots.py

For an example in C++, see this example.


问:
iRobot Create 2/Roomba 530 Screw size/thread?
I've looked everywhere I can think of to find this information, but haven't come across anything. Does anyone know what kind of screws I can use to replace the ones on top of my Roomba 530?

I realize that the Create 2 is technically a 600 series, but I would expect they were the same.

I'd like to replace the screws on my Roomba with standoffs so I can stick a mounting plate on top of it. (Additional sensors, CPU, etc.)

答: The screws in the top cover of the robot appear to be special plastic screws; I've never been able to find a good place to buy more. If you're careful with a pin vise (remove the battery first! Don't use a power drill!!), you can tap into the holes shown in the Open Interface Spec section entitled Roomba Internal Screw Boss Locations with an M3 or 4-40 bottoming tap. I'd avoid the screws vertically aligned with the center of the robot, though; they're awfully close to other circuitry.</p>


问:
Analogue video to digital
I have FPV camera which outputs analog video (RCA, PAL).

I want to capture video and do image processing, therefore I need some way to convert the analog video to digital.

Can some one recommend me how to do it? Is there advice or a shield which can assist?

Please note:

I want to convert the frames with minimum latency, because it is a real time flying drone.

I don't need to convert the image to some compressed format (which encoding/ decoding may take time), if I can get the RGB matrix straight, it is preferred.

I thought about digital output camera, but I need one which weighs few grams and I haven't found yet.

答:
You will need to have on-board processing if you plan to go with real time processing and the low latency premise. There is no other way around it, since transmitting the signal will introduce sizable latency of an order of 200-500ms.
Consequently, I don't see how you can avoid loading your whole robotic vision system on top of your quad.

I believe that getting 1) and raw video isn't possible in an on-board format. Your best bet is something like this and you still don't get neither raw video nor guaranteed low latency.

I think your best bet is to combine a companion computer with a compatible camera. Consider the following combos:

Get a raspberry pi with its very small digital camera

Use the Odroid counterpart

Do the same as the above in a BBB

The choice boils down to your hardware of choice, where you feel more comfortable programming.

Be warned though: Attitude control and split-second obstacle avoidance is not possible with today's board PCs and low FPS cameras. Very custom solutions are required to get the job done.

Edit: If you still want to go with Analog->Video conversion, something like this would be the hobbyist's option. PCI frame grabbers cost $$$. Still, I haven't used this particular product, so please do your own market research.

Title: Analogue video to digital


答:
You could also consider the ESP8266. It can be programmed directly with the Arduino Developers Kit (see ESP8266 Arduino). In that sense the developer community overlaps heavily with that of the Arduino family. The way it integrates into the Arduino SDK basically makes it just another flavor of Arduino, although the pinouts aren't physically compatible.

The ESP8266 even when on a breakout board is a smaller than a typical arduino and does have PWM support as well as digital IO and ADC.

The advantage of the ESP8266 is that it has builtin wifi and can act as wifi host and client simultaneously. Getting a simple web page running from the ESP8266 has proven to be quite easy. Many examples are included in the SDK that is specific to the ESP8266 which are really just specifically tailored Arduino sketches.

Also, given the answer from greenonline that NodeJS can run on Arduino, I believe that the instructions at the link he provided should also work with the ESP8266. I'm not positive if Node.JS can run concurrently with the web sketches.


问:
L293D won't turn motor backwards
My small robot has two motors controlled by an L293D and that is controlled via a Raspberry Pi. They will both go forwards but only one will go backwards.

I've tried different motors and tried different sockets in the breadboard, no luck. Either the L293D's chip is broken (but then it wouldn't go forwards) or I've wired it wrong.

I followed the tutorial, Controlling DC Motors Using Python With a Raspberry Pi, exactly.

Here is a run down of what works. Let the 2 motors be A and B:

When I use a python script (see end of post) both motors go "forwards". When I change the values in the Python script, so the pin set to HIGH and the pin set to LOW are swapped, motor A will go "backwards", this is expected. However, motor B will not move at all.

If I then swap both motors' wiring then the original python script will make both go backwards but swapping the pins in the code will make motor A go forwards but motor B won't move.

So basically, motor A will go forwards or backwards depending on the python code but motor B can only be changed by physically changing the wires.

This is forwards.py

```<code>import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)

Motor2A = 23
Motor2B = 21
Motor2E = 19

Motor1A = 18
Motor1B = 16
Motor1E = 22

GPIO.setup(Motor1A, GPIO.OUT)
GPIO.setup(Motor1B, GPIO.OUT)
GPIO.setup(Motor1E, GPIO.OUT)

GPIO.setup(Motor2A, GPIO.OUT)
GPIO.setup(Motor2B, GPIO.OUT)
GPIO.setup(Motor2E, GPIO.OUT)

print("ON")
GPIO.output(Motor1A, GPIO.HIGH)
GPIO.output(Motor1B, GPIO.LOW)
GPIO.output(Motor1E, GPIO.HIGH)

GPIO.output(Motor2A, GPIO.HIGH)
GPIO.output(Motor2B, GPIO.LOW)
GPIO.output(Motor2E, GPIO.HIGH)
</code>```

And this is backwards.py

```<code>import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)

Motor2A = 21
Motor2B = 23
Motor2E = 19

Motor1A = 16
Motor1B = 18
Motor1E = 22

GPIO.setup(Motor1A, GPIO.OUT)
GPIO.setup(Motor1B, GPIO.OUT)
GPIO.setup(Motor1E, GPIO.OUT)

GPIO.setup(Motor2A, GPIO.OUT)
GPIO.setup(Motor2B, GPIO.OUT)
GPIO.setup(Motor2E, GPIO.OUT)

print("ON")
GPIO.output(Motor1A, GPIO.HIGH)
GPIO.output(Motor1B, GPIO.LOW)
GPIO.output(Motor1E, GPIO.HIGH)

GPIO.output(Motor2A, GPIO.HIGH)
GPIO.output(Motor2B, GPIO.LOW)
GPIO.output(Motor2E, GPIO.HIGH)
</code>```

If you see this diff https://www.diffchecker.com/skmx6084, you can see the difference:

Below are some pictures. You can use the colour of the cables to link them between pictures

enter image description here

答:
The motor driver chip you state you are using, the L293D, is a "quadruple half H driver." This means that, instead of two full H circuits capable of driving a motor forward and reverse, you have four half H circuits, which are only capable of driving a motor in one direction.

You even speculate in your post,

Either the L293D's chip is broken (but then it wouldn't go forwards) or I've wired it wrong.

I'm going to guess that you have not wired the motors to the driver chip correctly. This is just a guess, though, because you haven't posted pictures or schematics of your wiring.

In looking at a diagram of the chip, it looks like maybe an easy place to go wrong would be to wire into a ground pin on the chip instead of to one of the motor outputs.

You can see in the picture above from the datasheet (linked above) that the "heat sink and ground" pins are right beside the driver output pins. If you happened to wire one of your motor leads to pins 4, 5, 12, or 13 instead of 3, 6, 11, or 14, then the motor would still turn one direction (HIGH to LOW), but would not turn in another direction (LOW to LOW) because it's not connected to the driver pin that should be HIGH.

Again, pure speculation on my part, but it would seem to explain all of your symptoms. Please take a picture of your wiring and edit your question to include it.

:EDIT:

It's hard to tell in your pictures, and I can't see which way the chip is oriented, but it looks like:

Gold wires are Vcc

The teal wire is Pin 19, which you have as "Motor 2E" - or motor 2 enable, HOWEVER, it's not plugged in to the (3,4EN) or (1,2EN) pin on the L293D chip. Those are pins 9 and 1, respectively, and they are located on the corners of the chip. It looks like it's maybe plugged in to 4A (or 2A, again I can't tell the orientation of the chip).

Purple with maybe a white stripe is Pin 23, which you have listed as "Motor 2B", but that wire goes to a corner of the chip, which is where the motor enable is located.

So it looks like to me that when you set "Motor 2E", to enable motor 2, you are actually NOT enabling motor two, but instead you are setting maybe what you're calling 2A in your code. Then, when you think you are going "forward", you set "2A" LOW and "2B" high - what you're calling "2B" is actually the motor enable, and that's why it's turning on.

When you try to turn the other way, it looks like you're setting "2A" HIGH and "2B" LOW, but again what you're calling "2B" is actually the motor enable pin, so you're disabling the motor.

Try swapping 2B and 2E in your code (swap 23 and 19).

If that doesn't work, please post clearer pictures and we can troubleshoot some more. Particularly, I'm looking to see the chip's orientation and a better (crisper and better lit) shot of the wires where the enter the Raspberry Pi. Also, you have 3 white wires or very light gray and it's hard to tell where they're going.

Title: L293D won't turn motor backwards