问:
How to evaluate 3D Occupancy grid maps
I would like to know how to go about evaluating 3D occupancy grid maps.

I have a SLAM system that produces a 3D OGM (in .bt format using octomap/octovis)

I also have a ground truth OGM in same .bt format.

How do I compare the accuracy of my map to the ground truth map in a qualitative and quantitative way?

Important notes:

The two maps may not be the same scale.

One map may be less dense than the other.

One method I have thought about using is MRPT's occupancy grid matching application
This would require me to send both 3d maps as a message to the octomap_server node in ROS, get the resulting map in Rviz, save the image 2D image of each separately, and then somehow convert the images to MRPT's .simplemap file format, and then run MRPT's grid matching program on the two files.

Surely there is a better/more accurate way?

EDIT:
So I did more research and another route I could go is Matthew's Correlation Coefficient (MCC). I could compare two maps and iterate over each cell to compare my result to a ground truth, counting the True and False Positives and Negatives.
Only problem with this is that I have to assume that the two maps are the same scale, and also in the same orientation.

If you have any ideas on solving these scale and orientation issues don't be shy.

答:
I'd be (pleasantly) surprised to hear that there is a way to get the output you want based on your available inputs, but this problem seems incomplete.

The most accurate map is the one that gets you to your precise destination. To quantitatively measure that accuracy, you'd have to use your map to navigate from point A to point B, then compare that final position to the one you'd get with the ground-truth map.  It sounds like you only have point A (the origin) defined for both maps, so you have no way to measure point B's error.

At the very least, you would need to start with a set of points that are defined on both maps. (I say "points" meaning "2 or more"; I can't convince myself that a round-trip measurement -- starting and ending at the origin -- would properly explore the space.)

Title: How to evaluate 3D Occupancy grid maps


问:
Arduino uno A0 pin not working properly
void setup() {
  pinMode(A0, INPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(A0)== HIGH) {
    Serial.println("YES");
  }
}

Not giving any input when i am supplying input via push button. I have 5 v supply through 10 kohm resistor to push button and then have other side to A0 and a led to ground. It takes input when I take out wire connected to A0 and just leave it unconnected.

答: The A0 pin is an analog pin, so you'd have to use analogRead(), which would give you a value. If you want to use digitalRead() and compare it to HIGH/LOW, use a digital pin.

ContentLicense: CC BY-SA 3.0

Title: Arduino uno A0 pin not working properly


问:
Shedding light on "cyber-physical systems"
These days, one often hears of cyber-physical systems. Reading on the subject, though, it is very unclear how those systems differ from distributed and/or embedded systems. Examples from Wikipedia itself only make them look more like traditional distributed systems. For example:

A real-world example of such a system is the Distributed Robot Garden at MIT in which a team of robots tend a garden of tomato plants. This system combines distributed sensing (each plant is equipped with a sensor node monitoring its status), navigation, manipulation and wireless networking.

Obviously, any distributed system consists of sensing, actuations (which can easily include navigation) and networking.

My question is, how exactly does cyber-physical systems differ from traditional distributed systems? Is it just a fancy name, or is there something considerably different with it?

答:
Reading through some of the articles linked to in the Wikipedia article, I'll respectfully disagree with @Theran. The distinction seems quite well grounded, although Wikipedia does a poor job of making it.

The term embedded systems (ES) has been around since the 60s and can, arguably, refer to anything from an airplane to a Furby. I think the term cyber-physical systems (CPS) was coined to distinguish it from what are traditionally thought of as embedded systems, namely closed-loop, non-networked "boxes" that operate in a very well-defined and constrained domain with a limited power to affect physical systems. CPS, on the other hand, embody the idea of think globally, act locally (my apologies to Patrick Geddes), that is, they are usually highly networked systems that bring about change in a local physical system dependent on the state and actions of other entities in the wider network.

While many robotic applications fit this definition, and can therefore be termed cyber-physical systems, many are not. What bestows the honour on MIT's robotic garden, I believe, is the fact that the robots form part of a wider, decentralised system (PDF). It is the plants, equipped with sensors, that decide when to request watering or other services from the robots, while it is the robots that then decide between them which one will fulfil that request. Furthermore, not all CPS are thought of as "robotic", for example, an intelligent power grid.

Cybernetics, as @Theran has noted, is occupied with the study of control systems, and so will form a core part of studying CPS, but also has a broader range of applications in fields such as mathematics, economics, and sociology, for example.

This report on cyber-physical systems (PDF), by Edward Lee from UC Berkeley, makes clear that CPS are a next step in the evolution of embedded systems with many of the same constraints (real-time capabilities, reliability) plus a few extra ones (robustness, adaptability, intelligence, interconnectedness). As such, the field of CPS is, in parts, concerned with developing completely new approaches to hard- and software architecture. For example:

But I believe that to realize its full potential, CPS systems will require fundamentally new technologies [...] One approach that is very much a bottom-up approach is to modify computer architectures to deliver precision timing [...] Complementing bottom-up approaches are top-down solutions that center on the concept of model-based design [...] In this approach, "programs" are replaced by "models" that represent system behaviors of interest. Software is synthesized from the models.

Lee's thoughts are echoed in this Embedded Computing column (PDF) by Wayne Wolf of Georgia Tech.

After all, we've had computers attached to stuff for a long time. Why, you may ask, do we need a new term to describe what we've been doing for years? [...] We have a surprisingly small amount of theory to tell us how to design computer-based control systems. Cyber-physical systems theory attempts to correct this deficiency. [...] Cyber-physical systems actively engage with the real world in real time and expend real energy. This requires a new understanding of computing as a physical act—a big change for computing.

I recommend reading both articles for a good view on how CPS are different from "mere" embedded systems. Cyberphysicalsystems.org has a concept map of CPS on their homepage that nicely illustrates many of the aspects involved in developing CPS.

As for the origin of the term, none of the sources I found attributed it to anyone. Many papers defined it without attribution while clearly not being the first to use them. The term first crops up in the literature in 2006 but, by that time, the US National Science Foundation had already organised a Workshop on Cyber-Physical Systems, suggesting that the term was already in use by then.


答:
As an alternative to ChrisVolkoff's answer, you may not be getting a high enough voltage to reach the ON threshold.

If your circuit is setup:

[Vin]-----[10k Resistor]---[switch]---[pin]---[LED]---[Gnd]

The forward bias of the LED is generally about 1.8 volts so, when you push the switch, the voltage at the pin is only about 1.8 volts. Typically, with a boolean pin, "HIGH" is triggered for voltages above about 60% of Vin, "LOW" is triggered for voltages below about 30% of Vin, and anything in between is unreliable and, depending on the system, either ignored or may be counted as high or low.

My advice would be to put the 10k resistor between the input pin and the LED, so when you close the switch the input pin is reading 5V. If you don't want the full 5V on the pin, then you could set up a voltage divider by putting one smaller resistor between 5V and the pin, and another one (the remainder of the 10k of resistance you were originally using) between the pin and the LED.

I'm not familiar enough with the Arduino to know what your maximum allowable voltage is on the input pin (5V or 3.3V), so we'll consider a couple cases.

First, is that you're allowed to put 5V on the input pin. In that case, just move the full 10k between the input pin and the LED:

[Vin]----[switch]---[pin]---[10k Resistor]---[LED]---[Gnd]

Second is that you're only allowed 3.3V on the input pin. In this case, I would suggest you first measure voltage at the positive end of the LED when the circuit is completed. 1.8V is a general assumption; it might be different based on LED color.

You want 3.3V, but there is some voltage drop at the LED that fixes the "minimum" voltage you can get - let's call it V_LED.

What you want to do is to make up the difference between V_LED and 3.3V to get 3.3V on the input pin. Your input voltage is 5V, so you want a voltage divider that gives you:

(5V to 3.3V) on the high end
(3.3V to V_LED) on the low end.

The total voltage drop should be (5V to V_LED), so you want one resistor that is

(5V-3.3V)/(5V-V_LED) * 10k

and one resistor that is:

(3.3V - V_LED)/(5V-V_LED) * 10k

Assuming again that V_LED is 1.8V, this means that you should get:

$$
R_1 = \frac{5-3.3}{5-1.8}*10k\Omega \\
R_1 = \frac{1.7}{3.2}*10k\Omega \\
R_1 = 5.3 k\Omega \\
$$
$$
R_2 = \frac{3.3-1.8}{5-1.8}*10k\Omega \\
R_2 = \frac{1.5}{3.2}*10k\Omega \\
R_2 = 4.7 k\Omega \\
$$

[Vin]-----[switch]-----[5.3k Resistor]----[pin]----[4.7k Resistor]---[LED]---[Gnd]

As you can see, $R_1 + R_2 = 10k\Omega$, so you still get the 10k resistance you need for the LED, but now the voltage at the input pin is 3.3V instead of the 1.8V (or V_LED, whatever it measures to be).

In general, when you are trying to measure a HIGH input value, you should attempt to send the nominal HIGH voltage that the input is expecting. Trying to send borderline values (minimum value for HIGH, etc.) is begging for trouble.

Title: Arduino uno A0 pin not working properly

Body:
void setup() {
  pinMode(A0, INPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(A0)== HIGH) {
    Serial.println("YES");
  }
}

Not giving any input when i am supplying input via push button. I have 5 v supply through 10 kohm resistor to push button and then have other side to A0 and a led to ground. It takes input when I take out wire connected to A0 and just leave it unconnected.


问:
Biped Robot not getting on one foot
I am creating a biped robot with an arduino and I have the lower part of the body complete, the legs and hip joints. Before I am going to 3D print the top part of the body I wanted to make sure that it would walk. So when I started the walking tests I could not get the robot to go onto one foot no matter what I tried. The foot would just raise up the body and not lift the other foot here is a picture of what is happening:

and this is what I want to happen:

Does it just need more weight on the top or is there a specific sequence of movements that I can do? I have two hip servo that moves left and right, a knee servo and a foot servo that move side to side.

答:
You got the second picture by physically manipulating the robot to get the center of mass above the rotated foot. What you need to do is to get the robot to shift its own center of mass in a similar fashion.

You should do some research into support polygons. The center of mass of the robot is not above the polygon made by the contact area between the foot and ground. In order to shift the center of mass that far, I think you'll find that you need to move the hip joints and ankle joints in tandem to shift the floor-leg-hip-leg quadrilateral from a rectangle to a parallelogram, or you'll need to make one leg shorter (e.g., bend the knee) to shift the same quadrilateral to a trapezoid.

Once the center of mass is above the foot, then you can take corrective/restorative action to finish in the pose you desire. For example, you would roll one ankle out and adduct the hip on the same leg, while simultaneously rolling the other ankle in and abducting that hip. Once the center of mass is over the foot, put the hips back in position, then put the other ankle back in position.

Title: Biped Robot not getting on one foot


问:
How does the Makeblock threaded slot work?
I've been looking into a Makeblock robotics kit but have found no information on the web that comes from end-users, and one of the main advertised features is not clear to me:  The slot threads shown below are straight, while the screw thread that will mate with them is angled.  Is there just very little contact between screw thread and rail thread vs. regular screw hole threads?  Or would the screw want to rest angled somewhat- and then the head would not be flush with the rim of the rail?  Or would the screw deform the aluminum rail if over-torqued?

This is a close up picture of the slot with screws:

答:
It's a clever and attractive design, but it's mechanically weak.

The mating area between the screw and grooves is small, so the pitch angle of the threads isn't as much of a problem. The grooves on opposite sides are offset by half a thread so the screw has less of a tendency to tilt. Mechanical clearance and deformation of the parts is enough to compensate for the remaining geometric mismatch.

The screw will have a strong tendency to strip out the grooves when torqued. This is already a problem with threading into softer materials like aluminum; that's why they invented threaded inserts. It's even worse when only a small fraction of each thread carries any load. The grooves should only be considered suitable for light loading and gentle torquing.


问:
Motion planning and robot controlling
I am stuck with understanding how can I make my robot move along planned path. For instance, if we have a grid map of an environment and applied, for example, A* to plan a path then after that we have to make our robot move through each cell in our path. Assuming that we know center coordinates of cells, the task is to generate control commands which will lead robot along the trajectory.

I have two differential wheeled robot so equations of motion are going to be like these, where b is a distance between wheels:

$v = \frac{1}{2}(v_{1}+v_{2})\\
\dot\theta=\frac{1}{b}(v_{2}-v_{1})\\
\theta = \frac{\delta t}{b}(v_{2}-v_{1}) + \theta_{0}\\
\dot x = v\cos(\theta)\\
\dot y = v\sin(\theta)\\
x = x_{0} + \frac{b(v_{1}+v_{2})}{2(v_{2}-v_{1})}(\sin(\theta)-\sin(\theta_{0}))\\
y = y_{0} - \frac{b(v_{1}+v_{2})}{2(v_{2}-v_{1})}(\cos(\theta)-\cos(\theta_{0}))
$

Suppose that we can control speeds of both wheels therefore we are able to set any possible angular and linear velocities. So what actually I have to do with these equations to make robot move through each cell?

Moreover there may be different constraints like moving with constant linear speed etc. I understand that I have to solve these equations somehow.
Will appreciate practical advises, certain names of algorithms and etc. Thanks!

答:
I found what I was looking for. It is called tangential escape. In general it is used to move from point A to point B avoiding obstacles, but as we have already planned path we can omit the last part.

The idea is to define the model in polar coordinates which describes distance to a target and the angle between current position and target position, therefore our aim is to set $\rho = 0, \alpha=0$. After that use this model with Lyapunov function:

$V(\rho, \alpha) = \frac{1}{2}\rho^{2} + \frac{1}{2}\alpha^2$

It is necessary that derivative of $V$ must be negative in order to make the system stable. Then inserting our model into $\dot V$ we can find such linear and angular velocities functions that will make our derivative negative. Finally we will get these equations for them:

$\begin{cases}
v=v_{max}\tanh\rho\cos(\alpha)\\
w=k_{w}\alpha+v_{max}\frac{\tanh\rho}{\rho}\sin(\alpha)\cos(\alpha),k_{w}>0
\end{cases}$

It may seem like a hard math but actually just read the original article carefully.

Here you can find example of code at the very end of the article. This article is written in Russian but nevertheless code examples might appear to be very useful.

Title: Motion planning and robot controlling


问:
Why does one IMU axis influence another?
For a home robotics project I just bought a BerryIMU to connect it to my Raspberry Pi. After hooking it up I ran the provided Python code to read out some values while moving it around.

If I keep the IMU (more or less) straight and in Northern direction I get the following line of output:

```<code>ACCX Angle  0.60
ACCY Angle  4.58
GRYX Angle -125.14
GYRY Angle 114.15
GYRZ Angle 93.74
CFangleX Angle -0.26
CFangleY Angle  4.45
HEADING   1.02
tiltCompensatedHeading  3.73
kalmanX  0.48
kalmanY  4.43
</code>```

I am most interested in the compass (in 360 degrees), and how much it tilts right/left and front/back.

As far as I understand, the tiltCompensatedHeading tells me that it points 3.73 degrees right of the magnetic north. And I think kalmanX and kalmanY should give me the tilting of the IMU to the left/right (X) and to the front/back (Y) (compensated by a Kalman filter for smoothening).

So I played around with it and saw what the numbers did. In the images below I look slightly down on it. I hope the description on it explains how you see it.

From what you see here the X and Y degrees independently behave as I would expect them to. But what I don't understand is why "the other one" is always between 90 and 130. So if I tilt it 90 degrees forward I would expect

```<code>X ≈ 0
Y ≈ 90
</code>```

similarly, if I tilt it 90 degrees backward, I would expect

```<code>X ≈ 0
Y ≈ -90
</code>```

Instead X is around 100 for both of them and I really don't understand why it's not around 0.

Does anybody see the logic in this? What am I missing?

答:
The problem is estimating angles in regions of instability.

Let us look at equations used for estimation of pitch and roll angles. For aerospace rotation sequence e.g. $xyz$:

$\tan(roll)=\frac{G_{y}}{G_{z}}\\
\tan(pitch)=\frac{-G_{x}}{\sqrt{G_{y}^2+G_{z}^2}}$

Now imagine that you rotated IMU around $y$ axis by 90 degrees so that $G_{x}=-g, G_{y}=0, G_{z}=0$ and look at the first equation. Since both parts of it are close to zero, $atan(\frac{\approx 0}{\approx 0})$, inverse tangent deals almost only with noise therefore you get unpredicted results. The second equation is $atan(\frac{g}{\approx0})=\frac{\pi}{2}$

For the $yxz$ rotation sequence so the equations are:

$\tan(roll)=\frac{G_{y}}{\sqrt{G_{x}^2+G_{z}^2}}\\
\tan(pitch)=\frac{-G_{x}}{G_{z}}$

This way your region includes cases when $y$ axis points upwards or downwards.

The possible solution is to modify unstable equations, for $yxz$ it would be:

$\tan(pitch)=\frac{-G_{x}}{sign(G_{z})\sqrt{G_{z}^2+\mu G_{y}^2}}$ where $\mu$ is a small scale factor.

Adding small amount of $G_{y}$ will prevent  denominator from being zero ever. And it can be shown that until you are in unstable region the values estimated by original and modified equations are almost equal. However when we are in unstable region, pitch becomes just an approximation but still very close to the true result.

Actually I can not understand why you have wrong results in both cases: rotating around $x$ axis and $y$ axis. If we rotate sensor around $x$ axis  so that $G_{x} = 0, G_{y}=g, G_{z} = 0$ and insert them into $xyz$ equations we will get $roll=atan(\frac{g}{\approx 0}) \approx \frac{\pi}{2}$ and $pitch=atan(\frac{\approx 0}{g})\approx0$. This case is stable as you can see.


问:
Modified DH Parameter for Puma 560
I'm trying to apply modified DH parameters (from Craig's version) to Puma 560.

As per modified DH says,

And the robot Puma 560 with axes and frame are,

As per above sign convention, the sign of d2 and d3 should be negative. However, for the correct result, it seems that the sign of d2 should be positive.

My question is, should the sign here be positive and if yes, then doesn't it contradict the sign convention for above mentioned modified DH convention?

答:
I'm not sure if there's a typo in your question (maybe you're asking the question after working in a zero-based programming language?) but you're asking about the signs of d2 and d3, but I don't see a d2 anywhere in Picture 1 or Table 1. Do you mean d3 and d4? I'll assume this is the case for the answer.

Consider your statement,

$$
\mbox{Offset length, } d_i \mbox{ is the distance from } x_{i-1} \mbox{ to } x_{i} \mbox{ measured along } z_i \\
$$

So, start at $x_{i-1}$, go to $x_i$, and compare the direction you're going to the direction that $z_i$ points. If you're moving in the same direction, it's positive.

So, I get that both $d_3$ and $d_4$ are positive; here's my work:

Again, in the top image I'm comparing the line from $x_2$ to $x_3$ to the orientation of $z_3$. They point in the same direction, so $d_3$ is positive. The same goes for the bottom graphic.

Title: Modified DH Parameter for Puma 560


答:
You might be able to use the the opposite foot to begin the rotation of your chassis, but it will be dependent on your chassis and foot geometry.

Using your photos for reference, the left foot would push up beginning the chassis rotation, while the right foot would rotate simultaneously.  At some point the center-of-gravity (CoG) would shift enough so that the remainder of the chassis rotation could be done only on the right root.

I have a similar robot. It has an extra DoF, but if you ignore the knee joint, it is similar to your design.  These pictures show the basic idea.

Exaggerated rotation of opposite foot only:

Rotation of both feet simultaneously:

Whether or not this will work for you is dependent on a few things:

If your legs are too far apart (hip too wide), then this might not work because the opposite foot will never be able to help shift CoG enough that the primary foot can take over and keep balance.

Your foot joint location and geometry must be such that it can initiate enough of the rotation.

Consider that you can rotate the opposite foot in either direction to start the shift, and if the joint is not centered on the foot, then the direction you rotate the foot will change the amount of much leverage available to that foot.

Your opposite foot servo must have enough power to begin the chassis rotation by lifting a portion of the machine.

Title: Biped Robot not getting on one foot

Body:
I am creating a biped robot with an arduino and I have the lower part of the body complete, the legs and hip joints. Before I am going to 3D print the top part of the body I wanted to make sure that it would walk. So when I started the walking tests I could not get the robot to go onto one foot no matter what I tried. The foot would just raise up the body and not lift the other foot here is a picture of what is happening:

and this is what I want to happen:

Does it just need more weight on the top or is there a specific sequence of movements that I can do? I have two hip servo that moves left and right, a knee servo and a foot servo that move side to side.


问:
What mechanical parts can be attached to a 28BYJ-48 stepper motor?
Sorry I am asking a mechanical question here, but, after all, where else people have experience with using motors? If there is a better forum for this, please do guide me.

Everywhere I've seen online, the stepper motor 28BYJ-48 is used in tutorials, to rotate on its own, or, at most, to spin a clothes pin attached to it. I am trying to get Arduino to work for my 10 year old kid. He's got the motor rotating, now what? How does he attach anything to it?

Don't laugh, I made him a wheel out of a raw potato. He is happy with it now. Where can I find any guidance as to what to do next?

答:
I found, that carefully filing the shaft down to 2mm will make it a perfect fit for lego gears.
You will have to file the flat sides. You can check uniformity of your work by light reflection. The shaft indentation in the front works as center guide, so you take off from both sides evenly. You also might have to slightly round the edges. </p>

<p>If you don't like that, try an adapter: check whether your local library has a 3d printer (some are setting up science labs for kids).
There are a handful adapters for this motor (lego, round axis, servo,..) which you can download and print on a 3d printer. </p>

OwnerDisplayName: Таня Т.

ContentLicense: CC BY-SA 4.0

Body:
I found, that carefully filing the shaft down to 2mm will make it a perfect fit for lego gears.
You will have to file the flat sides. You can check uniformity of your work by light reflection. The shaft indentation in the front works as center guide, so you take off from both sides evenly. You also might have to slightly round the edges.

If you don't like that, try an adapter: check whether your local library has a 3d printer (some are setting up science labs for kids).
There are a handful adapters for this motor (lego, round axis, servo,..) which you can download and print on a 3d printer.


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

Thanks,

Alan

答:
Kinect is an active 3D depth estimation setup that employs IR laser
  structured patterns for Depth calculation and are reliable for Indoor
  applications only.

Whereas,

Stereo Camera setup is a passive 3d depth estimation setup that
  typically involves use of Stereo calibration procedure in order to
  compute projection matrix that will transform a 2D point(generally
  observed in left camera) into a 3D point in the left camera coordinate
  system(assuming left camera is at origin[0,0,0]). These stereo camera
  setups performs way better than Kinect in case of outdoor
  applications.

Title: Stereo camera Vs Kinect


问:
Is it possible to use an arduino in hard real time
I am using the ros_arduino_bridge to control a robot, by connecting the Arduino to a main pc with a usb cable. I was thinking of using the Arduino with main pc with a serial cable and then doing real time control of the Arduino by using the real time clock.

Is it possible to communicate with the Arduino in hard real time by using the real time clock and serial connections? I want to use Arduino board as a bridge between the main computer and the sensor and motors. And i want to control those sensors and motors in real time. All the high level processing tasks like computer vision and motion planning will be running in the main computer which then sends the commands to motors from the Arduino. So it is just acting like a bridge.

The reason I want hard real time is so that my robot can control its joints at very high and accurate speed so that the robot can do human level tasks like running, jumping, assembling some parts, balancing its body while moving(walking, running, jumping) at any speed (which requires the joints to be controlled at very high speed and accuracy) etc. I will be using gazebo simulator to test most of the tasks.

答: Are you willing to put an RTOS on the Arduino, or do you want to make your program deterministic with bare metal code?   If you are willing to use an RTOS, there are several to choose from.  For example, FreeRTOS and RTuinOS are available.  Check out this Dr Dobbs article from a couple of years ago for some additional options:   http://www.drdobbs.com/embedded-systems/arduino-real-time/240165395. </p>


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

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

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

Can an R-Pi even run ROS at all?

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

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

答:
An experimental repository has just been populated with ROS Groovy packages for Raspbian (wheezy), instructions to use it can be found here:

http://www.ros.org/wiki/groovy/Installation/Raspbian

The repository has 350+ packages and the core ROS packages can be installed in a matter of minutes on a fresh Raspbian install.

Title: Can ROS run on a Raspberry Pi?


问:
How to make a particle filter evaluation function with LIDAR sensing?
I am currently trying to implement a particle filter an a robot in a view to localize it on a 2D plane (i.e. to determine x, y and its orientation theta ). I am using a LIDAR which give me (alpha, d) with alpha the angle of measurement and d the distance measured at this angle. For now, I can compute the theoretical measures for each of my particle. But I am struggling with the evaluation function (the function that will give me the probability (or weight) of a particle considering the real measures).

Suppose my LIDAR give me 5 values per rotation (0°, 72°, 144°, 216°, 288°), thus I store one rotation in an array (5000mm is my maximum value) :

Real LIDAR value : [5000, 5000, 350, 5000, 5000]

Particle 1 : [5000, 5000, 5000, 350, 5000]

Particle 2 : [5000, 5000, 5000, 5000, 350]

In this example, I want the function to return a higher probability (or weight) for Particle 1 than for Particle 2 (72° error vs 144°).

For now I am just doing the invert of the sum of the absolute difference between the two value at the same place in the array (e.g. for Particle 1 : 1 / (5000-5000 + 5000-5000 + 5000-350 + 5000-350 + 5000-5000)). The problem with this method is that, in this example, Particle 1 and 2 have the same probability.

So, what kind of function should I use to have the probability of a particle to be the right one with those kind of measurements ?

PS : I am trying to adapt what is in this course : https://classroom.udacity.com/courses/cs373/lessons/48704330/concepts/487500080923# to my problem.

答:
Having your "real" measurement, particles' state and model of taking "virtual" measurements from particles, you can define multivariate Gaussian and exploit it in order to get your probability.

Multivariate normal distribution has density function:

$f(x) = \frac{1}{\sqrt{(2\pi)^{k} |\boldsymbol{\sum}|}}\exp(-\frac{1}{2}(x-u)^{T}\sum^{-1}(x-u))$ where $x$ and $u$ are measurements vectors of size [k x 1] and $\sum$ is a covariance matrix of size [k x k]. As $u$ you use your "real" measurements taken by robot, as for $x$, it contains "virtual" measurements taken from particles.

In your case you have 5 measurements so $x$ is going to have a size of [5 x 1] and $\sum$ --- [5 x 5]. Since measurements are independent, off-diagonal elements of covariance matrix are going to be zeros and diagonal elements define how uncertain your measurements are. So covariance matrix looks like this:

$\sum =
\begin{bmatrix}
q_{0} & 0 & 0 & 0 & 0\\
0 & q_{1} & 0 & 0 & 0\\
0 & 0 & q_{2} & 0 & 0\\
0 & 0 & 0 & q_{3} & 0\\
0 & 0 & 0 & 0 & q_{4}\\
\end{bmatrix}$

And because all your measurements are taken by the same LIDAR $q = q_{0} = ... =q_{4}$.

Now having a state of your particle you can obtain "virtual" measurement and feed it to your density function and as an output you will get the probability $p(z|x)$ which describes how likely this "virtual" measurement  is your "real" measurement. Then based on that probability you can resample your particles.


问:
Is pyserial real time
I am using arduino with FreeRTOS and a computer with patched xenomai linux. I am using python library called pyserial to communicate with arduino. Right now I am using simple servo motors. I want to be sure that whether the communication between the arduino and my main computer is real time or not.

How can I check this, properly. I want hard real time communication between arduino and computer for balancing robot.

答:
pyserial and more generally python is not suited to hard real time systems, as it was simply not designed for that application, due to duck typing and other runtime provisions cannot provide deterministic latency. Depending on what you want to do you can write all your hard real time subsystems in C or some other system that is suitable for hard realtime systems and then do data processing in the background in python.

You could test this behaviour by sending a byte, having pyserial read it and do some operation (say multiply them by 2) and spit the serial string back out. You could then probe the TX and RX lines on an oscilloscope and find the latency between the first byte in and the first byte out and I would guess that you would see a jitter of 1ms or more, in most hard real time systems I have worked with the jitter is below 10us (100 times less).

Though for a balancing robot you might find that that latency and jitter is acceptable, I would suggest you try it out and see how it works and if it does not work for you then move on to writing your code in a language that is suited for Hard Realtime.

Title: Is pyserial real time


问:
Error when using Matlab Function block in Simechanics (nested functions and parsing of Matlab function both error)
I create a simple simulink model using Matlab Function block to calculate angles of 4 dof robotic arm using Robotic toolbox Matlab while input is x, y and z values. I used forward kinematics to calculate angles. Model and error is shown in below images:

My code is given below (which is put in matlab funcrion block):

```<code>function [theta1,theta2,theta3,theta4]=invkin(px,py,pz)
% code to find inverse kinematics solution for 4 dof rootic arm
preach = [px py pz]; % reach point of end-effector
theta1 = 0;  theta2 = 0; theta3 = 0; theta4 = 0;
% create links using D-H parameters
L(1) = Link([ 0 0 0 pi/2 0], 'standard');
L(2) = Link([ 0 .15005 .4318 0 0], 'standard');
L(3) = Link([0 .0203 0 -pi/2 0], 'standard');
L(4) = Link([0 .4318 0 pi/2 0], 'standard');
%define link mass
L(1).m = 4.43;
L(2).m = 10.2;
L(3).m = 4.8;
L(4).m = 1.18;
%define center of gravity
L(1).r = [ 0 0 -0.08];
L(2).r = [ -0.216 0 0.026];
L(3).r = [ 0 0 0.216];
L(4).r = [ 0 0.02 0];
%define link inertial as a 6-element vector
%interpreted in the order of [Ixx Iyy Izz Ixy Iyz Ixz]
L(1).I = [ 0.195 0.195 0.026 0 0 0];
L(2).I = [ 0.588 1.886 1.470 0 0 0];
L(3).I = [ 0.324 0.324 0.017 0 0 0];
L(4).I = [ 3.83e-3 2.5e-3 3.83e-3 0 0 0];
% set limits for joints
 L(1).qlim=[deg2rad(-160) deg2rad(160)];
 L(2).qlim=[deg2rad(-125) deg2rad(125)];
 L(3).qlim=[deg2rad(-270) deg2rad(90)];
 L(4).qlim=[deg2rad(-170) deg2rad(110)];
   %build the robot model
  rob = SerialLink(L, 'name','Puma56');
  qready = [0 -pi/4 pi/4 0]; % initial position of robot
T1= transl(preach); % convert of reach point of 4x4 homogenous matrix
[qreach,err,exitflag] =  rob.ikcon(T1, qready); % find inverse kinematics with error
%rob.fkine(qreach);
theta1 = qreach(1,1);  theta2 = qreach(1,2); theta3 = qreach(1,3); theta4 = qreach(1,4);
end
</code>```

How to solve these errors.

Thanks.

答:
In Simulink the Matlab embedded function block supports only a subset of the available commands in Matlab. If you want to use external functions, you have to declare these using coder.extrinsic().

If the problem is with nested functions and not with declaring the external function, you could try to de-nest the function, by simply deleting the 'value' function from the file it is defined in and create a new, separate file for the function on the same path. Please keep in mind that this is a workaround, not really a fix.


问:
Why to combine a Raspberry Pi (or similar board computer) and an Arduino for controlling motors?
I am planning to build a omnidirectional holonomic robot, and checking what I should use for the hardware, I saw many people using a Raspberry to compute most stuff, which in turn calls an Arduino to control the motors. But since the Arduino will have to drive some H-bridges, and the board computer is probably a lot more powerful, it seems to me that those drivers for the motors could be controlled by the Raspberry-ish board.

What am I missing?
Why so many people use both at the same time?

答:
The reason is Clock on the Raspberry Pi. Note that the raspberry is powerful but not that powerful that it can run an OS and simultaneously give you precisely timed PWM outputs. I assume that you'll be handling the motors with PWM on the Enable pin on the motors.
Reasons:

As stated, it is more on getting precise PWM outputs on for the motor driver. The Arduino as a slave controller drive it better.

Sure the Raspi is powerful but it is advised to keep the computationally expensive task on the Board and leave everything to the slave controller to ensure an isolation between two.

A small reason is also to ensure that running higher voltages(9V,12V) and currents(sometimes >1000 mA) shouldn't damage your more expensive and OS running board.

Have stated the same in my blog for my ball tracker.


问:
how to read and write data with pyserial at same time
How can i make pyserial read and write at same time or at same program? Right now i only know how to either write or to read but not both simultaneiously. So how can i do it? I tried this simple code:

```<code>int incomingByte = 0;

void setup() {

Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

}

void loop() {

incomingByte = Serial.read(); // read the incoming byte:

Serial.print(" I received:");

Serial.println(incomingByte);

}
</code>```

and python program is:

```<code>import serial
ser = serial.Serial('/dev/ttyACM0',9600)
ser.write("333")
ser.close()
ser.open()
data = ser.readline()
print data
ser.close()
</code>```

答: What you're looking for is called "full duplex" serial, in that you want to read and write at the same time. In looking around, it appears that this would typically be done with distinct threads, where one is doing the writing and the other is independently doing the reading. Unfortunately, you can't multithread with the Arduino. </p>


问:
Modified DH Parameters for Puma 560 - Wrong Results
In continuation of my question on modified parameter for Puma 560 posted here Modified DH Parameters for Puma 560. Further I used a available dimension for Puma 560 here (FYI: the figure shows dimension in inches, but all following dimensions in DH parameters for length are converted to mm), [ and trial version of RoboDK simulator to check my result. I assigned the frame as show in the figure from first link, the last link is placed to the flange in the figure below with z6 pointing downward while keeping x6 in same direction as x5.

So the DH parameter looked liked,
    double alpha[6] = { 0, -90, 0, -90, 90, -90 };
    double a[6] = { 0, 0, 431.80, 0, 0, 0 };
    double d[6] = { 0, 0, 139.7, 433.07, 0, 55.88 };

I started with joint angles (theta)
double theta[6] = { 0, 0, 0, 0, 0, 0 };

My calculations give me same position as Puma 560 simulator except z values are negatives. Correct position for joint angles of zeroes is x = 431.800, y = 139.700, z = 489.580. I get x = 431.800, y = 139.700, z = -489.580.

But if I put double d[6] = { 0, 0, 139.7, -433.07, 0, -55.88 }; then I get the correct value, x = 431.800, y = 139.700, z = 489.580.

I tested with other joint angles, for which I am getting correct values with negative -433.07 and -55.88 in above. So, they must be negatives.

My question is, why I have to take negative values for d to get correct result? Does this is because the value in this case should be assigned as per base frame (all value above base frame is assigned positive and all below should be assigned negative irrespective of convention.)

Base frame is located at same position as frame 1 (refer to the top most link) I used the same procedure as described in "Introduction to Robotics" by J.J. Craig.

EDIT: below is the codes I am using for the computation. Alpha and theta is converted to radians.

```<code>    ////// Craig Matrix - Modified DH Parameters Convention
    mat[0] = cos(theta);
    mat[1] = -1 * sin(theta);
    mat[2] = 0;
    mat[3] = a;

    mat[4] = sin(theta) * cos(alpha);
    mat[5] = cos(theta) * cos(alpha);
    mat[6] = -1 * sin(alpha);
    mat[7] = -1 * sin(alpha) * d;

    mat[8] = sin(theta) * sin(alpha);
    mat[9] = cos(theta) * sin(alpha);
    mat[10] = cos(alpha);
    mat[11] = cos(alpha) * d;

    mat[12] = 0;
    mat[13] = 0;
    mat[14] = 0;
    mat[15] = 1;
</code>```

Above codes will give a 4 x 4 DH transformation matrix for each frame as per Modified DH conventions (Refer to Modified DH parameters on Wikipedia or J.J. Craig book, the matrix is defined there.)

Now, we multiply all matrices as per,

starting with matrix for frame 6 on the right hand side and multiplying it with preceding joint from left hand side. Repeating the same sequence as noted above. This should give as the location of origin of frame 6 with respect to the base frame of the robot.

答:
I think the problem is with your simulator. You said,

Base frame is located at same position as frame 1 (refer to the top most link)

And, from the previous question you asked, there is the following picture where I have highlighted the first frame:

So here you can see how the global frame is oriented. Now, compare the global/world frame to the end effector location:

You've got the coordinates clearly labeled now on these drawings and you can, at a glance, see what the end effector's position is:

You move along the positive x axis 17 inches, you move along the positive y axis 5.5 inches, and you move along the NEGATIVE z axis (17.05 + 2.2) inches. So, per your drawing, the output you're calculating is correct; it should be +17,+5.5,-19.25 inches, or +431.8,+139.7,-488.95 mm.

My suggestion to you would be to find the discrpancy in your simulator. It looks like there's an offset somewhere on your z-axis measurement. I would say that maybe the base frame there is considered the base of the robot, but that doesn't make sense per the x/y coordinates. Your x/y values are pretty close to equal, which means the end effector should be located close to a (+/-) 45 degree line from the origin.


答:
It's not entirely clear what you mean by "write and read at the same time" because that can refer to different contexts.  It can be confusing because people tend to mix the meanings of full-duplex/half-duplex when switching back-and-forth in discussion of the hardware and software layers.

True full-duplex serial communications requires hardware level support. Separately, to make use of full-duplex communications, your serial library and program itself must be written to support full-duplex.

Most simpler two-way serial devices will only respond after receiving a command. For example, you send a command (write), and then expect a response (read). This is sometimes referred to as half-duplex and this is what your current program example is doing. However, you shouldn't be closing and reopening the serial port.

If the serial device you are working with is such that you can write at any time and you can independently expect to receive something from the device at any time, then you are working with a full duplex serial device.  In that case, your options are either multi-threading or doing writing/reading sequentially without the reads blocking your program indefinitely.

Multithreaded programming with python is possible on most arduinos. (Again, this gets confusing. Another answer here indicated that arduinos do not support multithreading. That is true for most arduinos at the hardware level. But there are ways to simulate multithreading at the software level, and python does this.)  A multi-threaded solution to your problem can get complex. Here are some examples though:

https://stackoverflow.com/questions/14487151/pyserial-full-duplex-communication

https://github.com/headrotor/Python-Arduino-example

If multi-threading is not available to you, then you can use a single thread where the writes are before reads, and the reads are done only if bytes are available or with a short timeout. Psuedo program loop:

Is there data to write? If so, write it.

Attempt to read anything that has been received since last time tried to read.

If serial library/hardware can provide "bytes available" on the read line, check that to determine if you should try reading anything.

If library/hardware can not provide "bytes available" on the read line, then set a short time out for the read. This will block program until timeout waiting for anything to come in. If bytes do come in, start processing them.

Loop (or if nothing to do, sleep a little to prevent 100% cpu)

The single thread approach works as long as your hardware read buffers are large enough to hold the inbound data until you are able to read it and clear the buffer. Examples:

https://stackoverflow.com/questions/19908167/reading-serial-data-in-realtime-in-python

http://forum.arduino.cc/index.php?topic=297609.0

If going with this approach, be aware that while readLine is probably safe, using read(size>1) can be non trivial when using a timeout, because it's possible that timeout will occur before a complete multi-byte "message" has been received.

Title: how to read and write data with pyserial at same time

Body:
How can i make pyserial read and write at same time or at same program? Right now i only know how to either write or to read but not both simultaneiously. So how can i do it? I tried this simple code:

```<code>int incomingByte = 0;

void setup() {

Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

}

void loop() {

incomingByte = Serial.read(); // read the incoming byte:

Serial.print(" I received:");

Serial.println(incomingByte);

}
</code>```

and python program is:

```<code>import serial
ser = serial.Serial('/dev/ttyACM0',9600)
ser.write("333")
ser.close()
ser.open()
data = ser.readline()
print data
ser.close()
</code>```


问:
How to get Max Torque on Robot arm 's Joints (RRR)
Suppose I have a Robot Arm with 3 joint(revolute)( 3 DOF) as shown below , and I'm given

-The ranges of each joint q1,q2,q3

-The lengths of each link L1,L2,L3

-Load on the end effector [Fx Fy M]

how can I calculate the max torque at each joint of the robot ?

*image below describes the robot configuration.

If I missed any details , mention it in a comment and I will add it .
Thanks in advance

答:
Torque is pretty easy to calculate for a single static arm configuration.  Torque is just the length of the moment arm * the perpendicular force.  And it is easy to decompose the problem into X and Y components, then sum.  So in your example you would have the torque about joint 1 to be:

$$
T_1 = a * F_y + b * F_x
$$

(Assuming $F_x$ and $F_y$ are in the global frame).  You don't list the masses of the links, (which is typically not negligible), but you would want to add those in too.  You should check out this arm torque calculator.  The robot arm tutorial on that same site also has lots of helpful info.

For very complicated arms or dynamic situations, you might want the help of some code.  See my answers to these other similar questions for pointers.

Static equilibrium for 7 dof manipulator

Dynamic torque simulation for a 6 DOF robotic arm

Type of servo and torque calculation required for a 2axis robot arm


答:
After looking closer at your code, I'll reiterate my comment - why are you doing this in Simulink? I'll make your code briefer for clarity:

```<code>function [theta]=invkin(px,py,pz)
theta = 0;
L = <const>;
preach = <const>;
rob = f(L);
qready = <const>;
T1= f(preach);
qreach = f(rob,T1,qready);
theta = qreach;
end;
</code>```

So,

You aren't using the inputs at all.

You're constantly resetting theta to zero at the start of the script, so if you did happen to make the inputs time-varying, I don't think the time-varying output would be what you want because you're not progressing through time. Your script would run a complete simulation at every call.

Imagine plotting this from a Matlab script - plot(time,theta) - again, there's no time dependence here. You just have one value, theta, that describes the joint angles required to achieve the desired end effector position. Your plot would be a horizontal line.

I would imagine this might be contributing to the trouble you're having implementing the fix you were given.

Title: Error when using Matlab Function block in Simechanics (nested functions and parsing of Matlab function both error)

Body:
I create a simple simulink model using Matlab Function block to calculate angles of 4 dof robotic arm using Robotic toolbox Matlab while input is x, y and z values. I used forward kinematics to calculate angles. Model and error is shown in below images:

My code is given below (which is put in matlab funcrion block):

```<code>function [theta1,theta2,theta3,theta4]=invkin(px,py,pz)
% code to find inverse kinematics solution for 4 dof rootic arm
preach = [px py pz]; % reach point of end-effector
theta1 = 0;  theta2 = 0; theta3 = 0; theta4 = 0;
% create links using D-H parameters
L(1) = Link([ 0 0 0 pi/2 0], 'standard');
L(2) = Link([ 0 .15005 .4318 0 0], 'standard');
L(3) = Link([0 .0203 0 -pi/2 0], 'standard');
L(4) = Link([0 .4318 0 pi/2 0], 'standard');
%define link mass
L(1).m = 4.43;
L(2).m = 10.2;
L(3).m = 4.8;
L(4).m = 1.18;
%define center of gravity
L(1).r = [ 0 0 -0.08];
L(2).r = [ -0.216 0 0.026];
L(3).r = [ 0 0 0.216];
L(4).r = [ 0 0.02 0];
%define link inertial as a 6-element vector
%interpreted in the order of [Ixx Iyy Izz Ixy Iyz Ixz]
L(1).I = [ 0.195 0.195 0.026 0 0 0];
L(2).I = [ 0.588 1.886 1.470 0 0 0];
L(3).I = [ 0.324 0.324 0.017 0 0 0];
L(4).I = [ 3.83e-3 2.5e-3 3.83e-3 0 0 0];
% set limits for joints
 L(1).qlim=[deg2rad(-160) deg2rad(160)];
 L(2).qlim=[deg2rad(-125) deg2rad(125)];
 L(3).qlim=[deg2rad(-270) deg2rad(90)];
 L(4).qlim=[deg2rad(-170) deg2rad(110)];
   %build the robot model
  rob = SerialLink(L, 'name','Puma56');
  qready = [0 -pi/4 pi/4 0]; % initial position of robot
T1= transl(preach); % convert of reach point of 4x4 homogenous matrix
[qreach,err,exitflag] =  rob.ikcon(T1, qready); % find inverse kinematics with error
%rob.fkine(qreach);
theta1 = qreach(1,1);  theta2 = qreach(1,2); theta3 = qreach(1,3); theta4 = qreach(1,4);
end
</code>```

How to solve these errors.

Thanks.

Body:
After looking closer at your code, I'll reiterate my comment - why are you doing this in Simulink? I'll make your code briefer for clarity:

function [theta]=invkin(px,py,pz)
theta = 0;
L = <const>;
preach = <const>;
rob = f(L);
qready = <const>;
T1= f(preach);
qreach = f(rob,T1,qready);
theta = qreach;
end;

So,

You aren't using the inputs at all.

You're constantly resetting theta to zero at the start of the script, so if you did happen to make the inputs time-varying, I don't think the time-varying output would be what you want because you're not progressing through time. Your script would run a complete simulation at every call.

Imagine plotting this from a Matlab script - plot(time,theta) - again, there's no time dependence here. You just have one value, theta, that describes the joint angles required to achieve the desired end effector position. Your plot would be a horizontal line.

I would imagine this might be contributing to the trouble you're having implementing the fix you were given.


问:
What BLDC servo drive takes sinusoidal hall sensor signals?
I am looking for a servo drive to control a brushless DC motor, with at least 10A, 30V rating. However, I want to know if any exist which take sinusoidal hall sensor signals directly.

I already know there are servo drives taking hall sensor pulses (with 6 different phases), but that is trapezoidal control.

Note: a servo drive includes the driving electronics (no additional transistors required).

答:
Sometimes they are called linear halls.

A company called Eltrol used to make drives for these. I used them in the past in combination with Anorad Linear motors. Nowadays they are still available from PeakServo.
The drives drive the linear (or sine) hall and receive the two halll signal (which are 120 degrees apart).

http://www.peakservo.com/series-45-linear-hall-sine-servo-amplifier/


问:
Do I need gyro sensor to make sure my automower turn 180deg if I already used 9DOF IMU?
I am doing a project to build an autonomous lawn mower and I need to decide several type of sensor to complete the features. one of my features is the vehicles need to stop running when someone held it on the air. so i decide to use 9 DOF IMU for this features.

as i know that 9 DOF IMU already have 3 axes magnetometer that can read the angular yaw position. so i just confused that do I still need to add another gyro sensor to make sure that my lawn mower do a turning 180deg?

Thanks for any words on this.

答:
A 6 DOF IMU refers to 3-axis accelerometers and 3-axis gyroscopes.

A 9 DOF IMU refers to a 6 DOF IMU plus a 3-axis magnetometer.

Since you already have 3-axis gyroscopes in your 9 DOF IMU, adding another gyro sensor would be redundant.
You don't need it.


问:
bounded deviation for straight line motion
I came across the paper(link given below) which discusses about bounded deviation joint path for straight line motion.

Planning and Execution of Straight Line Manipulator Trajectories (RH Taylor)
https://pdfs.semanticscholar.org/e01a/58608f4e68f31c7b9e7cdbddceae645727bb.pdf

In this method, the assumption is that the maximum deviation happens at or near the midpoint between the start and end point.

1) Is this assumption true in all cases?
2) Even if the assumption may not be true, will resulting trajectory be a straight line if this method is used for trajectory planning?

I hope someone shed some light on this. Thank you.

答: I don't know about the algorithms for a lot of industrial manipulators, but I suspect that the two main approaches cited by Taylor: that of velocity control by Whitney, and that of rapid position computational updates by Paul, are still primary approaches taken.   Note that the computing power to calculate these inverse solutions is magnitudes higher with today's robots compared with 1979.   The drawbacks of Paul's approach using 100ms updates are likely eliminated since we can update more than 10 times as quickly now.   The important innovations over the past two decades, in my opinion, are related to incorporating advanced dynamic models into manipulator control.  We kind of take for granted the ability to compute positions or velocities much more rapidly than is required for accurate kinematics.  </p>


问:
Can an arduino control a large servo motor?
A I wanting to build a robotic hand, a big one at that. Similar to this one but in a much larger scale:

http://www.instructables.com/id/DIY-Robotic-Hand-Controlled-by-a-Glove-and-Arduino/

Does it really matter how large the servo is, just as long as it has a power source? Or are there other things I need to know?

答:
It does matter how large/small the servo is.

The bigger you get (in the arm), the more you will have to account for the inertia of the moving arm.
There are a lot of types of servos... from micro ones, to really big ones.
I would suggest building the current arm as-is, and then actually building the bigger one.


问:
Inverse kinematic solution not giving the same forward kinematics answer
I'm working on an assignment where I need to derive IK for 5 DOF Youbot kuka robotic arm manipulatorofficial website. I'm using inverse kinematics decoupling and following a geometrical approach using simulink and matlab. The answer of the IK problem is 5 angles but when I apply those angles to the forward kinematics I'm receiving a different coordinates. Is that normal or am I supposed to get the exact coordinates?
I'm using the following Matlab code:

```<code> function [angles, gripperOut, solution] = IK(pos,toolangle,gripperIn)
l=[0.147 0.155 0.135 0.081 0.137];
x = pos(1);
y= pos(2);
z = pos(3);

surfangle = toolangle(2);

 theta1= atan2(y,x); % atan2(y/x) for theta1
 s=z-l(2); %  S = Zc - L2
 r=sqrt(x.^2+y.^2)-l(1);
 D = (r^2 + s^2 -l(3)^2 -l(4)^2)/2*l(3)*l(4);
 %D = (pow2(r)+pow2(s) -pow2(l(3)) -pow2(l(4)))/2*l(3)*l(4);
 D2 = sqrt(1-D.^2);
if D2<0
    theta3 = 0;
    theta2 = 0;
    solution = 0;
else
 theta3=atan2(D2,D);
 theta2=atan2(r,s)-atan2(l(4)*sin(theta3),l(3)+l(4)*cos(theta3));
 solution = 1;
end

%  R35 = subs(R35,[theta(1) theta(2) theta(3)],[theta1 theta2 theta3]);
%  theta4=atan2(R35(1,3),R35(3,3));
%  theta5=atan2(R35(2,1),R35(2,2));

theta4 = surfangle-theta2-theta3;
theta4 = atan2(sin(theta4),cos(theta4));
theta5 = toolangle(1);

 angles=[theta1 theta2 theta3 theta4 theta5];
 if(solution == 0)
    angles = [0 0 0 0 0];
end

 gripperOut = gripperIn;

end
</code>```

as shown I'm kind of fixing the last two angles for the tool so I can avoid using the subs command which is not supported for code generation.
Any help would be very appreciated.

答:
Debugging this situation can be done pretty easily - or at least you can easily narrow down the possible problems.

First, plug the joint angles you received from your inverse kinematics algorithm into your forward kinematics equations.   Do they provide the same end effector coordinates that you entered into your inverse kinematics routine?

If not, you have an error in either the forward or inverse equations.

If, however, the end effector coordinates are the same, then you have found a different pose of the robot.  Perhaps your solution has the robot's base turned 180 degrees and it is reaching back over its shoulder.   Or, the elbow may be either below or above the line connecting the shoulder and wrist.   Or, the wrist may be angled either down or up.   You need to pay attention to the multiple angles which can result in the same answer for atan2, acos, and asin.


问:
Fastest maze algorithm for robot
I'm planning on programming a prebuilt robot to solve a maze as fast as possible.  The robot has forward obstacle sensors (no side sensors) and 3-axis accelerometer.  I'm planning on using the wall following algorithm.  Is this the fastest possible algorithm?  Also, since there are no side sensors, the robot needs to continuously turn to check if there is a wall on its side, so is there a clever way to use the accelerometer and sensors?</p>

答:
You can't say much about solving a maze unless you are allowed to explore first, or know the maze before-hand. Otherwise, it is easy to build a maze that will take arbitrarily long to solve using wall-following, but which has a simple solution. See the following example.

In this case, it is faster on average to just chose turns randomly. So maybe this is a tough problem that requires a little more thought.
In some contexts, an iterative-deepening approach isn't bad. Start your research there, and come back when you have specific questions.

Title: Fastest maze algorithm for robot


问:
Constrained Second Angle Double Pendulum
If I am trying to model the dynamics of a double-pendulum (on a horizontal plane without the effects of gravity), in which the second angle is constrained to range between values of [-10 deg, 10 deg], how would I derive the equations of motion? I'm having trouble identifying whether I would use some method involving solving the Lagrangian with holonomic or non-holonomic constraints. </p>

答:
At first it is important to understand the double pendulum problem as a hybrid system. To solve these kinds of task a combination of a finite state machine plus mathematical equations are the best way. On page 26 of On-Line Symbolic Constraint Embedding for Simulation of Hybrid Dynamical Systems is a automaton given which consists of three modes: double-pendulum, slider-crank and stuck. Additional sourcecode in Matlab are not given, but this paper is the way to go.

A sourcecode for a simpler version (the single pendulum problem) is the following:

```<code>def fsmstart(self):
  # strategy: if pole is on 180 Degree, move in other direction
  for i in range(10000):
    a1=self.angPole()
    pygame.time.wait(50)
    a2=self.angPole()
    middle=False
    if a1>160 and a1<200: middle=True
    direction="left"
    if a2<a1: direction="right"
    if middle==True:
      print direction
      if direction=="right": self.setspeed(0, .7) # move left
      if direction=="left": self.setspeed(0, -.7) # move right
      pygame.time.wait(500)
      self.setspeed(0, 0)
def angPole(self):
  return self.getangle(4)
</code>```

Body:
At first it is important to understand the double pendulum problem as a hybrid system. To solve these kinds of task a combination of a finite state machine plus mathematical equations are the best way. On page 26 of On-Line Symbolic Constraint Embedding for Simulation of Hybrid Dynamical Systems is a automaton given which consists of three modes: double-pendulum, slider-crank and stuck. Additional sourcecode in Matlab are not given, but this paper is the way to go.

A sourcecode for a simpler version (the single pendulum problem) is the following:

def fsmstart(self):
  # strategy: if pole is on 180 Degree, move in other direction
  for i in range(10000):
    a1=self.angPole()
    pygame.time.wait(50)
    a2=self.angPole()
    middle=False
    if a1>160 and a1<200: middle=True
    direction="left"
    if a2<a1: direction="right"
    if middle==True:
      print direction
      if direction=="right": self.setspeed(0, .7) # move left
      if direction=="left": self.setspeed(0, -.7) # move right
      pygame.time.wait(500)
      self.setspeed(0, 0)
def angPole(self):
  return self.getangle(4)


问:
PID Controller for line following robot
I had this idea of using the PID Controller as the algorithm of the line following mechanism for my Robot. The problem (which is a nature behavior of the PID controller ) on the line gaps ( where there are no line e.g. 10 cm) the robot doesn't go straight forward but turns right .
I thought about it a lot , and i couldn't find any better idea for modifying this algorithm to work in this situation but, adding two more sensors and specify the (white area on the 3 sensors  ) as a special situation where the robot should go straight forward .

Now my question is is there any better idea , that i can use ?

答:
Using PID control in Line Follower of course require you to define the Error value for every condition of sensors, treat empty line just like straight line: which is 0 error. You should provide more info about your sensor setup, though it is better to have many sensors aligned in the front of the robot.

following is simple illustration example of the error look-up table based on sensors reading if you have 8 sensors, bit 1 represents reading of black Line:

```<code>sensor   : error
11000000 :-3
01100000 :-2
00110000 :-1
00011000 : 0
00000000 : 0 # line gap
00001100 :+1
00000110 :+2
00000011 :+3
</code>```

with 0 error, PID calculation should result in straight forward move

Title: PID Controller for line following robot

Body:
Using PID control in Line Follower of course require you to define the Error value for every condition of sensors, treat empty line just like straight line: which is 0 error. You should provide more info about your sensor setup, though it is better to have many sensors aligned in the front of the robot.

following is simple illustration example of the error look-up table based on sensors reading if you have 8 sensors, bit 1 represents reading of black Line:

sensor   : error
11000000 :-3
01100000 :-2
00110000 :-1
00011000 : 0
00000000 : 0 # line gap
00001100 :+1
00000110 :+2
00000011 :+3

with 0 error, PID calculation should result in straight forward move


问:
What method is commonly used in industral manipulators
Position control versus  torque control. What method is commonly used in industral manipulators</p>

答: In my experience, most pick and place robots use a version of position control, which they augment with feedforward dynamic models for improved speed and reduced errors.   Those robots which maintain contact with the environment (such as grinding, deburring, cutting, etc) usually implement a hybrid force/position control.</p>


问:
How do you make a device that can pick up nerve signals?
I am trying to make a robotic arm that mimics the movement of the user's arm, They way I need it to work is to detect nerve signals and send them to an arduino. The arduino would then have a servo motor mimic the movement of the user's arm when the arduino tells it how quickly to rotate and to what point to rotate, based on the user's input.

Any ideas on how this can be done?

答:
There are much better solutions to the project which you are trying to accomplish. First off, what I think you are really asking is how to detect muscle movement - not nerve signals.

You could do this by following the 1st solution shown below, but as you will see this method provides limited feedback and is expensive.

1st way: Use Myoware - Myoware is a myoelectric sensor that if placed correctly on the desired muscle will sense its movement. This can be used to signal an actuator from the Arduino. To open and close the fingers the sensor would be placed over the flexor digitorum profundus, to move the elbow joint the sensor would be placed over the triceps, and finally, to move the shoulder joint the sensor could be placed on the pectoralis muscle.Note that this method is very inefficient and expensive - I am also unsure of how to detect the motion of the users wrist through this

2nd way Use Accelerometers/gyroscopes - By placing accelerometers and gyroscopes over each section of the user's arm (which are only a couple of bucks each) you can detect the position, speed, acceleration, etc. of the user's motion along multiple different points. This cannot be done through detecting muscle signals.

3rd way Use force/IR sensors - This method is not as good as the 2nd solution presented however is certainly better than the first. By placing a force sensor or a very precise IR sensor over the flexor digitorium profundus, the triceps, and the pectoralis, you can detect the movement of the muscle from the skins surface (eg: when the muscle contracts, more force will be applied to the pressure sensor or the distance from the IR sensor will shrink.

4th way Use flexor sensors - Flexor sensors are basically bendy potentiometers. By placing flexor sensors over the user's joints and on each individual finger, you will be able to gain sensory feedback of the position of each joint. The benefit to this is that it allows for more position control (you can control each finger individually), and combined with an accelerometer could also offer information on the speed and acceleration of the movement of each joint.

I have used all 4 methods before in similar projects to yours. In my experience, all though seemingly easier, by trying to use feedback from the user's muscles, you sacrifice a lot of control. These muscle detecting sensors are also quite pricey.

RECOMMENDED SETUP
I highly recommend that you use a gyroscope and accelerometer on the elbow, shoulder, and wrist joints to detect their movement and speed. A potentiometer on each of the user's fingers along with an accelerometer will also allow you to control the position and speed of each finger of the robotic hand.


答: The wall following algorithm will benefit more from sensors on a side. Since you follow the side until you find a gap then you turn into that gap. You could then use the accelerometer to sense a bump when you hit the wall in front. However not sure how you can determine that you are out of the maze (in case you need to do that). Just an idea...</p>

Title: Fastest maze algorithm for robot

Body: I'm planning on programming a prebuilt robot to solve a maze as fast as possible.  The robot has forward obstacle sensors (no side sensors) and 3-axis accelerometer.  I'm planning on using the wall following algorithm.  Is this the fastest possible algorithm?  Also, since there are no side sensors, the robot needs to continuously turn to check if there is a wall on its side, so is there a clever way to use the accelerometer and sensors?</p>


问:
I want to code with arduino, but do not have a good computer
Before I buy any arduino products, I want to make sure that I can use this website:

https://create.arduino.cc

to create the code for the arduino. The thing is, I do not know if I can use this to export the code to the arduino. Can someone please tell me if I can use it to program an actual arduino instead of simulating one?

By the way, the I do not have an actual computer, just a chromebook thinkpad (lenovo EDU series), so I can not use windows or apple software, it must be usable on the chrome web browser.

Thanks.

答:
You need to be able to install the Arduino Plugin for that to work.
If your computer is based on regular Windows and can run Chrome, that should work fine.

If your computer is a Chromebook, or Windows RT (for the ARM based surfaces) that will perhaps not work.

In general, if you can install your own software, it's better to use the Arduino IDE. Most computers, even pretty old ones, should be able to run the Arduino IDE, assuming you can download and install it.

If you can install the plugin on the website, then yes, the website tool will let you download your compiled code and upload it to a real Arduino board.


问:
Humanoid robot arm - inverse kinematics - choose joint solutions
I have developed a 7DOF arm for a humanoid robot (see pic below for more details)
I have implemented the IK using a closed form solution and of course I come up with eight solutions - each one is actually positioning the end effector at the right position and orientation (I implemented the method described in the paper: "Kinematics and Inverse Kinematics for the Humanoid Robot HUBO2+").
The question now is how to choose the right one, knowing the fact that the end effector will follow a trajectory. The idea is to compute iteratively the $[N, S, A, P]$ matrix that will be provided to the IK module.

One solution I am thinking off is to choose the joint solution in the decision table that will minimize the given metrics:
$$\sum_i (\theta_i^{current} - \theta_i^{next})^2$$
where $\theta_i^{current}$ represents the the current value of the $i^{th}$ joint and $\theta_i^{next}$ is the computed value in the decision table.

Do you think it is the right approach or there are other methods out there to find the best joint solution from the decision table.

答:
That looks like a fun pair of arms :-)

Yes, if you already have a known pose, choosing a solution that minimizes movement is a decent choice. The obvious draw-back is that which choice is made for a particular pose then depends on history, which may make validation harder.

Another choice would be the one that minimizes the torque (because of gravity/load) on the weaker servos. I notice that you use a MX-28 in the shoulder, but AX-12 in the elbow. With the weight of the gripper and load, and the length of your arms, you should probably not plan on lifting any great weights in that configuration!

I was asked to elaborate on "obvious draw-back."

When validating that a mechanical system is safe to use in a particular environment, such as around human beings, you need to be able to validate that the system will never be in a "bad" configuration. When the configuration of time T depends on the configuration in time T-1, then you can't create a closed-form formula that describes exactly where the system will be for a given set of inputs, and thus validation degrades to either assuming the most pessimistic assumptions (everything within the theoretically possible movement range will happen,) or you have to degrade to manual testing, which is notoriously bad at finding rare edge cases.

Similarly, when something goes wrong, you're going to have a hard time reproducing the conditions for the failure, so that you can study them, fix them, and then add some kind of test to make sure the failure will never happen again. If the pose of an armature is dependent not just on known current inputs, but on all inputs that have been fed to the robot since power-on, you're going to have to log and study a whole lot more data than if the pose is "closed form." (For simple time-dependent systems, storing just the output state of time T-1, and the new input state, may be enough to reproduce movement -- consider this for your system.)

Another option is to say "the system is weak enough to never hurt humans, and it's only for cosmetic display, so if it breaks, there's no money on the line." That's a fine way of doing systems analysis. In the past, I've designed systems with MX servos, that, because of a bug, moved into interference (stalled against themselves,) and before I could cut power (a few seconds,) the delicate Maxxon motors in those servos had already burned out their brushes, necessitating a $90 replacement for each servo motor. There is an "overheating" and "stalled movement" safety in the controller for the servo, but the timing for those safeties is 5-7 seconds, and the timing for burning out a motor at the highest rated voltage of 4S LiPos is more like 2 seconds...

So, validation is not just about keeping humans safe, it's also about saving money. To avoid this, you'll have to guarantee that no link in your arm will interfere with (be blocked by) the body of the robot, or another link of the arm, when you do the iterative solution. When using a closed form solution, you can bake that guarantee into the solution, and rest assured that there will never be such a problem.

All in all, iterative solutions are SO MUCH SIMPLER, and also often "look better" aesthetically, so many solutions end up doing just that, and living with the, now obvious, draw-backs related to validation :-)

(Please accept this answer if you find it to be helpful.)


问:
Mounting gear on a servo
The outputs of most hobby servos is a spline. To mount a custom gear on the spline so that the servo turns the gear, how should it be best done? I see that some people just screw the gear into the threaded hole in the spline, but wouldn't this be inadequate?

It'd just be the bottom of the screw touching the gear.

答:
The attachment of something that's screwed in is not so much the screw, as it is the friction between the material around the screw (the "faying surfaces.")
If you have good friction, and the load/torque isn't higher than the friction, this will work fine.
A drop of super glue can also help this along!
This works with both plastic and metal gears.

Another option includes using the stock horn (injection molded) that come with the servo and screwing the gear into that horn. This is the option used by dedicated robotics servos like Dynamixels, although you can also use this with RC hobby servos and the round horns.
This also works with both plastic and metal gears.

A third option is to laser-cut a hole in the center of your gear (assuming it's made of Delrin or something else that's laser cuttable) with a pattern and diameter that matches the output spline on the servo.
This only works with laser-cuttable plastics. You can use a washer to keep the gear in place axially.

Finally, you can machine the gears with the right kind of spline. Broaching or wire EDM can generate splines of the right dimension. I wouldn't try to cut it on a mill; the micro-sized end mills are still hard to get small enough, deep enough, and oriented enough to cut a good spline of that size.

Pulling up the rear in complexity comes designing your own die cast or injection molding tooling to make the gears matching the spline. Not for those low on cash or time :-)

Title: Mounting gear on a servo


问:
How big is the set of kinematics singularities?
Suppose we have an $n$-DOF robot manipulator and let $q \in \mathbf{R}^n$ denotes a robot joint configuration. Then a singular configuration $q'$ is a configuration at which the Jacobian $J(q')$ does not have maximum rank. Let $S$ be the set of all singular configurations of a given robot

Is there any (general) result regarding characterization of the set $S$? Any work discussing or answering questions such as "Is $S$ a manifold?", "Does $S$ contain only isolated points?", etc.?

So far I have found quite a few work talking about classification of singular configurations. I think they still do not really answer my questions. Can anyone point me to some related stuff?

答: According to Pai and Leu, 1989, for a generic manipulator (which includes all 6R robots with a spherical wrist), the set of singular points of rank r are smooth manifolds in joint space of codimension (j - r)(k - r), where j is the dimension of joint space and k is the dimension of task space.


问:
PID tuning with (Deep) Reinforcement Learning
I am trying to implement a RL algorithm for an adaptive PID in a robot system. My doubt consists in the creation of the possible states in the problem.

I mean, I understand quite well the problem when the possible states are door numbers, but I don't know know what to do with PID. Do I have to create a finite number of possible PID values in which the algorithm learns?

答:
I read a bit more and realized that in RL states and rewards accept a wide variety of interpretations and this is the real complexity nowadays of this learning problem.

In case of PID values, problem can be formulated as the following:

imagine a Kp value, it represents a state. Next state could be increase or decrease 0.1. Same with the next state, and so on.

Moreover, in some research problems, when talking not about controllers, but about external efforts, they simplify the problem to three possible states: fixed positive value, fixed negative value or 0 value. It is complicated to apply this idea to controllers.

I am almost sure that my particular problem could be more easily formulated if I used as states another kind of variables, such as "advancing forward, backwards or not moving". RL allows it.


答:
You can use differential IK to solve for a set of IK solutions along a given trajectory. The idea is that you use the IK solution of the current time step, to compute an IK solution for the next time step.

Suppose $q$ is your IK solution at the current time step and $x^+$ is the desired end-effector pose at the next time step. You may compute $q^+$ by iteratively updating $q$:

$$
q \leftarrow q + dq,
$$

where $dq = J^{\dagger}(q)dx$, $J^{\dagger}$ is a pseudo inverse of the Jacobian matrix, and $dx$ is the difference between the current end-effector pose and the desired one. If a solution exists, this procedure should converge in only a few iterations (e.g. less than $10$ iterations). The converged value is taken as $q^+$.

An advantage of this method is that in the end you will have a smooth joint trajectory.

By the way, to select the initial IK solution for the trajectory, you may choose one which is well away from the configuration space boundary so that you wouldn't hit a boundary while following the end-effector trajectory.

Title: Humanoid robot arm - inverse kinematics - choose joint solutions

Body:
I have developed a 7DOF arm for a humanoid robot (see pic below for more details)
I have implemented the IK using a closed form solution and of course I come up with eight solutions - each one is actually positioning the end effector at the right position and orientation (I implemented the method described in the paper: "Kinematics and Inverse Kinematics for the Humanoid Robot HUBO2+").
The question now is how to choose the right one, knowing the fact that the end effector will follow a trajectory. The idea is to compute iteratively the $[N, S, A, P]$ matrix that will be provided to the IK module.

One solution I am thinking off is to choose the joint solution in the decision table that will minimize the given metrics:
$$\sum_i (\theta_i^{current} - \theta_i^{next})^2$$
where $\theta_i^{current}$ represents the the current value of the $i^{th}$ joint and $\theta_i^{next}$ is the computed value in the decision table.

Do you think it is the right approach or there are other methods out there to find the best joint solution from the decision table.


问:
What stepper motor driver to use?
I want to control a DVD drive's stepper motor with an arduino uno, but at the moment I'm not sure what kind of motor driver will work for that.

I am currently looking at this one

I have no idea about the specs of a motor driver, so any help would be greatly appreciated!

答:
That is a very good choice since DVD motor operate under 2A.

I'm using the very same driver to manage my DVD drivers also NEMA23.

You just need to take care about trimming the current limit very well and concern about chinese production because they differ between resistors. Note that the original StepStick stepper driver boards use 0.2 Ohm current sense resistors (Rs) while the original Pololu A4988 stepper driver boards uses 0.05 Ohm current sense resistors. However, the Made in China A4988 stepper driver boards use various current sense resistors depending on the manufacturer (usually either 0.05 Ohm, 0.1 Ohm or 0.2 Ohm). The current sense resistors are the two small black components next to the main chip. Compare the pictures above and check the detail below: the green Made in China A4988 board was fit with 0.1 Ohm resistors (labeled with "R100") while the red StepStick Made in China clone was fit with 0.2 Ohm resistors (labeled with "R200"), while other Made in China A4988 boards may come with 0.05 Ohm (labeled with "R050") current sense resistors. So it is very important that you closely examine your stepper driver boards and use the exact values for the current sense resistors when calculating the Vref formula (see an example below).

A4988 Resistor

Tuning motor current:

Per the A4988 datasheet, the calculation for the maximum trip current is:

```<code>I_TripMax= Vref/(8*Rs)
</code>```

With Pololus, the sensing resistors are Rs=0.05 ohm, so a Vref of 0.4 should produce a maximum current of 0.4/(8*0.05)=1A. Clockwise increases the current which will make the motor run hotter and counterclockwise reduces it which will cool it down (see forum thread 159081).
As another example, aiming for 50% temperature rise on 1A rated steppers by using max 0.7A, so rearrange it as:

```<code>Vref = I_TripMax * 8 * Rs
</code>```

or

```<code> Vref = 0.7A * 8 * 0.05 = 0.280V
</code>```

With a measured Vref of 0.273V, I should expect 0.6825A, and I measured the current through one coil as 0.486A in full step mode, which should be 0.7071 of the full trip current, or I_TripMax= 0.486/0.7071= 0.687A, which seems close enough.
The Vref signal is accessible as the "VREF" pin on the carriers with voltage regulators, as the through-hole via on the carriers without, and also as the wiper on the trim pot itself on both carriers.

example of a v-ref checking, + probe on the turnpot and - on a ground pin
Note 1: for StepStick, the Rs=0.2 ohm, so you'd get 4 times the Vref at the same current.
Note 2: most "Made in China" A4988 Pololu knock-offs have Rs=0.1 ohm

Example of a v-ref checking, + probe on the turnpot and - on a ground pin

How to wire and control your stpper motor:

Start with the 2 pins on the botton right side for powering the driver, the VDD and Ground pins that we need to connect them to a power supply of 3 to 5.5 V and in your case that will come from your controller, the Arduino Board which will provide 5 V.  The following 4 pins are for connecting the motor. The 1A and 1B pins will be connected to one coil of the motor and the 2A and 2B pins to the other coil of the motor.

The next two 2 pins, Step and Direction are the pins that we actually use for controlling the motor movements. The Direction pin controls the rotation direction of the motor and we need to connect it to one of the digital pins on our microcontroller, or in our case I will connect it to the pin number 4 of my Arduino Board.  With the Step pin we control the mirosteps of the motor and with each pulse sent to this pin the motor moves one step. So that means that we don’t need any complex programming, phase sequence tables, frequency control lines and so on, because the built-in translator of the A4988 Driver takes care of everything. Here we also need to mention that these 2 pins are not pulled to any voltage internally, so we should not leave them floating in our program.

Next is the SLEEP Pin and a logic low puts the board in sleep mode for minimizing power consumption when the motor is not in use.

Next, the RESET pin sets the translator to a predefined Home state. This Home state or Home Microstep Position can be seen from these Figures from the A4988 Datasheet. So these are the initial positions from where the motor starts and they are different depending on the microstep resolution. If the input state to this pin is a logic low all the STEP inputs will be ignored. The Reset pin is a floating pin so if we don’t have intention of controlling it with in our program we need to connect it to the SLEEP pin in order to bring it high and enable the board.

The next 3 pins (MS1, MS2 and MS3) are for selecting one of the five step resolutions according to the above truth table. These pins have internal pull-down resistors so if we leave them disconnected, the board will operate in full step mode.

Don't forget

The only thing you need to real concern is if your motor is Unipolar or Bipolar. A4988 are designed to control bipolar stepper motors, but you can set your Unipolar motor as Bipolar.

To make sure about your stepper motor, just look for his datasheet using his product number or model number on Google. If you can't find this, please look how to wire your stepper motor using the following links as source:

http://www.linengineering.com/resources/wiring-connections/

http://reprap.org/wiki/Stepper_wiring

http://digital.ni.com/public.nsf/allkb/B1CC4C64ABBC7D3C86257BC70017B9E2

Title: What stepper motor driver to use?

Body:
That is a very good choice since DVD motor operate under 2A.

I'm using the very same driver to manage my DVD drivers also NEMA23.

You just need to take care about trimming the current limit very well and concern about chinese production because they differ between resistors. Note that the original StepStick stepper driver boards use 0.2 Ohm current sense resistors (Rs) while the original Pololu A4988 stepper driver boards uses 0.05 Ohm current sense resistors. However, the Made in China A4988 stepper driver boards use various current sense resistors depending on the manufacturer (usually either 0.05 Ohm, 0.1 Ohm or 0.2 Ohm). The current sense resistors are the two small black components next to the main chip. Compare the pictures above and check the detail below: the green Made in China A4988 board was fit with 0.1 Ohm resistors (labeled with "R100") while the red StepStick Made in China clone was fit with 0.2 Ohm resistors (labeled with "R200"), while other Made in China A4988 boards may come with 0.05 Ohm (labeled with "R050") current sense resistors. So it is very important that you closely examine your stepper driver boards and use the exact values for the current sense resistors when calculating the Vref formula (see an example below).

A4988 Resistor

Tuning motor current:

Per the A4988 datasheet, the calculation for the maximum trip current is:

I_TripMax= Vref/(8*Rs)

With Pololus, the sensing resistors are Rs=0.05 ohm, so a Vref of 0.4 should produce a maximum current of 0.4/(8*0.05)=1A. Clockwise increases the current which will make the motor run hotter and counterclockwise reduces it which will cool it down (see forum thread 159081).
As another example, aiming for 50% temperature rise on 1A rated steppers by using max 0.7A, so rearrange it as:

Vref = I_TripMax * 8 * Rs

or

 Vref = 0.7A * 8 * 0.05 = 0.280V

With a measured Vref of 0.273V, I should expect 0.6825A, and I measured the current through one coil as 0.486A in full step mode, which should be 0.7071 of the full trip current, or I_TripMax= 0.486/0.7071= 0.687A, which seems close enough.
The Vref signal is accessible as the "VREF" pin on the carriers with voltage regulators, as the through-hole via on the carriers without, and also as the wiper on the trim pot itself on both carriers.

example of a v-ref checking, + probe on the turnpot and - on a ground pin
Note 1: for StepStick, the Rs=0.2 ohm, so you'd get 4 times the Vref at the same current.
Note 2: most "Made in China" A4988 Pololu knock-offs have Rs=0.1 ohm

Example of a v-ref checking, + probe on the turnpot and - on a ground pin

How to wire and control your stpper motor:

Start with the 2 pins on the botton right side for powering the driver, the VDD and Ground pins that we need to connect them to a power supply of 3 to 5.5 V and in your case that will come from your controller, the Arduino Board which will provide 5 V.  The following 4 pins are for connecting the motor. The 1A and 1B pins will be connected to one coil of the motor and the 2A and 2B pins to the other coil of the motor.

The next two 2 pins, Step and Direction are the pins that we actually use for controlling the motor movements. The Direction pin controls the rotation direction of the motor and we need to connect it to one of the digital pins on our microcontroller, or in our case I will connect it to the pin number 4 of my Arduino Board.  With the Step pin we control the mirosteps of the motor and with each pulse sent to this pin the motor moves one step. So that means that we don’t need any complex programming, phase sequence tables, frequency control lines and so on, because the built-in translator of the A4988 Driver takes care of everything. Here we also need to mention that these 2 pins are not pulled to any voltage internally, so we should not leave them floating in our program.

Next is the SLEEP Pin and a logic low puts the board in sleep mode for minimizing power consumption when the motor is not in use.

Next, the RESET pin sets the translator to a predefined Home state. This Home state or Home Microstep Position can be seen from these Figures from the A4988 Datasheet. So these are the initial positions from where the motor starts and they are different depending on the microstep resolution. If the input state to this pin is a logic low all the STEP inputs will be ignored. The Reset pin is a floating pin so if we don’t have intention of controlling it with in our program we need to connect it to the SLEEP pin in order to bring it high and enable the board.

The next 3 pins (MS1, MS2 and MS3) are for selecting one of the five step resolutions according to the above truth table. These pins have internal pull-down resistors so if we leave them disconnected, the board will operate in full step mode.

Don't forget

The only thing you need to real concern is if your motor is Unipolar or Bipolar. A4988 are designed to control bipolar stepper motors, but you can set your Unipolar motor as Bipolar.

To make sure about your stepper motor, just look for his datasheet using his product number or model number on Google. If you can't find this, please look how to wire your stepper motor using the following links as source:

http://www.linengineering.com/resources/wiring-connections/

http://reprap.org/wiki/Stepper_wiring

http://digital.ni.com/public.nsf/allkb/B1CC4C64ABBC7D3C86257BC70017B9E2


问:
2.4GHz helicopter hack [Edited]
I bought a little toy helicopter, namely the Revell Control 23982. After flying a few batteries I was wondering whether I could hack it in such a way, that my Arduino Uno can control/manipulate the signals from the transmitter to the receiver on board. However, to me it seems like I have big trouble getting started on the right path.
Can anyone spot out my mistakes?

Hardware hack

My first attempt was to bridge the potentiometers in the transmitter with the Arduino, this did not work at all. I think this is because the Arduino is using PWM and no true DC. Also I do not understand how the potentiometer (shown in the picture) works, where two of the three terminals are connected to each other.

NOTE: The soldered cable is a result of some unsuccessful hardware soldering.

EDIT

Here is further information according to @combos comment.

NOTE: The diagram is missing a connection between the line that connects all potentiometers and a 3v pin on the IC. Sorry for that.

This is a simple excerpt of the actual PCB, however, it should be the one which is important for my question. It is true that two terminals of the potentiometers are connected, and all the potentiometers are additionally soldered to ground via their housing. I was not able to find any information about the IC labelled "???". It contains the transmitter, that is clear.

A test with my multi-meter showed, that there is a maximum current flow of three volts on the single line of each potentiometer, and the connection between all of them is 3v consistent.

Software hack

My second attempt was trying to reverse engineer the 2.4GHz transmission via an nrf24l01 module, as some other people on the internet have been successful doing this with some other toys. I tried to scan the frequency bands, however with no successful outcome. I have no clue which transmitter module is being used on the board.

TL;/DR;

My questions:

Is it even possible to achieve what I want?

If yes, what do I need to do?

If not, what did others do to achieve this kind of behaviour?

Which circuit do I need to convert digital PWM in analog?

If you need any additional information please let me know!

答:
I guess this uses PWM (from what I understand from the question's description). Almost all standard flight-controllers use PWM values ranging from 1000 microseconds to 2000 microseconds refreshed at 50 Hz.
Regarding potentiometer, it is used to control voltage (and some people do use it to drive current; But, it has drawbacks which I'll discuss later). The Vin and the ground are the top and bottom pins while a potential divider circuit creates a potential (w.r.t ground) which is proportional to the variable resistance between Vout and ground while total resistance of both resistances remains same due to resistance strip. More info on Wikipedia: https://en.wikipedia.org/wiki/Potentiometer#Theory_of_operation and http://lmgtfy.com/?q=potentiometer .

Regarding the potentiometer, it is used because it is intuitive for us to use; We just use potentiometer angle as a measure of proportional linear actuation metric. (instead of 1 millisecond to 2 millisecond PWM train of 20 milliseconds as in standard OverrideRC methods which are counter-intuitive http://answers.ros.org/question/197109/how-does-mavros-rc-override-work/) You can connect potentiometer to arduino or so and then use PWM as output of Arduino and input of flight controller. But, if you use this to drive current, then, the potential divider calculations must be done for three resistors including the load resistance and thus, this resistance in parallel causes a non-linear relation with the input potentiometer angle.

I would have probably answered better if I were to have known both sides of the PCB as I could not gather much info online apart from some vague description like this one on Amazon. +1 for the hack and attempt.

Title: 2.4GHz helicopter hack [Edited]


问:
Self-Motion Manifolds
In this paper by J. W. Burdick, the main result basically says that

for a redundant manipulator, infinity solutions corresponding to one end-effector pose can be grouped into a finite set of smooth manifolds.

But later in the paper, the author said only revolute jointed manipulators would be considered in the paper.

Does this result (grouping of solutions into a finite set of manifolds) hold for redundant robots with prismatic joint(s) as well? Is there any significant difference in analysis and result when prismatic joints are included? So far I couldn't find anyone explicitly address the case of robots with prismatic joints yet.

(I am not sure if this site or math.stackexchange.com would be the more appropriate place to post this question, though.)

答:
I am not sure if it applies here, but it is usual way in mathematic to prove something simple and then say, that other cases can be transformed to the simple case, so it is proven for them too (usually in some ineffective long way, but it does not matter, if you want to prove existence of solution).

Prismatic joint can be replaced with three revolute joints connected with long enough rodes, working in cooperative way, maybe it is enought to do substitution for the case in the papers?

Title: Self-Motion Manifolds


问:
What is the scope of Electronics Engineering in Robotics/Automation?
I am beginner in Robotics .I have taken admission for Electronics engineering one year back as we don't have specifically Robotics Engineering Branch in my Country.Now I am suffering from questions like what is the scope of Electronics( not Electrical) Engineering in Robotics/ Automation?I am unable to distinguish between the role of Electronics engineer and Computer Engineer in Robotics as in both cases programming is required

Also,if I don't like to do programming(coding),are there any other options to stick to Robotics / Automation field as per my branch(Electronics Engineering ) is concerned?.

答:
This answer is specifically meant to help OP. Assuming you are from developing country like India, I can say that the current implementations of robotics is bleak (apart from some nice stuffs in cities like Bangalore and other metropolitan cities; like Team Indus trying to launch a rover on moon, Team Dhanvantari building IoT devices etc).

So, I would suggest something like trying to get some hands-on experience during free time. (Say, trying to control a remote robotic arm just by sitting and clicking something in your browser and developing codes from scratch and trying even better stuffs like RTOS for arm and learning the development of beautiful web interface at the same time; Personally I wish I had learnt RTOS and web development also during college days) That way, even if robotics/automation goes out of hand, still there will be some web development as a by-product 'scope'.

P.S.: I would edit this and add more info if needed.

Reference: Google and https://www.quora.com/What-is-the-future-scope-of-robotics-in-India