问:
Path planning for visual servoing
I am at moment trying to implement a visual servoing application.
the robot I am using is a UR5, and TCP has a stereo camera mounted on to it. The idea is to move the end effector according to the object being tracked.

The path-planning algorithm for this system should comply with some rules.

The path which it creates should be collision free, and always keep the object being tracked at sight at all time.

Having a path that keeps the object in sight has been bit of problem.  Sometime will the end effector rotate around itself, messing up  measurements taken and thus the tracking itself.

It should be able to maneuver away from static obstacles.

A Possible solution?

I thought of a possible solution. Since my current state and desired state is defined by two different sphere, A possible solution would be to create a straight line between each center of each sphere, and between the current position and desired position, such that a straight path in between could be computed easily.  which always keeps itself oriented toward the object. Problems is that I am not sure how I should handle collision here.

Update
  Or use it as a heuristic for a heuristic based path planning?

答:
I would recommend using an RRT or FMT sampling based path planner. The basic idea is to sample your state space and build a tree which connects your starting state to the goal state. Each time you connect two samples, you check for a collision: if there is no collision then you add the connection to your tree search, otherwise you move on.

It is your responsibility to write a collision checker routine, since this is a fairly application specific task. If you add some more detail to your set-up I could make the answer more specific (are you using an occupancy grid? Are there dynamic constraints?).

If I'm not mistaken you can represent an occluded view as a collision, in which case the algorithm will find a path which gets from start to finish without occlusions. Your sphere's idea is not too dissimilar from how the proof for the FMT algorithm works. For FMT (which I am more familiar with), a recent dissertation is here (look at "Avoiding plume impingement" as a way to avoid occlusions), and a complete description is here, with open source implementation here.

You might also be interested in "next best view" planners.

Title: Path planning for visual servoing


问:
Self learning robotics algoritm: feedback needed
I'm working on a robotics project and I've got this idea for a self learning algorithm. I'm looking for some feedback on this, and specifically on whether this is a more common way of doing things.

I simply want to store a lot of numerical log data of previous actions the robot took and the results it got. I then want to let it search through the DB multiple times per second so that the robot can make decisions based on that and thus learn from it's actions (like humans do).

So I constantly log a lot of data. One simple log record could be for example:

speed: 5.43

altitude: 35.23

wind_speed: 6.19

direction: 27

current position: [12, -20]

desired position: [18, -25]

steering decision: 23

success: 12

The desired_position are coordinates on a 2 dimensional matrix and the success is how close it came to the desired position within 10 seconds (so the lower the better).

I then have a certain situation for which I want to find a comparable experience in the database. So let's say my current situation is this:

speed: 5.13

altitude: 35.98

wind_speed: 7.54

direction: 24

current position: [14, -22]

desired_position: [17, -22]

As you can see it doesn't have a steering decision or a success yet, because it still has to make a steering decision and only after taking that action and seeing the result the success rate can be calculated.

So I want to search for the record "closest" to my current situation within certain boundaries, and which has the best (lowest) success rate. So for example, the boundaries could be that the direction cannot be more than 10% difference, and the heading cannot be more than 15% difference. So I first make a selection based on that. I'm left with A LOT of records. I then calculate for every field in every record the percentage difference, and accumulate those per record so that I get some sort of “closeness factor”. Once that's done I combine the closeness with the success, order by that number, and take the top record to base my decision on for the action to be taken. I take the steering decision of that record and randomly change it to something which is within a certain change percentage range. I do this because people also experiment, you try something new every time. And as the system becomes better at steering the robot (success factors get better) I also reduce the randomization change percentage. This is because as people get better, they also know that they are closer to the objective and they don't need to experiment as much any more.

So to steer my robot I will run the following process as often as possible (I will try to run it 20 times per second) and use this system to steer my robot.

So my questions are;

Do you think that this can work?

Is this kind of thing used more often?

Does anybody know a database which would make it possible to query based on a dynamically calculated factor (the closeness factor)?

答:
What you are describing seems a lot like reinforcement learning, and yes, it works well for this sort of scenario. It is a popular enough approach that you should be able to find starter code in whatever language you prefer.  This paper looks like it could be interesting for you.

Basic set-up

Typically the way the problem is set up is that we want to find a function called a policy which maps state/action pairs to rewards. For your problem, the state is all of the information besides steering_decision and success, your action is steering_decision and your reward is success. The goal is to find a policy that gives the best reward, where "best" could be the highest mean, lowest risk, etc. depending on the setting.

Importance of exploration

The randomization idea you propose is crucial, known as "exploration" in the reinforcement learning community. If you want to go really deep into how to best trade-off exploration and exploitation, statisticians have been studying the "Multi-armed bandit" problem for a few decades. If you're ok with exploration that is "good enough", then a linearly decreasing exploration factor will work fine.

Making it fast

As you note the amount of data you have to sift through makes it difficult to compute this policy quickly, so what typically happens is that we run a training phase off line (either based on historical data or simulated data) in order to find a good policy.  Then we use this policy (without changing it) on-line. If you store the policy as a look-up table (for example by hashing your state), then the on-line computation will be very fast. Off-line training will work well as long as your environment is fairly static, or you are able to capture the time-variation in your state (for example by including weather or time-of-day information).

Comparing "similar" states

The last piece of the puzzle is to formalize the "closeness" concept, where you decide what information is relevant. There are quite a few ways to do this, but I would recommend looking into a Gaussian process approach (see this on-line book), where you define a kernel function, which takes in two state vectors $x_1$ and $x_2$, and returns a number which represents how similar the states are. The reason to use this approach is that you can use your historical data to fit a statistical model for the reward distribution given a state $x$, even if you haven't seen the state before.

ContentLicense: CC BY-SA 3.0


问:
is designing a pcb with multiple controllers a good schematic design?
I am trying to design a bot, it has to measure the temp I am using an 8051 so the adc is taking up a lot of i/o pins so I am thinking of switching it out with a thermostat or put another controller and interface them (which also has the advantage of letting me add more features) But I wanted to make sure in general is it a good design to add multiple micro-controllers on the same pcb, will it cause hardware problems?</p>

答:
Will it cause hardware problems? Theoretically, no. This is done quite often, so there is no inherent limitation there. If you design the board badly on the other hand, well that's just bad design!

Using multiple microcontrollers is a great thing, because it lets you parallelize your tasks and can make life a lot easier on that front. However, with that comes a somewhat more complex firmware as you now need to synchronize the microcontrollers, make them communicate, and handle relevant errors.

In short, in general it's not at all a bad idea to put multiple controllers on the same PCB. Just be sure you understand the implications on your firmware design. Sometimes it may be a lot simpler to use a slightly larger microcontroller.


问:
Simple sensor to detect motion of inanimate objects
This is for a high school project that I'm doing. The sensor should be able to detect the movement of a moving inanimate object and convert into electrical energy, and be fairly cheap to buy.

I have looked into a few sensors but most of them seem to be geared towards detecting HUMAN movement, eg. PIR sensors. I am looking for the type of sensor that is able to detect non-human movement at close range (about 1/2 metres). Any suggestions?

答:
There are a range of solutions based on the type of environment you are gonna implement your system;

So I will list the possible solutions and the respective best possible implementation conditions.

You can use IR sensors to detect motion. Given your sensors are setup
in a controlled environment where the ambient lighting is consistent,
you can setup IR to read ranges from a given distance. For example
lets say you object is at 1 m from  the sensor; your MCU can
constantly read the voltage drop from IR sensor and detect 'motion'
when there is change in these voltage readings. This only works if
your sensors are stationary relative to your detecting object. This
is a very cheap solution. Can easily program using Arduino. You can
even use code already written from other users.

Using an ultrasound module. This works by sending a 'ping' and

listens for the echo. Motion can be detected by monitoring the width
of the 'echo' pulse. This solution doesn't not require a controlled

lighting environment unlike IR. But on the flip side, ultrasound

signals are not directional like IR; and hence your system maybe

prone to noise from other reflected 'echo' pulses off target. But

this can be implemented successfully by properly thresholding your

signals. This too can be implemented using Arduino easily. Check PING
example in Arduino IDE. This requires your system to be stable

relative to your target.

As mentioned earlier, camera is another solution. It could

implemented intelligently regardless whether your system is

stationery relative to your target. But this requires you to have

some kind computer vision/programming background. Since you mentioned
you are from high school, I presume this will be a bit challenging

for you. But you always try. OpenCV, and Matlab CV toolbox are a good
starting point. But this solution is relatively expensive. Camera is
relatively expensive compared to IR and Ultrasound. And if you are

looking for a embedded solution, you need a much powerful MCU than an
Arduino to deploy your project.

Cheers and good luck


问:
How to calculate quadcopter lift capabilities?
I'm looking for an equation (or set of equations) that would allow me to predict (with fair accuracy) how heavy a payload a quadcopter is capable of lifting.

I assume the main variables would be the weight of the copter as well as the size + power of the 4 rotors. What general approach can one use to make such a determination?

答:
Short answer is : it depends.
Variables such a motors, propellers and body construction are very important. I have been building drones in my garage as a hobby for years. You'd be surprised what difference can propellers make.

Since building heavy lift drone can be extremely hard, most of people should be satisfied by buying some heavy lift drone. There are several models available on amazon so it's probably good idea to check what market has to offer.


问:
Is it possible to make Kite flying robot?
This question was asked in electronics stackexchange. I want to know if is it possible to make a robot that can fly kites. Is this idea practical? I was thinking that making a kite is just like making some flying quadcopter or helicopter. I just want to know is this idea really implementable?  Is there an example or similar work in reference to this?     </p>

答:
I'm the author of the question you refer to and I will tell you; it is in fact possible. But unfortunately not easy.

There is quite some heavy development going on now, since it seems to be the next promis of wind energy. This is because at higher altitudes, winds are stronger and more constant. In addition to that, there is no need for large constructions (like conventional wind turbines) and the setup is highly mobile (which indeed makes it ideal for emergency situations or developing countries). Lastly, there is less "view pollution" as we more or less call it in Dutch. This is the concept that everyone wants to use green wind energy in their homes, but no one wants a humongous wind turbine in their backyard because of the noise and the view. A kite however, can be a thousand square meters, but if its 5 kilometers up in the air, you just see a string going up in the air.

Next to the advantages, there are some severe challenges as well though. These are of course in some hardware related parts. For example; how do you reliably track the kite in the air (which was exactly my issue with my other question), but also; how do you measure wind speed at kite height without the kite its wind disturbance, and how do you overcome the rope weight when the rope becomes 5 kilometers long?

The software issues seem to be a way bigger issue than the hardware ones though. It appears to be not so easy to fly a kite reliably in a figure 8. This is because you're dealing with quite an unstable environment; changing wind direction, varying speed, and incidental wind gusts. Kite deformations and the different reactions of the kite in different parts within and outside the so called "wind power zone" are very different. A simple PID controller is not the easy solution apparantly. In addition to these things, heavy wind gusts can also be a danger in that it can break the kite's rope. So the kite must be able to quickly depower itself when a windgust comes up, which needs some kind of feed-forward loop. Finally, if the wireless data connection between the kite and the ground station breaks (for whatever reason) how can the kite control itself to decent to make a safe landing.

The reason I'm so into this is because I'm looking into doing a PhD at the Delft University to develop a evolutionary based self learning kite control system for the currect kitepower project they have there.

Although I'm not very experienced with the hardware side of the story, I thought why not start myself while I haven't started at the TU Delft yet? So I set out to find what I need for all of this. By now I have a good grasp of my first plans. I am now able to do some motor controlling and I am currently in the process of collecting some parts I need.

If you also want to try building one that would be great. The more people in it, the more experience that is gained.. :)

Cheers


问:
How to implement PD controller to this 2D planar quadcopter dynamics?
I want to code the dynamics of 2D planar quadrotor and than control it to drive it from one state to another.

Dynamics that I use is taken from the online course fiven by Vijay Kumar in Coursera as follows,

$
\begin{bmatrix}
    \ddot{y}\\
    \ddot{z}\\
    \ddot{\phi}
\end{bmatrix} =
\begin{bmatrix}
    0\\
    -g\\
    0
  \end{bmatrix} +
\begin{bmatrix}
   -\frac{1}{m}sin\phi & 0\\
    \frac{1}{m}cos\phi & 0\\
    0 & -\frac{1}{I_{xx}}
\end{bmatrix}\begin{bmatrix}
   u_1\\
    u_2
\end{bmatrix}
$

it has some linearizations also as $sin\phi->\phi$ & $cos\phi -> const.$

And u1, u2 is defined by;

$u_1=m\{g+\ddot{z}_T(t)+k_{v,z}*(\dot{z}_T(t)-\dot{z})+k_{p,z}*(z_{T}(t)-z)\}$

$u_2=I_{xx}(\ddot{\phi}+k_{v,\phi}*(\dot{\phi}_T(t)-\dot{\phi})+k_{p,\phi}*(\phi_{T}(t)-\phi))$

$\phi_c=-\frac{1}{g}(\ddot{y}_T(t)+k_{v,y}*(\dot{y}_T(t)-\dot{y})+k_{p,y}*(y_{T}(t)-y))$

it is assumed to be the vehicle is near hover condition and commanded roll angle $\phi_c$ is calculated based on desired y-component and is used to calculate u2 which is net moment acting on CoG.

The thing that I dont understand is, don't I need any saturation on actuators? Do I need to implement some limiting part on my code to limit the control signals.

The other thing is, I don't have any desired acceleration. There is those terms in control signal equations. Can I remove them?

The last thing is, my control signals creates some signals causes to vehicle to have order of 10^5 in roll angle by integrating the high angular rates caused by high u2 moment signal I guess. Since the linearization works on small angle approximation, those high angles and rates are problematic. Thus how can I handle it?

答:
Yes, you will have saturations on your torque and thrust outputs that you will send to your motors after the mapping. However this will be machine specific and needs to be handled in your code. You may also require saturations to maximum pitch angle as this PD controller will not handle large angles very well.

The desired acceleration is a feed forward term carried over from the derivatives of the trajectory that you want to pursue. Yes, you can safely ignore this and still converge to the desired setpoint/trajectory albeit with lower performance.

You should re-tune your gains and add the correct saturations so that your simulation makes sense physically. And make sure that you use a complementary filter to estimate your orientation as simply integrating the gyroscope rates will cause drift in your states. Despite this you will find it hard to control a quadrotor with just PD as you may have model uncertainties and disturbances. Some researchers have developed controllers which map your angle errors in SO(3) preventing singularities and allowing you to reach the harder orientations.


问:
Why ODE for optimal control theory?
I am trying to understand optimal control theory which forms the base for reinforcement learning techniques in AI. Whenever I open a lecture or a book or any online notes, everything starts with an ODE and then derivation goes the payoff function which is straight forward.

I am trying hard to comprehend why an ODE models any system? Many say it easy to begin with but why this model?

$dx/dt = f(x(t))$

I could not find the reason and decided to ask for help.

答:
Appending to @WalterJ's answer.

Linear and nonlinear systems which form the basis for subjects like optimal control theory have rigorous math fundamentals which allow you to analyze ODEs without actually solving them and mathematically prove whether is system is stable, how fast your convergence will be or define a safe operating region. This makes representing systems as ODEs very useful in control systems. ODE representation also makes it clear how your states (eg: position, velocity, acceleration for cars) interact with each other (is there any coupling between the states?).

Coming back to optimal control, the cost functional is expressed as functions of your states and/or control inputs. Say you want to minimize distance, your cost functional will be the integral over the velocity for all time. As you expressed your system as an ODE, you already have access to this expression.

ContentLicense: CC BY-SA 4.0

Title: Why ODE for optimal control theory?


问:
How to reduce the DC motor starting current?
I am making a bot with 4 motors with a stall current rating of 11.7A. I was using 4 separate motor controllers which has a peak current rating of 20A to control each motor. But when I gave power to the motors in my bot, the motor drivers blew off within a second.

Was it due to the starting peak current of the motors? If yes, then how can I reduce the starting current? If no, then what could be other possible problems and their corresponding problems?

答: Could be the starting current, try adding an inductance in series with the motor that will limit the rate of the current change. Once the motor starts spinning the current will stabilize. This will however make your motor more inert (respond slower to the change of the supplied voltage).</p>


问:
Why are two cameras mounted in paralle in stereo application?
For stereo cameras on the market, two cameras are always mounted side by side and with a displacement that is perpendicular to the cameras’ optical axes. I take this setup for granted. One idea came to my mind whether this is necessary? If two cameras are not parallel and have different focal length, camera calibration can correct the difference. Why are two cameras mounted in parallel? My guess is that two cameras can have a large overlapping region. Am I correct?</p>

答:
Each camera needs to be defined by 6 variables (3 position, 3 orientation). This would mean that during the calibration process, a solver needs to find 12 variables. As this is done usually with an nonlinear optimization process, the solutions are quite sensitive to the initial guess. By making them parallel and giving them a fixed width, you can give the solver a much nicer initial guess (which can converge to the correct solution).

Aside from this of course, we do get large overlapping areas which become important when creating depth maps.


问:
Markov Localization using control as an input
When using Hidden Markov Models in Global Localization problems on the prediction step there is a need to calculate the probability of robot's pose given the actions (control u, odometry):

```<code>p(Xt|Xt−1, Ut−1)
</code>```

where xt-1 and ut-1 are the robot's previous pose and control.

There are different tutorials (this one for instance) and articles on the web with the examples, but most of these examples are for the 1D localization problem where action simply equals to 1 if the odometry is perfect.

What if I am considering 2D space?
For example in 1D example for time step T=1 I would compute like:

```<code>p(Xt = 2 | Xt-1 = 1, Ut = 1) = 1
</code>```

How should I do the computations for 2D case?

答:
Multi-dimensional models

In the 2D case, $x_t$ is a vector with two components (e.g. position in $x$, $y$), but why stop at 2D? Often, the state vector $x_t$ will have your position in two or three dimensions, in addition to velocity and acceleration. Oftentimes we also include angular state in $x_t$ such as the heading and angular rate of change.

Your control is also often multi-dimensional, for example if you have a wheeled robot it could be the velocity of the left and right wheels.

Linear case (Kalman filter!)

Typically we have a model that maps the previous state and control actions to a new state and control action. In the linear, time invariant case, we have matrices $A$ and $B$, and
$$x_t = A x_{t-1} + B u_t $$
in this setting we would probably use a Kalman filter to keep track of our belief about the distribution of $x_t$.  The Kalman filter is nice because it gives a closed form solution to the estimation problem which is correct if noise/uncertainty is Gaussian.

More general models

The markov approach (as I understand it) let's us move past these assumptions (linearity and Gaussian noise) by using approximation methods such as particle filters to estimate the belief distribution of our state $x_t$. The markov assumption is saying that we only need the distribution of $x_t$ (and don't need to use the distribution of $x_{t-1},x_{t-2},\dots$) when computing the distribution of $x_{t+1}$. I think the figure on slide 30 of the link you posted illustrates this quite well.

Discrete (small) state space

As for your last question about how to find your belief: it depends on your application. If your state/controls are discrete, and you don't have very many of them, you can explicitly write down all of the transition probabilities $p(x_t \mid x_{t-1}, u_t)$ for every possible $x_t$, $x_{t-1}$ and $u_t$. Then when you do your estimation, you just look up the appropriate value.

Further reading

Typically states are continuous, or there are too many to compute/store every possible transition.  If you're just getting started in this, try a Kalman filter and see how that works for you (there are many tutorials on them). If you want to see what else is out there, I recommend the Probabilistic Robotics book, which gives a still quite good overview of different approaches (including Kalman filters) for this localization problem.


问:
How to rotate covariance?
I am working on an EKF and have a question regarding coordinate frame conversion for covariance matrices. Let's say I get some measurement $(x, y, z, roll, pitch, yaw)$ with corresponding 6x6 covariance matrix $C$. This measurement and $C$ are given in some coordinate frame $G_1$. I need to transform the measurement to another coordinate frame, $G_2$. Transforming the measurement itself is trivial, but I would also need to transform its covariance, correct? The translation between $G_1$ and $G_2$ should be irrelevant, but I would still need to rotate it. If I am correct, how would I do this? For the covariances between $x$, $y$, and $z$, my first thought was to simply apply a 3D rotation matrix, but that only works for a 3x3 submatrix within the full 6x6 covariance matrix. Do I need to apply the same rotation to all four blocks? </p>

答:
Very intuitive explanation with geometric interpretation for covariance and its decomposition.

http://www.visiondummy.com/2014/04/geometric-interpretation-covariance-matrix/

Title: How to rotate covariance?


问:
Can the rate of peristaltic pump's flow be accurate across changes in fluid viscosity?
I'm building an arduino controlled pump system to be able to move fluids around. I need this to be fairly accurate, but extreme precision isn't required. Since there will be a variety of liquids moved through the pump, I've determined a peristaltic pump the best fit. But I don't think I fully understand them, and had a few questions..

Since I'll need to purge the system... Can a peristaltic pump push air? Let's assume you have a 2m of tubing, and you pump a bunch of water through it. Can you remove the tube from the water reservoir so it is open to the air, and effectively purge the system of any remaining water?

Since I want to fairly accurately measure flow, could I simply count milliseconds instead of using a flowmeter? ... Will a peristaltic pump ALWAYS pump at a constant rate, regardless of the viscosity of the fluid? That is, will maple syrup come out at the same rate as water?

Shopping question, ignore I suppose ... Anyone know where I may find a fast/high flow peristaltic pump? I'm looking to be able to pump, at a minimum, .5oz/sec

Would be determinant upon #3 ... What sort of relay would I want for toggling this on/off with an arduino?

答:
The answers to "will it work" and "will viscosity affect flow rate" is really "it depends".

Peristaltic pumps that push air exist.

All pumps work by using low pressure to pull in fluid and high pressure to push it out.  In this case, the low pressure is the suction created when the flexible tube tries to retain its shape after being pressed by the roller.  The high pressure is created by the roller moving forward, like you would do with a tube of toothpaste.

Here's where it gets interesting.

Completely flattening the tube is a foolproof way to pump, but it shortens the life of the tube.  So, a lot of pumps take advantage of the viscosity of the fluid (the slowing down of the fluid near the walls of the tube).  All the rollers really need to do is make it easier for the fluid to flow forward than backwards.

So, the pump is actually balancing the following factors:

The ability of the tubing to regain its shape (springy-ness of the tube, affected by the fluid viscosity)

The pressure of the fluid at the pump exit

The resistance of the fluid to flowing backwards through the restricted tube (fluid viscosity, affected by the extent that the tube is constricted by the roller)

You'll have to find out whether your pump is completely flattening the tube, or just relying on water's higher viscosity in order to increase the life of the tubing.


问:
High speed usb webcam
I am looking for a high speed usb webcam.

The plan is to rotate the camera at about 20-30 revolutions per second, the problem is this requires me to have a framerate of about 120fps (depending on the lense...) and secondary the exposure time needs to be really short for the image not to be blurred (and still have a decent quality).

At the moment i am using a 120fps USB-Webcam by ELP but the results are not satisfiying (the image is used by a computer-vision algorithm which needs a more or less sharp image).

Is there any camera available which can achieve the desired results (and is quite small and lightweight). Money is not our primary concern.

答: I would contact the professional computer vision folks, such as Cognex, and maybe National Instruments.  Your camera requirements are quite challenging for off-the-shelf USB cameras which are not designed to support high-speed automation.  </p>

Title: High speed usb webcam


问:
How quickly can a driverless vehicle generate control commands?
Can anyone give me a typical frequency that a driverless vehicle could generate steering and motor thrust commands?

I am trying to model a driverless vehicle in MatLab. Right now the vehicle is generating commands at 50Hz and the integrator is solving the dynamics at a 0.01s timestep (100Hz). I just want to know if this is realistic.

I would be even more grateful if you could point to a published source for this number.

答: MPC lab from Berkeley uses about 50-100 Hz. Although, I think it might be closer to 500Hz-1kHz for the low-level control (motor speeds etc.) implementations (this is close to the rates at which you control quadrotors as well) - I will post links here if I come across any publications that use a faster update rate.</p>


问:
Model Predictive Control (MPC) horizon and constraints
I am new to the MPC idea and I am trying to understand the key concepts but there are two things which I found confusing and I didn't find answers regarding to them.

The first one is about the optimized control signal sequence which can be computed from the cost function. If we want to predict, say five steps further, then we will have 5 control signals. After the calculation is done, we will apply only the first signal from the sequence to our system, and them remaining four will be "wasted" (I read that it can be used as an initial guess for the next optimization but thats not my point here). My first question is why don't we just predict one step further, and instead of optimizing five signals, we restrict our optimization to just one, which makes the computation faster?

The second question is about constraints. Lets say that I have some restriction on my input signal, say $0 < u < 5$. With some math, we can include these constraints to the optimization task but it takes more time to solve. Why don't we just do an unconstrainted optimization and after our input signals are ready we apply our contraints on them? Obviously this can not be done for state contraints, but i am interested about input constraints.

Thanks for your answers in advance.

答:
Both questions come down to stability. However the a long finite horizon does still not guarantee stability, so often a base policy is assumed afterwards, which is not computationally expensive and can be calculated for an infinite horizon.

For example if you have a mass (of 1 kg) on a fiction less finite surface to which you can apply a force $u$ (in Newtons), so the system can be simply modeled as,

$$
\begin{bmatrix}
\dot{x} \\ \ddot{x}
\end{bmatrix} =
\begin{bmatrix}
0 & 1 \\ 0 & 0
\end{bmatrix}
\begin{bmatrix}
x \\ \dot{x}
\end{bmatrix} +
\begin{bmatrix}
0 \\ 1
\end{bmatrix} u. \tag{1}
$$

There are also constraints to this system. Namely,

$$
\left\{\begin{matrix} -1<u<\frac12 \\ -0.1<x<1.1\end{matrix}\right. \tag{2}
$$

Usually for MPC a discrete model is considered. Using a sampling time of 1 second and zero order hold for $u$, then the given continues time model can be converted into the following discrete time model,

$$
\begin{bmatrix}
x_{k+1} \\ \dot{x}_{k+1}
\end{bmatrix} =
\begin{bmatrix}
1 & 1 \\ 0 & 1
\end{bmatrix}
\begin{bmatrix}
x_{k} \\ \dot{x}_{k}
\end{bmatrix} +
\begin{bmatrix}
0.5 \\ 1
\end{bmatrix} u_{k}. \tag{3}
$$

We want to use MPC to find a sequence $\mathbb{u}=\{u_0,u_1,\cdots,u_{N-1}\}$ which minimizes,

$$
\min_\mathbb{u}\sum_{k=0}^N x_{k}^2, \tag{4}
$$

subjected to $(2)$ and $(3)$. So $x_k$ should be steered towards zero.

The initial condition is given to be $x_0=1$ and $\dot{x}_0 = 0$. If the horizon would be taken to be one, so $N=1$, then solving $(4)$ would yield $u_0=-1$. The state of the system after this input would be $x_1=0.5$ and $\dot{x}_1=-1$. But for the next time step it is not possible to apply a suitable control input, which satisfies the first half of $(2)$ such that the position constraint from $(2)$ will still be met the next time step. Namely applying $u_1=0.5$ would still yield $x_2 = -0.25$ and $\dot{x}_2=-0.5$.

So you need a longer horizon in order to find a $u$ which guarantees that $(2)$ will always be satisfied. When initially neglecting the input constraint and solving $(4)$ for $u_k$ and then saturating the applied input afterwards nullifies the entire remainder of the calculated inputs/states. So nothing can be said based on this applied input about whether system would ever violate $(2)$. For this system this might never be the case, but if you would for example have time dependent inequality constraints then this system might become unstable when neglecting the constraint on $u$ when solving $(4)$.


问:
Recording GPS position
I build 3d models using Agisoft and need to record the position of the Ground Control Points as accurately as possible, latitude , longitude and altitude. What is the best way of doing this?</p>

答:
The most accurate position is probably calculated by using a sensor-fusion algorithm.

As sensors you can use:

GPS for absolute (but relatively inprecise position)

Distance sensors (either via triangulation with multiple ground stations or via a SLAM algorithm)

Odometric data from your quadrocopter (motor power)

Acceleration (lot's of drift over time but precise for a short time)

This sensor data can be fused used something like a Kalman-Filter.

Title: Recording GPS position


问:
detect post-it from an image of a visual management Board
'm trying to detect all the post-it in an image and get them into an arrayList. I tried many alternatives (removing backgroud -> detecting contours, haar Cascade
classifier, detecting rectangular objects...) but none of them gave me good results.

Any Idea how to proceed? Any help will be appreciated.

答:
As HighVoltage already suggested this should be an easy task using the HSV spectrum.

Your code could look something like this:

```<code>// img is a Mat containing your image

// Convert your image into HSV
Mat imgHSV = img.clone();
cvtColor(img, imgHSV, CV_BGR2HSV);

// Blur to reduce noise
blur(imgHSV, imgHSV, Size(3,3), Point(-1,-1));

// Threshold image to only accept a certain saturation
inRange(imgHSV, Scalar(0, 127, 0), Scalar(255, 255, 255)), imgHSV);

// If you have to much noise you can erode and dilate at this point

// Find contours in your image
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
findContours(imgHSV, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
</code>```

The contours contain a list of a list of points, each inner list represents the contour of one object.

You can for example use contourArea(contour[n]) to get the area of the nth contour.

Body:
As HighVoltage already suggested this should be an easy task using the HSV spectrum.

Your code could look something like this:

// img is a Mat containing your image

// Convert your image into HSV
Mat imgHSV = img.clone();
cvtColor(img, imgHSV, CV_BGR2HSV);

// Blur to reduce noise
blur(imgHSV, imgHSV, Size(3,3), Point(-1,-1));

// Threshold image to only accept a certain saturation
inRange(imgHSV, Scalar(0, 127, 0), Scalar(255, 255, 255)), imgHSV);

// If you have to much noise you can erode and dilate at this point

// Find contours in your image
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
findContours(imgHSV, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

The contours contain a list of a list of points, each inner list represents the contour of one object.

You can for example use contourArea(contour[n]) to get the area of the nth contour.


答:
With a 1.4 gigapixel-per-second throughput, you can capture stunning high-speed video at up to 1280x1024 resolution. Frame rate ranges from 1,057fps at full resolution, up to 21,500fps at minimum resolution. but the price is bit absurd.
I guess this will do.

Title: High speed usb webcam

Body:
I am looking for a high speed usb webcam.

The plan is to rotate the camera at about 20-30 revolutions per second, the problem is this requires me to have a framerate of about 120fps (depending on the lense...) and secondary the exposure time needs to be really short for the image not to be blurred (and still have a decent quality).

At the moment i am using a 120fps USB-Webcam by ELP but the results are not satisfiying (the image is used by a computer-vision algorithm which needs a more or less sharp image).

Is there any camera available which can achieve the desired results (and is quite small and lightweight). Money is not our primary concern.


问:
What exactly does a motor driver do? Why do we need an additional power supply for motors?
What exactly does a  motor driver do? Why do we need an additional power supply for motors? I'm a hobbyist and making a line follower from scratch.</p>

答:
At a high level, a motor driver takes a "logic-level" input (desired "effort") and delivers a corresponding "high-side" output to the motor. Exactly what is inside the motor driver depends on the motor and driver (for example brushed and brushless motors are driven very differently).  Larger motors like the ones in quadcopters or higher end remote control cars tend to be brushless motors, which are driven using carefully offset sinusoidal inputs (very roughly speaking).  A smaller line-follower robot will typically use a brushed motor, which can be controlled using simpler circuits such as an H-bridge.

There are several reasons to "isolate" the motor and control power supplies.

Motors have a lot of electrical "inertia" (inductance) which translates into a lot of electrical noise pushed back into the power supply. Microcontrollers are built assuming that the input supply is reasonably "clean", and this noise can reset your control circuitry (best case), or burn out internal components (worst-case).

Motors often have higher voltage and current requirements than control circuitry. For example the digital outputs of an aruino can put out around 100mA at 5 volts (which might be enough for a small line follower). A brushless motor used on a small fixed wing aircraft such as the Zephyr II can draw 100 amps at 12 volts.

Note that you do not need a separate battery for the controls and motor power, but you should have separate circuitry which "cleans" the raw battery voltage (such as an LDO or buck converter) before sending it to the control circuitry.


答:
If a DC motor is being connected to something like a microcontroller's I/O, the I/O pins usually are only capable of supplying currents in the order of mA. Motors need much higher current to actuate themselves, so typically a motor driver is used. A motor driver is merely a current amplifier, even a push-pull transistor pair can be used to achieve that. Another function that motor drivers commonly perform is to isolate low power electronics from the high power supply that usually runs a motor. A more commonly used implementation is called an H-bridge: https://en.wikipedia.org/wiki/H_bridge

If you're talking about stepper motors though, this becomes a more complicated process. Stepper motor operation involves attraction between rotor and stator magnets, and a reversal of stator poles is one of the things that takes place. But the motor winding, being a coil, usually has its own inductance, and high drive voltages are necessary to overcome this inductance and cause the reversal. Hence, stepper motor driver circuits are usually more complicated, which are responsible for both generating high voltages and also controlling current to each winding, making sure it doesn't exceed a certain value etc.

So mainly, any motor usually needs a driver circuit because its voltage/current requirements are different from the device that's trying to control it.

Body: What exactly does a  motor driver do? Why do we need an additional power supply for motors? I'm a hobbyist and making a line follower from scratch.</p>


问:
When should FPGAs be used in Robotics?
FPGA has good points such as a lot of IO points but then again you need to think things on very low level with flip-flops and pioneer on areas where things are not yet mature -- for example see this question here about development-tools on FPGAs -- this is my understanding currently! Now FPGA has been used to create excellent dexterity in robotic hands like here. Now some people market FPGA for fast prototyping and "forward looking" designs like here, I don't fully understand them: if you don't need a lot of IO points for things such as sensors, why to choose FPGA for a robot? So

When should FPGA be chosen for a project in robotics?

答:
I think there might be a misconception around what an FPGA actually is and when it is used in designs.  So let me try to explain that part first.

FPGAs and when one might want to have one...

At risk of simplication, an FPGA is little more than a processor that happens to be 'reconfigurable'.

Why would someone want a 'reconfigurable' microprocessor?  Well, because it costs far too much to fabricate a silicon processor to afford to do it for one, two, or even two hundred chips.  You'd need to be running batches of thousands of chips to make it economically feasible.

Since no design is ever bug-free the first time round, going the silicon route effectively commits a company to at least two if not more test runs, all at huge fabrication costs.

Which essentially means that very few commercial companies are going to be interested in designing and bringing to fabrication anything other than chip with broad enough commercial appeal.

So, if you come up with a brilliant design that justifies a custom microprocessor, then you might try to bring your idea to life on a shoestring budget by implementing it in an FPGA, where the actual chip is simply a collection of gates, and a 'program' (typically VHDL or Verilog) arranges those gates into an actual microprocessor.

But that's quite a ways down an entirely different (microprocessor design!) road...

Which leads me to suggest that

... FPGAs are not essential to robotics -- at least at the outset

What you need for robotics is a processor.  An FPGA is just a special kind of processor (reconfigurable).

You ask whether you 'should'?  Well that depends on your knowledge as well as where your real interests lie -- microprocessor design first or robotics first?

If microprocessors are your passion, then by all means!  And robotics is a great application area for custom microprocessors -- perhaps a vision cortex with many parallel decision pathways handled directly in hardware, or special tensor multiplication in hardware -- basically anything that generic processors can't handle well off-the-shelf.

But if you're going to microprocessor designs in FPGAs, well, then of course you'll need to have all of that low level knowledge you mention, and more -- because fundamentally you'll be designing your own processor.  Which has nothing really to do with robotics, even though your target application might be robotics.

Most designers can probably find an existing processor that will do most of what they'll ever need.

So I think you probably don't need an FPGA.

A starter roadmap: from commercial capabilities to (maybe) an FPGA...

First goal in my opinion is to try to get all of your creative concepts built up into a working robot (quite an intensive challenge in itself).

If you find that you've got specific and significant processing bottlenecks in your design, then the next goal is optimising the selection / design of your processors, still commercially available chips.  Maybe bigger, faster (trade-off with power draw, heat dissipation).  Maybe smaller, dedicated chips handling specific tasks and interfacing with the main brain (trade-off with algorithm / logic complications).

Only if there's capabilities that you just won't be able to get commercial chips to handle, then you might consider implementing a specialised processor inside an FPGA because at that point there will be very clear advantages that you hope to gain by 'rolling your own', and you can focus on just implementing those capabilities, with the right interfaces to rest of your design.

Otherwise, you're likely to get side-tracked from your main goal (which I'm going to assume is to actually build a robot!)

Bottom line: FPGAs are a distraction from getting started in robotics --- until you're quite a ways down the robotics road -- and have gained some strong chops in digital electronics / microprocessor design somewhere along the way.

Title: When should FPGAs be used in Robotics?


答: Main work of motor driver is to supply power to motor from external source by taking inputs from logics from microcontroller because microcontroller output will be in milliamps.Another use is to change the direction of rotation of motor </p>

Title: What exactly does a motor driver do? Why do we need an additional power supply for motors?


答:
DC motor draw more current initially because when motor is in normal speed it creates back emf which reduces drawing current .So initially when DC motor is powered there is no back emf so current drawn is more.
Solution a capacitor in parallel to DC motor which will provide more current from its reservoir when motor is initially powered....</p>

Title: How to reduce the DC motor starting current?

Body:
I am making a bot with 4 motors with a stall current rating of 11.7A. I was using 4 separate motor controllers which has a peak current rating of 20A to control each motor. But when I gave power to the motors in my bot, the motor drivers blew off within a second.

Was it due to the starting peak current of the motors? If yes, then how can I reduce the starting current? If no, then what could be other possible problems and their corresponding problems?


问:
RobotC graphical raise arms while reversing
I am trying to help my son program his robot using RobitC graphical. He has it doing most of what he wants it to do but the code is stuck and won't continue past the arm raise/ hold. What it is supposed to be doing at the point where it gets stuck is raise the arms (to lift an object) Hold the arms up while reversing Turn 90 degrees Reverse (This is as far as he's created as he realized it isn't working) Turn 90 degrees Reverse to the basket and raise the arms again

His code is trying to say to hold the arms up until he creates a new set point

He has tried both of these codes

I know it says (left drive) instead of (arm) on one bit that was corrected and still doesn't work correctly

I was asked in the comments on my other question to post which line it fails. I believe it fails at 18. The arms stay up but the bot does not continue the program (reverse). I could not respond in the comments as I do not have a high enough rating.

答:
In both of the pictures, line 19 has a "wait" command. The execution of the program will progress past this line when the condition in the parenthesis has been met.  You mentioned, that you have changed Ldrive to Larm and Rdrive to Rarm, however the motor brakes for these motors are set only after line 19. The command at line 19 is waiting for the brakes to be active, but there has been no command issued which would activate the brakes. </p>

<p>I would suggest that you try moving the set brake commands for the Larm and Rarm before the waituntil command. </p>

Body:
In both of the pictures, line 19 has a "wait" command. The execution of the program will progress past this line when the condition in the parenthesis has been met.  You mentioned, that you have changed Ldrive to Larm and Rdrive to Rarm, however the motor brakes for these motors are set only after line 19. The command at line 19 is waiting for the brakes to be active, but there has been no command issued which would activate the brakes.

I would suggest that you try moving the set brake commands for the Larm and Rarm before the waituntil command.


答:
Motors when starting can draw ca. 10x their nominal current. You mentioned that you have a driver attached to the motor. Do you use PWM to control the motor? A soft start when the motor is accelerated in a controlled manner to the required velocity helps limiting this initial large current.

When starting the motor, instead of just setting the required pin to 1, use the PWM function and increase the duty cycle of the PWM slowly (from 0 to 100% min ca. 1-2 seconds). That should reduced the current and make the motor accelerate smoothly to its maximum velocity. You can find a tutorial here, here and here.

As the other answers suggested, adding a capacitor can help, but this is a hardware solution, and I would suggest a software approach. The driver you are using seems to already have capacitors.


问:
How to relate forward kinematics into PWM/speed?
I am having a hard time understanding how to relate forward kinematics to things one can control in a robot like PWM and reading encoder values.

For example, how to relate the encoder values from motors and RPM to PWM values of the motors to make a robot follow a curved path?

答:
Usually you do this by implementing a feedback-loop.

Theory

By generating a PWM Signal you are (over time average) generating a voltage at your motor. As a approximitation the voltage is proportional to the speed of the motor (this could be redefined by measuring the relationship between voltage and speed).

This could be decribed by:

where r is the rotation as a function of the duty-cycle p.

Now you know which rotation your motor should have. Now you can implement a feedback loop, you know how fast your motor is running and how fast your motor is actually running so you can define delta r:

This delta r can be used to implement a PID Controller so your motor always rotates at the speed it should. The power P of your PID controller is defined by (the three constant P,I,D are device dependent):

<img src="https://latex.codecogs.com/gif.latex?P_%7BMotor%7D(%5Cdelta_r)=P_%7Bconstant%7D&space;%5Ccdot&space;%5Cdelta_r&space;+&space;I_%7Bconstant%7D&space;%5Ccdot&space;%5Cint_%7B0%7D%5Et&space;%5Cdelta_r&space;%5Ctext%7B&space;d%7Dt&space;+&space;D_%7Bconstant%7D&space;%5Ccdot&space;%5Cfrac%7B%5Ctext%7Bd%7D%5Cdelta_r%7D%7B%5Ctext%7Bd%7Dt%7D" title="P_{Motor}(\delta_r)=P_{constant} \cdot \delta_r + I_{constant} \cdot \int_{0}^t \delta_r \text{ d}t + D_{constant} \cdot \frac{\text{d}\delta_r}{\text{d}t}" />

With a good setup your motor rotates now more or less always at the exact speed it should. The distance s your robots travells over time is now given by:

with p(t) beeing the power as a function of time.

Implementation

In this example motorPower(int16_t power) is a function which controls the motor with a power between -255 and 255. This function does not reads the current motor speed. The function currMotorSpeed() returns the current speed of the motor, for simplicity reasons also a value between -255 and 255. The constant dt is the time between each execution of the PID controller.

Implementation in C++:

```<code>// PID Controll for the motor
int16_t motorPowerControlled(int16_t motorPower){
    static int iArea, dLastValue;
    int16_t deltaPower = currMotorSpeed() - motorPower;

    int16_t pValue = deltaPower * P_CONSTANT

    iArea += deltaPower;
    int16_t iValue = iArea * dT * I_CONSTANT

    int16_t dValue = (deltaPower-dLastValue)/dt * D_FACTOR;
    dLastValue = deltaPower;

    return pValue + iValue + dValue;
}

int main(void){
    int16_t distanceDriven = 0;
    const int16_t POWER = 100;

    while(true){
        motorPowerController(POWER);
        distanceDriven += POWER * dt;
        delay_ms(dt);
    }
}
</code>```

Body:
Usually you do this by implementing a feedback-loop.

Theory

By generating a PWM Signal you are (over time average) generating a voltage at your motor. As a approximitation the voltage is proportional to the speed of the motor (this could be redefined by measuring the relationship between voltage and speed).

This could be decribed by:

where r is the rotation as a function of the duty-cycle p.

Now you know which rotation your motor should have. Now you can implement a feedback loop, you know how fast your motor is running and how fast your motor is actually running so you can define delta r:

This delta r can be used to implement a PID Controller so your motor always rotates at the speed it should. The power P of your PID controller is defined by (the three constant P,I,D are device dependent):

<img src="https://latex.codecogs.com/gif.latex?P_%7BMotor%7D(%5Cdelta_r)=P_%7Bconstant%7D&space;%5Ccdot&space;%5Cdelta_r&space;+&space;I_%7Bconstant%7D&space;%5Ccdot&space;%5Cint_%7B0%7D%5Et&space;%5Cdelta_r&space;%5Ctext%7B&space;d%7Dt&space;+&space;D_%7Bconstant%7D&space;%5Ccdot&space;%5Cfrac%7B%5Ctext%7Bd%7D%5Cdelta_r%7D%7B%5Ctext%7Bd%7Dt%7D" title="P_{Motor}(\delta_r)=P_{constant} \cdot \delta_r + I_{constant} \cdot \int_{0}^t \delta_r \text{ d}t + D_{constant} \cdot \frac{\text{d}\delta_r}{\text{d}t}" />

With a good setup your motor rotates now more or less always at the exact speed it should. The distance s your robots travells over time is now given by:

with p(t) beeing the power as a function of time.

Implementation

In this example motorPower(int16_t power) is a function which controls the motor with a power between -255 and 255. This function does not reads the current motor speed. The function currMotorSpeed() returns the current speed of the motor, for simplicity reasons also a value between -255 and 255. The constant dt is the time between each execution of the PID controller.

Implementation in C++:

// PID Controll for the motor
int16_t motorPowerControlled(int16_t motorPower){
    static int iArea, dLastValue;
    int16_t deltaPower = currMotorSpeed() - motorPower;

    int16_t pValue = deltaPower * P_CONSTANT

    iArea += deltaPower;
    int16_t iValue = iArea * dT * I_CONSTANT

    int16_t dValue = (deltaPower-dLastValue)/dt * D_FACTOR;
    dLastValue = deltaPower;

    return pValue + iValue + dValue;
}

int main(void){
    int16_t distanceDriven = 0;
    const int16_t POWER = 100;

    while(true){
        motorPowerController(POWER);
        distanceDriven += POWER * dt;
        delay_ms(dt);
    }
}


答:
Forward kinematics is used to compute the pose (position and orientation) the end-effector of a robot from the joint angles. Simialry, higher order forward kineamtics can be defined to calcualte the velocities of the end-effector from the volocities (and angular positions) of the joints. The same can be done for accelerations.

Inverse kinematics represents the same transformation  but in a reversed direction. It is used to calculate the joint angles from the end-effectro pose. Simialry, higher order inverse kinematics can be defined for calculating joint velocities from end-effectro velocities (and pose). The same can be done for accelerations.

A curve is given in Cartesian space as a string of points. For each point the inverse kinematics problem can be solved, and so, a string of points in joint space can be computed. This string of points will consist of joint angle coordinates. If the joints are set to thee values, one after another, the end-effectro will describe the given path. Please be advised, that the points have to be close to one another. The closer they are, the more precise the curve will be.

The motors of all joints have to be commanded to turn in the positive or negative direction in order to reach the desired point. This is what the PID controller does. It gets the reference value (the desired angle) and then calculates the PWM duty cycle toe make the motor move. The PWM duty cycle, as a simplistic explanation, is proportional to the maximum speed of the motor. 100% duty cycle will turin the motor with full speed, 50% will turin the motor with half speed. The PID Controller calcultes the PWM duty cycle based on how far the desired point is from the current point. If far, high speeds will be reached, if it is near, only slow speed will be necesary.

So, if you want to make the robot follow a path, a simplisic approach is to:

Define the curve in cartesian space a string of points

Compute the joint coordinates of the robot for each point

Select the First point in the list

Command the motors of the robot to turn to the selected point

Wait for the robot to arrive

If there are point left in the list select the next point in the list and go to 3 if not end

A more advancced appraoch would need also velocity information from the Cartesian Space and would transfomr those velocitey to joint space and not just set motor positions but also motor velocities to generate a smoother motion.

Title: How to relate forward kinematics into PWM/speed?

Body:
I am having a hard time understanding how to relate forward kinematics to things one can control in a robot like PWM and reading encoder values.

For example, how to relate the encoder values from motors and RPM to PWM values of the motors to make a robot follow a curved path?


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

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

答:
If you're working with the TK1 and stereo camera, you might consider this:

https://devtalk.nvidia.com/default/topic/994170/jetson-tk1-and-stereo-vision/

These stereo cameras are supports ROS: http://rosindustrial.org/news/2016/1/13/3d-camera-survey

Title: Low power computer for stereo vision


答:
Having worked with both FPGAs and Microcontrollers in robotics projects, I would actually say now: whatever the person implementing the task has the most experience with. If you know both equally well, you wouldn't be asking yourself the question. If you don't know either well, than these would be the points to go by:

Is there complex timing on I/O ports required? 3-Phase motor control can have such requirements. FPGAs have a slight advantage here.

Can you parallelize your super low latency algorithm? Here the FPGA doesn't really compete with microcontrollers, but more with embedded PCs. Most things I would go for the embedded PC, but you may have an advantage with an FPGA for some specific applications. Dense stereo processing for example is often done in FPGAs. Lots of cameras use FPGAs for processing the data stream.

What is also often used are hybrid solutions. Either with two chips, so one microcontroller for the program code, and an FPGA for IO or some other task. There also are a number of FPGAs that actually have a microcontroller embedded.

I wouldn't be so harsh on FPGAs like some other posts, but would also generally argue, that unless you know your VHDL well, you will be better off using microcontroller, or even better still embedded PCs.

Title: When should FPGAs be used in Robotics?

Body:
FPGA has good points such as a lot of IO points but then again you need to think things on very low level with flip-flops and pioneer on areas where things are not yet mature -- for example see this question here about development-tools on FPGAs -- this is my understanding currently! Now FPGA has been used to create excellent dexterity in robotic hands like here. Now some people market FPGA for fast prototyping and "forward looking" designs like here, I don't fully understand them: if you don't need a lot of IO points for things such as sensors, why to choose FPGA for a robot? So

When should FPGA be chosen for a project in robotics?


问:
Creating MAVLink commands from python
I am struggling to find any clear documentation on how to create MAVlink commands using python.

I am looking to create an autonomous glider and require some of the basic functions

Retrieve GPS Data and store into a file

Import GPS data in Python function

Send waypoint lat, long, alt to the autopilot (APM)

I am currently using MAVProxy as my GCS and the ErleBrain 3 as my autopilot hardware but the aim is to not require a GCS and just have a python script to automatically add and remove waypoints based on the received GPS data

答:
There are a couple libraries for doing what you want to to, the first is pyMAVlink and the second is dronekit-python it is going to be easiest to use dronekit as it handles a lot of the lower level stuff like processing incoming packets and connecting over your preferred interface for you automatically. I assume you want to  load waypoints from a file and have your UAV fly them? In that case you probably want to set your UAV into Guided mode (for a description of modes on Ardupilot see the docs here) this will tell Ardupilot that you are going to command it step by step what to do.

Here is some example code form there wiki that does what you want to do you'll just have to load your files and transform the coordinates to lat lon points:

```<code>def arm_and_takeoff(aTargetAltitude):
    while not vehicle.is_armable:
        print " Waiting for vehicle to initialise..."
        time.sleep(1)
    vehicle.mode = VehicleMode("GUIDED")
    vehicle.armed = True

    while not vehicle.armed:
        print " Waiting for arming..."
        time.sleep(1)

    print "Taking off!"
    vehicle.simple_takeoff(aTargetAltitude)
    # Wait for takeoff to finish
    while True:
        print " Altitude: ", vehicle.location.global_relative_frame.alt
        if vehicle.location.global_relative_frame.alt>=aTargetAltitude*0.95: #Trigger just below target alt.
            print "Reached target altitude"
            break
        time.sleep(1)

def get_distance_metres(aLocation1, aLocation2):
    dlat = aLocation2.lat - aLocation1.lat
    dlong = aLocation2.lon - aLocation1.lon
    return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5

# define connection method
# see all the methods at http://python.dronekit.io/guide/connecting_vehicle.html
connection_string = "127.0.0.1:14550"

# Connect
vehicle = connect(connection_string, wait_ready=True)
# arm and takeooff to 10m
arm_and_takeoff(10)
# set airspeed to 3 m/s
vehicle.airspeed = 3

point1 = LocationGlobalRelative(-35.361354, 149.165218, 20)
vehicle.simple_goto(point1)

while vehicle.mode.name=="GUIDED": #Stop action if we are no longer in guided mode.
        remainingDistance=get_distance_metres(vehicle.location.global_frame, point1)
        print "Distance to target: ", remainingDistance
        if remainingDistance<=targetDistance*0.01: #Just below target, in case of undershoot.
            print "Reached target"
            break;
        time.sleep(2)
</code>```

Per request I have some example pymavlink code, you can see some more examples here, sending messages is a pain, you need to identify what type of packet you need to send, and fill it's paramaters acording to the standard

```<code>from pymavlink import mavutil

data = mavutil.mavlink_connection('udp:localhost:14551', planner_format=False,
                                  notimestamps=True,
                                  robust_parsing=True)

while True:
    msg = data.recv_match();
    #If we have a valid message
    if msg is not None:
        #print msg.get_type()
        if msg.get_type() is "HEARTBEAT":
            print msg.autopilot
        elif msg.get_type() is "NAV_CONTROLLER_OUTPUT":
            print msg
</code>```

Title: Creating MAVLink commands from python

Body:
There are a couple libraries for doing what you want to to, the first is pyMAVlink and the second is dronekit-python it is going to be easiest to use dronekit as it handles a lot of the lower level stuff like processing incoming packets and connecting over your preferred interface for you automatically. I assume you want to  load waypoints from a file and have your UAV fly them? In that case you probably want to set your UAV into Guided mode (for a description of modes on Ardupilot see the docs here) this will tell Ardupilot that you are going to command it step by step what to do.

Here is some example code form there wiki that does what you want to do you'll just have to load your files and transform the coordinates to lat lon points:

def arm_and_takeoff(aTargetAltitude):
    while not vehicle.is_armable:
        print " Waiting for vehicle to initialise..."
        time.sleep(1)
    vehicle.mode = VehicleMode("GUIDED")
    vehicle.armed = True

    while not vehicle.armed:
        print " Waiting for arming..."
        time.sleep(1)

    print "Taking off!"
    vehicle.simple_takeoff(aTargetAltitude)
    # Wait for takeoff to finish
    while True:
        print " Altitude: ", vehicle.location.global_relative_frame.alt
        if vehicle.location.global_relative_frame.alt>=aTargetAltitude*0.95: #Trigger just below target alt.
            print "Reached target altitude"
            break
        time.sleep(1)

def get_distance_metres(aLocation1, aLocation2):
    dlat = aLocation2.lat - aLocation1.lat
    dlong = aLocation2.lon - aLocation1.lon
    return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5

# define connection method
# see all the methods at http://python.dronekit.io/guide/connecting_vehicle.html
connection_string = "127.0.0.1:14550"

# Connect
vehicle = connect(connection_string, wait_ready=True)
# arm and takeooff to 10m
arm_and_takeoff(10)
# set airspeed to 3 m/s
vehicle.airspeed = 3

point1 = LocationGlobalRelative(-35.361354, 149.165218, 20)
vehicle.simple_goto(point1)

while vehicle.mode.name=="GUIDED": #Stop action if we are no longer in guided mode.
        remainingDistance=get_distance_metres(vehicle.location.global_frame, point1)
        print "Distance to target: ", remainingDistance
        if remainingDistance<=targetDistance*0.01: #Just below target, in case of undershoot.
            print "Reached target"
            break;
        time.sleep(2)

Per request I have some example pymavlink code, you can see some more examples here, sending messages is a pain, you need to identify what type of packet you need to send, and fill it's paramaters acording to the standard

from pymavlink import mavutil

data = mavutil.mavlink_connection('udp:localhost:14551', planner_format=False,
                                  notimestamps=True,
                                  robust_parsing=True)

while True:
    msg = data.recv_match();
    #If we have a valid message
    if msg is not None:
        #print msg.get_type()
        if msg.get_type() is "HEARTBEAT":
            print msg.autopilot
        elif msg.get_type() is "NAV_CONTROLLER_OUTPUT":
            print msg


问:
how to calculate the angular velocity of end effector of two link robot arm?
I am trying to calculate the angular velocity of end effector of two-link robot arm. Can anyone help me to find it?

If $q_1$, $q_2$  are joint angular position and $\dot{q_1}$ and $\dot{q_2}$ are joint angular velocities, and $\omega$ is angular velocity of end effector, then I use $\omega=\dot{q_1}+\dot{q_2}$.
Is that correct?

答:
angular velocity is wrt the center axis.  a simple way to account for that is to calculate absolute cartesian velocities, it's something like

v1 = cos(q1) I + sin(q1) J

v2_absolute = v1 + cos(q2) I + sin(q2) J

where I and J are the unit vectors in the x, and y direction


答: Yes, angular velocities are additive if that is all you're looking for (i.e., $\omega_2$ expressed in the base frame of $\omega_1$).  If you are trying to find the velocity of a point on link 2, then you need to add an $\omega $x$ r$ term.

Title: how to calculate the angular velocity of end effector of two link robot arm?

Body:
I am trying to calculate the angular velocity of end effector of two-link robot arm. Can anyone help me to find it?

If $q_1$, $q_2$  are joint angular position and $\dot{q_1}$ and $\dot{q_2}$ are joint angular velocities, and $\omega$ is angular velocity of end effector, then I use $\omega=\dot{q_1}+\dot{q_2}$.
Is that correct?


问:
Robot clutch to disengage wheels
I have a robot that moves around autonomously. Very often I want to push the robot several feet to start a test over again, or sometimes I want to wheel the robot outside to my car or to a nearby field.

Pushing my robot is pretty tough. Its 60lbs (27kg) and when I push it with the motors engaged its very difficult. I want a way to decouple the 2 back wheels so I can haul it around like a suit case. I've seen similar posts to this one where people suggested just leaving them coupled and recharging the battery. I don't really care to exert that much of my own energy just to recharge the battery. I just want to make transporting easier.

I also Want to be able to engage and disengage without the robot being on. This means that electromagnet clutches are out. Id like the solution to be under $300 and to be fairly easy to machine. I have access to a lathe, mill, welder... etc and can machine some complex stuff, but I don't want it to be like making a custom gear box.

Does anyone have any suggestions? I'm using standard dolly wheels from Northern tool. (http://www.northerntool.com/images/product/2000x2000/425/42570_2000x2000.jpg) I've considered a quick release pin but given the geometry of the dolly wheel that would be tough. The pin would hit the rim as you are pulling it out.

Thanks in advance for any suggestions.

答:
How about a electronix solution, at the moment i guess your motors are controlled by a H-Bridge or similar, by rotating the motor you are generating a current which generates a magnetic field in your motor (see Maxwells Laws for more information). If your motor is not connected the only fricition you have is the friction of your gears.

So you can use a simple mosfet to disconnect your motors from their driver, if your motor uses a lot of current you may use a relay (or a IGBT) but the idea is the same.

Title: Robot clutch to disengage wheels


答:
If your robot's drive wheels always move in the forward direction, you may be able to design in a wrap slip clutch device.  This device would tighten a beefy spring around the driven shaft when the input is turned in the forward direction, but would loosen itself and decouple from the motor when the robot is pushed in reverse.  Here is an example:  Wrap slip clutch article from Machine Design 1/25/2007

If your drive wheels move bidirectionally, you can probably come up with a different, more standard, slip clutch device that allows you to manually engage/disengage the tangs between the input and output shaft for when you want to push the robot.  You'd need a mechanism to overcome the spring force that engages the tangs, and a method of locking it in place.  However, before thinking too hard about the design, I'm concerned if you can really get any manual clutch to work given that you are challenged on space for even a quick-release mechanism.

Title: Robot clutch to disengage wheels

Body:
I have a robot that moves around autonomously. Very often I want to push the robot several feet to start a test over again, or sometimes I want to wheel the robot outside to my car or to a nearby field.

Pushing my robot is pretty tough. Its 60lbs (27kg) and when I push it with the motors engaged its very difficult. I want a way to decouple the 2 back wheels so I can haul it around like a suit case. I've seen similar posts to this one where people suggested just leaving them coupled and recharging the battery. I don't really care to exert that much of my own energy just to recharge the battery. I just want to make transporting easier.

I also Want to be able to engage and disengage without the robot being on. This means that electromagnet clutches are out. Id like the solution to be under $300 and to be fairly easy to machine. I have access to a lathe, mill, welder... etc and can machine some complex stuff, but I don't want it to be like making a custom gear box.

Does anyone have any suggestions? I'm using standard dolly wheels from Northern tool. (http://www.northerntool.com/images/product/2000x2000/425/42570_2000x2000.jpg) I've considered a quick release pin but given the geometry of the dolly wheel that would be tough. The pin would hit the rim as you are pulling it out.

Thanks in advance for any suggestions.


问:
motor to turn a screw to move a lever
Where I can buy an actuator that consists of a motor that turns a screw that moves a rod?

答:
Are you talking about a worm drive (pictured below)?

If so there are plenty of places to get one depending on your needs, I have linked some below:

From Vex

From Andymark

Plenty of people on Ebay

From Tetrix

And many others, if you could tell us more about what you want to do we could be more helpful.

Title: motor to turn a screw to move a lever


问:
How to call remote ROS node on mobile robot through laptop using wifi?
I've recently tried to get the remote ROS node on a mobile robot through wifi. This is as below picture.

I've run roscore command on both laptop and mobile robot and when I run the roscore command, I get the following warning message on my laptop server:

WARNING: ROS_MASTER_URI [http://192.168.7.2:11311] host is not set to this machine

```<code>auto starting new master
process[master]: started with pid[2719]
ROS_MASTER_URI=http://192.168.7.2:11311/

setting /run_id to 4ef6c0f8-bfdf-11d3-a450-4e699f75a6e7
process[rosout-1]:started with pid[2732]
started core service[/rosout]
</code>```

But, when I run rosparam list command on my laptop, I've got the following results:

```<code>root@duminda-laptop:~#rosparam list
/rosdistro
/roslaunch/uris/host_192_168_7_2_35078
/rosversion
/run_id
root@duminda-laptop:~#rosparam get /rosdistro
hydro
root@duminda-laptop:~#rosparam get /roslaunch/uris/host_192_168_7_2_35078
http://192.168.7.2:35078
root@duminda-laptop:~#rosparam get /run_id
4ef6c0f8-bfdf-11d3-a450-4e699f75a6e7
</code>```

These results show that both laptop and mobile robot connected ok.

Is my setup to receiving the mobile robots data to my laptop is ok?

Why there is a warning message like above when starting the roscore?

答:
You only need one roscore. It should be run by the "host," which is the mobile robot, if I understand correctly. Then you can connect to it with your laptop.

Following this tutorial with the "talker" being your mobile robot and the "listener" being your laptop:

Start the roscore on the host (mobile robot).

$ roscore

Configure ROS_MASTER_URI on the host (mobile robot).

$ export ROS_MASTER_URI=http://192.168.7.1:11311

Now, do that same step on your laptop.

$ export ROS_MASTER_URI=http://192.168.7.1:11311

I've personally tried using hostnames, but sometimes it can't resolve it, so I've stuck to using the complete address.


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

Hardware hack

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

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

EDIT

Here is further information according to @combos comment.

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

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

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

Software hack

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

TL;/DR;

My questions:

Is it even possible to achieve what I want?

If yes, what do I need to do?

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

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

If you need any additional information please let me know!

答:
As @combo pointed out, the solution to my problem was that the potentiometers are driving current rather than voltage! I just connected another one in parallel and the hack was done.
Thanks!

Title: 2.4GHz helicopter hack [Edited]


问:
Why is it so hard to walk?
At least, on two legs. Asimo, one of the best known humanoid robots, is already capable to walk, although it doesn't seem to do this very stable. And it is a recent result.

As far I know, the legs are essentially many-dimensional non-linear systems, the theory of their control is somewhere in the border of the "very hard" and the "impossible".

But, for example, the airplanes are similarly many-dimensional and non-linear, despite that, autopilots are controlling them enough well some decades ago. They are enough trusted to confide the lives of hundreds of living humans to them.

What is the essential difference, what makes the walking so hard, while the airplane controlling so easy?

答:
A bipedal robot is essentially unstable - a little knock will cause it to fall over.

A commercial aircraft is essentially stable - a little gust of wind might move it off course, but it will keep flying the right way up and not simply fall out the sky.

Although aircraft with relaxed stability do exist, but for relaxed stability it is only recently that they can be controlled using fairly complicated automated control systems, and even then they are not anything like as unstable as a bipedal robot.

OwnerDisplayName: peterh

Title: Why is it so hard to walk?


问:
What are the recommended interconnects for wiring a battery to a motor via its driver?
I am currently working with a combination of Tamiya and T-connectors. I have not previously had issues with either, but the T-connectors I'm using currently do not seem to be maintaining a connection. If I torque the T-connectors in a particular way they will start working, but if I leave them "floating" they disengage. My first thought was that the problem was I had 2 different brands of T connectors, but it turns out, after switching all to one brand, that some of them do not work properly.

My first question is if there are known problems with T connectors or if I probably just got a bad batch?

My second question is if there are better interconnects out there than either Tamiya or T? (specifically for wiring a motor to its driver and the battery to the driver)

Let me be clear, I am NOT looking for opinions. I obviously realize this could be based on personal preference, but I am specifically asking if there are engineering principles at play in the choice being made. If it really just comes down to preference, then I am only interested in the first question. I also realize the possibility of avoiding interconnects, but let's assume that's not an option.

答: Anderson Power Poles (APP's) are your best source for a good connection. I have had MANY failures due to Tamiya, especially when with any kind of impact. I finally learned my lesson after being introduced to APP's. Never had any issues. </p>


问:
Arduino robot to move spirally
I am planning to build robot like irobot Roomba. So cleaning in a spiral pattern is required like the image shown starting from the center:

This code is part of my full code which doesn't give me spiral pattern:

```<code>void spiralling() {
  for(int i=0;i<=2;i++) {
    digitalWrite(motor1,HIGH);
    digitalWrite(motor2,LOW);
    digitalWrite(motor3,HIGH);
    digitalWrite(motor4,LOW);
    analogWrite(pwm1,180);
    analogWrite(pwm2,80);
    delay(300);
    p=1;
  }
  analogWrite(pwm2,250);
  delay(150);
}
</code>```

So my question is how can I make my bot trace spiral pattern (algorithm?,Logic? to use), as the only way to change the direction is with two wheels on sides.

Is there any code which constantly increases the radius of bot movement from center to radially outwards?

My robot has arduino uno ,l293d motordriver,two geared motors on either sides as shown in image and castor wheel in front:

答:
the code should be like this:</p>

```<code>int tourtime=1000; // circle tourtime. it is about intersection areas between each spiral. it should be less than circle time
int increasetime=10; // time for next tour, larger spiral needs more time
int numberofspiral=10; // number of circle
int minspeed=50; // initial speed for spiral.
int maxspeed=200;// max speed
void spiralling() {
  digitalWrite(motor1,HIGH);
  digitalWrite(motor2,LOW);
  digitalWrite(motor3,HIGH);
  digitalWrite(motor4,LOW);

  for(int i=0;i<=numberofspiral;i++) {
    analogWrite(pwm1,maxspeed);
    analogWrite(pwm2,minspeed);
    minspeed=minspeed+1;// increase the speed to increase radius
    delay(tourtime);
    tourtime=tourtime+increasetime;// increase the time for scan optimum area
  }
  analogWrite(pwm2,250);
  delay(150);
}
</code>```

Title: Arduino robot to move spirally

Body:
the code should be like this:

int tourtime=1000; // circle tourtime. it is about intersection areas between each spiral. it should be less than circle time
int increasetime=10; // time for next tour, larger spiral needs more time
int numberofspiral=10; // number of circle
int minspeed=50; // initial speed for spiral.
int maxspeed=200;// max speed
void spiralling() {
  digitalWrite(motor1,HIGH);
  digitalWrite(motor2,LOW);
  digitalWrite(motor3,HIGH);
  digitalWrite(motor4,LOW);

  for(int i=0;i<=numberofspiral;i++) {
    analogWrite(pwm1,maxspeed);
    analogWrite(pwm2,minspeed);
    minspeed=minspeed+1;// increase the speed to increase radius
    delay(tourtime);
    tourtime=tourtime+increasetime;// increase the time for scan optimum area
  }
  analogWrite(pwm2,250);
  delay(150);
}


问:
Why do I need an additional moment of inertia term in the cart-pole dynamics equation?
I'm trying to understand the dynamic equations for the cart pole system according to this control tutorial from the University of Michigan, where the angular acceleration equation can be written as

$(I+ml^2)\ddot{\theta}+mglsin(\theta)+ml\ddot{x}cos(\theta)=0$

I'm having trouble understanding what forces are represented separately by the terms  $ml^2\ddot{\theta}$ and $I\ddot{\theta}$.  Both seem to represent a moment force exerted by the mass of the pole, so they almost seem to represent exactly the same thing.  My intuition tells me that I really only need the term $ml^2\ddot{\theta}$, but the fact that there is an additional $I\ddot{\theta}$ term suggests that my intuition is not accounting for some other force present in the system.

Any help to clarify and distinguish the meaning behind these two terms would be greately appreciated!

答: Look up an explanation of the parallel axis theorem for the mass moment of inertia.   The two terms do represent similar things, but the axis of rotation is different.  The term $I \ddot\theta$ comes from summing the moments about the centroid of the link, whereas the term $m l^2 \ddot \theta$ comes from summing the horizontal forces from the free body diagram.</p>


问:
Minimum speed controller refresh rate
In a quadrotor we need to change each motor's speed depends on its position in space. More frequency will result more stability ( I mean if we can change motor's speed 400 times per second instead of 100 times per second we may stabilize our UAV quadrotor far better ).

Now my question targeting people who made a UAV quadrotor before or have any information about ESCs. I wanna know whats the minimum refresh rate for ESCs in a quadrotor to make it stable ? For example may an ESC with 50hz refresh rate enough for stabilizing quadrotor or not ? I'm asking this question because high speed ESCs are more expensive than lower speed ones.

I have this one. May it work ?

答: In case you need to do such an analysis, you should build up a Simulink/xcos model and derive such an analysis from that rather than make assumptions about such things which may or may not be directly correlated.</p>

Title: Minimum speed controller refresh rate


问:
Which motors are used in boston spot robot
I want to know which motors or smart servos are used in boston dynamics spot robot. Where can i read its spicification and is it possible to buy the motor? </p>

答: Most of Boston Dynamics' robots are hydraulic driven including this one.  I believe it is mostly composed of off-the shelf hydraulic components, but they are very expensive.</p>


问:
2DOF arm with quick movement: Stepper, servo, or DC motor?
To make a two degree of freedom arm capable of speeds needed to play air hockey, how should the arm be controlled? I'm wondering about speed vs accuracy.

The following image is from a project involving a 2DOF drawing arm:

For this air hockey project, the general mechanics of that arm seem appropriate. it can move the "hand" around a 2D plane. I also like how both motors are at the base of the arm, instead of having the 2nd motor at the elbow (which adds weight to the arm and slows it).

However, the drawing robot is slow.

Steppers:

I understand that in general, steppers are 'slow'.

But, steppers have accurate positioning, which is very important in a game of air hockey. I also know that the steppers can be geared-up, but then they lose torque. The steppers would need to handle the inertia of quick, back-and-forth arm movement.

Hobby servos:

I've used small servos for other projects, but the accuracy was poor. Most don't have a way to read the angle externally, and those that do, have noisy signals. I'm not sure how strong the hobby servos are, and if they can be accurate enough for this project. I understand that using digital servos improve dead band issues.

DC motors with external feedback:

The only other method I can think of for controlling the arm would be to use DC motors with sensors like as rotary encoders. I think I would need an absolute rotary encoder.  But they seem to be around \$50-$1000, which is a bit much for a solution I'm not sure will even work out. Perhaps there are cheaper solutions to motor angle measurement. I could just use a potentiometer, but then I'm worried about noise again.

It's worth noting that I don't know of any easy or affordable way to design my own drivetrain. All I have is a drill, and I don't know how I would mount shafts/bearings and such, even if the gears themselves were affordable.

This means that if I need to gear-up or down, I don't think I can unless it's cheap and involves simple tools.

So for the arm: DC motors with external feedback, servos, steppers, something else?...

Which method would be the best in terms of speed, and which for accuracy? I'm wondering which would cost less as well, but I understand that is a grey area.

I'm leaning towards servos out of simplicity. I'm may try digital servos with ball-bearings, in the hope they that will move quick enough, but be strong enough to handle the inertia of the arm.

(Note that a 2DOF arm is desired, and not something else like a 3D-printer x-y belt system.)

答:
any times when people say "servo motor" they are talking about the model airplane style square black plastic box.   That is not what you want here.   You would be looking at the industrial type servo.  These are larger sized DC motors when optical encoders on the motor shaft.

You do NOT need absolute position sensors.  All you need is a quadrature sensor and you keep count of the "ticks" in each direction.   At some place in th system there is a "home" switch.  On power on you slowly move until the home switch is tripped then the count is reset to zero.   From there you count.  As long as you don't miss a coubtthe position is accurate.

Cost can be nearly zero if you salvage parts from broken ink jet printers or copy machines.   They are a good source of encoders, and optical limit switches and motors and gears.   Old inline skates are a good source of ball bearings.  Can make arms from wood.

Path planning is th hardest part of the controller.   You need to accelerate the motors and arms so that the X motor and Y motor each reach their target position and velocity at eat same time.  Typically this solution is re-computed using feedback many times per second.

A good drive system if you can't use gears or timing belts is to wrap kevlar cord or steel cable around a driven drum then around a second drum and then connect the ends of the cord with a spring.   As long as you keep the spring between the drums

Also for air hockey 2 DOF is not enough.  You You need to control the X, Y position and also the ANGLE of the paddle.  Unless you are using a disk shaped paddle like hitting a puck with a puck.


问:
Robot arm matlab Simulink simulation error
I am doing robotic arm simulation in Matlab Simulink but get the error. How I can resolve this.

My model given below.

Other details:
1. image of coordinates with world coordinates.
2. 6 DOF joint setting

答:
You cane find a detailed explanation on how to set the joint actuation types here. It seems that you need to set the torques as automatically computed, otherwise these are set to zero.

Furthermore, as it seems, the robot only moves in the x-y plane, but there is a z offset wrt the world coordinate system. Please make sure that this is handled correctly (you can use the same offset before the 6dof joint or you can allow for z axis movement)


问:
Granite Devices Ioni Pro. PWM set point mode
Inspecting the PWM set point mode it seems HSIN2 is the PWM input, and HSIN1 is the PWM direction input.  Is it possible to reverse this, so that it's more consistent with step and direction mode wiring?  I would like HSIN1 as the PWM input, and HSIN2 as the PWM direction.

Could the function of HSIN1, and HSIN2 be selected in Granity, once the setpoint type is chosen?

Most grateful for your help,

Mark

答: Currently it's not possible to change the HSIN pin functions in Granity. We'll check if it's easily feasible to implement to the firmware.</p>


问:
Robot end effector sensor query
I am currently in the process of implementing a Fanuc robotic arm at our company and have just received the pneumatic gripper end effector to go on the end of the arm (which we won't have for about a week).

The end effector has come with both NPN and PNP sensors which attach into machined slots in the side of the gripper.

I have very little experience or understanding of electronics so my question is really, what is the purpose of these sensors when used in conjunction with an end effector. Do they enable and disable the gripper or is that done through controlling the air supply?

Many thanks for any help!

答:
The PNP and NPN sensors differ in the output signal. The robot controller it is connected to must have matching inputs.

The sensor is most likely sense one of these two thing:

It might be used for detecting if there is an object gripped

It might detect the end of travel for the gripper claws.

Without documentation these are of course only guesses.

Title: Robot end effector sensor query


问:
Is the working principle of all servo motors the same?
If I can control a small hobby servo motor then can I control high torque servo motor in same way? I want to make a robot which needs a high torque and speed motors. But first before buying some industrial servo motors I want to first test the kinematics of my robot with small cheap servo motors. I will be using ros-orocos toolchain to control the robot and to make an efficient motion planning algorithm. Why I can't go for expensive servo motors right now is that first I want to test the working of the robot arm, whether it moves as expected or not. Although I think it is possible, I want to be sure.</p>

答:
For the most part, yes, the working principle is the same.

All servo motors I've ever encountered use PWM to control them (sometimes called PPM).  So the code you use to turn your test motor ought to be reusable with the high torque motor, or in fact any other servo. But be aware of the following possible issues that you may or may not need to account for:

the neutral point might not be in the middle of the PWM range

the direction of motion of servos is not standardized, so while one might turn clockwise from low PWM to high, another might turn counterclockwise

most servos work in the range of a 1000μs pulse to a 2000μs pulse for a total rotation of 180° but this is not necessarily true for all, some may work from 800-2200μs or from 1200-1800μs, for example

the time to turn from one extreme to another might vary greatly between two servos

50Hz (or 20ms updates) is pretty standard but some servos (esp. digital servos) may be capable of much quicker updates

This article on the pololu site is very good at describing the reactions to expect from the various signals and how they might vary between servos.

Good servo code will allow you to tweak the performance by adjusting parameters in the code rather than rewriting the code.


问:
Dynamics of a 3R planar robot manipulator,matrices M(q),C(q,q') and G(q)
The dynamics equation is T=M(q)*q''+C(q,q')*q'+G(q).

Can somebody provide me with the M(q), C(q,q') and G(q) matrices of a 3R manipulator with link mass,length and rotational inertia m_i, l_i and Inertia_i respectively?

答: The simplest approach for deriving the dynamics equation of the manipulator is via Lagrangian approach. I've hand-written in a hurry the equations that you need to start computing the Lagrangian equation in the following picture and I leave the rest for you:


问:
Calculate Transformation between two point sets - but with constrained Degrees of Freedom
How can I calculate the rigid-body transformation [R|t] between two 3d triangles, but restricted to a given N degrees of freedom (for N = 1..6) ?

I know for N=6 I can get a least-squares solution via SVD of a certain matrix, but how can I integrate further constraints (fewer DOF) into the system?

答:
Regardless of the number and kind of degrees of freedom you are using this is a least squares optimization problem. A basic approach is:

write the transformation matrices that you are planning to use as a parameterized function

use an initial guess to get the results for the triangle coordinates and calculte the obtained coordinates using the initial
guess paramters

calculate the distance from the obtained points in step 2 to the required points

iterate and refine the intial guess using an optimisation method (e.g. a simple gradient descent) until you reac a certein desired precision

The above algorithm is similar (maybe more simplistic) to the Iterative Closes Point algorithm, used for SLAM.


问:
1 motor and 180 degree servo or just 2 motors?
I am planning to use this motor: http://www.adrirobot.it/robot_kit/feetech_FT-DC-002/TGP01D-A130_TT-Motor.pdf Model: TGP01DA130 12215-48.
But I have some questions: How much a robot will be slower if it has 1 motor and one 180 degree servo instead of just 2 motors? And which one is the best option?</p>

答: If you want to use the second motor/servo for steering, I suggest you used a servo. To me, It's easier to operate for steering and more accurate.</p>