答:
Which type of real-time are you seeking for? Hard-, soft- or near- RT?

I'm asking because I believe it's likely that near-RT fits your application, depending of course on the speed of the conveyor and the system responsiveness you require.

Near-RT does not need large implementation effort: for instance, on Windows you can easily reach up to 100 Hz computation linking against yarp, which is a C++ lightweight library already integrated with OpenCV for vision processing.

Note that 100 Hz should be suitable for dealing with the normal camera frame rate (i.e. 33 Hz)

Title: Real time operating system for robotics vision

Body:
I have robot vision system which consists of conveyor with encoder, two cameras (gigabit eth and usb) and simple illuminator.

I need to trigger cameras and illuminator when encoder reaches position interval.

I'm considering using real time operating system for this task:
Encoder, illuminator and cameras connected to PC and vision system application runing on it.

Which real-time solution you can reccomend for this problem?

I'm considering using Beckhoff TwinCAT software which turns normal operating system into RT.


问:
Is there a working implementation of "Navigation Among Movable Obstacles" for a bi-pedal robot?
I would like to have a better understanding of work in the field of "Navigation Among Movable Obstacles". I started off with Michael Stilman's thesis under James Kuffner, but that has not yet sated my appetite.

I am currently trying to simulate a scenario where debris (Tables and Table parts) from a disaster scenario block pathways. The debris forms part of a movable obstacle. The robot which will be used is a bipedal humanoid.

The thesis describes an approach to define the search space of possible actions leading from the start point to the goal. However, it assumes a mobile robot which works via gliding.

I think the state space definitions would change for a bi-pedal robot. Why is why I wonder what other work is being done in this field. Perhaps the work of other research groups could give me clues as to how to design and perhaps reduce the search space for a bipedal humanoid robot.

An implementation of Navigation among Movable Obstacles would also aid me in understanding how to reduce the search space of possible actions.

So does anyone know of a working implementation of Navigation among movable obstacles?

Any supporting information about other professors or research groups working on similar problems would also be very useful.

I hope this edit is sufficient for the problem description.

答: Speaking about navigation among moving obstacles, look at Jur van den Berg thesis. Also Lavalle provided a tutorial at ICRA12 http://msl.cs.uiuc.edu/~lavalle/icra12/ and the videos are here http://techtalks.tv/events/105/ but neither mention the problem of bipeds.</p>

ContentLicense: CC BY-SA 3.0


问:
Is there build your own garage robotic assembly lines out there?
I am new to robotics, and would like to build a smaller robotic arm than in manufacturing facilities.
I want a small robotic material handlers that can pick up or handle small objects around 12"x12"x12" objects. Essentially a small robotic assembly line in my garage.

Are there any kits I can purchase that deals with robotic assembly lines?
I was wondering has anyone dealt with this before any suggestions on this?

答: There are a number of kickstarter campaigns for small low-cost robot arms.  It is interesting that there is a delta robot, a scara arm, and a parallelogram arm.  However, I doubt they come with much software.  So you will probably have to do a lot of the controls yourself.</p>


问:
How to periodically estimate states of a LTI if the output is measured irregularly?
How can I periodically estimate the states of a discrete linear time-invariant system in the form $$\dot{\vec{x}}=\textbf{A}\vec{x}+\textbf{B}\vec{u}$$
$$\vec{y}=\textbf{C}\vec{x}+\textbf{D}\vec{u} $$if the measurements of its output $y$ are performed in irregular intervals? (suppose the input can always be measured).

My initial approach was to design a Luenberger observer using estimates $\hat{\textbf{A}}$, $\hat{\textbf{B}}$, $\hat{\textbf{C}}$ and $\hat{\textbf{D}}$ of the abovementioned matrices, and then update it periodically every $T_s$ seconds according the following rule:

If there has been a measurement of $y$ since the last update: $$\dot{\hat{x}}=\hat{\textbf{A}}\hat{x}+\hat{\textbf{B}}\hat{u}+\textbf{L}(y_{measured}-\hat{\textbf{C}}\hat{x})$$
  If not:
  $$\dot{x}=\hat{\textbf{A}}\hat{x}+\hat{\textbf{B}}\hat{u}$$

(I have omitted the superscript arrows for clarity)

I believe that there may be a better way to do this, since I'm updating the observer using an outdated measurement of $y$ (which is outdated by $T_s$ seconds in the worst case).

答:
This problem can be conveniently addressed in the context of multi-rate Kalman estimation.

See for example "Multi-rate Kalman filtering for the data fusion of displacement and acceleration response measurements in dynamic system monitoring" (Section 4).

Essentially, you have to establish a time sample $T_s$ lower than the minimum time interval you can expect from two consecutive measurements. Then, you always perform the Kalman time update step each $T_s$ instant, whereas the measurement update is run only upon fresh data.


问:
Quadcopter Hovering Problem
My quadcopter can lift off the ground, but it kinds of circles around. Here is my video
https://www.youtube.com/watch?v=Rxjpwhbgiw0

Anyone helps me?

答: The first thing that comes to my mind is an error associated with the sensors, have you tuned the sensors? It seems that the sensor is reading an angle when the craft is level which makes it correct continuously when it's level. </p>

Title: Quadcopter Hovering Problem


问:
Controlling a system with delayed measurements
Assume I have a rather simple system I want to control, but all sensor measurements exhibit considerable time delay, i.e.:

$z_t = h(x_{(t-d)}) \neq h(x_t)$

With my limited knowledge about control, I could imagine the following setup:

One observer estimates the delayed state $x_{(t-d)}$ using control input and (delayed) measurements.

A second observer uses the delayed observer's estimate and predicts the current state $x_t$ using the last control inputs between delayed measurement and current time.

The second observer's estimate is used to control the system.

Can I do any better than that? What is the standard approch to this problem? And is there any literature or research about this topic?

答:
Kalman framework can be adapted to deal with joint state and delay estimation: see this paper as an example.

Don't forget to consider the Smith Predictor, which will help you design the linear regulator as the system was without delays.


问:
Developing a Quadrotor using ROS
I
 suppose who know ROS and how it works (at least most of you)
I have some question regarding the implementation of a quadrotor in that
 framework.

3D movements: A quadrotor has 6DOF and moves in a 3D
environment. Looking at the various ROS packages I could not find any
package that allows to drive a "robot" in the 3D space. The package
/move_base for instance allows only 2D. Make sense to use this
package for such a project? I thought to use 2D navigation projecting
the "shadow" of a quadrotor on the ground...

MoveIt: it seems a real interesting and promising package, but I
read that it is for robotic arms and not expressly indicate for
quadrotor. Maybe one can use the possibility to create a virtual
floating joints in MoveIt to let the quadrotor any movement in a 3D
environment...that's ok, but I cannot understand whether is "too much"
and not useful for a flying robot.

Trajectories: The possibility to create a 3D trajectory in the
space seems to be not a standard package of ROS. I found Octomap
which allows the creation of 3D maps from sensor datas. Very interesting
and for sure very useful. But...I don't think it could be useful for
creating 3D trajectories.  Should I in that case create an extra package
to compute 3D trajectories to be feed into the quadrotor? Or there
already something like that?

There is already an existing project hector_quadrotor which seems to
acclaim a good success ans it is very considered in the field. Most
people refer to that project when speaking or answering question
regarding quadrotors in ROS. I saw many times that project...since
weeks. And due to the total lack of documentation I didn't try anymore
to understand how it works. Really too difficult.
Another interesting project, ArDrone, has comments in the source
code...in Russian!!! @_@

Could you me give any good suggestions? Or point me in the right direction
please?
It would help me to understand how to focus my searches and which
package I can/cannot use.

UPDATE: my goal is to let the quadrotor flying and using gmapping to localize itself. I've heard and read al lot of stuff about that but I found all this tutorials very hard to understand. I cannot get a global vision of the software and sometime I run in problems like: "is there a package for this task, or should I invent it from scratch?"

Thanks!

答:
CCNY seems to have a pretty good UAV ROS library.

You might also want to try your question on ROS's question/answer site: http://answers.ros.org.

Title: Developing a Quadrotor using ROS


问:
How to obtain dense point clouds from stereo cameras?
I am trying to use a stereo camera for scene reconstruction, but I can usually only obtain sparse point clouds (i.e. over half the image does not have any proper depth information).

I realize that stereo processing algorithms rely on the presence of texture in the images and have a few parameters that can be tweaked to obtain better results, such as the disparity range or correlation window size. As much as I tune these parameters, though, I am never able to get results that are even remotely close to what can be obtained using an active sensor such as the Kinect.

The reason why I want that is because very often point clouds corresponding to adjacent regions don't have enough overlap for me to obtain a match, so reconstruction is severely impaired.

My question to the Computer Vision experts out there is the following: what can I do to obtain denser point clouds in general (without arbitrarily modifying my office environment)?

答:
So the stereo image processing algorithms I have used in the past were implemented pixel by pixel. We just used the pinhole camera model and did some old fashioned measurements with measuring tape until our depth estimations matched the real thing.

The equations for a pair of parallel cameras are:

$d = $half the distance between the cameras

$f = $the focal length of the cameras (assumed to be the same)

Coordinate Frames:

$x, y, z = $ coordinate frame between the cameras (i.e. the camera base frame)

$u_R, v_R$ camera coordinates in the right camera from the perspective of the robot (u is horizontal, v is vertical)

$u_L, v_L$ camera coordinates in the left camera

Note: the camera coordinates have their origins at the coordinate frame between the cameras (i.e. the u axes face opposite directions)

$u_L = \frac{f(x-d)}{z}$, $u_R = \frac{f(x+d)}{z}$

$zu_R = f(x+d)$, $zu_L = f(x-d)$

$z(u_R - u_L) = 2df$

$z = \frac{2df}{u_R - u_L}$

$y = \frac{v_L*z + df}{f}$

$x = \frac{u_L*z + df}{f}$

Using these equations you can compute a dense stereo cloud.  One for each pixel on your cameras.


答:
Sorry but...it is normal... you are flying in ground effect so it is normal that it is very hard to keep it stable in one point (I suppose you are driving it with some controllers).

Give more power and lift on about 0.5 m or something like that and see what happen.
To avoid destroying your quadrotor I can suggest you to put a cable (or better a spring) from the ceiling of your garage to the C.G. of the quadrotor to keep it balanced. At worse you destroy one propeller..

Title: Quadcopter Hovering Problem

Body:
My quadcopter can lift off the ground, but it kinds of circles around. Here is my video
https://www.youtube.com/watch?v=Rxjpwhbgiw0

Anyone helps me?


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

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

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

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

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

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

答: To expand on the Tracked-ROV/toilet-bowl answer, the same could be achieved without the complexity of the airgun cartridge, if the motor is positioned high enough in the chamber:   As the water enters, it compresses the air trapped above, depending on the height of the chamber, depth of ROV (and density of the fluid), at some point the pressures will equalise and prevent further fluid ingress.</p>


问:
Robotics simulation from PNG map
I am a complete beginner at this.

I have an arbitrary map as a PNG file (black and white, only). And I'm supposed to draw a robot at a position(x,y) and then I'm supposed to simulate the robot taking a laser-scan measurement for an opening angle of 130 degrees, separation of each scan-line is 2 degrees. So, obviously: each laser scanline is supposed to be obstructed by black pixels in the PNG map, while the other lines just keep on going for an n distance.

I've attempted drawing scanlines around the object, but I'm running into issues when it comes to getting each line to be obstructed by the black-lines. To my mind, it requires a completely different approach.

Any helpful advice on how to get started would be greatly appreciated.

答:
Using scanlines

A naive approach could be something like this:

```<code>for (angle = 0; angle < 360; angle += precision)
    draw_line_from_robot(robot, angle)
</code>```

which tries to draw many lines from the robot, reaching out to as far as it can. You could use Bresenham's line algorithm for example and as you draw your line, make sure you don't hit a black pixel. When you do, simply stop and try the next angle.

This approach has a couple of problems. Take this map for example:

And the following map with a few lines drawn:

You can see the first problem here. As you get farther from the robot, you get gaps in the scanlines. You could get precision higher, but you could also change your algorithm a bit to make sure you cover every surrounding pixel:

```<code>for (i = 0; i < x; ++i)
    draw_line_from_robot_to_destination(robot, i, 0)
    draw_line_from_robot_to_destination(robot, i, y - 1)

for (i = 1; i < y - 1; ++i)
    draw_line_from_robot_to_destination(robot, 0, i)
    draw_line_from_robot_to_destination(robot, x - 1, i)
</code>```

This way, you are sure to cover all pixels. However, there is a second problem. a lot of pixels close to the robot are being redrawn over and over again.

A better way

Given these limitations (either not covering all pixels, or being highly inefficient), I'm going to propose a different algorithm.

You can use breadth-first search on the pixels of the image (as if it was a graph) starting from the robot. Additionally, keep a binary-search tree of disjoint angle-ranges visible to the robot.

First, let's talk about what the binary-search tree does for you. In the beginning, the tree holds only one node:

```<code>                       [0, 360)
</code>```

which means the robot can see from angle 0 to 360.

Let's say at some point you meet an obstacle, at angle x. You need to block the view of the robot by a certain range, which is blockable by a pixel.

In the picture above, gray pixels are just to show the distance between the robot and the blocked pixel. The green pixel is the robot and the black is the obstacle. The $\alpha$ and $\beta$ are easily calculated. Assuming the block to be at:

$\alpha = arctan(b_x - r_x + 0.5, b_y - r_y - 0.5)$

$\beta = arctan(b_x - r_x - 0.5, b_y - r_y + 0.5)$

The computed, you reduce the blocked range from your tree and get a new tree:

```<code>                       [0, a)
                           \
                           (b, 360)
</code>```

If later you decide to reduce $[\gamma, \delta]$ from your tree, where they are below $\alpha$, you would get:

```<code>                       (d, a)
                       /    \
                   [0, g)   (b, 360)
</code>```

If you want to reduce $[\epsilon, \alpha]$ from the tree, you get:

```<code>                       (d, e)
                       /    \
                   [0, g)   (b, 360)
</code>```

You get the idea!

So what's the final algorithm?

```<code>/* this is a BFS */
init_tree(range_tree)
insert_queue(Q, robot_pos)
mark_visited(robot_pos)

while (!empty(Q))
    pos = queue_pop(Q);
    for (all neighbors of pos, n)
        if (n is outside the map or visited before)
            continue
        if (n is black)
            remove_blocked_view(range_tree, robot_pos, n)
        else if (visible_in_ranges(range_tree, robot_pos, n))
            mark_visited(n)
            insert_queue(Q, n)
</code>```

In the end, the pixels that you have visited are the visible pixels from the robot. In the above algorithm, remove_blocked_view is the algorithm I described above, and visible_in_ranges is a simply binary-search tree lookup that tells whether the angle from robot_pos to n ($arctan(n_x - r_x, n_y - r_y)$) is in the tree or not.  If it is in the tree, the pixel is visible. If it is not, then it's not visible.

Title: Robotics simulation from PNG map

Body:
Using scanlines

A naive approach could be something like this:

for (angle = 0; angle < 360; angle += precision)
    draw_line_from_robot(robot, angle)

which tries to draw many lines from the robot, reaching out to as far as it can. You could use Bresenham's line algorithm for example and as you draw your line, make sure you don't hit a black pixel. When you do, simply stop and try the next angle.

This approach has a couple of problems. Take this map for example:

And the following map with a few lines drawn:

You can see the first problem here. As you get farther from the robot, you get gaps in the scanlines. You could get precision higher, but you could also change your algorithm a bit to make sure you cover every surrounding pixel:

for (i = 0; i < x; ++i)
    draw_line_from_robot_to_destination(robot, i, 0)
    draw_line_from_robot_to_destination(robot, i, y - 1)

for (i = 1; i < y - 1; ++i)
    draw_line_from_robot_to_destination(robot, 0, i)
    draw_line_from_robot_to_destination(robot, x - 1, i)

This way, you are sure to cover all pixels. However, there is a second problem. a lot of pixels close to the robot are being redrawn over and over again.

A better way

Given these limitations (either not covering all pixels, or being highly inefficient), I'm going to propose a different algorithm.

You can use breadth-first search on the pixels of the image (as if it was a graph) starting from the robot. Additionally, keep a binary-search tree of disjoint angle-ranges visible to the robot.

First, let's talk about what the binary-search tree does for you. In the beginning, the tree holds only one node:

                       [0, 360)

which means the robot can see from angle 0 to 360.

Let's say at some point you meet an obstacle, at angle x. You need to block the view of the robot by a certain range, which is blockable by a pixel.

In the picture above, gray pixels are just to show the distance between the robot and the blocked pixel. The green pixel is the robot and the black is the obstacle. The $\alpha$ and $\beta$ are easily calculated. Assuming the block to be at:

$\alpha = arctan(b_x - r_x + 0.5, b_y - r_y - 0.5)$

$\beta = arctan(b_x - r_x - 0.5, b_y - r_y + 0.5)$

The computed, you reduce the blocked range from your tree and get a new tree:

                       [0, a)
                           \
                           (b, 360)

If later you decide to reduce $[\gamma, \delta]$ from your tree, where they are below $\alpha$, you would get:

                       (d, a)
                       /    \
                   [0, g)   (b, 360)

If you want to reduce $[\epsilon, \alpha]$ from the tree, you get:

                       (d, e)
                       /    \
                   [0, g)   (b, 360)

You get the idea!

So what's the final algorithm?

/* this is a BFS */
init_tree(range_tree)
insert_queue(Q, robot_pos)
mark_visited(robot_pos)

while (!empty(Q))
    pos = queue_pop(Q);
    for (all neighbors of pos, n)
        if (n is outside the map or visited before)
            continue
        if (n is black)
            remove_blocked_view(range_tree, robot_pos, n)
        else if (visible_in_ranges(range_tree, robot_pos, n))
            mark_visited(n)
            insert_queue(Q, n)

In the end, the pixels that you have visited are the visible pixels from the robot. In the above algorithm, remove_blocked_view is the algorithm I described above, and visible_in_ranges is a simply binary-search tree lookup that tells whether the angle from robot_pos to n ($arctan(n_x - r_x, n_y - r_y)$) is in the tree or not.  If it is in the tree, the pixel is visible. If it is not, then it's not visible.


问:
What middle-ware do you recommend for a swarm of AUVs?
Working with a swarm of robots, collaboration between the nodes is really important(either for the goal of simulation or real-word operation). Middle-wares are the frameworks for this special purpose. I know some of the relevant middle-wares like ROS(general-purpose but popular) or uMVS(that is basically design for AUVs). Now, I have two questions:

Do you know any other choice for the above mentioned purpose?

What criteria should I consider for choosing a middle-ware suitable for my purpose?

Thank you.

答:
To your first question if there is something other:
We are using for AUV control the middleware framework work named rock:

http://www.rock-robotics.org

The main problem in general is the weak communication between AUVs.
You have really limited bandwidths available.

Your question in unclear which kind of information do you wand to exchange (and how). I know currently no framework which supports data-exchange on real-low bandwidths. The Communication between AUVs is a special case, and should not be fullfilled by a framework.

If you plan to do multi-agent setups (where is client is autonomous after the start) the framework plays no special rule, since there is no communication between the vehicles.


问:
Choosing DC motor: max needed torque vs nominal torque
I have just sized the DC motors I want to use (corresponding to my robot and its intended applications - my figures include a 50% uncertainty factor to account for friction in reducers and other losses). Now I need to actually choose the exact motors I want to buy from the manufacturer (I am targeting maxon motors as I am not an expert and want no problem). I have a few down to earth questions about linking the mechanical needs to the electrical characteristics, among them:

Question #2:

As far as I understand, the nominal torque corresponds to the maximum torque the motor can sustain continuously. So I guess, as a rule of thumb, I should find a motor with a nominal torque = my max needed torque (after reduction), or around. Right?

答: The other answer is not quite right.  Nominal (rated) torque is the torque at which the motor can run continuously without overheating.  This is not the same as the torque at maximum efficiency.  A well designed motor will have its rated torque slightly higher than the torque at max. efficiency.  Maximum torque of a DC motor is the stall torque.  </p>


问:
Are there surface texture sensors for integration in circuits?
I have a project in mind for a robot which is able to recognize surfaces, and thought about including the following sensors:

a temperature sensor

a colour sensor, or a complex of electronic components to determine a colour

and a texture sensor, or, as above, a complex of components to fulfill the purpose

Now, I did some research on finding a(preferably small) texture sensor for soldering into an electronic circuit, similar to those little temperature sensors one can buy.
I already thought that "small" would probably turn out to be not small at all before I searched.
But my research has been fruitless.
Not just fruitless like in "I can't find exactly what I want." but fruitless like in "I cannot find anything similar to what I want."...

Most things that turned up either were scientific papers about whole devices, or whole devices for purchase.
Some company even choose "Structure Sensor" as the name of their iPad-compatible 3D scanner, which made the search utterly depressing as every second article I found is about buying some pre-built iPad device.

All I need is the electronic component, nothing else.
So hope that any of you people can spare me some research time and recommend me a company/site/whatever which sells such texture sensors.

(Btw., I do know that surface sensors are probably a bit way more complex than temperature sensors, and my hope for getting what I want is low, but just because I cannot find something, ot does not mean that it doesn't exist.)

答:
You might try a simple microphone. They're available in tiny surface mount packages:

You'll need to rub it across the surface, and you should be able to recognise different surface textures by the sound they make.

Do a Fourier transform on it, and you should be able to tell something about the scale of the surface textures.

You might not want to rub the microphone itself on the surface. Rather rub something else, and listen to the sound. Try dropping a blob of silicone rubber over the hole, and let it set. When the silicone rubs on a surface, the vibrations should transmit fairly efficiently into the microphone.


问:
What are good strategies for tuning PID loops?
Tuning controller gains can be difficult, what general strategies work well to get a stable system that converges to the right solution?

答:
System modeling

Of course experimental tuning can be done as mentioned in the other answers, but if you are able to define a reasonable dynamic model for whatever you want to control and are able to identify its parameters, you should be able to design your controller based on well-defined criteria such as overshoot, rise time, settling time, steady-state error and so on.

There are even tools in MATLAB that are able to tune your controller to optimize for a combination of these criteria, which makes it even better to use.

Know your controller

Learning what each parameter in the PID controller does is quite helpful as well. All the experimental algorithms are based on this kind of knowledge somehow. If you not only follow instructions, but are able to get that feeling yourself, you may find it easier to tune your controller manually.

Real world problems

There is a chance one of these things, among others, will get on your way when tuning your controller: windup, inadequate sampling rate, saturation.

Conclusion

In the end, it all depends on what you can actually do with your system to get some knowledge about how it works and what kind of experimentation can be done. The best thing is to actually learn more about PID controllers and control theory in general, IMO, but I'm biased :)


问:
Controlling a 400W motor with 24V 16A batteries with an arduino board
I want to build a robotic vacuum. I have a 400W 24V vacuum motor that I want to switch on automatically at a set time every night. The batteries I will be using will be 2x12V 80aH deep cycle gel batteries connected in series. I want the Arduino to switch the motor on and off. So my first real question I guess is will the 5V supplied from the Arduino be able to switch on a motor that big? The second question is a mosfet the answer? My apologies I'm pretty new to all this but love it..

Can I control a 400W motor with 24V 16A batteries with an Arduino board and a mosfet? What type of mosfet would I use?

答: If you only want to turn it on and off, a mechanical relay is a simpler and cheaper solution. You will need a common transistor to turn on and off the relay, which in turn turns on and off the motor. Just google "arduino relay transistor".</p>


问:
Cannot launch iRobot Create. Powers down upon minimal launch?
I just got an iRobot iCreate base and I've followed the instructions given in  ROS Tutorials to setup the turtlebot pc and the workstation. I could successfully ssh into username@turtlebot through workstation so I'm assuming that is all good. I had an issue with create not able to detect the usb cable which I solved using the detailed answer given for question here. This solved the problem of "Failed to open port /dev/ttyUSB0" that I was facing before.

Now the next step would be to ssh into the turtlebot (which I've done) and use roslaunch turtlebot_bringup minimal.launch to do whatever the command does (I've no idea what to expect upon launch). But apparently something's amiss since the create base chirps and then powers down after showing [kinect_breaker_enabler-5] process has finished cleanly as output and the log file location (see output below), but I dont see a prompt. I checked the battery and that's charged so that's not the problem. Following is the terminal output.

```<code>anshul@AnshulsPC:~$ roslaunch turtlebot_bringup minimal.launch
... logging to /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/roslaunch-AnshulsPC-5038.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://128.110.74.233:48495/

SUMMARY
========

PARAMETERS
 * /cmd_vel_mux/yaml_cfg_file
 * /diagnostic_aggregator/analyzers/digital_io/path
 * /diagnostic_aggregator/analyzers/digital_io/startswith
 * /diagnostic_aggregator/analyzers/digital_io/timeout
 * /diagnostic_aggregator/analyzers/digital_io/type
 * /diagnostic_aggregator/analyzers/mode/path
 * /diagnostic_aggregator/analyzers/mode/startswith
 * /diagnostic_aggregator/analyzers/mode/timeout
 * /diagnostic_aggregator/analyzers/mode/type
 * /diagnostic_aggregator/analyzers/nodes/contains
 * /diagnostic_aggregator/analyzers/nodes/path
 * /diagnostic_aggregator/analyzers/nodes/timeout
 * /diagnostic_aggregator/analyzers/nodes/type
 * /diagnostic_aggregator/analyzers/power/path
 * /diagnostic_aggregator/analyzers/power/startswith
 * /diagnostic_aggregator/analyzers/power/timeout
 * /diagnostic_aggregator/analyzers/power/type
 * /diagnostic_aggregator/analyzers/sensors/path
 * /diagnostic_aggregator/analyzers/sensors/startswith
 * /diagnostic_aggregator/analyzers/sensors/timeout
 * /diagnostic_aggregator/analyzers/sensors/type
 * /diagnostic_aggregator/base_path
 * /diagnostic_aggregator/pub_rate
 * /robot/name
 * /robot/type
 * /robot_description
 * /robot_pose_ekf/freq
 * /robot_pose_ekf/imu_used
 * /robot_pose_ekf/odom_used
 * /robot_pose_ekf/output_frame
 * /robot_pose_ekf/publish_tf
 * /robot_pose_ekf/sensor_timeout
 * /robot_pose_ekf/vo_used
 * /robot_state_publisher/publish_frequency
 * /rosdistro
 * /rosversion
 * /turtlebot_laptop_battery/acpi_path
 * /turtlebot_node/bonus
 * /turtlebot_node/port
 * /turtlebot_node/update_rate
 * /use_sim_time

NODES
  /
    cmd_vel_mux (nodelet/nodelet)
    diagnostic_aggregator (diagnostic_aggregator/aggregator_node)
    kinect_breaker_enabler (create_node/kinect_breaker_enabler.py)
    mobile_base_nodelet_manager (nodelet/nodelet)
    robot_pose_ekf (robot_pose_ekf/robot_pose_ekf)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    turtlebot_laptop_battery (linux_hardware/laptop_battery.py)
    turtlebot_node (create_node/turtlebot_node.py)

auto-starting new master
process[master]: started with pid [5055]
ROS_MASTER_URI=http://128.110.74.233:11311

setting /run_id to 9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9
process[rosout-1]: started with pid [5068]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [5081]
process[diagnostic_aggregator-3]: started with pid [5102]
process[turtlebot_node-4]: started with pid [5117]
process[kinect_breaker_enabler-5]: started with pid [5122]
process[robot_pose_ekf-6]: started with pid [5181]
process[mobile_base_nodelet_manager-7]: started with pid [5226]
process[cmd_vel_mux-8]: started with pid [5245]
process[turtlebot_laptop_battery-9]: started with pid [5262]
[WARN] [WallTime: 1403641073.765412] Create : robot not connected yet, sci not available
[WARN] [WallTime: 1403641076.772764] Create : robot not connected yet, sci not available
[kinect_breaker_enabler-5] process has finished cleanly
log file: /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/kinect_breaker_enabler-5*.log
</code>```

Following is the log file: /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/kinect_breaker_enabler-5*.log output:

```<code>[rospy.client][INFO] 2014-06-24 14:20:12,442: init_node, name[/kinect_breaker_enabler], pid[5538]
[xmlrpc][INFO] 2014-06-24 14:20:12,442: XML-RPC server binding to 0.0.0.0:0
[rospy.init][INFO] 2014-06-24 14:20:12,443: ROS Slave URI: [http://128.110.74.233:51362/]
[xmlrpc][INFO] 2014-06-24 14:20:12,443: Started XML-RPC server [http://128.110.74.233:51362/]
[rospy.impl.masterslave][INFO] 2014-06-24 14:20:12,443: _ready: http://128.110.74.233:51362/
[xmlrpc][INFO] 2014-06-24 14:20:12,444: xml rpc node: starting XML-RPC server
[rospy.registration][INFO] 2014-06-24 14:20:12,445: Registering with master node http://128.110.74.233:11311
[rospy.init][INFO] 2014-06-24 14:20:12,543: registered with master
[rospy.rosout][INFO] 2014-06-24 14:20:12,544: initializing /rosout core topic
[rospy.rosout][INFO] 2014-06-24 14:20:12,546: connected to core topic /rosout
[rospy.simtime][INFO] 2014-06-24 14:20:12,547: /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
[rospy.internal][INFO] 2014-06-24 14:20:12,820: topic[/rosout] adding connection to [/rosout], count 0
[rospy.core][INFO] 2014-06-24 14:20:20,182: signal_shutdown [atexit]
[rospy.internal][INFO] 2014-06-24 14:20:20,187: topic[/rosout] removing connection to /rosout
[rospy.impl.masterslave][INFO] 2014-06-24 14:20:20,188: atexit
</code>```

From the logs, I could tell something told the create to power down. And since the log is named with 'kinect', I tried minimal.launch w/ and w/o kinect attached to the turtlebot pc. It doesn't make any difference.

Any clue what I might be missing? Or is this the way bringup works (I guess not)?

答: I had this problem when using the Brown ROS Create drivers.  I never found the source of the issue but I did notice that if I powered the Create with a fresh set of AA's, using the Create AA-battery adapter, the problem occurred rarely if ever.  As the AA's charge ran down, the problem would occur more frequently.  It might be a silly and inefficient workaround but perhaps try it.  The AA battery adapter that I'm referring to is shown on page 9 of the Create manual (http://www.irobot.com/filelibrary/create/Create%20Manual_Final.pdf).</p>


答:
Communication between swarms of AUVs is an open problem, because you are trying to build a reliable communications network out of unreliable links.  Between the time that I did an undergraduate thesis on this (multiple cooperating AUVs) and the present day, there are currently no middlewares that address this issue -- all of them assume flawless communication between nodes.

In other words, you are trying to simultaneously arrange the nodes in a way that will allow them to communicate, and communicate to find how to arrange the nodes for the purposes of the mission.

Title: What middle-ware do you recommend for a swarm of AUVs?

Body:
Working with a swarm of robots, collaboration between the nodes is really important(either for the goal of simulation or real-word operation). Middle-wares are the frameworks for this special purpose. I know some of the relevant middle-wares like ROS(general-purpose but popular) or uMVS(that is basically design for AUVs). Now, I have two questions:

Do you know any other choice for the above mentioned purpose?

What criteria should I consider for choosing a middle-ware suitable for my purpose?

Thank you.


问:
Gyro rate gets increase problem
I am using PID controller to stabilize quadcopter. Its working well on the jig. But when I removed jig it went up and hit ceiling. I analyzed my data and from which I come to the conclusion that at static poisition my gyro sensor is outputing +-6deg/sec but when I start motors (without being control in) gyro rate jupms to +-30deg/sec. This increase in rate due to vibrational noise is causing quadcopter to liftup without beign my intension. Any suggestions to get rid from this vibrational noise? </p>

答:
You could probably use a low pass filter to eliminate the vibrational noise.

You should also correct the drift in your gyro measurement using some form of altitude sensor.

Title: Gyro rate gets increase problem


问:
Self-locking actuator: Friction versus worm gear
I am planning to control my bicycle derailleur with an electronic circuit, the advantages being multiple but not topic of this question.

The actuation would be performed by placing the assembly very close to the derailleur (but not on it) and by winding the usual steel cable around a spool placed on axis of a gear, and by using a motor to turn the gear.

This question concerns the alternatives for the spool self-locking mechanism (and eventually the kind of motor to use).

In the literature I found http://nabilt.github.io/diy_eshift/ and other similar ones that directly modify the derailleur with a stepper motor, and then are forced to keep the stepper motor powered up all the time to keep some torque on the shaft. I consider this inefficient, therefore I require a self-locking system to be able to remove power.

I come up with two ideas:

worm gear operated by a DC motor, where the steel cable is wound around the gear. This system is self-locking or almost self-locking, according to the gear ratio: the gear cannot (easily) drive the worm.

a motor driving normal gears with an appropriate reduction factor, but with an additional friction element, whose friction force is greater than the strength of the spring mounted on the derailleur (sorry if I mixed the technical terms). This is what normal bicycles already have: the friction along the cable and in the element placed n the handle is high and keeps the derailleur in place.

Both system would be assisted by a position-sensitive element (a trimmer?) to detect the actual position of the gear and/or of the derailleur, all configured in a closed feedback loop.

I don't consider additional options for the gear such as this one: http://www.agma.org/assets/uploads/publications/10FTM17_Kapelevich.pdf that consists of parallel-axis gears, whose teeth are however shaped in a manner to achieve self-locking without the need of a low-efficiency worm system.

From my point of view, I cannot see any clear advantage of worm gear vs friction except for:

the worm gear may allow me to build a more compact assembly, thanks to the two axes being perpendicular

speed vs torque: worm gears reduce the torque requirements, but the motor has to spin a lot and I cannot wait 3 seconds for each gear change.

Concerning the choice of the motor type (this is not the main question though), I think that:

a worm gear allows me to easily use a DC motor, since torque requirements are low and I don't need to detect the position of the shaft. Moreover, DC motors increase torque with decreasing speed, while stepper motors have the maximum torque defined by the stepping frequency.

DC are more compact and cheaper, important if I decide to offer this assembly as a kit and not unique, personal prototype.

I am working with 5V supply and I fear most easy-to get DC motors (old printers, scrap electronics) work on 12V, with a significant reduction of the available torque when operated at 5V.

I was looking for a "mechanics" section in Stack Exchange but I couldn't find it, so I opted for Robotics instead of Electronics.

答:
It sounds like what you're looking for is a pawl.

This would allow you to passively lock the gear, and when you wanted to loosen the tension on the cable you would just use a solenoid to disengage the pawl.


问:
LM2576 and LM2596 regulator make microcontroller hang
I am making a self balancing scooter which runs off 2 x 12V SLA batteries connected in series to make 24V. Everything works as expected except for the power supply which makes me pull most of the hair in my head for 2 weeks now. Hope someone could help.

The 2 24V motors run off the batteries directly. Now for my scooter, I need a +12V line for the half bridge drivers, and a +5V line for the signal part. For +12V I am using a LM2576-12 hooked to the batteries (+24) and for the +5V signal I am using a LM2596 ADJ, also hooked directly to the batteries (or is it supposed to be hooked to the output of LM2576-12 for better performance??).

The problem is that, when the motors are under load this power supply system makes the microcontroller hang (or reset I am not too sure, since everytime I have to try to turn off the power switch immediately, because the motor keeps running with whatever value they are fed with right before this happens), usually within 1 minute of riding, which is very dangerous when someone is onboard.

I have read and re-read the datasheet of LM2576 and LM2596 many times, and have tried many settings, from recommended to different values of capacitor and inductor. For the diode, I am using the SS34.

I guess its not because of electromagnetic interference, since while I do have the PCB located near the motors, the PCB is actually put inside a homemade Faraday cage which is grounded (Battery -), and the motor cases are also grounded. Plus that the microcontroller only hangs when motors are under load (i.e. me on board), especially when I go from forward to backward.

The motor controller is self made, using 8 x AUIRF2804S MOSFETs. I also put 4 x 1000uF caps between the motors and the +24V.

Would anyone be so kind to throw some light. What would a power supply for this kind of application is supposed to be?

答:
It sounds like the main problem is that you are powering your control electronics and power electronics off the same battery.  The battery voltage will drop when it's under load, and that drop seems to be browning out the control circuitry.

It's not impossible to power both pieces from the same power source, but it would be a very good idea to isolate the root cause of your issue before you go about trying to fix that.


答:
This is a complete shot in the dark, but what about the sensor from an optical mouse? I mean--they are always coupled with a processor that just gives you displacement in the x and y directions, but if you interface directly with the sensor, it's essentially a low resolution camera that focuses immediately in front of it.

Edit: This link might help: http://spritesmods.com/?art=mouseeye

Title: Are there surface texture sensors for integration in circuits?

Body:
I have a project in mind for a robot which is able to recognize surfaces, and thought about including the following sensors:

a temperature sensor

a colour sensor, or a complex of electronic components to determine a colour

and a texture sensor, or, as above, a complex of components to fulfill the purpose

Now, I did some research on finding a(preferably small) texture sensor for soldering into an electronic circuit, similar to those little temperature sensors one can buy.
I already thought that "small" would probably turn out to be not small at all before I searched.
But my research has been fruitless.
Not just fruitless like in "I can't find exactly what I want." but fruitless like in "I cannot find anything similar to what I want."...

Most things that turned up either were scientific papers about whole devices, or whole devices for purchase.
Some company even choose "Structure Sensor" as the name of their iPad-compatible 3D scanner, which made the search utterly depressing as every second article I found is about buying some pre-built iPad device.

All I need is the electronic component, nothing else.
So hope that any of you people can spare me some research time and recommend me a company/site/whatever which sells such texture sensors.

(Btw., I do know that surface sensors are probably a bit way more complex than temperature sensors, and my hope for getting what I want is low, but just because I cannot find something, ot does not mean that it doesn't exist.)


问:
Robot to manipulate poultry
I am a software engineer and also a poultry farmer.

I periodically have to manipulate my poultry in such a way as to grab their head and hold them for a brief period, approximately 10 - 30 seconds.  This is an extremely labor-intensive process and it occurred to me that I might be able to use robotics to do the same task.  I am a software engineer so I know very little about robotics and am hoping that someone can point me in the right direction.  Can someone please refer me to companies and/or robotic systems that might be able to help me with this task?

I currently load the poultry into cages specifically designed for this process.  I am thinking that these cages could still be used as they keep the birds from running and make it much easier to capture their heads.

I recently read about a Raspberry PI that had a port of Deep Belief image recognition SDK and thought this might be a promising start.

答: Georgia Tech Research Institute (GTRI) does research on automated poultry processing (http://foodtech.gatech.edu/robotics-automation.html).  You might start there. </p>

Title: Robot to manipulate poultry


问:
Why do I need a Kalman filter?
I am designing an unmanned aerial vehicle, which will include several types of sensors:

3-axis accelerometer

3-axis gyroscope

3-axis magnetometer

horizon sensor

GPS

downward facing ultrasound.

A friend of mine told me that I will need to put all of this sensor data through a Kalman filter, but I don't understand why. Why can't I just put this straight into my micro controller. How does the Kalman filter help me about my sensor data?

答:
A Kalman Filter is an algorithm that is commonly used in UAVs to fuse multiple sensor measurements together to provide an "optimal" estimate of the position and/or orientation of the UAV.  For example, a Kalman Filter can fuse accelerometer, gyro and magnetometer measurements with a velocity estimate to estimate the UAV's yaw, pitch and roll.

For more information on the sensors and algorithms used in UAV state estimation, try the stand-alone article Fundamentals of Small Unmanned Aircraft Flight.

The article also links to accompanying Matlab code implementing the described Kalman Filter UAV state estimation algorithms.

Title: Why do I need a Kalman filter?


问:
Simplest and cheapest way to create a spring back latch
My and a friend are hacking together a Nespresso Coffee pod dispenser. We have our heart set on a particular design after thinking up countless ways of dispensing a single pod.

The design has a single flavour of pods in a vertical tube so they tend to fall down. One or more latches around the base of the tube stop any pods from falling out. Releasing the latch for 45ms will allow the pod through (10mm fall, well past the lip of the pod) while catching the next one.

The latch is the problem component. I haven't yet found a suitable product off the shelf. Ideally, the solution would be compact and cheap (< $5).

Here are some of the latch ideas to date (most of which are considered linear in motion):

Solenoid - Seems over-kill and tend to be > 5 dollars each

Ultrasonic Motor - Can't find any

Linear Actuator - Usually around 50 dollars and quite bulky

Piezoelectric Actuator - Mostly tuned for nM scale precision, and are hard to come by.

Rotating disk with release notch, driven by stepper motor - still > $5 and moderately bulky.

Rotating latch with string attached to rack and pinion powered by electric motor - Don't think it's a simple enough solution.

Rotating cam - how a gumball machine works (I suspect). (This was also suggested in an answer, but would involve both a mechanical and electronic motor component, not as simple as option [5])

I have a 3D printer, so I am open to mechanical solutions - a custom latch with crude electromagnet for example.

Note the desired size of the latch (Yellow), holding pods (Orange) in a tube (Black). Yes, motors can work, but they would be quite bulky. I'm not after the obvious solution, but a clever one, or one which finds the suitable product.

(I understand that with only one latch on one side, the pods will not sit perfectly vertical, and the latch would need to be higher up.)

答:
What about using a simple RC-servo with a rotating cam that holds one pod.
When rotating down It would drop the pod it is holding. When rotating up, it would lift the whole stack for one pod height and allow the bottom pod to drop into the cam's holding space.


答:
If I understand the problem correctly, this is very straightforward. Given a set of grid points that can be either filled or unfilled, a point of origin, and a set of scan angles, you want to find the distance of the closest filled point for any scan angle.

To do this optimally, you will need to find an algorithm that can give you the full set of points that would be covered by your scan angles, up to distance n.  For now, we can skip that -- the rest of the algorithm is the same.

```<code>x_o, y_o    = get_origin_point()
theta_o     = get_center_angle_of_desired_scan_direction()
n           = get_max_sensor_distance()
sweep_angle = 130
beam_width  = 2
num_bins    = sweep_angle / beam_width

# initialize the array of scanned lines to the maximum sensor distance
scan_results = []
for angle in range(bins):
    scan_results[angle] = n

# iterate over all points in the grid
for (x, y) in all_points:

    if not point_is_filled(x, y): continue

    # distance from scanner
    r = math.hypot(x - x_o, y - y_o)
    if n < r: continue

    # the angle of this point relative to scanner
    theta = math.atan2(y - y_o, x - x_o)

    # the corresponding scan line bin this angle is in
    bin = (theta - theta_o - (sweep_angle / 2)) / beam_width
    if bin < 0 or num_bins <= bin: continue

    # update value if this point is closer than what was already sensed
    scan_results[bin] = min(scan_results[bin], r)
</code>```

Title: Robotics simulation from PNG map

Body:
I am a complete beginner at this.

I have an arbitrary map as a PNG file (black and white, only). And I'm supposed to draw a robot at a position(x,y) and then I'm supposed to simulate the robot taking a laser-scan measurement for an opening angle of 130 degrees, separation of each scan-line is 2 degrees. So, obviously: each laser scanline is supposed to be obstructed by black pixels in the PNG map, while the other lines just keep on going for an n distance.

I've attempted drawing scanlines around the object, but I'm running into issues when it comes to getting each line to be obstructed by the black-lines. To my mind, it requires a completely different approach.

Any helpful advice on how to get started would be greatly appreciated.

Body:
If I understand the problem correctly, this is very straightforward. Given a set of grid points that can be either filled or unfilled, a point of origin, and a set of scan angles, you want to find the distance of the closest filled point for any scan angle.

To do this optimally, you will need to find an algorithm that can give you the full set of points that would be covered by your scan angles, up to distance n.  For now, we can skip that -- the rest of the algorithm is the same.

x_o, y_o    = get_origin_point()
theta_o     = get_center_angle_of_desired_scan_direction()
n           = get_max_sensor_distance()
sweep_angle = 130
beam_width  = 2
num_bins    = sweep_angle / beam_width

# initialize the array of scanned lines to the maximum sensor distance
scan_results = []
for angle in range(bins):
    scan_results[angle] = n

# iterate over all points in the grid
for (x, y) in all_points:

    if not point_is_filled(x, y): continue

    # distance from scanner
    r = math.hypot(x - x_o, y - y_o)
    if n < r: continue

    # the angle of this point relative to scanner
    theta = math.atan2(y - y_o, x - x_o)

    # the corresponding scan line bin this angle is in
    bin = (theta - theta_o - (sweep_angle / 2)) / beam_width
    if bin < 0 or num_bins <= bin: continue

    # update value if this point is closer than what was already sensed
    scan_results[bin] = min(scan_results[bin], r)


问:
Power switch standards and suitability for purpose
I scavenged a 4 terminal power switch (Legion EPS 21) from some electronic device (don't remember what it was) and it has the following markings on it:

Legion EPS21
10A 250VAC TV-5
8A/128A 250V µT85

I would like to use this as the main power switch for my robot which will have nothing higher than 12 volts and a "normal" total Amperage (i.e. with all the motors in it running) of around 25 Amps, but of course if a motor stalls then the current will rise much higher.

First of all I cannot understand how the same switch can be rated for different amperages. I cannot find any datasheets for this switch that might help nor any reference to the standards (TV-5 and µT85). So I would like to know if this can handle 128 Amps at 12 Volts. If it helps at all, the wires currently connected to the terminals are quite thick and have "18 AWG 600 volts" written on them.

Secondly I would like to ask whether I need to cater for normal running amperage levels or for stall current levels, which are obviously much higher. Although people talk about stall currents running over 100 Amps in some cases - which quite frankly cause me some concern - I cannot seem to be able to find any such switches on any robot component websites, so I am starting to think that it is the "normal" level of current I should plan for and not the "stall" one. Am I right in this?

答:
First, regarding why “the same switch can be rated for different amperages”, the current-rating of a switch depends on switched voltage and current because switching a high voltage or current typically produces a more energetic arc than does switching a low voltage or current.

The switch you referred to, with its “Legion EPS21 10A 250VAC TV-5 8A/128A 250V μT85” markings, is rated at switching a maximum of 10A in a 250VAC circuit, and is rated at 8A normal current, 128A surge, and is rated for use at temperatures no higher than 85° C.

See eg alps.com for a table of UL, CSA, and IEC Safety Standards markings.  The 8A/128A mark is a VDE, SEMKO, or BS (ie, German, Swedish, or British) Load Life Test  rating, comparable to the UL or CSA (ie, American or Canadian) TV8 Load Life Test  rating for DPST switches.

If you used that switch in a 12VDC circuit carrying 25A, you'd have no guarantees about how it would work.  It might fail open or closed, after working for 1 or 1000 operations; it might catch fire; it might work ok.

If you operated it during a motor-stall event to switch a hundred or so amps, I'd expect it to fail after one or two such uses, with contacts either welded together or melted off.

The 18 AWG wires attached to it are rated at 7 to 10A.  They wouldn't burn out carrying 25A, but would run warm.  If you consult a wire-size table (eg at powerstream.com or stayonline.com) you will see that 12 AWG is a workable size of wire for 25A, while 10 AWG would provide a bigger safety margin.

Using a 12V contactor or automotive relay (controlled by a small switch like the example) is an alternative to using a big switch.  (Eg, see contactor and relay pictures at Google Images.)

Edit: If a surge or stall is brief (eg a few hundredths of a second; I don't know the actual UL specs on surge duration) and the switch is not operated during it, the switch should survive.  But if the switch is opened during a motor stall, arcing will occur.  Typically, most of the energy inductively stored in the motor windings will dump into the arc, and the switch contacts will vaporize.


问:
Inverse Kinematics Constant End Effector Angle
I have a simple RRR manipulator where one motor controls the base rotation, and the other two allow movement in a plane extending forward from the base and upwards/downwards. Are there any standard ways to ensure the angle of the end effector remains constant?

My current solution uses explicit trigonometric expressions based on distance between joints, but if there is a better way to solve it to include restraints I'd be open to suggestions.

Edit

The manipulator is essentially like the image below, but with an additional base rotation. This allowed for the inverse kinematics to be simplified. As a reference here is the site http://www.hessmer.org/uploads/RobotArm/Inverse%2520Kinematics%2520for%2520Robot%2520Arm.pdf

答:
You want the angle of link 2 to stay constant relative to the global frame?  I think that your arm is so simple what you are doing is probably best.  I wonder if you need trig though.  To keep link 2 at a constant world angle, i think you can use this equation:
$$
\Delta \theta_1 = - \Delta \theta_2
$$
So every time you move one joint by some amount, you should move the other joint the same amount but in the opposite direction.  </p>


问:
Can I use QT to communicate with a Lego NXT robot?
QT has native bluetooth support, but can it be used to communicate with the Lego NXT robot?</p>

答:
Sure it can. The NXT provides a bluetooth serial port, so you don't actually have to do anything with bluetooth in Qt. All of the Bluetooth stuff will be handled by your OS.

Instead, to communicate to the NXT from Qt, you will need to open the serial port for reading and writing, then send commands to the NXT over this connection. You can find out more about the available commands using the NXT Hardware Developer Kit.


问:
Real time operating system for robotics vision
I have robot vision system which consists of conveyor with encoder, two cameras (gigabit eth and usb) and simple illuminator.

I need to trigger cameras and illuminator when encoder reaches position interval.

I'm considering using real time operating system for this task:
Encoder, illuminator and cameras connected to PC and vision system application runing on it.

Which real-time solution you can reccomend for this problem?

I'm considering using Beckhoff TwinCAT software which turns normal operating system into RT.

答:
Whether you actually require a realtime system is unclear.  The only component for which realtime would be relevant is the computer vision application, and it sounds like you haven't written it yet -- you don't know if it will work without realtime.

All the hardware components you listed are agnostic toward the hard- soft- or non-realtime nature of the OS they will connect to.

You should implement the vision system first, and see if its performance is adequate.  If not, only then should you start looking for more real-time OS options -- at that point, you'll have a more solid grasp of the performance requirements.


问:
Why can't i use different ESCs together on a multirotor?
I'm working on a diy quadcopter build from scratch and have bought a 4pack ESC from Castel Creations.While i currently have my quad up and running(sort of), from what i've read on the various sources and forums on the internet, i am not able to/ not recommended to use different ESCs together on the same quad.

As i bought my ESCs together as a 4 pack, and am not able to buy any replacements unless i were to switch out all 4 of them, this has me worried in the eventual case of a spoilt ESC in the future.

From what i can gleam from various posts on the internet, it seems to have something to do with the rate at which ESCs communicate with the flight controller.If so, can i not simply buy a esc programmer and program all of them to communicate at the same rate?

I've asked the dude at my local hobby shop, and he said that i cannot/should not be using different escs from different brands or even the same brand but different models( i.e 35v & 20V ) ESCs together.

I would really appreciate it if someone were to clarify what exactly is the issue with using different ESCs together on the same quadcopter.

P.S If it helps, i'm currently using the APM 2.6 as my flight controller on a WFLY transmitter and a f450 frame.

答:
Ideally, when you raise the collective all the way up, all the ESCs put out their max power and the quadcopter goes straight up.

Different ESCs will end up producing different maximum thrusts; and also will ramp up (and down) differently with sudden changes in control signal.

As you probably already know, if one rotor of a multirotor vehicle has more (or less) thrust than the others, the vehicle will flip over.

The ArduPilotMega (APM) or other electronic stabilization system will try to compensate for differences in thrust to keep it right side up.

The ESCs don't need to be exactly the same.

The more different the ESCs are from each other, the longer it will take to tune the stabilization system.
The more different the ESCs are from each other, the harder the stabilization system has to work in flight to keep the multirotor vehicle right-side up; and the more the vehicle will wobble in flight.


答:
Since you don't need any position control (i.e., it needs to be either latched or unlatched), the simplest option that will serve your needs is a solenoid.

All of the other mechanisms you listed would require some degree of position control, not to mention the extra complexity.

Title: Simplest and cheapest way to create a spring back latch

Body:
My and a friend are hacking together a Nespresso Coffee pod dispenser. We have our heart set on a particular design after thinking up countless ways of dispensing a single pod.

The design has a single flavour of pods in a vertical tube so they tend to fall down. One or more latches around the base of the tube stop any pods from falling out. Releasing the latch for 45ms will allow the pod through (10mm fall, well past the lip of the pod) while catching the next one.

The latch is the problem component. I haven't yet found a suitable product off the shelf. Ideally, the solution would be compact and cheap (< $5).

Here are some of the latch ideas to date (most of which are considered linear in motion):

Solenoid - Seems over-kill and tend to be > 5 dollars each

Ultrasonic Motor - Can't find any

Linear Actuator - Usually around 50 dollars and quite bulky

Piezoelectric Actuator - Mostly tuned for nM scale precision, and are hard to come by.

Rotating disk with release notch, driven by stepper motor - still > $5 and moderately bulky.

Rotating latch with string attached to rack and pinion powered by electric motor - Don't think it's a simple enough solution.

Rotating cam - how a gumball machine works (I suspect). (This was also suggested in an answer, but would involve both a mechanical and electronic motor component, not as simple as option [5])

I have a 3D printer, so I am open to mechanical solutions - a custom latch with crude electromagnet for example.

Note the desired size of the latch (Yellow), holding pods (Orange) in a tube (Black). Yes, motors can work, but they would be quite bulky. I'm not after the obvious solution, but a clever one, or one which finds the suitable product.

(I understand that with only one latch on one side, the pods will not sit perfectly vertical, and the latch would need to be higher up.)


问:
What servos does this robot use?
Well, I wanted to use some very small servos for a project and the smallest I could find there these:
https://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=33401

But Danny Choo (a Japanese blogger) started a business with robotic dolls some time ago and I remember him mentioning somewhere on his site that he uses servos in his dolls.

(also this pic, containing doll nudity: https://farm4.staticflickr.com/3889/14502508165_fde682636b_o.jpg)

This is about 60cm in height and therefore the servo in my first link is obviously too big, to e.g. fit inside the arm.

I was wondering what kind of servo(or motor in general if it's not a servo in the end) he is using that is so tiny it can fit in there.

Does anyone here have any idea?

答:
The first image shows some tiny gear motors.  They look kind of like this one https://solarbotics.com/product/gm18/ from solarbotics, but smaller.  Solarbotics also has some smaller geared pager motors you should look into.

Toys like this almost definitely use a custom motor and gearbox.  When you tell the far-east manufacturer that you want to produce X million, they take your specs, and shop it around to their motor and gearbox houses.  Then they get a completely custom motor and gearbox for dirt cheap.

I don't think i've ever seen a standard "hobby" servo in a mass manufactured product.  they are too big and expensive.  After all, a servo is just a motor with some type of angular feedback so a little bit of code can drive (i.e. servo) the motor to a desired angle.  In a product, you want more control over where to put the sensing, and you can integrate the drive electronics with the rest of your system.

Title: What servos does this robot use?


问:
More powerful alternatives to Lego Mindstorm NXT 2.0?
I'm interested to build Robot from my imagination, and I was looking to purchase a robotic kit.

I find the Lego Mindstorm NXT 2.0 really interesting for many reasons : You can plug whatever brick you want, and you can develop in the language you want.

I am a developer, and the use of this kind of robotic would be interaction mostly (not moving, so the servo motors are useless to me, at least now).

But regarding the spec of the NXT main component, I feel it's a bit low (proc, ram & rom).

That made me wonder if any of you know something similar (where I can plug whatever I want on it, and most importantly, program the reaction), but with a more powerful hardware ?

Price will also be a limitation : I like the NXT also because I can build what I want under 300 USD. I don't want to spend 10k USD on my first kit, but I would appreciate buying a better piece of robotic if the price isn't too distant from the NXT's.

Do you have some alternatives to check out ?

Thanks for your help !  :)

答:
I do not think you will find ANY kit better than the NXT 2.0.  You may find components, and be able to piece together your own Robot, but there is nothing available as a kit that I know of in that price range (which BTW is $230 at walmart at the moment, pretty good deal). I also do not understand how you are planning to do very much without using servos. A robot that has no movement at all is pretty boring, and more like a refrigerator than a robot. The use of servos is IMHO an important part of robotics.

Exactly what is "a more powerful "AI"'? As a developer, I would not have expected that type of question. Are you sure an NXT does not have enough AI for your current robotic experience? Personally, short of some neural network stuff, I have never exceeded capacity with an NXT, and I was able to size that down and make it workable. Learning to be efficient is part process.

The NXT also open up great opportunities in mechanical design as well as pure robotics. There is plenty to keep anyone busy for quite a while, until college at least, then you step up to $1/2million dollar PR2s that someone else paid for.


问:
Submarine screw and the isolation from the water
How does the submarine prevent water flow through the screw mechanism? The mechanism rotates the screw so there should be a little gap, how come the water doesn't come through this gap in to the submarine?</p>

答:
A variety of techniques are used for propeller shaft sealing.  One of the most common is a "packing gland" or "stuffing box", as in illustration below from a dieselduck.info web page which has details of using such seals.

Also see boatus.com, which describes how much leakage to allow, and when to repack.  Two or three drops of leakage per minute is recommended; the leakage helps lubricate the shaft where it passes through the seal. Leakage gets pumped out of the vessel as necessary.
For some submarines, high leakage rates occur.  For example, wikipedia  notes that

Propeller shaft seals were a significant problem on Collins and Farncomb.  Although designed to allow for a leak of 10 litres per hour, during trials it was found that the seals would regularly misalign and allow hundreds of litres per hour into the boat – during one deep diving test the flow rate was measured at approximately 1,000 litres a minute.

Other kinds of propeller shaft seals (oil or grease filled, gas filled, with carbon plates, o-rings, etc) may leak less or not at all. (1, 2).


问:
Quadcopter Hovering Problem
My quadcopter can lift off the ground, but it kinds of circles around. Here is my video
https://www.youtube.com/watch?v=Rxjpwhbgiw0

Anyone helps me?

答:
Have you tried removing the white blocks under the propellers?

I understand that you use them as somewhere to safely land, but they seem a bit far from aerodynamic. A quadrotor flies because of the air it gets to move under it, but you are placing a white box just in the middle of the way of that air.

The sound that quadrotor makes just to move a few cm from the ground should be a hint.

The blocks are a good idea, in my opinion, but they should be placed somewhere else, try and move them towards the centre, far from the propellers influence. Make them a bit smaller if you have to, but let the air flow free. Cut them to a more rounded shape if you will.

If you have some doubts about my answer, no better way of proving me wrong (or right) than running your own wind test. Get some smoke (anyway you want) go through the propellers, fix the quadrotor to ground and record the results of how the air flows around the blocks. The smoother (a perfect straight line being the best) the lines of air are, the better the flight can be. A vortex means a low pressure under your vehicle, which is the opposite of what you want.

Good luck! Please, show us the results.

Title: Quadcopter Hovering Problem


答:
You are flying in the near of ground so the Ground effect applies. Test flight in an altitude of min. 0.5 meter height.

Also if this doesn't help, then there could be that there is a bit more weight on one side of the multicopter, to counteract it set an integral (I) value for the PID controller of the Multicopter. The I value will help the Quadrotor to remain in the required position (horizontal while hover).

Title: Quadcopter Hovering Problem


问:
How to decide about the length of a robotic arm, the base of it and the torque?
I am designing  a remote controlled robot which will have a base with three wheels, two of them will be simple wheels at the back of the base and the third will be a ball wheel at the front. It will have a robotic arm which will have a gripper to hold objects up to 1kg. I have designed the arm like this

What I want to ask is how to calculate the length of the arm, the base of the  robot, the torque and also which motor to use. Please suggest to me if there is a better solution for designing the robot.I am a robot enthusiast and I am designing a robot for the first time.

答:
http://www.societyofrobots.com/robot_arm_calculator.shtml

Please check the above link for calculating torque.


答:
but with a more powerful "AI" ?

Firstly, no robotics kit has any AI built in. AI needs to be tailor-made for the situation, it's not like you import AI and everything just... works. You need to program your own AI every time you want a smart bot. That being said, some  AI-related things like image processing can be found prepackaged for use.

Regarding kits, I don't know of there's any such kit that's better than the NXT. For "serious robotics", such kits will always prove inadequate as they're restrictive in many ways. What I suggest is to start using an Arduino or Raspberry Pi. A Raspberry Pi fits your criteria more--it has a good amount of RAM, and runs Linux--so it's easier to work with (it's pretty much like programming a normal application, except you don't need to create a GUI for the app). It's extremely cheap, costs $25-$35. You can use whatever language you want here, as long as you have something to make the language run on Linux (gcc/python/java--generally these are all built in, though you can easily find APT packages for stuff like ruby). In addition, it's easy to find packages for tasks like image processing/etc. It also has 512MB of RAM, which is good enough unless you want to play Warcraft on it. You do have to get familiar with Linux to use this, though.

The Arduino's another good (possibly better) option. You can program it in C/C++/Java (and some other languages if you use some third party tools). It is low on RAM, though--you sometimes need to chain two Arduinos in a master-slave configuration to get stuff done.

The only issue is, you need to make your own sensors for the Raspberry Pi (sensors for the Arduino exist and some can be found here. In addition, there is some examples using NXT equipment here.) Generally not that hard (for example, a light/dark sensor can be made with a photodiode and resistor), though this is a big shift from the NXT (which was plug-and-play). You'll have to get your own servos and learn how they are controlled, and lots of other little things. You will have to get your hands dirty with soldering control boards/etc, and you will have to know a decent amount of electronics.

Otherwise you can just continue using the NXT, there are all sorts of premade sensors out there (though custom making your own sensor isn't that easy).

Title: More powerful alternatives to Lego Mindstorm NXT 2.0?

Body:
I'm interested to build Robot from my imagination, and I was looking to purchase a robotic kit.

I find the Lego Mindstorm NXT 2.0 really interesting for many reasons : You can plug whatever brick you want, and you can develop in the language you want.

I am a developer, and the use of this kind of robotic would be interaction mostly (not moving, so the servo motors are useless to me, at least now).

But regarding the spec of the NXT main component, I feel it's a bit low (proc, ram & rom).

That made me wonder if any of you know something similar (where I can plug whatever I want on it, and most importantly, program the reaction), but with a more powerful hardware ?

Price will also be a limitation : I like the NXT also because I can build what I want under 300 USD. I don't want to spend 10k USD on my first kit, but I would appreciate buying a better piece of robotic if the price isn't too distant from the NXT's.

Do you have some alternatives to check out ?

Thanks for your help !  :)


问:
What kind of lidar is necessary for SLAM?
I've read about various robots using a 2D lidar system for SLAM ( such as at IGCV, http://www.igvc.org/ ) but I'm wondering how good exactly does the sensor have to be? Specifically:

What accuracy is necessary?

What field of view is necessary? Is it enough just to have lidar scanning forward in a 90 degree sweep?

What angular resolution is needed?

I realize that probably with super clever software you could probably do SLAM with a couple ultrasonic sensors, but using standard packages for software navigation what's a reasonable minimum value for these parameters? (and any other important ones I've forgotten)

答:
I know this is not a specific answer, but I have found that the more range and field-of-view the better.  </p>

<p>I have a gut feeling that if you can trade these off for accuracy and resolution, then you should go with more range.  For example, if you could have 100 degrees FOV at some angular resolution, or 200 degrees FOV at half the angular resolution, then go with 200 degrees. </p>

Body:
I know this is not a specific answer, but I have found that the more range and field-of-view the better.

I have a gut feeling that if you can trade these off for accuracy and resolution, then you should go with more range.  For example, if you could have 100 degrees FOV at some angular resolution, or 200 degrees FOV at half the angular resolution, then go with 200 degrees.


答:
There are no constraints on accuracy, because SLAM deals in probabilities.  Better sensors mean better mapping (and better performance), but there are no baseline requirements.

For your question to have a meaningful answer, you would need to know how accurate you'd like your map to be, how long you'd want to spend exploring the space, and what level of confidence you'd like the map to have.

Title: What kind of lidar is necessary for SLAM?

Body:
I've read about various robots using a 2D lidar system for SLAM ( such as at IGCV, http://www.igvc.org/ ) but I'm wondering how good exactly does the sensor have to be? Specifically:

What accuracy is necessary?

What field of view is necessary? Is it enough just to have lidar scanning forward in a 90 degree sweep?

What angular resolution is needed?

I realize that probably with super clever software you could probably do SLAM with a couple ultrasonic sensors, but using standard packages for software navigation what's a reasonable minimum value for these parameters? (and any other important ones I've forgotten)


问:
How to program an Inovatic USB interface?
In my possession I have an Inovatic USB Interface. (In Detail: UI-8x8 v1.1 2009) I would like to program it to do some simple stuff and things. I am familiar with C# Programming but from what i have heard its not possible to program this interface with C#.

What it looks like:

Where can I find the Drivers for this Interface?  I have checked the Inovatic website but they only have the v1.0 version of the drivers and I'm pretty sure that I need v1.1 !

How can i program it? What language do i use?

答:
Drivers

The only link they have to download drivers is on their download page. Unfortunately the link to the EMoRo USB drivers returns a 404 error. I have attempted to send a message to the company to let them know.

As for the version of the driver, the only way you'll know if the v1.0 driver will work is if you try it. Since nothing else is available at the moment, you should try working with the driver you have and see if you have any problems relating to that.

Programming Tools

According to the page you linked in your question:

The kit is designed for users who wish to program the robot with a flowchart or in the Basic programming language... Advanced users can program the robot in Bascom-AVR or AVR C and they can build their own autonomous robot.

So you can either use their flow-chart programming environment, you can use Bascom-AVR (which is BASIC for AVR microcontrollers), or you can program it in C. It looks like Inovatic's download page has IDEs and compilers available to download for free to use any of these options.


问:
Controlling a system with PID that resists backdrive
I'm controlling the angular position of a pendulum using a DC motor with a worm gearbox. Mechanically, worm gears are impossible to backdrive.

Using a PID controller on a pendulum system with a regular DC motor (no worm gear), the integrator would help the motor find the appropriate constant power setting to overcome gravity so the pendulum can hold any arbitrary position. With the worm gear, however, there is no need to apply constant power to the motor once the desired position is achieved. Power to the motor can be cut off and the worm gear will resist gravity's force to backdrive the pendulum to the lowest gravity potential.

It seems to me, then, that the integrator of the PID algorithm will cause large overshoots once the desired position is achieved. I want the integrator initially to help control the pendulum to the desired position. But once the position is achieved, I'd need the integrator to turn off.

The only solution I can come up with is to test for a special condition in the PID algorithm that checks if the position has been reached AND the angular speed is small, then instantaneously reset the integrator to zero. Is there a better way to handle the integrator in a system that resists backdrive?

** EDIT *

When I originally worded my question, I was mostly just interested in the academic approach of backdrive resistance in a PID loop. But it'll help if I explain the actual mechanism I'm building. The device is a robotic arm that rotates on a car window motor. It will also occasionally pick up and drop small weights at the end of the arm. Manufacturing variability in motors and the difference in drive torque when picking up the small weights led to me consider a PID loop.

答:
This is a picture of my own PID-like regulator of the form:

```<code>out = feed + MaxMin(DiffMax, DiffMin, // limit the difference, add feed (can be removed)
  + P*(E=setp-feed)                   // proportional factor, error calculation
  + (A = MaxMin(AccuMax, AccuMin, A   // limit for accumulator
  + I*E - D*(feed-prev)))             // joined integrator and derivator
</code>```

The big difference from regular PID regulators is in the way of using the accumulator for both I and D - which is a bit similar to that leaking integrator mentioned by ryan0270 (I was experimenting with similar thing as well). The derivator will decrease the accumulator (which can be limited as well to prevent windup and big value when set-point is greatly changed).

blue = output / control signal (force, input to boiler)

white = feedback (regulated value, actual temperature)

green/yellow = set-point (desired value)

red = state of accumulator (centered like being +50%)

navy/dark blue = proportional part

I have designed it for temperature regulation, but it seems to be equally good for your problem. My fade factor of the system is simulating the temperature dissipation / error of equitherm regulator. Your gravity and variable small weights seems similar to me. The integrator can compensate for this, but would normally overshoot and cause oscillation. Derivator applied on the shared accumulator prevents that - it reduces the accumulated error by the change made.

Proportional is strongest at the beginning (startup acceleration), Integrator comes next (error-correcting acceleration) and Derivator will slow it last (like a brake - preventing the overshoot by reducing the accumulator).

Regulator step:

```<code>//  regulator step
    float diff = setp - feed
    float accu = 0
    if pA && !isnan(diff)
    //  integrator
        accu = *pA + I*diff
    //  derivator
        if pV
            accu += D*(*pV - feed)
            *pV = feed
    //  accu limits
        if accu > aMax; accu = aMax
        if accu < aMin; accu = aMin
    //  store back
        *pA = accu
//  proportional
    diff = P*diff + accu
//  diff limits
    if diff > dMax; diff = dMax
    if diff < dMin; diff = dMin
</code>```

Full code:

```<code>#include <math.h>
#include "mem/config.h"
#include "device/analog.h"

__packed struct PID
    byte    type
    char    name[9]
    word    period
    Timer   tmr
    byte    feed, setp
    word    flags
    ANALOG  output
    float   vals[9]

enum
    fP          = 1<<0
    fI          = 1<<1
    fD          = 1<<2
    fDiffMax    = 1<<4
    fDiffMin    = 1<<5
    fAccuMax    = 1<<6
    fAccuMin    = 1<<7

void devPid()
    PID *pid = (PID *)xpointer(DevAddr)
    if !pid->tmr.reached(pid->period*10u)
        return
    pid->tmr.start()

//  inputs
    float feed = 0.0f
    float setp = 0.0f
    if pid->feed < ainCount
        feed = getxf(ains[pid->feed] + AIN_value)
    if pid->setp < ainCount
        setp = getxf(ains[pid->setp] + AIN_value)

//  PID factors (multiplicators)
    float P = 0.0f
    float I = 0.0f
    float D = 0.0f
//  difference limits (output-feedback)
    float dMax = INFINITY
    float dMin = -INFINITY
//  accumulator limits (anti-windup)
    float aMax = INFINITY
    float aMin = -INFINITY

//  flags and pointers
    word flags = pid->flags
    float __packed* pf = pid->vals
    float __packed* pA = null   // accumulator
    float __packed* pV = null   // previous feed

//  parse variable object part
    if flags & fP
        P = *pf++
    if flags & fI
        I = *pf++
        pA = pf++
        if flags & fD
            D = *pf++
            pV = pf++
    if flags & fDiffMax
        dMin = -(dMax = *pf++)
        if flags & fDiffMin
            dMin = *pf++
    if flags & fAccuMax
        aMin = -(aMax = *pf++)
        if flags &fAccuMin
            aMin = *pf++

//  regulator step
    float diff = setp - feed
    float accu = 0
    if pA && !isnan(diff)
    //  integrator
        accu = *pA + I*diff
    //  derivator
        if pV
            accu += D*(*pV - feed)
            *pV = feed
    //  accu limits
        if accu > aMax; accu = aMax
        if accu < aMin; accu = aMin
    //  store back
        *pA = accu
//  proportional
    diff = P*diff + accu
//  diff limits
    if diff > dMax; diff = dMax
    if diff < dMin; diff = dMin

//  final output
    ainSet(DevAddr + offsetof(PID,output),
      feed + diff)
</code>```

You can tune it a bit and use the error, accumulator and feedback-change to detect the steady state to power it off.

Add-on

I have been experimenting with it a bit more - used the regulator with erroneous non-linear 7bit DAC (custom-made of few resistors and opto-transistors) with erroneous main regulation (basic conversion peformed very bad in high values) and observed the behaviour (good ADC was used as feedback). The regulator performed really well and quickly ended with 1-bit oscillation (which is inevitable). I have further enhanced my simulation with this gained knowledge and here is the picture:

Body:
This is a picture of my own PID-like regulator of the form:

out = feed + MaxMin(DiffMax, DiffMin, // limit the difference, add feed (can be removed)
  + P*(E=setp-feed)                   // proportional factor, error calculation
  + (A = MaxMin(AccuMax, AccuMin, A   // limit for accumulator
  + I*E - D*(feed-prev)))             // joined integrator and derivator

The big difference from regular PID regulators is in the way of using the accumulator for both I and D - which is a bit similar to that leaking integrator mentioned by ryan0270 (I was experimenting with similar thing as well). The derivator will decrease the accumulator (which can be limited as well to prevent windup and big value when set-point is greatly changed).

blue = output / control signal (force, input to boiler)

white = feedback (regulated value, actual temperature)

green/yellow = set-point (desired value)

red = state of accumulator (centered like being +50%)

navy/dark blue = proportional part

I have designed it for temperature regulation, but it seems to be equally good for your problem. My fade factor of the system is simulating the temperature dissipation / error of equitherm regulator. Your gravity and variable small weights seems similar to me. The integrator can compensate for this, but would normally overshoot and cause oscillation. Derivator applied on the shared accumulator prevents that - it reduces the accumulated error by the change made.

Proportional is strongest at the beginning (startup acceleration), Integrator comes next (error-correcting acceleration) and Derivator will slow it last (like a brake - preventing the overshoot by reducing the accumulator).

Regulator step:

//  regulator step
    float diff = setp - feed
    float accu = 0
    if pA && !isnan(diff)
    //  integrator
        accu = *pA + I*diff
    //  derivator
        if pV
            accu += D*(*pV - feed)
            *pV = feed
    //  accu limits
        if accu > aMax; accu = aMax
        if accu < aMin; accu = aMin
    //  store back
        *pA = accu
//  proportional
    diff = P*diff + accu
//  diff limits
    if diff > dMax; diff = dMax
    if diff < dMin; diff = dMin

Full code:

#include <math.h>
#include "mem/config.h"
#include "device/analog.h"

__packed struct PID
    byte    type
    char    name[9]
    word    period
    Timer   tmr
    byte    feed, setp
    word    flags
    ANALOG  output
    float   vals[9]

enum
    fP          = 1<<0
    fI          = 1<<1
    fD          = 1<<2
    fDiffMax    = 1<<4
    fDiffMin    = 1<<5
    fAccuMax    = 1<<6
    fAccuMin    = 1<<7

void devPid()
    PID *pid = (PID *)xpointer(DevAddr)
    if !pid->tmr.reached(pid->period*10u)
        return
    pid->tmr.start()

//  inputs
    float feed = 0.0f
    float setp = 0.0f
    if pid->feed < ainCount
        feed = getxf(ains[pid->feed] + AIN_value)
    if pid->setp < ainCount
        setp = getxf(ains[pid->setp] + AIN_value)

//  PID factors (multiplicators)
    float P = 0.0f
    float I = 0.0f
    float D = 0.0f
//  difference limits (output-feedback)
    float dMax = INFINITY
    float dMin = -INFINITY
//  accumulator limits (anti-windup)
    float aMax = INFINITY
    float aMin = -INFINITY

//  flags and pointers
    word flags = pid->flags
    float __packed* pf = pid->vals
    float __packed* pA = null   // accumulator
    float __packed* pV = null   // previous feed

//  parse variable object part
    if flags & fP
        P = *pf++
    if flags & fI
        I = *pf++
        pA = pf++
        if flags & fD
            D = *pf++
            pV = pf++
    if flags & fDiffMax
        dMin = -(dMax = *pf++)
        if flags & fDiffMin
            dMin = *pf++
    if flags & fAccuMax
        aMin = -(aMax = *pf++)
        if flags &fAccuMin
            aMin = *pf++

//  regulator step
    float diff = setp - feed
    float accu = 0
    if pA && !isnan(diff)
    //  integrator
        accu = *pA + I*diff
    //  derivator
        if pV
            accu += D*(*pV - feed)
            *pV = feed
    //  accu limits
        if accu > aMax; accu = aMax
        if accu < aMin; accu = aMin
    //  store back
        *pA = accu
//  proportional
    diff = P*diff + accu
//  diff limits
    if diff > dMax; diff = dMax
    if diff < dMin; diff = dMin

//  final output
    ainSet(DevAddr + offsetof(PID,output),
      feed + diff)

You can tune it a bit and use the error, accumulator and feedback-change to detect the steady state to power it off.

Add-on

I have been experimenting with it a bit more - used the regulator with erroneous non-linear 7bit DAC (custom-made of few resistors and opto-transistors) with erroneous main regulation (basic conversion peformed very bad in high values) and observed the behaviour (good ADC was used as feedback). The regulator performed really well and quickly ended with 1-bit oscillation (which is inevitable). I have further enhanced my simulation with this gained knowledge and here is the picture:


问:
Keeping two wheeled wall following robot straight
I have a two-wheeled (two DC motors) robot that needs to follow the wall beside the robot.

The issue is that the DC motors spin at different rates (because they are not identical, of course), so the robot does not go straight when the same voltage is provided to each motor.

How can I use IR distance sensors (and op-amps) to keep the distance from the wall constant?

(the robot must travel parallel to the wall)

答:
You can use the principle of proportional error control.
Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps.  If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output.

Either way, you want to arrange that the commanded motor speeds are as follows:

$$ V_1 = V_{nom} + k_p (d - d_{nom}) $$
$$ V_2 = V_{nom} - k_p (d - d_{nom}) $$

Where $V_1$ and $V_2$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance.

More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure.  But I think a simple proportional controller as describe should work just fine.

OwnerDisplayName: Jaysbays

OwnerDisplayName: pericynthion


答:
Looks like you could use PI or PID regulator (see my answer there).

The P-regulator (proportional) suggested by pericynthion should work, but you have to tune it well and won't be same for another similar robot if the difference changes. PI regulator can compensate on-the-fly and deduce the error. D-part can be used for fine-tuning.

Use the distance (measured by IR-sensor) as a feed for PID regulator and desired distance as the input. Output will be the difference of the regulation for the two motors (actually the Kp from the answer you got from pericynthion).

Title: Keeping two wheeled wall following robot straight

Body:
I have a two-wheeled (two DC motors) robot that needs to follow the wall beside the robot.

The issue is that the DC motors spin at different rates (because they are not identical, of course), so the robot does not go straight when the same voltage is provided to each motor.

How can I use IR distance sensors (and op-amps) to keep the distance from the wall constant?

(the robot must travel parallel to the wall)


答: What I suggest to you is to use a PI or PID regulator for each motor like pericynthion said, but I'm afraid is not sufficient to keep your robot stright, so you need to keep the the two wheels at the same speed and synchronized, for example you can implement odometery in your UC.</p>


问:
Stereo vision on a moving vehicle
When I put stereo camera on a moving platform and sync the cameras, what kind of delay between the cameras is tolerable? This would probably depend on the motion, but are there some guidelines?

Are there any practitioner guides on how to build a moving stereo system?

答:
The guidelines is quite simple math. You are right the sync precision requirement is a function of speed - the faster you go the better the sync has to be to give you the same distance difference between the two cameras. Example: 100 km/h is 27.7 m/s - 100ms sync will give you difference of 2.7 meters of distance from one camera to other. 10ms will give you 27cm, 1ms 2.7cm etc. If you have a very slow moving vehicle 100ms can be OK. But I think no stereo algorithm (3D reconstruction, visual odometry) can produce good results with bad input data so you want to do your math before starting to see where the sync should be.

If you can analyze your stereo in post you can fix the sync in post-processing (more FPS will give you better sync possibility). If you need real-time then you can not fix in post and your requirement for hardware is higher.

For real time stereo processing I think you want the stereo sync to be as good as possible within your budget (of course depending on vehicle speed). The best is two identical cameras with wired external trigger (remote shutter) - you wire both cameras to the same HW trigger button. If you dont need high FPS you can use commodity (relatively cheap) consumer cameras with remote shutter (few point&shoot cameras may have it, ultrazooms or DSLRs will too), but these usually save to SD card which is not very convenient for real-time processing.

An USB camera is better for real time as you can stream the images directly into your code (C++ etc.). "Industrial" cameras are usually USB, they have quite high FPS and external trigger - See3CAM_10CUG by e-con Systems is the cheapest one probably, other more expensive brands are The Imaging Source or Point Grey. These can usually do from about 10 to many FPS with external trigger depending on model.

I use 2 separate cams. The first camera is software triggered, but when its sensor is exposed it hardware triggers the 2nd camera.

This is a wrong solution - you want to trigger both the same way in order for them to behave the same - see the remote shutter above.

EDIT:

Going back to the root of your question:

what kind of delay between the cameras is tolerable?

As I said above this translates into "what distance difference between left and right stereo frames is tolerable for stereo vision?" To be honest, even though I did some stereo matching I have no experience with sync precision here (I used synced dastasets), but as I said I can imagine the results will get worse linearly with the distance delta. Would be interesting to do some tests in this field...

Something like "spherical resolution" (number of image horizontal/vertical pixels divided by your lens field-of-view) will probably play a big role - the lower the spherical resolution the lower the sync precision needs because you could not recognize the details anyways. There will be some (probably not very difficult) math behind this.

Title: Stereo vision on a moving vehicle


问:
Connecting multiple servos to a robotic arm
I am computer programmer and it's really been long since I have done electronics. I need help on connecting my servos to an Arduino to power my robotic arm. This is the robotic arm that I am trying to build.

I have come up with the connections as shown in the below diagram with my basic knowledge and browsing the internet. I have omitted the signal wires for clarity.

What I would like to know is

Will this work?

Is this a good/decent design? I think it isn't as I have 4 battery packs.

I would like to have a single power source that would save me the trouble of maintaining so many batteries. To do this I have thought of using a voltage regulator but I am concerned about how this would perform if one servo starts drawing too much load. It might suck up all most the power leaving very little for the other servos.

Any suggestions would be greatly helpful.

答:
It's will work depending on the characteristics of your batteries and servo motors (draw current and voltage). If you draw more current than the battery capacity you'll damage your batteries (overload or overdischarge) and probably your servos. I suggest to you to use NIMH battery they are more reliable than the AAA batteries

Why you want to use single porwer ssource, 4 batteries pack in parallel are more reliable for your servos. If one servo drawing to much current, its will effect one battery and the other servos they are safe. In the other case (one sngle battery), the others servos may damaged by the failing servo. If you use one single battery, you need the arduino to control the current and voltage of the servos and BMS to your battery.