问:
Confused about time systems in ephemeris computation (from GPS subframes)
I am using the gnss-sdr library to compute ephemeris from the GPS message, and to try to make sense of things, I am reading the well-known IS-GPS-200E specification. To compute ephemeris, the time from ephemeris reference ephoch is defined as (page 101, table 20-IV)

$$t_k=t-t_{oe}.$$

I am unsure about how $t$ is defined, and I find the specification unclear on that. Rummaging in the source code of the aforementioned library, I found out that $t$ seems to be computed as follows:

$t=t_{x}-b$

where $b$ is the satellite clock bias, and

$t_x=R_x- (\text{pseudo-range})/c$

where $c$ is the speed of light. However, I have been unable, so far, to find out what $R_x$ exactly refers to. It seems to correspond to "time of week at current symbol", but there is no documentation/precison on that. I suppose that an expert could very simply deduce what $R_x$ is just from the formulas, though.

So my question is: what is $R_x$? What time system is it expressed in (satellite time? gps time? receiver time?). And if someone could explain to me what those formula are doing or give me pointers, I'd be extremely grateful.

答: My understanding is that $R_x$ is the receiver time when the signal is received. So that would make $t_x$ the transmission time. And you subtract the bias to get a more accurate transmission time.</p>


问:
I’m building a robot.what kind of sensor can find the way home
I’m building a robot by raspberry pi and arduino . I want it can charge automatic.I mean the robot can find the charger station by itself. But I don’t know what kind of sensor can make it true. Wifi and bluetooth not a good choose. So any ideas can make it true? Thank you!</p>

答:
This problem has been solved in automated commercial vacuum cleaners.  However most articles on the subject simply state the cleaners find the infrared signal and follow it back to the charger.  The details are missing. Regardless we can speculate.

Consider the charger station constantly emits a modulated infrared signal similar to that of a TV remote control.  Consider the robot has an infrared receiver similar to that of a TV designed to detect the modulated infrared signal.

The problem, this will not work as the infrared receiver used in TVs and other entertainment equipment contains an Automated Gain Control (AGC) circuit which will compensate for weak signals making it impossible to tell which direction the signal is the strongest in.  In other words, which direction the charger is in.

To solve this we need to use an infrared beam interrupter receiver.  This is similar to the infrared receivers found in TV but with out the AGC circuit.  They are designed to detect when an object is in the way.

Using an infrared beam interrupter receiver, we can rotate or oscillate the robot as it moves to find the direction in which the charger is in.

The more infrared beam interrupter receivers placed on the robot and pointed in slightly different directions, the less the robot has to rotate or oscillate to find the direction in which the charger is in.

OwnerDisplayName: Cheng Jeiry

ContentLicense: CC BY-SA 3.0


问:
How to calculate the max load that owi 535 arm can lift?
I am trying to calculate the max lifting capability of the OWI 535 arm. The robot has 3 DOF and 3 three 3 DC motor with the robot power source delivers an Operating Voltage current of 3 Volts. The motors have a Stall Torque 60g-cm. I would like to know how to do the math to calculate the lifting capacity.

The Robot has a wrist motion of 120 degrees, an extensive elbow range of 300 degrees, base rotation of 270 degrees, base motion of 180 degrees, vertical reach of 15 inches, horizontal reach of 12.6 inches, and lifting capacity of 100g

Again, I am attempting to use the robot information on the Society of Robots http://www.societyofrobots.com/robot_arm_calculator.shtml

I have middle and high school student that want to be able to calculate this information.

答:
To solve this analytically you need the following information (I have bolded that which you have not provided):

Stall torque for each joint

Mass and COM of each joint

Orientation of each joint relative to its parent joint (not given but I know the robot, they are all parallel to the ground)

Mass and COM of each link

Length of each link

I use the word joint and not motor here for simplicity. If you want to include things like gearing and other things which may make the joint stall torque different from the motor stall torque, then you will need to know these factors. If your motors are directly connected, you can assume the motor torque is the joint torque for simplicity.

I am also going to ignore the Omi 535's base joint (it is actually 4DOF) since it is orthogonal to the ground. Not having a go, I assume you ignore it too because you knew it experiences no torque due gravity, but it's probably worth mentioning for completeness.

Since all your motors are the same and aligned parallel to the floor, your job is easier. You just need to find the highest possible torque on any joint for any given payload, and then calculate the value of that payload that equals the joint stall torque.

For a robotic arm like yours where all joint axes are parallel to the ground in all configurations, the maximum torque for any joint occurs at the first joint when the arm is stretched out horizontally. This is because torque due to gravity is:

$\tau = m \cdot g \cdot r_{xy}$

That is, mass times gravity times the horizontal distance from the mass to the joint. You can see how the further any mass gets away from the joint horizontally, the higher the torque at the joint. The first joint has to deal with the mass of all the links and other joints plus the payload, and all these masses are furthest away from the first joint horizontally when the arm is fully outstretched.

The total torque at the first joint can be calculated by adding up the torque contributed by each mass along the arm (i.e the links, other joints and finally the payload):
\begin{align}
\tau_{max} &= \sum_im_i\cdot g \cdot r_i\\
&= g\sum_im_i \cdot r_i \\
&= g \cdot (m_{l_1} \cdot r_{l_1} + m_{j_2} \cdot r_{j_2} + m_{l_2} \cdot r_{l_2} + m_{j_3} \cdot r_{j_3} + m_{l_3} \cdot r_{l_3} + m_{payload} \cdot r_{payload})
\end{align}

Each $r$ value is the horizontal distance from that component's center of mass to the joint. If the COM of each joint lies on the joint axis, you can simply add up the lengths of the links preceding, since the arm is stretched horizontally. The $r_{payload}$ value should be simply the addition of all the lengths of the links.

The only variable on the RHS of the above equation that is unknown at this stage is $m_{payload}$. We want to know what this value is, when we set $\tau_{max}$ to our stall torque. By solving this equation we get the maximum payload of the arm:
\begin{align}
\tau_{stall} &= g \cdot (m_{l_1} \cdot r_{l_1} + m_{j_2} \cdot r_{j_2} + m_{l_2} \cdot r_{l_2} + m_{j_3} \cdot r_{j_3} + m_{l_3} \cdot r_{l_3} + m_{payload} \cdot r_{payload})\\
\frac{\tau_{stall}}{g} &= m_{l_1} \cdot r_{l_1} + m_{j_2} \cdot r_{j_2} + m_{l_2} \cdot r_{l_2} + m_{j_3} \cdot r_{j_3} + m_{l_3} \cdot r_{l_3} + m_{payload} \cdot r_{payload}\\
m_{payload} \cdot r_{payload} &= \frac{\tau_{stall}}{g} - m_{l_1} \cdot r_{l_1} - m_{j_2} \cdot r_{j_2} - m_{l_2} \cdot r_{l_2} + m_{j_3} \cdot r_{j_3} - m_{l_3} \cdot r_{l_3}\\
m_{payload} &= \frac{\frac{\tau_{stall}}{g} - m_{l_1} \cdot r_{l_1} - m_{j_2} \cdot r_{j_2} - m_{l_2} \cdot r_{l_2} + m_{j_3} \cdot r_{j_3} - m_{l_3} \cdot r_{l_3}}{r_{payload}}\\
\end{align}

This value is the mass at which the arm will not be able to move when holding it in this stretched out configuration. It does not mean it cannot hold this weight at all, since for any other configuration the maximum torque on any joint will be less.


问:
How to efficiently update a local Cartesian frame when traveling over long distances on a curved earth
I have a mobile robot which receives GPS position (lat/lon) and has an IMU for handling gaps in GPS service.

I want to be able to conduct short distance planning in a Cartesian plane, but the robot will ultimately be traveling over long distances. Most references I have found describe using a tangential North-East-Down (NED) frame starting at the robot initial position for local planning. This is fine but I am not sure how to go about updating this plane as the robot moves.

If I was to update (change the origin) for the frame every 5 min, then I would need to compute many new transformations at this time and potentially introduce a repeating lag in the system. How can I avoid this?

答:
Caveat: This is outside my area of expertise so I'm just making stuff up.

The best approach I have thought of so far that avoids extra computation, is to use a distance metric that is a hybrid of true distance and plane approximation distance.

The coordinate of objects, observations, used for planning and navigation are the plane cartesian coordinate, and which mesh element that coordinate is relative to.

For local planning, whose horizon is contained within a mesh element, you can use only the local coordinate. For global planning, the distance between objects is the sum of the great circle between mesh element origins and the local vectors to the start and end point.

Planning and pathfinding with meshes is well researched I think, though you will want to use the great circle distance between nodes rather than the cartesian distance.

You should be able to find a mesh size that works for you. One for which the error in distance is acceptable for the simplification of using a plane approximation locally.

EDIT:

At the boundary you need to convert objects in the current 100m window from the last origin to the next one. This is a simple plane translation or transform which can be done at object creation to spread out the computation cost. You'll need some hysterisis to prevent switching too often at the boundary.

Back of the envelope calcs give about 1mm of error from true position at a 5Km radius. So you could probably get away with increasing your mesh size.

Bottom line, used many fixed location local maps and jump from one to the other rather than dragging the origin of a single map along with you.


问:
How to tell a stepper motor's position, or detect slippage
I am creating a CNC machine on a budget, using old motors out of printers/scanners/etc.

I am limited to about 650mA for the whole system, so my fear is that when the cutting bit touches the material, the stepper might be moving too quickly and won't have enough torque.  This would mean it will become one rotation behind, which could really mess up a CNC project.

Detecting when the motor "misses" a step would allow me to readjust the motor speed until it reaches a balance between working quickly and having adequate torque.  How can I achieve this?

答:
To detect if your steppers have stalled check this questionhow to detect when a stepper motor has stalled.

If you want to use absolute positioning you can create a linear potentiometer using a length of nichrome wire pulled across the axis, with the "wiper" touching where the bed/mill is moving. You will need some uC to report on the actual position of the system however a 10ADC should be enough for a small project.


问:
Determining rated speed (RPM) required for a DC gearmotor
I'd like a two-wheeled robot to travel at 1m/s, given a wheel radius of 0.03m. I've calculated the rated speed required by the gearmotor as 318.28RPM:

$v = \omega r$, $\displaystyle{\frac{v}{r} = \omega}$

$\displaystyle{\frac{1 \mathrm{\frac{m}{s}}}{0.03 \,\mathrm{m}}} = $ $33.33 \mathrm{\frac{radians}{s}}$

$33.33 \mathrm{\frac{radians}{s}} \left(\frac{1 \,\mathrm{rev}}{2 \pi \, \mathrm{radians}}\right) \left(\frac{60 \, \mathrm{s}}{1 \, \mathrm{min}}\right)$

$= 318.28 \mathrm{\frac{rev}{min}}$

Is this correct?

On a side note, would an acceleration value of 0.5m/s^2 be a good choice for the robot, based on the velocity I've chosen? Help appreciated, thanks.

答:
Yes, that's correct.

A "good choice" for acceleration has nothing to do with velocity. Generally, acceleration limits are chosen based on motor thermal ratings. You should have some design load the motor should accelerate, that design load should require some quantity of torque, the motor constant relates torque to current, and then the current heats the motor.

Typically you would see "duty cycle" ratings for the motor - 20%, 30%, etc. That means you should only run at full power for 20% of the time to avoid overheating the motor. Generally those duty cycle ratings will also come with design durations - run at full power for 20 seconds then turn off for at least 80 seconds, etc.

You could probably run at 20% power for an unlimited period of time, but you should really contact the manufacturer to verify that. So then you have 20% of power as the limit, and you have a design load moment of inertia $I$, torque is $\tau = I\alpha$, or moment of inertia times angular acceleration, and power is $P = \tau\omega$.

The duty cycle rating cascades down from the power rating to an acceleration limit:

$$
P_{\mbox{max}} = \left(\tau_{\mbox{max}}\right)\omega \\
P_{\mbox{max}} = I\left(\alpha_{\mbox{max}}\right)\omega \\
$$

Here it's assumed that your angular speed $\omega$ is fixed, because you have some design speed you want to operate at, and the moment of inertia $I$ is fixed, because you have to operate at your design speed with a target load, and so then the only thing that you can vary to get below the power rating is the motor acceleration:

$$
\alpha_{\mbox{max}} = \frac{P_{\mbox{max}}}{I\omega} \\
$$

This is how you would arrive at an acceleration limit.

You should also include a factor of safety or some other margin in the design, and you should also look at accounting for viscous friction. There are power losses due to friction, and friction force (torque) is proportional to the motor speed:

$$
\tau_{\mbox{friction}} = b \omega \\
$$

Where $b$ is the viscous friction constant for the motor.

So, if you were to combine the above with the power equation, you get a more complete model:

$$
P_{\mbox{max}} = \left(\tau_{\mbox{acceleration}} + \tau_{\mbox{friction}}\right)\omega \\
P_{\mbox{max}} = \left(\tau_{\mbox{acceleration}}\right)\omega + b\omega\omega \\
P_{\mbox{max}} = I\left(\alpha_{\mbox{max}}\right)\omega + b\omega^2 \\
$$

That speed squared term is the real killer, and it's why accounting for it is important. Increasing speed by a factor of 10 increases the friction power requirement by a factor of 100.

So, rearrange to get the fuller model for the acceleration limit:

$$
\alpha_{\mbox{max}} = \frac{P_{\mbox{max}}-b\omega^2}{I\omega} \\
$$

Unfortunately, the only good way to get the viscous friction constant value is by empirical testing. It's complicated by the fact that real motors are inefficient, otherwise you could just calculate input power ($P=IV$), get unloaded top speed $\omega$, and determine the friction constant that way.

The trick would be to alter input power (by varying input voltage) and making a plot of input power versus top speed. You should see that top speed drops off as $1/\sqrt{P}$, but there should be an offset to the data as well. The curve would give you the friction coefficient and the offset gives you the efficiency.

But again, this all requires you to get a quality estimate of the design load (moment of inertia) and top speed. The moment of inertia calculation will be a little harder, but you should be able to do it with a good solid modeling software kit like Solidworks or Inventor.

You could also just try to get motor that is very oversized to what you need and then set the acceleration limit after the fact.


问:
Postion of Robotic Arm Joints
For the shown general serial link n-DOF robotic arm the joint inertial positions are given by $p_i$, where $i=1,...n$:

I learned that the joints' inertial positions can be calculated in one of two ways:

1- $p_i=r_o + b_o + \sum _{k=1}^{i} (a_k+b_k)$

2- As the first three elements of $\bar{p}_i$, where:
  $\bar{p}_i=T_o$ $^oT_1\text{...}$ $^{i-1}T_i$ $\bar{p}_0,$ $^{i-1}T_i$ is the homogeneous transformation matrix from coordinate $(i)$ to coordinate $(i-1)$, and $\bar{p}_0=\left(
\begin{array}{c}
 0 \\
 0 \\
 0 \\
 1 \\
\end{array}
\right). [1]$

By definition, the two methods should yield identical results. The problem is that they don't for a $\textbf{ wrist-partitioned manipultor}$.

$\textbf{My question is: Where could I be going wrong?}$

In the following I describe the specifics of my calculations:

1- $a_i$ is calculated as $a_i=A_o$ $^oA_1 ...$ $^{i-1}A_i$  $^ia_i$ (where $^{i-1}A_i$ is the rotation matrix). $b_i$ is calculated in a similar manner.

2- The homogeneous transformation matrix is

$^{i-1}T_i=\left(
\begin{array}{cccc}
 \cos \left(\theta _i\right) & -\sin \left(\theta _i\right) & 0 & a_i \\
 \cos \left(\alpha _i\right) \sin \left(\theta _i\right) & \cos \left(\alpha _i\right) \cos \left(\theta _i\right) & -\sin \left(\alpha _i\right) & -d_i \sin \left(\alpha _i\right) \\
 \sin \left(\alpha _i\right) \sin \left(\theta _i\right) & \sin \left(\alpha _i\right) \cos \left(\theta _i\right) & \cos \left(\alpha _i\right) & d_i \cos \left(\alpha _i\right) \\
 0 & 0 & 0 & 1 \\
\end{array}
\right)$

Where the rotation matrix,$^{i-1}A_i$, is the $3\times{3}$ top-left matrix. And $T_o$ is given by:

$T_o=\left(
\begin{array}{cc}
 A_o & r_o \\
 0 & 1 \\
\end{array}
\right)$

Where:

$A_o=\left(
\begin{array}{ccc}
 \cos \left(\theta _{b_z}\right) & -\sin \left(\theta _{b_z}\right) & 0 \\
 \sin \left(\theta _{b_z}\right) & \cos \left(\theta _{b_z}\right) & 0 \\
 0 & 0 & 1 \\
\end{array}
\right).\left(
\begin{array}{ccc}
 \cos \left(\theta _{b_y}\right) & 0 & \sin \left(\theta _{b_y}\right) \\
 0 & 1 & 0 \\
 -\sin \left(\theta _{b_y}\right) & 0 & \cos \left(\theta _{b_y}\right) \\
\end{array}
\right).\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos \left(\theta _{b_x}\right) & -\sin \left(\theta _{b_x}\right) \\
 0 & \sin \left(\theta _{b_x}\right) & \cos \left(\theta _{b_x}\right) \\
\end{array}
\right)$

represents the rotation of the base. For fixed base systems $A_o$ and $T_o$ are identity matrices.

$\underline{EDIT}$:

My robot model and the DH parameters I obtained for it are shown below:

$ \alpha =[0^{\circ},90^{\circ},0^{\circ},-90^{\circ},0^{\circ},-90^{\circ}] \\
a=[0,0,a_2,0,0,0] \\
d=[d_1,d_2,0,d_4,0,0] \\
\theta =[\theta_1(t),\theta_2(t),\theta_3(t),\theta_4(t),\theta_5(t),\theta_6(t)] \\$
$\text{Where:} \\
$
$d_2=L_2 \\
d_1=L_1 \\
a_2=L_3 \\
d_4=L_5 $

$[1]$ Liu Haitao, Zhang Tie, "A New Approach to Avoid Singularities of
6-DOF Industrial Robot"

答:
No valid dh parameters are possible for the transform from frame 1 to 2.  Try using a different configuration of the robot to find your DH parameters. Or don't use DH parameters.

Also remember that a constant offset in theta is one of the dh parameters if you care about where your joint zero is. $\theta = [\theta_{1DH}+\theta_{1}(t), ...]$

Title: Postion of Robotic Arm Joints


答: Between frame 2 and 3, there should be a net 180° rotation about the Z axis. However, your second and third DH parameter seem to only have a net rotation of 90°.</p>

Title: Postion of Robotic Arm Joints

Body:
For the shown general serial link n-DOF robotic arm the joint inertial positions are given by $p_i$, where $i=1,...n$:

I learned that the joints' inertial positions can be calculated in one of two ways:

1- $p_i=r_o + b_o + \sum _{k=1}^{i} (a_k+b_k)$

2- As the first three elements of $\bar{p}_i$, where:
  $\bar{p}_i=T_o$ $^oT_1\text{...}$ $^{i-1}T_i$ $\bar{p}_0,$ $^{i-1}T_i$ is the homogeneous transformation matrix from coordinate $(i)$ to coordinate $(i-1)$, and $\bar{p}_0=\left(
\begin{array}{c}
 0 \\
 0 \\
 0 \\
 1 \\
\end{array}
\right). [1]$

By definition, the two methods should yield identical results. The problem is that they don't for a $\textbf{ wrist-partitioned manipultor}$.

$\textbf{My question is: Where could I be going wrong?}$

In the following I describe the specifics of my calculations:

1- $a_i$ is calculated as $a_i=A_o$ $^oA_1 ...$ $^{i-1}A_i$  $^ia_i$ (where $^{i-1}A_i$ is the rotation matrix). $b_i$ is calculated in a similar manner.

2- The homogeneous transformation matrix is

$^{i-1}T_i=\left(
\begin{array}{cccc}
 \cos \left(\theta _i\right) & -\sin \left(\theta _i\right) & 0 & a_i \\
 \cos \left(\alpha _i\right) \sin \left(\theta _i\right) & \cos \left(\alpha _i\right) \cos \left(\theta _i\right) & -\sin \left(\alpha _i\right) & -d_i \sin \left(\alpha _i\right) \\
 \sin \left(\alpha _i\right) \sin \left(\theta _i\right) & \sin \left(\alpha _i\right) \cos \left(\theta _i\right) & \cos \left(\alpha _i\right) & d_i \cos \left(\alpha _i\right) \\
 0 & 0 & 0 & 1 \\
\end{array}
\right)$

Where the rotation matrix,$^{i-1}A_i$, is the $3\times{3}$ top-left matrix. And $T_o$ is given by:

$T_o=\left(
\begin{array}{cc}
 A_o & r_o \\
 0 & 1 \\
\end{array}
\right)$

Where:

$A_o=\left(
\begin{array}{ccc}
 \cos \left(\theta _{b_z}\right) & -\sin \left(\theta _{b_z}\right) & 0 \\
 \sin \left(\theta _{b_z}\right) & \cos \left(\theta _{b_z}\right) & 0 \\
 0 & 0 & 1 \\
\end{array}
\right).\left(
\begin{array}{ccc}
 \cos \left(\theta _{b_y}\right) & 0 & \sin \left(\theta _{b_y}\right) \\
 0 & 1 & 0 \\
 -\sin \left(\theta _{b_y}\right) & 0 & \cos \left(\theta _{b_y}\right) \\
\end{array}
\right).\left(
\begin{array}{ccc}
 1 & 0 & 0 \\
 0 & \cos \left(\theta _{b_x}\right) & -\sin \left(\theta _{b_x}\right) \\
 0 & \sin \left(\theta _{b_x}\right) & \cos \left(\theta _{b_x}\right) \\
\end{array}
\right)$

represents the rotation of the base. For fixed base systems $A_o$ and $T_o$ are identity matrices.

$\underline{EDIT}$:

My robot model and the DH parameters I obtained for it are shown below:

$ \alpha =[0^{\circ},90^{\circ},0^{\circ},-90^{\circ},0^{\circ},-90^{\circ}] \\
a=[0,0,a_2,0,0,0] \\
d=[d_1,d_2,0,d_4,0,0] \\
\theta =[\theta_1(t),\theta_2(t),\theta_3(t),\theta_4(t),\theta_5(t),\theta_6(t)] \\$
$\text{Where:} \\
$
$d_2=L_2 \\
d_1=L_1 \\
a_2=L_3 \\
d_4=L_5 $

$[1]$ Liu Haitao, Zhang Tie, "A New Approach to Avoid Singularities of
6-DOF Industrial Robot"


问:
How to implement PID control for robotic arm?
I'm wondering that, PID control is a linear control technique and the robot manipulator is a nonlinear system, so how it is possible to apply PID control, in this case. I found a paper named: PID control dynamics of a robotic arm manipulator with two
degrees of freedom. on slide share page, is this how we use PID control for robotic arm, is there any name for this approach? and how to remove the ambiguity that PID is linear control technique and the robot is nonlinear system. Any suggestions?</p>

答:
There are at least two different ways to get it:

Explanation 1)

For a very special class of mechanical systems like the robotics manipulator, the control law $u=-K_pe+g(q)$ with $K_p$ symmetric positive definite matrix, $e=q_d-q$ (with $q_d$ the set-point and $q$ the actual angular position from the encoders) and $g(q)$ gravitational component leads to have:

$$M(q)\ddot{q} + C(q)\dot{q} + g(q) = u + g(q)$$ (supposing no forces applied to the end-effector)

and then an internal energy as:

$$V(q,\dot{q}) = \frac{1}{2}\dot{q}{^T}M(q)\dot{q} + \frac{1}{2}e^{T}K_pe + U(q)$$

with $U(q)$ the potential energy per gravity compensation.

It can be shown that assuming that energy as Lyapunov candidate function leads to have the system asintotically internally stable and the state variable $q$ convergent to $q_d$ like a spring of stiffness $K_p$. If during this regulation we want to adjust also convergence rate and/or accuracy we can extend the same concept by introducing respectively the symmetric positive definite matrices $K_d$ and $K_i$ with the respective errors $\dot{e}=\dot{q_e}-\dot{q}$ and $\int e(t)dt$.

Explanation 2)

the substitution operated in your paper in (15) drives the substitution of nonlinear terms due to $M(q)$, $C(q)$, $g(q)$ with linear ones, and provides a "global" linearity to the system since the relationship input-output becomes described by the linear ODE:

$$u = K_p(q_d − q) − K_d(\dot{q_d}-\dot{q})$$


问:
How much torque do I need for a CNC machine?
I have a handful of 31.2oz-in stepper motors (Mouser.com - Applied Motion: HT17-268D), and I was curious if they would be big enough to run a 3D printing/cutting/etching type (think RepRap) of machine. I had in mind to attach them via  a simple gear to a screw-type drive to run the tool head back and forth.

Maximum bed size would probably be ~1.5'3.

Heaviest tool head would be something about half the weight of a Dremel tool.

Hardest substances I would use it on would probably be hardwoods (with high speed cutter) and copper (for PCB etching).

How do I figure the amount of torque needed to drive the head, and would the motors that I already have be big enough to do the job?

答:
The torque you need on a CNC machine is dependant on:
1) How much force the mill is expected to exert on the material
2) The resistance of the linear bearings used to move the axes
3) The type/style of cnc mill(i.e mills using a moving gantry need more torque than a xy table)
4) The drive system (i.e. belt driven machines needs more torque than lead screw)

Ultimately the amount of torque depends on how much power (like watts power) you're pumping into your steppers. The rating on the steppers are based on their optimal; however you can over drive them. Also if you are running your machine slowly then you can escape with using less torque since there is less risk of stalling as opposed to a machine running at high speed.

Further as stepper motors speed up they loose torque, unless they are BEMF compensated.

Try with your steppers; it may work in which case you're just over thinking the problem and if it doesn't work then you have an idea of how much torque you will need.


问:
Understanding inverse kinematics with the Jacobian
I'm learning about inverse kinematics with Jacobians, and getting a little confused. So, let's say I have a robot arm with two joints with angles Y = (a, b) whose tip I want to move along a certain direction in 2D space X = (u, v). The Jacobian J tells me how much the arm will move in 3D space, with respect to rotations of the joints: J = dY/dX. Then, in order to move the arm in a certain direction, I can find the inverse of the Jacobian J-inv, and then multiply this by the 3D direction I want the tip to move in: X = J_inv * Y.

However, let's say that at a particular joint configuration, the first joint (with angle a) is much more able to move the tip in the desired direction, than the second joint. So, dY/da >> dY/db. Intuitively, it would therefore make sense that greater velocity is given to the first joint than the second joint, to take advantage of this.

But this does not seem to be the case. If X = J_inv * Y, then J_inv will cause a greater response from the joint which finds it harder to move the tip in the desired direction, i.e. the second joint, because J_inv is effectively finding db\dY, which is greater than da\dY.

So why would the joint which finds it harder to move the tip along the desired direction, actually be given a higher velocity than the joint which finds it easier?

答:
Really good question!

And here's the solution: you're making a mistake in your matrix inversion. In your coordinate system, $\frac{\partial{b}}{\partial{Y}}$ does NOT equal $\frac{\partial{Y}}{\partial{b}}$.

Remember how you have that crazy formula for inverting a 2x2 matrix? The one where you swap about the elements, make some negative, and then divide the whole thing by the determinant?

That formula is the key to solving your puzzle. Write it out on paper and let us know what you get! It should all work out as expected :)


问:
How do the joint angles of a 4-legged impact the body's position with respect to the world frame?
For a four-legged robot (like Big Dog or the one shown here) how are the joint angles and "feet" position related to the body's frame in the world/inertial frame? For example, if I know the body's position and orientation in the world frame, and the joint angles, how do I derive the relationship that tells me where the robots "feet" are?

For simplification, if I assume the legs can be represented as a planar 3R manipulator (where the end effector is the foot), it's easy enough to derive the relationship between the end effector and the angles. But the "base" is the robot's body, which will change position and orientation when the joint angles change. So do I have to find the matrix which relates the body to the world frame, then find the position of the foot with respect to the world? Or am I thinking of this the wrong way?

答:
If you know all the joint angles, to fill in all the world frame information, all you need to know is the pose of something in the world frame.

You first ask how to find the feet position given the pose of the body and the joint angles. I'll explain that and then I'll explain how to find the body pose from a foot pose (and therefore the poses of all the other feet).

I'm going to assume you understand homogeneous transformation matrices for computing forward kinematics.

I'll be using the notation:
\begin{equation}^AT_B\end{equation}
To denote the transform from frame B to frame A. Or alternatively, the pose of B expressed in frame A.

Body pose known

So we know the joint angles $\theta$ and the pose of the body in the world frame $^WT_B$.

By representing the the four legs as 3DOF arms where the feet are end-effectors and the body is the "base", we can calculate the position and orientation of each foot relative to the body. This is the same as saying that we have the poses of the feet expressed in the body frame as a function of the joint angles:
\begin{equation}
^BT_{f_i}(\theta)
\end{equation}
Where $f_i$ represents each of the four feet.

We therefore can easily calculate the pose of each foot in the world frame by transforming the pose of the foot in the body frame into the world frame:
\begin{equation}
^WT_{f_i}(\theta) = ^WT_B \cdot ^BT_{f_i}(\theta)
\end{equation}

A foot pose known

Now let's say we know the pose of a single foot in the world frame $^WT_{f_i}$ and all the joint angles.

Since you know the pose and not just the position, you can completely calculate the pose of the body based on that one foot. If this is not intuitive, think of the fact that for any set of joint angles, if you move the body in any way, the position and/or orientation of every foot will change, i.e. every combination of body and joint angles corresponds to a unique foot pose).

\begin{align}
^WT_B(\theta) &= ^WT_{f_i} \cdot ^BT_{f_i}^{-1}(\theta) \\
^WT_B(\theta) &= ^WT_{f_i} \cdot ^{f_i}T_B(\theta)
\end{align}


问:
How to move a robot to a point while avoiding obstacles?
I am trying to move a robot in a straight line from point A, to point B. The robot's primary sensor is a Hokuyo URG-04LX-UG01 LIDAR that gives me the magnitude and direction of each point it detects in the form of two arrays.

I also have the wheel encoders on each motor of the robot, so I can obtain some odometry of the robot even though its accuracy will diminish over time.

The problem that I have is that there are obstacles in the path of point A and point B that the robot must go around. I am not sure how to take the readings from the LIDAR, and convert them into movements that go around the obstacle, while also heading to B. Sorry if that doesn't make sense, but I am really confused on how to solve this problem.

Is this an easy problem to solve and I am just over complicating it? Does anyone know of a way to do this? Any help or guidance would be greatly appreciated.

答:
What you are talking about is Robotic Path Planning.

Regarding your specific questions

"Is this an easy problem to solve" - For the specific problem you show, no.  It is 2D Configuration Space with defined goal and obstacles.  If you expand that to an loosely defined goal and undefined obstacles in a 3D space then NO!!

"Does anyone know of a way to do this?"  - There are LOTS of people who have been doing this and researching it for a while.  Google "Robotics Path Planning".  There are products that do it from the Roomba to the Mars Exploration Rover.  They can both path plan; but, I'm sure both have situations where they will get stuck or confused.

"Any help or guidance"

Read and learn from others

Try something simple

Once you have simple working, add some complexity and the go back to the first step (read) and continue

start small and grow from there


问:
How can I create a robot like the EZ-B using a regular Arduino?
I am interested in building a robot like the EZ-B, sold by ez-robot.com. It comes with an SDK for Visual Studio and has direct scripting in runtime through a USB, Bluetooth, Wi-Fi, IRC or HTTPS connection.

If I get a regular Arduino board, will I be able to control it remotely in the same way? From what I've read, an Arduino needs to hold the instructions in its own memory, but I would rather have the brain in the computer, feeding signals back and forth to the microcontroller.

Also, is Arduino alone, a step down as the website niceley puts it?

答:
We've written robotic software in C# for a school
project, called NetBotProject.

It works in the way you described. Instead of using an Arduino we used a self-soldered ATmega8 board with our own firmware. The communication is based on RS-232 and on top of that our own protocol. The protocol (and the firmware) has commands for setting/getting I/O ports, powering servos, timer functions, etc.

To make a Wi-Fi connection, we used a cheap Fonera router, La Fonera 2100. It has RS-232 pins built in (connected to Atmega) and is running a socket server/client with Netcat. Our C# software also has a socket connection running, so we can send/receive the commands/signals to/from the ATmega over Wi-Fi.

With a few modifications the firmware should be able to run on an Arduino board. The protocol and firmware has not yet commands for the I²C bus. So you have to implement that by your own if you want to control more than one microcontroller with the software.


问:
Linear actuator for impact tests
I'm puzzling over the remake of an impact testing machine. It's a sort of a robot arm that pushes a probe against a target to test its characteristics.

Right now the machine use air pistons, because it's easier to decide the force to exert. The probe is a ball of about 0.5 kg and 8 cm in diameter.

The machine should control three main parameters:

speed at the moment of the impact (roughly between 100 mm/s and 20 m/s)

force to exert against the target (roughly between 5 N and 100 N)

duration of the holding after the impact (between 100 ms and 10+ s)

The goal is to try to redesign the machine using only electrical actuators, like steppers or other motors, avoiding the pneumatic systems.

I'm looking for some ideas how to design the mechanical device to fit the requirements.

Some idea that won't work:

using a standard linear actuator or a stepper coupled with an endless screw: you can easily control parameters 1 and 3, but 2 it's very hard to achieve

using a cam to accelerate and launch the probe without a hard-link to the mechanism: you cannot control the third parameter and hence neither the second

Any thought?

答: Do you have the space to implement a straight-line 4-bar mechanism?  These devices take a rotary input and generate straight-line motion for a point on the coupler.  There are exact straight-line mechanisms as well as approximate straight-line mechanisms.  Challenges may be range of motion, plus the need to implement additional (passive) rotary joints without compromising the dynamics or accuracy of the device.</p>

Title: Linear actuator for impact tests


问:
How to setup CLion for ROS?
How can I setup the C++ IDE CLion to display documentation and auto completion correctly when working with ROS?</p>

答:
Integrating CLion with ROS is actually straight forward and works out of the box if one knows how to do it:

With your console, go into your ROS workspace and source the respective setup.bash file.

Go to the src directory of your workspace.

Start CLion from the console from your src directory.

Close any open projects  in CLion and select Import Project from Sources

Select ONLY the src directory in your workspace for the import.

If CLion complains about CMakeList.txt already existing simply click Open Project

CLion will build symbols for several minutes, then you should be ready to go.

If it still doesn't work make sure that you delete all .idea files from your workspace, that might have been created in previous attempts at using CLion with ROS.

Title: How to setup CLion for ROS?


问:
Do I need to use separate function in PID algorithm to make the bot go LEFT or RIGHT?
Do I need to use separate function in PID algorithm to make the bot go LEFT or RIGHT?</p>

```<code>/**************************
  Author-
  Project- PID Code V-2
**************************/

float Kp = 0, Ki = 0, Kd = 0;
float error = 0, P = 0, I = 0, D = 0, PID_value = 0;
float previous_error = 0, previous_I = 0;
int sensor[5] = {0, 0, 0, 0, 0};
int initial_motor_speed = 100;

void read_sensor_values(void);
void calculate_pid(void);
void motor_control(void);
void motor_left(void);
void motor_right(void);
void setup()
{
  pinMode(3, OUTPUT); //PWM Pin 1;9;EN PIN
  pinMode(5, OUTPUT); //PWM Pin 2;10;EN PIN
  pinMode(12, OUTPUT); //Left Motor Pin 1;4
  pinMode(13, OUTPUT); //Left Motor Pin 2;5
  pinMode(7, OUTPUT); //Right Motor Pin 1;6
  pinMode(8, OUTPUT); //Right Motor Pin 2;7

  Serial.begin(9600); //Enable Serial Communications
}

void loop()
{
  read_sensor_values();
  delay(15);
  calculate_pid();
  delay(15);
  motor_control();
}

void read_sensor_values()
{
  sensor[0] = digitalRead(A0);
  Serial.print("Sensor[0]:");
  Serial.println(sensor[0]);
  sensor[1] = digitalRead(A1);
  Serial.print("Sensor[1]:");
  Serial.println(sensor[1]);
  sensor[2] = digitalRead(A2);
  Serial.print("Sensor[2]:");
  Serial.println(sensor[2]);
  sensor[3] = digitalRead(A3);
  Serial.print("Sensor[3]:");
  Serial.println(sensor[3]);
  sensor[4] = digitalRead(A4);
  Serial.print("Sensor[4]:");
  Serial.println(sensor[4]);
  delay(3);

//  for(int i=0; i<5; i++)
//  {
//    sensor[i] = digitalRead(i);
//    Serial.print("Sensor[i]:");
//    Serial.println(sensor[i]);
//  }

  if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 0) && (sensor[4] == 0) && (sensor[4] == 1))
    error = 4;
  else if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 0) && (sensor[4] == 1) && (sensor[4] == 1))
    error = 3;
  else if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 0) && (sensor[4] == 1) && (sensor[4] == 0))
    error = 2;
  else if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 1) && (sensor[4] == 1) && (sensor[4] == 0))
    error = 1;
  else if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 1) && (sensor[4] == 0) && (sensor[4] == 0))
    error = 0;
  else if ((sensor[0] == 0) && (sensor[1] == 1) && (sensor[2] == 1) && (sensor[4] == 0) && (sensor[4] == 0))
    error = -1;
  else if ((sensor[0] == 0) && (sensor[1] == 1) && (sensor[2] == 0) && (sensor[4] == 0) && (sensor[4] == 0))
    error = -2;
  else if ((sensor[0] == 1) && (sensor[1] == 1) && (sensor[2] == 0) && (sensor[4] == 0) && (sensor[4] == 0))
    error = -3;
  else if ((sensor[0] == 1) && (sensor[1] == 0) && (sensor[2] == 0) && (sensor[4] == 0) && (sensor[4] == 0))
    error = -4;
  else if ((sensor[0] == 0) && (sensor[1] == 0) && (sensor[2] == 0) && (sensor[4] == 0) && (sensor[4] == 0))
    if (error == -4) error = -5;
    else error = 5;
}

void calculate_pid()
{
  P = error;
  I = I + previous_I;
  D = error - previous_error;

  PID_value = (Kp * P) + (Ki * I) + (Kd * D);

  previous_I = I;
  previous_error = error;
}

void motor_control()
{
  // Calculating the effective motor speed:
  int left_motor_speed = initial_motor_speed - PID_value;
  int right_motor_speed = initial_motor_speed + PID_value;

  // Constraining the motor speed:
  constrain(left_motor_speed, 0, 255);
  constrain(right_motor_speed, 0, 255);

  analogWrite(3, initial_motor_speed - PID_value); //Left Motor Speed
  analogWrite(5, initial_motor_speed + PID_value); //Right Motor Speed

  //goForward:

  /*The pin numbers and high, low values are configurable depending on connections */
  digitalWrite(12, HIGH);
  digitalWrite(13, LOW);
  digitalWrite(7, HIGH);
  digitalWrite(8, LOW);
}
</code>```

答:
No, but you do need to calculate the P/I/D terms correctly. You have:

```<code>I = I + previous_I;
</code>```

followed by:

```<code>previous_I = I;
</code>```

With

```<code>I = 0;
previous_I = 0;
</code>```

declared at the start. So your I term will always be zero here. What it should be is:

```<code>error = reference - feedback;
P_error = error;
I_error = I + (error*timeStep);
D_error = (error - previous_error)/timeStep;
prevous_error = error;
</code>```

That is the most bullet-proof way to implement the PID loop. If your loop time is relatively stable, then you can absorb the time steps (the elapsed time between function calls) into the control gains:

```<code>P_term = P_gain * P_error;
I_term = I_gain * I_error;
D_term = D_gain * D_error;
</code>```

Expanding this:

```<code>P_term = P_gain * (error);
I_term = I_gain * (<sum_0^k>(error*timeStep));
D_term = D_gain * ((error - previous_error)/timeStep);
</code>```

I used a <sum_0^k> term (the "sum from zero to k") there to highlight the fact the integral term is a numeric integral composed of:

```<code>I_error = (error_0 * timeStep_0) + (error_1 * timeStep_1) + ... + (error_k * timeStep_k);
</code>```

And if your timeStep is constant at every point, then you can factor it out and say:

```<code>I_error = timeStep*(error_0 + error_1 + ... + error_k);
</code>```

So, regrouping the PID terms:

```<code>P_term = (P_gain) * error;
I_term = (I_gain*timeStep) * (<sum_0^k>error);
D_term = (D_gain/timeStep) * (error - previous_error);
</code>```

At last, you can see that, if your time steps are relatively constant, you can say:

```<code>Effective_P_gain = P_gain;
Effective_I_gain = I_gain*timeStep;
Effective_D_gain = D_gain/timeStep;

P_error = error;
I_error = I_error + error;
D_error = error - previous_error;
previous_error = error;
</code>```

Here you can see that I_error accumulates the error terms. I frequently see the timeStep being left off of the PID error terms, which I grudgingly accept because, as shown above, it's mathematically possible to do, but the problem is that:

If you build modular code (which you should), then gain values you test when you're just doing motor tuning may fail when you add more detailed logic (or remove faulty logic) later in the development cycle. This is because addition or removal of program logic will alter the total time between function calls. The PID loop becomes highly sensitive to logic changes and thus also becomes very difficult to tune.

You can't use empirical tuning methods like Ziegler-Nichols because those tuning methods require you to be using the true PID gains, not the modified gains. The timeStep term scales the integral and derivative gains, and the values diverge pretty quickly.

If your sample time is 10Hz, then your time step is (1/10) seconds, so integral gain is reduced by a factor of ten and your derivative gain is increased by a factor of ten, meaning they're a factor of ONE HUNDRED apart from one another. Ziegler-Nichols and others requires you to tune one gain until you see a particular system response, then set the remaining gains based on a formula that uses the first gain as an input.

If your gains aren't scaled correctly, those tuning methods will all fail. Now you're having twice the difficulty in tuning your PID controller:

You can't use established tuning guidelines to tune the system, so you're guessing at the gains, then

Once you do finally find good gains, your system becomes highly sensitive to changes in logic, which means you'll have to re-tune (entirely by guessing) again.

It's a huge time suck and a big distraction from the project.

Body:
No, but you do need to calculate the P/I/D terms correctly. You have:

I = I + previous_I;

followed by:

previous_I = I;

With

I = 0;
previous_I = 0;

declared at the start. So your I term will always be zero here. What it should be is:

error = reference - feedback;
P_error = error;
I_error = I + (error*timeStep);
D_error = (error - previous_error)/timeStep;
prevous_error = error;

That is the most bullet-proof way to implement the PID loop. If your loop time is relatively stable, then you can absorb the time steps (the elapsed time between function calls) into the control gains:

P_term = P_gain * P_error;
I_term = I_gain * I_error;
D_term = D_gain * D_error;

Expanding this:

P_term = P_gain * (error);
I_term = I_gain * (<sum_0^k>(error*timeStep));
D_term = D_gain * ((error - previous_error)/timeStep);

I used a <sum_0^k> term (the "sum from zero to k") there to highlight the fact the integral term is a numeric integral composed of:

I_error = (error_0 * timeStep_0) + (error_1 * timeStep_1) + ... + (error_k * timeStep_k);

And if your timeStep is constant at every point, then you can factor it out and say:

I_error = timeStep*(error_0 + error_1 + ... + error_k);

So, regrouping the PID terms:

P_term = (P_gain) * error;
I_term = (I_gain*timeStep) * (<sum_0^k>error);
D_term = (D_gain/timeStep) * (error - previous_error);

At last, you can see that, if your time steps are relatively constant, you can say:

Effective_P_gain = P_gain;
Effective_I_gain = I_gain*timeStep;
Effective_D_gain = D_gain/timeStep;

P_error = error;
I_error = I_error + error;
D_error = error - previous_error;
previous_error = error;

Here you can see that I_error accumulates the error terms. I frequently see the timeStep being left off of the PID error terms, which I grudgingly accept because, as shown above, it's mathematically possible to do, but the problem is that:

If you build modular code (which you should), then gain values you test when you're just doing motor tuning may fail when you add more detailed logic (or remove faulty logic) later in the development cycle. This is because addition or removal of program logic will alter the total time between function calls. The PID loop becomes highly sensitive to logic changes and thus also becomes very difficult to tune.

You can't use empirical tuning methods like Ziegler-Nichols because those tuning methods require you to be using the true PID gains, not the modified gains. The timeStep term scales the integral and derivative gains, and the values diverge pretty quickly.

If your sample time is 10Hz, then your time step is (1/10) seconds, so integral gain is reduced by a factor of ten and your derivative gain is increased by a factor of ten, meaning they're a factor of ONE HUNDRED apart from one another. Ziegler-Nichols and others requires you to tune one gain until you see a particular system response, then set the remaining gains based on a formula that uses the first gain as an input.

If your gains aren't scaled correctly, those tuning methods will all fail. Now you're having twice the difficulty in tuning your PID controller:

You can't use established tuning guidelines to tune the system, so you're guessing at the gains, then

Once you do finally find good gains, your system becomes highly sensitive to changes in logic, which means you'll have to re-tune (entirely by guessing) again.

It's a huge time suck and a big distraction from the project.


问:
SLAM system for LIDAR and Stereo camera for cone detection for Autonomous driving
The purpose of the SLAM system is very specific, for detecting cones in an image and triangulate their position to create a map.

The data input would be the camera data, odometry and the LIDAR data.

I have been going through SLAM algorithms on openSLAM.org and through other implementations of SLAM systems.

I would like to know if there are a set of SLAM algorithms specific for the problem I have and what are the most efficient and least time consuming SLAM algorithms available. Any leads would be helpful.

答:
You should probably also add information regarding your sensors, for instance what LIDAR are you to use 2D or 3D etc. The nature of SLAM algorithm shall also depend upon what kind of system do you need to use it on specifically what are the rates that you need, do you need the SLAM to be online or offline etc. Further the machine you run your algorithms may also be the reason which decides which algorithm you finally use.

Regardless I think these are some SLAM algorithms that may help you :

Orb SLAM : http://webdiis.unizar.es/~raulmur/orbslam/ uses only camera information but performs very well at least the RGB-D version.

Google Cartographer : https://github.com/googlecartographer/cartographer needs no introduction.

You should also checkout gmapping - slam-gmapping

Definitely checkout the LOAM algorithm, it uses only LIDAR data but produces very good quality maps, you can use EKF on the odometry that it provides with the one you have, that should give you a good positional estimate.


问:
Grid based SLAM using BeagleBone Green Wireless and RPLIDAR
I've written a grid based DFS algorithm with a PID-based steering system to maneuver a 30cm2 square-grid maze all in Python. The robot is a 4 wheel drive with an approximate size of 20 cm. The robot has a BeagleBone Green Wireless controller which is connected by USB to the RPLIDAR A1.

At this current moment, the robot is underutilizing the LIDAR and I want to begin to learn SLAM. However, the environment is highly predictable which I think makes a full SLAM counterintuitive. I would also like the code to be low CPU strain.

I've seen people converting a conventional SLAM into a grid based but only after the calculations are complete. I was wondering if there is a way to do a Grid Based SLAM right from the start (assume its position and map with a grid).

Accuracy isn't hugely important here as long as it understands a tile and the robot is able to avoid walls.

Any advice, tips or suggestion is appreciated. How would you store the map? How would you locate the position of the robot? How would you map the LIDAR's values?

答:
I would highly recommend you to go through "Improved Techniques for Grid Mapping With Rao-Blackwellized Particle Filters" by Grisetti, Stachniss, and Burgard. There is quite a good implementation of it which can found at the OpenSLAM.org. This website is a gold mine for SLAM algorithms and their implementations. You can learn a lot from there.

The algorithm from the paper, "Improved Techniques in grid mapping with Rao Blackwellized particle filters" is implemented as gmapping (or slam gmapping) and it does precisely what you want. The source code can be found on github.

Hope this helps.


答:
First off, I would highly recommend checking ROS (Robot Operating System) out, the ROS community includes researchers and enthusiasts as well as professionals from all around the world and thus most of what you need to solve the problem is already available there. You would have to just implement what others have done, on your system.

I, rather me and my team, have done the exact same thing as you want and the problem becomes much easier if you are using ROS.

There are pre-built SLAM packages available open source which you can use and for making maps and localizing your robot. Once you have the robot's position in a map that also contains all of the obstacles, you just have to do the path planning so that you do not hit any of the obstacles and reach your goal as fast as possible. Then break your path into neared goal points which are simpler to reach so that just by getting to these points your robot can get to the final goal.

As the problem you have put forth is a rather large problem, I feel it is hard to explain it completely here, but I will try to do as much as I can (When I get time I will add more links to help).

Let us break this problem into several parts,

(Don't worry about some occasional ROS jargon, you'll catch them during the tutorials).

If you are unaware of ROS, I suggest taking a look at it and here is a place where you can learn it hands-on.

Next you will have to get your sensors working with ROS, this should be easy as for most of them you will have packages already made and open source.

Once all your sensors are working with ROS, you will have topics which contain have current sensor data, now you can do anything with them, i would use filters on the data and fuse to find your robots estimated pose. (You should also look into Kalman and Extended Kalman Filters at this point.)

Now is the time when you can use some SLAM (Simultaneous Localization and Mapping) algorithms to have a map with obstacles and your robot at all times.

Do the Motion Planning, break the path into smaller pieces and feed them to your robot in the format it wants (You will need some knowledge about Control Systems at this point).

From my experience you can use these packages : gmapping, robot-poe-ekf, moveit. (Google these by adding ros)

I hope this helps, and all the best man.

Title: How to move a robot to a point while avoiding obstacles?

Body:
I am trying to move a robot in a straight line from point A, to point B. The robot's primary sensor is a Hokuyo URG-04LX-UG01 LIDAR that gives me the magnitude and direction of each point it detects in the form of two arrays.

I also have the wheel encoders on each motor of the robot, so I can obtain some odometry of the robot even though its accuracy will diminish over time.

The problem that I have is that there are obstacles in the path of point A and point B that the robot must go around. I am not sure how to take the readings from the LIDAR, and convert them into movements that go around the obstacle, while also heading to B. Sorry if that doesn't make sense, but I am really confused on how to solve this problem.

Is this an easy problem to solve and I am just over complicating it? Does anyone know of a way to do this? Any help or guidance would be greatly appreciated.


问:
Stop giving current to motor with Roboclaw
I am not an expert on this topic and I know this is kind of old thread but im facing the same issue and I would like some help or advice.

I am using and Arduino and a Roboclaw 2x7A (old version)

At first I was also stopping the motors using

```<code>roboclaw.SpeedAccelM2(address, 0, 0);
</code>```

on each one and it worked, but later I saw it is still consuming current. I used your suggestion and it works, but only for M1, M2 doesn't seem to stop recieving current, less than an ampere, but i would like it to be zero.

I am uploading a piece of code so I can explain myself and to show you what I am doing.

This is the part where it checks if error (difference between origin and goal) is greater than deadzone, if greater then keep moving, if lower, it would stop by itself but also it must stop giving current to that motor.

```<code>  // M1 > Azimut
  //M2 > Zenith

  if (abs(error1) > deadzone1) {
    roboclaw.SpeedAccelDeccelPositionM1(address, 0, 0, 0, posicionM1, depth1);
  } else {
    Serial.println("Azimut - error es menor que deadzone");
    roboclaw.DutyM1(address, 0);
  }
  if (abs(error2) > deadzone2) {
    roboclaw.SpeedAccelDeccelPositionM2(address, 0, 0, 0, posicionM2, depth2);
  } else {
    Serial.println("Zenith - error es menor que deadzone");
    roboclaw.DutyM2(address, 0);
  }
</code>```

And this is the output (with some extra info)

```<code>Azimut - error es menor que deadzone
Zenith - error es menor que deadzone
Encoder1:15531 80 Speed1:0    Temp:  47.10   error : -24
Encoder2:15474 80 Speed2:0    Temp2: 0.00   error : -81
Pos Obj       - M1 : 15555
Pos Real      - M1 : 19.97
azimuthGlobal - M1 : 20.00
Pos Obj       - M2 : 15555
Pos Real      - M2 : 19.90
zenithGlobal  - M2 : 20.00
PWM        Zen : 0   Azi : 0
switch Pin Zen : 0      Azi : 0
e-Stop : 0
total revs Zen : 280000   Azi : 280000
Corrientes Zen : 0.06   Azi : 0.00
</code>```

At the end, as you can see, Zen motor is still recieving 0.06 A, but the other motor is fully stopped.

Why does this only works with one of them?, Or. Is there some configuration I am doing wrong?.

答:
Solved.

Controller error, even when the controller "says" there is current, actually there isn't any!

Update:

The problem is inside the controller Roboclaw. Roboclaw's forum moderator says the problem is because current is too low to get an accurate measure.

A current of .06 amps is noise, not actual current. Anythign under 1
  amp isnt really accurate and even with no motors attached(so there is
  definitely no current) you will usually see readings from 60 to 200ma,
  .06 to .2, coming from the current sensors.

Also, the sensor is not very good calibrated, and there is no way a user can calibrate that.

The current sense is measuring .001v/amp. We already do a lot of
  filtering to get reasonably good values but there is no way to
  completely elliminate the noise or offset error(not without adding
  craszy costs).

Solution: Just ignore any current under 1 amp.

Robloclaw's forum moderator solution: You should use a conditional in your code to display zero if the value is less than around 200ma to 1amp.

More info here


问:
Force calculations for a wheeled robot
I'm trying to work out the wheel force and torque required for a TWIP robot, so that I can size a motor.

I've calculated a maximum traction force of $\small6.51\mathrm N$.
My understanding is that a torque force at the wheels of up to and including $\small6.51\mathrm N$ can be applied, to drive the robot without the wheels slipping. This would give the robot a maximum acceleration of $\small3.92\mathrm{ms}^{-2}$

So, assuming I wanted to achieve the maximum force to drive the robot, and hence the maximum acceleration (assuming pendulum is balanced), I would need a wheel force of $\small6.51\mathrm N$.

There is also resistance against the direction of motion/driving force of the robot, in the form of rolling resistance and aerodynamic drag. From what I've read rolling resistance (a type of static friction) is a resistive moment to wheel rotation, which needs to be overcome by the wheel torque force in order to produce acceleration.

I've calculated a rolling resistance value of $\small0.16\mathrm N$.  The robot is intended for indoor use but in case I take it outside I calculated an aerodynamic drag value of $\small0.14\mathrm N$, using an average wind flow velocity of $\small3\frac{\mathrm m}{\mathrm s}$ for my location.  Taking these resistive forces into account I calculated a wheel force of $\small6.81\mathrm N$ and axle torque of $\small0.20\mathrm{Nm}$, for maximum acceleration of the robot.

I've considered the maximum torque exerted by the pendulum i.e. when it's pitch angle/angle of inclination is at +- 90° from the stable vertical position at 0°.

This torque needs to be matched (or exceeded) by the torque/moment exerted about the pivot by the wheel force, accelerating the robot horizontally.
The wheel force and axle torque required to stabilise the pendulum I've calculated as $\small13.7340\mathrm N$ and $\small0.4120\mathrm{Nm}$ respectively, and an axle torque of $\small\approx0.2\mathrm{Nm}$ for one motor. I ignored rolling resistance and aerodynamic drag for these calculations.

The motor will be a brushed DC motor, so I think $\small0.2\mathrm{Nm}$ should be 25% or less of the motor's stall torque.

Can you please tell me if this is correct?

Here are my calculations and FBD:$$$$

Maximum tractive force

$\begin{align}
F_{t(max)}&=μN\qquad\qquad\qquad\qquad\qquad\qquad Mass\,of\,robot: 1.66\mathrm{kg}\\
&=(0.4)*(16.28\mathrm N)\qquad\qquad\qquad\,\,\,\,Weight\,of\,robot:16.28\mathrm N\\
&=6.51\mathrm N\qquad\qquad\qquad\qquad\qquad\,\,\,\,\,\,Number\,of\,wheels:2\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\,\,\,\,\,Wheel\,radius: 0.03\mathrm m\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\,\,\,\,\,Mass\,of\,pendulum:1.4\mathrm{kg}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\,\,\,\,\,Distance\,from\,axle\,to\,pendulum\,COM:0.2575\mathrm m
\end{align}$

$F_{t(max)}$: Maximum tractive force

$μ$: Coefficient of friction

$N$: Normal force at wheel$$$$

Maximum acceleration of robot

$\begin{align}
a_{r(max)}&=\frac{F_{t(max)}}{m}\\
&=\frac{6.51\mathrm N}{1.66\mathrm{kg}}\\
&=3.92\mathrm{ms}^{-2}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$a_{r(max)}$: Maximum acceleration of robot

$F_{t(max)}$: Maximum tractive force

$m$: Mass of robot$$$$

Rolling resistance force

$\begin{align}
F_{rr} &= C_{rr}N\\
&=(0.01)*(16.28\mathrm N)\\
&=0.16\mathrm N\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$F_{rr}$: Rolling resistance force

$C_{rr}$: Rolling resistance coefficient

$N$: Normal force at wheel$$$$

Drag resistance force

$\begin{align}
F_{d} &= C_{d}\left(\frac{ρ*v^2}{2}\right)A\\
&=1.28\left(\frac{1.2\frac{\mathrm {kg}}{\mathrm m^3}*(3\frac{\mathrm m}{\mathrm s})^2}{2}\right)0.06\mathrm m^2\\
&=0.14\frac{\mathrm{kg}\cdot\mathrm m}{\mathrm s^2}=0.14\mathrm N\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$F_{d}$: Drag resistance force

$C_{d}$: Drag coefficient

$ρ$: Mass density of fluid

$v$: Flow velocity of fluid relative to object

$A$: Reference area/projected frontal area of object$$$$

Wheel force/tractive force for maximum acceleration of robot

$\begin{align}
F_t-F_{rr}-F_d&=ma_{r(max)}\\
F_t-0.16\mathrm N -0.14\mathrm N &=(1.66\mathrm{kg})*(3.92\mathrm{ms}^{-2})\\
F_t&=(1.66\mathrm{kg})*(3.92\mathrm{ms}^{-2})+0.16\mathrm N +0.14\mathrm N\\
&=6.81\mathrm N
\end{align}$

$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad$
OR
$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad$

$\begin{align}
F_w&=F_{t(max)}+F_{rr}+F_d\\
&=6.51\mathrm N +0.16\mathrm N +0.14\mathrm N\\
&=6.81\mathrm N\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$F_t$: Tractive force

$F_{rr}$: Rolling resistance force

$F_{d}$: Drag resistance force

$m$: Mass of robot

$a_{r(max)}$: Maximum acceleration of robot

$F_w$: Wheel force

$F_{t(max)}$: Maximum tractive force$$$$

Axle/wheel torque for maximum acceleration of robot

$\begin{align}
T_a&=F_w r\\
&=(6.81\mathrm N)*(0.03\mathrm m)\\
&=0.20\mathrm{Nm}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$T_a$: Axle/wheel torque

$F_w$: Wheel force

$r$: Wheel radius (lever arm length)$$$$

Maximum torque exerted by pendulum

$\begin{align}
T_{p(max)}&=F_p r\\
&=(1.4\mathrm{kg}*9.81)*(0.2575\mathrm m)\\
&=3.5365\mathrm{kg}\cdot \mathrm m\\
&=3.5365\mathrm{Nm}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$T_{p(max)}$: Maximum torque exerted by pendulum

$F_p$: Force applied to pendulum

$r$: Distance from axle to pendulum COM (lever arm length at +/- 90° )$$$$

Wheel force to stabilise pendulum

$\begin{align}
T_{p(max)}&=F_w r\\
3.5365\mathrm{Nm}&=F_w*(0.2575\mathrm m)\\
F_w&=\frac{3.5365\mathrm{Nm}}{0.2575\mathrm m}\\
&=13.7340\mathrm N\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$T_{p(max)}$: Maximum torque exerted by pendulum

$F_w$: Wheel force

$r$: Distance from axle to pendulum COM$$$$

Axle/wheel torque to stabilise pendulum

$\begin{align}
T_a&=F_w r\\
&=13.7340\mathrm N*(0.03\mathrm m)\\
&=0.4120\mathrm{Nm}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$
$\therefore$

$\begin{align}
T_{a(one\,motor)}&=\frac{0.4120\mathrm{Nm}}{2}\\
&=0.2060\mathrm{Nm}\\
&\approx0.2\mathrm{Nm}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\end{align}$

$T_a$: Axle/wheel torque

$F_w$: Wheel force

$r$: Wheel radius (lever arm length)

$T_{a(one\,motor)}$: Axle/wheel torque for one motor$$$$

FBD

答:
I've calculated a max. traction force of 6.51N. Does this mean a
  torque force at the wheels of up to and including 6.51N can be
  applied, to drive the robot without the wheels slipping?

...

$max(F_{t}) = μN$

Yes, the traction force equation means that the wheels can push on that surface with up to and including that force (and the surface pushes back with an equal and opposite force, accelerating the robot) without the wheels slipping.

Also, I've calculated a rolling resistance value of 0.16N. Am I
  correct in thinking this value needs to be added to the wheel force,
  so as to provide enough force to overcome it?

...

$F_{rr} = C_{rr}N$

Yes, Wikipedia defines "specific rolling resistance" $C_{rr}$ as "the force per unit vehicle weight required to move the vehicle on level ground at a constant slow speed where aerodynamic drag (air resistance) is insignificant and also where there are no traction (motor) forces or brakes applied."

Newton's second law $\vec{F} = m\vec{A}$ applies to this free body diagram -- the acceleration of your vehicle, times its mass, equals the net total force.
The net total force in the horizontal direction on your vehicle appears to be the traction force $F_t$ of the ground on the contact patch of the wheel (this actual traction force is almost always far less than the maximum traction force $max(F_{t})$), the (effective) rolling resistance $F_{rr}$, and the force due to aerodynamic drag -- forces that in some cases may align in the same direction and add up, but in more common cases are opposing and partially cancel out.

Title: Force calculations for a wheeled robot


问:
Correctly calculating free acceleration given NED referenced orientation quaternion and sensor referenced acceleration data
I have a sensor outputting correct, calibrated North-East-Down referenced quaternions describing the orientation of the sensor. It also outputs raw, sensor referenced acceleration data, inclusive of gravity. I want NED free acceleration, without gravity.

What I have been doing is rotating the acceleration data by the quaternion, and subtracting gravity from the z axis. this doesnt really make sense to me.

I think it should be something more like

Rotate acceleration data by the quaternion (brings data to some strange frame?

Subtract gravity from z axis

Inverse rotation (back to sensor frame?)

Second inverse rotation? (goes to NED frame??)

Any explanation would be appreciated

答:
I think you have the concept down. I'm not sure what the "some strange frame" would be, or how you would have a transform to that frame.

You know, by physics, that gravity points down in the world frame. You know, by your sensor's orientation quaternion, how the sensor is oriented relative to the world.

So, as you mention:

Rotate acceleration data by the quaternion from the sensor frame to the world frame.

Subtract gravity from the down axis (typically z or y - be sure to read the sensor's data sheet!)

Rotate the acceleration data from the world frame to the sensor frame.

I'm not positive why you would want that last step though, unless you were doing something strictly in the local frame. Generally you would care about how an object is oriented or how it moves with regards to an arbitrary start location in the world frame.

That is, once you rotate the acceleration data to the world frame, you can remove gravity, and then perform your single and double integrations to get speed and position with respect to the world frame. I'm not sure what you get by going back to the sensor frame after removing gravity.

Maybe this is your fourth point?

Second inverse rotation? (goes to NED frame??)

Right, because again you care about how the object moves with respect to the world. If you don't care about that relationship then you're in a pretty small minority of IMU applications, and I personally can't really imagine the scenario you're working with.

But, if you look, your points three and four cancel and you're left with one and two - rotate to world frames, remove gravity.


问:
Euler-Lagrange Dynamic model
I'm working on a masters thesis and need to calculate Mass inertia matrix ($M$), Coriolis/Centrifugal matrix ($C$), and the gravity matrix ($G$) in the equation $M\ddot{\theta} + C\theta + G = \tau$ (to get the dynamic model).
I'm trying to calculate PD control in matlab, but I'm unsure if I need to calculate $M$, $C$, $G$ for every orientation of the robot as it moves.
I assume so, but I don't want to code it and then find out I didn't need to.
Please advise.</p>

答:
You haven't included a diagram of your robot, so I don't know how big or complex these matrices are to calculate, but I would argue that you might not need to constantly recalculate the values if your controller isn't sensitive to the parameter changes.

At the master's level, I would hope you have a good grasp on dynamics and kinematics and would be able to know what the "best" and "worst" case scenarios are for loading on your joint(s). For example, an arm that is fully extended would provide maximal torque to a shoulder joint, and arm that is curled up would provide the minimal torque to the shoulder joint.

Calculate your matrices at the nominal or average use case, then calculate your gains for that case. Then, calculate your matrices at the minimum and maximum use cases and compare performance with the nominal gains. This is referred to as a sensitivity analysis.

If you can prove that there is a "negligible" difference in performance between the min/max cases when you use the nominal control gains, then you're in the clear. If you fail this test (if there is a "non-negligible" difference in performance) then you need to calculate the system parameters in order to maintain satisfactory performance.

A couple notes:

Be careful with PD control - the integral term I is what eliminates steady-state error. Derivative control is highly sensitive to noise.

If you're going to go through the effort of modelling the system ("plant"), then you may want to consider using a more advanced control mechanism like a state feedback controller.

On that note, also be careful with the state feedback controllers - they are for use with Linear, Time-Invariant (LTI) systems. LTI means that your model must be linear and the only thing that is allowed to change with respect to time is the state vector. I would suggest you look at LQR control for nonlinear systems.

Finally, with regards to calculating the new matrices with every orientation, I would suggest you read more about Jacobian matrices. The Jacobian is basically a vector of vectors (matrix) that gives the mathematical expression for how a particular value changes when the underlying parameters change. It's a matrix of partial differentials, and you can use it to find how each of your control matrices changes when things like the joint angles change. A change of XX percent on a particular joint causes a YY percent change in your matrix, etc.

Title: Euler-Lagrange Dynamic model


问:
Is there a benefit to using 2 IMU units on a UAV set at different sensitivities?
I noticed that some IMU units are tuned to be sensitive to small changes, other to large changes and some that can be adjusted between different sensitivities. I am familiar with the use of a Kalman filter to normalize readings, but I was wondering if my UAV could benefit from a second IMU where the two are set at high and low sensitivities to get even more accurate and timely information.</p>

答:
I think you're mixing two meanings of the word "sensitive".

Input Sensitivity

If you have an IMU that gives very raw ("twitchy") readings, then you should be able to generate the output of a less input-sensitive IMU by simply computing a moving average or using a Kalman filter on the output.

This will produce an effect similar to running a low-pass filter on the output signal; the ability of your filter to reject noise will determine how much accuracy you salvage in this process of subsampling.

Output Sensitivity

Accelerometers produce analog output, and in many accelerometers you can adjust the number of $mV/g$ that the reading will be.  This is just the scale factor that lets you match the (expected) output of the IMU to the range of your ADC, in order to get the most precision.  So, your intuition is correct -- you could get 2 accelerometers and mix low and high sensitivity to get better precision when reading slight movements.

Whether It Matters

Ultimately, an IMU that you can buy for less than $50,000 has a limit to its accuracy, and will never be accurate enough for you to use it without other navigational aids -- compasses, GPS units, etc.  Since your vehicle is really only able to react to a certain range of forces, its accelerometers should be tuned to that range.  So, if you have 2 different operating modes that involve 2 different ranges of forces then it might be a good idea to use multiple accelerometers; otherwise, it will produce data that is interesting but not practical (and give you one more source of noise to calibrate).


答:
Accelerometer frames are kind of tricky.  They treat the sign differently for gravity and regular accelerations.  This is the equation they use:
$$
a_{accelerometer} = a_{sensorFrame} - g
$$

See this question for more info:
Why do 3-axis accelerometers seemingly have a left-handed coordinate system?

Title: Correctly calculating free acceleration given NED referenced orientation quaternion and sensor referenced acceleration data

Body:
I have a sensor outputting correct, calibrated North-East-Down referenced quaternions describing the orientation of the sensor. It also outputs raw, sensor referenced acceleration data, inclusive of gravity. I want NED free acceleration, without gravity.

What I have been doing is rotating the acceleration data by the quaternion, and subtracting gravity from the z axis. this doesnt really make sense to me.

I think it should be something more like

Rotate acceleration data by the quaternion (brings data to some strange frame?

Subtract gravity from z axis

Inverse rotation (back to sensor frame?)

Second inverse rotation? (goes to NED frame??)

Any explanation would be appreciated


问:
Is a larger Kv equivalent to more voltage?
I've been a fan of first person view drone Racing for years now and, in thinking of building a new quadcopter, I have a question I'm unable to resolve myself.

Please correct me if I'm wrong:

As i understand, a brushless motor has a maximum torque and power (Watts), if you push it beyond its limits it will start heating and eventually burn.

A brushless motor will always try to match the speed required drawing as much amps as is needed so increasing the power used.

Any brushless motor has a Kv value related to the coils windings that determines the rpm it will get without load per volt applied.

Then, can I say, for example, 1000 Kv at 1 volt will be equivalent to 500 Kv at 2 volts in terms of power, rpm and torque? So could I say it will generate the same lift?

Of course more voltage will reduce the amps but that's not related to the question, I think.

If this is true, I can't understand why actual drones do not run on bigger Kv and fewer cells since cells add weight and Kv not.

EDIT:

As a example of my question the DRL RacerX has broke the speed world record using T-motor f80 wich is a 2408 at 2500kv the manufacturer says it should be run at 16V achieving 680W but the 1900kv says 22V around 1000W.

The DRL used it at 42V (the 2500kv version) still with a 5 inch prop (Sure the motor will not survive for a long time), they just seemed to increase the amp rating of the controllers and just hope the motor will last long enought.

Why did they use such a high voltaje (2 x 5s) since that will not only increase the total weight but that will also increase the amps needed (as its increasing the load).

Im sure they had done their research and made the best they could but i want to understand why is that the best way of achieving it, the main question that comes to my mind is why not a larger prop? it should be much more efficient right? and still that drone is for a max speed record maneuverability is not needed

答:
It is helpful if you think of this in terms of overall power, rather than just voltage.

Imagine you have a machine which requires 100W per motor for your desired flight performance characteristics. This 100W can be delivered to the motor using any voltage/current combination you wish.

For instance, you could deliver it by supplying 100V at 1A, or 1V at 100A, or any other combination.

Your proposed approach, using higher KV motors, would mean using lower voltage but higher current.

The electrical engineering problems that you experience with higher current are harder to solve than those you experience at higher voltages (at least in this range of voltage and current). Switching 100V at 1A is much easier than switching 1V at 100A.


答:
Power is power is power.

As you mention in your post,

Of course more voltage will reduce the amps but that's not related to the question, I think.

Well, it is related to the question, because

$$
P = IV \\
$$

If you have constant power output, then current decreases as voltage increases because you can rearrange that as $I = P/V$. In this expression, you can clearly see that a bigger denominator (bigger voltage) means smaller current, again for a constant power output.

As I mentioned, power is power; you seem to have a good feeling for the electrical power, but consider also that there is a mechanical power:

$$
P = \tau \omega \\
$$

That is, power is torque ($\tau$) times speed ($\omega$). Now you can hopefully see where I'm going. Just like the constant power expression for electrical power shows that current declines for increasing voltage, mechanical power can be rearranged to show:

$$
\boxed{\tau = \frac{P}{\omega}} \\
$$

Torque declines with increasing speed for a constant power!

Torque is important because it affects your ability to accelerate:

$$
\tau = I \alpha \\
$$

Where $I$ is the moment of inertia of the load and $\alpha$ is the angular acceleration.

Now, with some of the math explained, consider the performance of a racing vehicle. Depending on the course, you may want a vehicle with a higher top speed, or you may want a vehicle with more acceleration.

Assume for a moment that the maximum power output of the drone is fixed by the "class" or performance tier for the competition. For example, single A racing might have a 10 watt limit, but triple A racing might have a 250 watt limit. This is hypothetical, but a good argument for the need for a constant power assumption.

You, as the designer and/or crew chief, would obviously want a motor that performs at the maximum allowable power output for your class. Now, if you have a track that requires a lot of turns, you want to be able to change the speed quickly. Changing speed requires an acceleration, and again, your acceleration is a linear function of your available torque.

If you want a more maneuverable, agile drone, you would pick a motor with a lower Kv constant. This reduces the top speed of the drone in exchange for more torque, meaning you are able to change the speed of the props (and thus change directions) with more authority.

If you want a drone with a higher top speed, then you would pick a motor with a higher Kv constant. This sacrifices torque (and thus maneuverability) for a higher top speed. This would be used for a drone equivalent of drag racing.

Ultimately it is up to the crew chief, pilot, designer, etc. - whoever makes the hardware decisions - to pick the motors that provide the best performance for a given track. As mentioned at the top of the post, it all has to do with the trade-off imposed by the constant power assumption.

Title: Is a larger Kv equivalent to more voltage?

Body:
I've been a fan of first person view drone Racing for years now and, in thinking of building a new quadcopter, I have a question I'm unable to resolve myself.

Please correct me if I'm wrong:

As i understand, a brushless motor has a maximum torque and power (Watts), if you push it beyond its limits it will start heating and eventually burn.

A brushless motor will always try to match the speed required drawing as much amps as is needed so increasing the power used.

Any brushless motor has a Kv value related to the coils windings that determines the rpm it will get without load per volt applied.

Then, can I say, for example, 1000 Kv at 1 volt will be equivalent to 500 Kv at 2 volts in terms of power, rpm and torque? So could I say it will generate the same lift?

Of course more voltage will reduce the amps but that's not related to the question, I think.

If this is true, I can't understand why actual drones do not run on bigger Kv and fewer cells since cells add weight and Kv not.

EDIT:

As a example of my question the DRL RacerX has broke the speed world record using T-motor f80 wich is a 2408 at 2500kv the manufacturer says it should be run at 16V achieving 680W but the 1900kv says 22V around 1000W.

The DRL used it at 42V (the 2500kv version) still with a 5 inch prop (Sure the motor will not survive for a long time), they just seemed to increase the amp rating of the controllers and just hope the motor will last long enought.

Why did they use such a high voltaje (2 x 5s) since that will not only increase the total weight but that will also increase the amps needed (as its increasing the load).

Im sure they had done their research and made the best they could but i want to understand why is that the best way of achieving it, the main question that comes to my mind is why not a larger prop? it should be much more efficient right? and still that drone is for a max speed record maneuverability is not needed


问:
How are color sensors used for line following?
I have to build a line following robot that will be able to detect a selected colored line on the floor and start following it.

How do color sensors do this after detecting the specific colored line?

答:
This is a common problem in First Lego League, and, while legos are simple, the approach would hold for many other environments. Here is a video showing a way to follow the middle of the line using two color sensors. And here is an article showing the principles of how to do it.

In short, the algorithm is like this (assuming you are following the right side of the line)

Calibrate the difference in color between "the line" and "not the
line"

As you drive, continually measure the color, assume you should be measuring half way between "the line" and "not the line".

If the measured color is closer to "the line" then you are too much on the line and need to steer away from it.
the line.

If the measured color is closer to "not the line" then you are too far off the line, and need to steer towards it.


答:
It's great that you are taking an initiative in building/replicating one like EZ-Robot. I would like to add a few things which helps in building a robot:

1) Simplicity.

2) Cost Factor.

By simplicity I mean choosing the right hardware that actually helps your prototype to be built faster and the testing/debugging is easier. For instance, if you choose Raspberry Pi with a Wi-Fi module (I saw one at Adafruit stores for around US$12), the whole setup may be build under US$50. Adding computer vision (I think this will boost up the investment price) since it already runs Linux on it, helps in achieving the ease in usability and development. Now you have a system that can be controlled by many components. Using a Bluetooth module with Raspberry Pi is much cheaper than you may think. Chinese modules are cheap, like US$5-US$10. Hereby you will have an independent robot.

But as you say, you wish to remotely control, the Arduino keeping your PC (since you mentioned Visual Studio), this can be done easily by adding a Wi-Fi module, but Xbee costs are really high, and then use the HTTP protocol to control the robot. The Arduino will be fed with some input, like say numbers ranging from 1-100 that may accumulate 100 tasks. Like move left, right, up down, turn on the light, etc.

So essentially make sure, which development board may help you serve the purpose easily.

Title: How can I create a robot like the EZ-B using a regular Arduino?

Body:
I am interested in building a robot like the EZ-B, sold by ez-robot.com. It comes with an SDK for Visual Studio and has direct scripting in runtime through a USB, Bluetooth, Wi-Fi, IRC or HTTPS connection.

If I get a regular Arduino board, will I be able to control it remotely in the same way? From what I've read, an Arduino needs to hold the instructions in its own memory, but I would rather have the brain in the computer, feeding signals back and forth to the microcontroller.

Also, is Arduino alone, a step down as the website niceley puts it?


问:
How mature is real-time programming in robotics?
Edit: I don't know why, but this question seems to be confusing many people. I am aware of when/where/why/how to use real-time. I am interested in knowing whether people who have a real-time task would actually care enough to implement it in real-time or not.

There's no need to mention why real-time operations are important for a robot. My question is however, how much is it actually used in robotics?

Take this question for example. Only one answer mentions any platform with real-time capabilities, and it is far from the top too. ROS apparently, being a very popular platform which is not real-time.

In the real-time world however, RTAI1 seems to be the only workable free real-time platform of use. It is however, limited to Linux (no problem), badly documented and slowly developed.

So, how much is real-time behavior sought after among robotics developers? The question is, how much are developers inclined to write real-time applications when real-time behavior is actually needed? If not much, why?

For example, reflexive behavior based on tactile data, cannot go through ROS because it would lose its real-time property. But do people really come up with a real-time solution or use ROS anyway, ignoring the real-time property?

1 or similarly Xenomai

答:
The purpose of the software determines whether it needs to be strictly real-time.

Where the purpose is path planning or localization, often a low frequency is sufficent, for example, 10Hz. In these cases, a player/stage setup running on Linux is fine. We can see that there are few problems if one time step is a bit longer or shorter.

Strictly real-time behaviour is required if the robot dynamics are fast. For example, moving a robotic arm to track a position, or to handle/grip objects, and move them. If a time step is missed, the position may overshoot undesirably, and we may want more predictable behaviour. In this case, we may have a frequency up to 1kHz or more. If an operating system is used, we want a real-time operating system.

Real-time behaviour can be accomplished in embedded applications, by using timers and interrupts (compiled C code on a microcontroller). In this case, we must ensure that the processing load is not too high so that a regular sampling frequency can be maintained.

Robots using computers/microprocessors (because more processing power is required), will need to use a real-time operating system to guarantee high sampling rates.

Therefore, whether real-time behaviour is required depends on what the developer intends to use it for.


问:
Issues upgrading Arduino code for Kinect controlled arm from 2 servos to 4
I have arduino code for operating 2 servos, but we are using 4 servos and am having trouble getting the other 2 to talk.

The program so far as I can make out is that the angles for the servos that are calculated by the processing side are being sent out one after the other (shoulder, elbow, wrist, wrist2) then repeated. The arduino program gets this data and stores in into an array and then is written to the pin of the appropriate array segment. So 0 is shoulder, 1 is elbow, 2 is wrist and 3 is wirst2.

I can easily get 2 servos to run with no problem.  But when I try and add 1 or 2 more we get no response.  Can anyone please help me to get the other 2 servos to work?  My knowledge on this code is rather limited, so any help is appreciated.

processing Data being sent to the arduino:

```<code>byte out[] = new byte[4];
out[0] = byte(shoulderAngle);
out[1] = byte(elbowAngle);
out[2] = byte(wristAngle);
out[3] = byte(wrist2Angle);
port.write(out);
</code>```

Arduino Code:

```<code>#include <Servo.h>

//Declares the servos.
Servo shoulder;
Servo elbow;
Servo wrist;
Servo wrist2;

//Setup servo positions.
int nextServo = 0;
int servoAngles[] = {0, 0};

//Define pins for each servo.
void setup()
  {
  shoulder.attach(50);
  elbow.attach(51);
  wrist.attach(52);
  wrist2.attach(53);

  Serial.begin(9600);
}

void loop()
{
  if(Serial.available())
  {
    int servoAngle = Serial.read();

    servoAngles[nextServo] = servoAngle;
    nextServo++;

    if(nextServo > 3)
    {
      nextServo = 0;
    }

    shoulder.write(servoAngles[0]);
    elbow.write(servoAngles[1]);
    wrist.write(servoAngles[2]);
    wrist2.write(servoAngles[3]);
  }
}
</code>```

Sorry for the lengthy post but have been stuck for a while.

答:
I can see two potential problems.

The first is that you're only declaring the servoAngles array to have two elements:

```<code>int servoAngles[] = {0, 0};
</code>```

Your code is equivalent to this:

```<code>int servoAngles[2];
servoAngles[0] = 0;
servoAngles[1] = 0;
</code>```

Later, you're assigning values to servoAngles[2] and servoAngles[3], which are out of the bounds of your original array -- this is very bad practice.  Instead, you should be declaring the servoAngles array the same way you're declaring and initializing your byte out[] array -- it should be declared and/or initialized with 4 elements, as you require.

The other problem that I can see is that you're reading 1 servoAngle value every time you loop, but you're writing all 4.  That means that every 4th byte is automatically going to be sent to the same servo, regardless of whether things get out of sync.  (You would recognize this problem as the proper angle being put at the wrong joint.)

Normally, you'd read all 4 values at once (followed by a newline, or some special sequence of characters that indicates the end of the info) and write all 4 values at once.

Body:
I can see two potential problems.

The first is that you're only declaring the servoAngles array to have two elements:

int servoAngles[] = {0, 0};

Your code is equivalent to this:

int servoAngles[2];
servoAngles[0] = 0;
servoAngles[1] = 0;

Later, you're assigning values to servoAngles[2] and servoAngles[3], which are out of the bounds of your original array -- this is very bad practice.  Instead, you should be declaring the servoAngles array the same way you're declaring and initializing your byte out[] array -- it should be declared and/or initialized with 4 elements, as you require.

The other problem that I can see is that you're reading 1 servoAngle value every time you loop, but you're writing all 4.  That means that every 4th byte is automatically going to be sent to the same servo, regardless of whether things get out of sync.  (You would recognize this problem as the proper angle being put at the wrong joint.)

Normally, you'd read all 4 values at once (followed by a newline, or some special sequence of characters that indicates the end of the info) and write all 4 values at once.


问:
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>

答:
Another group that is working on Kite-flying robots is Professor Srikanth Saripalli's group at Arizona State University. Perhaps looking into that, their videos and contacting them would give you additional perspective.

Professor Srikanth Saripalli's Homepage

Kite-Flying Robot Team - Webpage and Videos


问:
What are the mechanics of translational drift?
Concerning robots which rotate at high speed by spinning the drive motors in opposite directions, while still being able to simultaneously move in a direction (translate):

As far as I know this originated with competitive fighting robots, where it is known as "melty brain" or "tornado drive," according to wikipedia, and is based on alternately slowing down the motors on either side as they revolve around the centre of mass.

However, with the whole body spinning so fast how is the current "heading" of the robot established and maintained?

答:
Okay, so most(if not all) transational drift robots or meltys use an acceleorometer to indicate the heading of the robot. What this acceleorometer does is calculates the rate of rotation based on G-forces around a given radius. The data that is accumulated from the accelerometer is then used to light up an LED once per rotation - giving and indication of the heading of the robot. The driver or user then uses this LED to decide using the remote control the direction he wants to traverse to.

As for the moving, as mundane it might sound is done by switching the motor on and off.
The program or the control of the system turns a motor on when that motor is in the correct position to result in a net movement the direction the robot is indicated to go to.
So for example the LED is lit between 30 and 120 degrees it can be interpreted as the direction of the robot would be around 90 degrees.(Keep in mind that the indications of the heading using the LED is not a 100% accurate, the might be off by more than some tens of degrees. Usually because of the time taken for all the data processing and the time taken to switch the LED's on and off). If you wanted to move forward now, the motors would be needed to be on between 270 and 450(360+90) degrees during each rotation after which the net direction of travel will be 90 degrees.

Likewise if the robot wants to go to the left that is 180 degrees, but its current heading is 90. The motors will need to be on between 0 and 180 degrees.

Hope that helps.


问:
What kind of sensor do I need for knowing that something is placed at a position?
I have a small device that's picking up small rocks from a pile and moving them to another place. Its a kind of crude way of trying to push the whole pile onto a bigger gear and hoping one of them is pushed to one of the spaces between gears and taken around and falls off on the other side of the spinning gear. Here I want to know if the machine successfully got a rock here, if not it should spin the gear until it turns up a single rock on the other side of it. If a rock is present at the spot, the gear should stop spinning until the rock is taken care of by the rest of the machine.

What kind of device can I use to sense if I successfully succeeded in getting a rock on the other side of the gear?

This is just a part of a bigger system. To sum up, I need the sensor to signal when a rock is signaled out and separated from the rest so it can continue work on that single rock.

I am building this using an Arduino to move the gear around, so the sensor needs to be something that can be controlled by an Arduino.

答: IR sensor are best used for detecting any thing but they are quite sensitive to IR lights and sunlight.So if in condition when you are not bothering about Ir rays and sunlight , you can always use a pair of IR LED and Photodiode to make a pair of IR sensor.</p>

ContentLicense: CC BY-SA 4.0


问:
How can I create a robot like the EZ-B using a regular Arduino?
I am interested in building a robot like the EZ-B, sold by ez-robot.com. It comes with an SDK for Visual Studio and has direct scripting in runtime through a USB, Bluetooth, Wi-Fi, IRC or HTTPS connection.

If I get a regular Arduino board, will I be able to control it remotely in the same way? From what I've read, an Arduino needs to hold the instructions in its own memory, but I would rather have the brain in the computer, feeding signals back and forth to the microcontroller.

Also, is Arduino alone, a step down as the website niceley puts it?

答:
Certainly you can.  You need a firmware for the Arduino that accepts remote control commands over the COM channel.  Take a look at Reflecta or Firmata.

I made something like this called RocketBot for Bay Area Maker Faire 2012.  This was a PC remote controlling two Arduinos which ran the motors, a pneumatic rocket launcher, plus a siren and a warning light.  I'll be posting a simpler version of this design that uses more off the shelf parts in a few weeks to the same blog.  This one will have a bluetooth connection to the Arduino in addition to USB.


问:
What useful gaits exist for a six legged robot, and what are their pros and cons?
http://www.oricomtech.com/projects/leg-time.htm lists three gaits:

the tripod

wave, and

ripple.

Can these be improved, or can their relative pros and cons be altered, and are there other gaits worth considering?

答:
Tripod

I have never been a big fan of the traditional tripod gait. It usually looks clumsy, and doesn't really take into account the delicacy of walking over uneven terrain. Walking this way tends to be jerky since one tripod is reaching the end of its travel just as the next tripod is touching down. Exactly how smooth you can make the walk depends on the implementation of your robot. If you have 3 degrees of freedom on each leg, then you have great freedom bring one set of legs forward quickly, bring them carefully into contact with the ground, matching the motion of the ground, and gently taking the robot's weight on them before lifting the other tripod. Alternatively, if you have two fixed tripods, the robot is going to just clunk along like a toy. It also has the lowest payload carrying capacity, since only three legs are on the ground. However, it can be pretty fast, since you're moving three legs at once.

Ripple
This is by far my preferred gait. What I like about this gait is that it's easier to make the walk smoother. At any one time, you have three legs taking the weight, one in flight, one touching down, and one lifting off. It also makes it easier to cope with rough terrain. When the terrain is rough, you may need a moment longer to touch the leg down carefully on the ground, begin to apply weight and see if it's stable. If so, take the weight fully, and continue walking. If not, then it's not a disaster to delay lifting another leg so that you can try to get this one stable.