问:
How do I apply a disturbance observer to a mobile robot?
I have to design a observer to estimate disturbances which are applied to a unicycle model. So, the unicycle model with disturbances is:

$\dot{x}=v cos\theta + d_x$

$\dot{y}=v sin\theta + d_y$

$\dot{\theta}=\omega$

where $d_x$ and $d_y$ are the disturbances, which can be thought as velocities which I cannot access. I would like to define a disturbance observer to estimate these velocities, and use them in the controller for the control law.

The problem is that I am not practicle with disturbance observers, since I have never studied them. Searching online I have understood that I have to define a copy of the system of the type:

$\dot{\xi_x}=v cos\theta + k(x-\xi_x)$

$\dot{\xi_y}=v cos\theta + k(y-\xi_y)$

where I have understood that : $d_x=k(x-\xi_x)$ and $d_y=k(y-\xi_y)$.

Now, I have to design this on Simulink, but while doing it I have realized that I haave not clear from where I should access $\xi_x$ and $\xi_y$. Moreover, from the observer, the output should be $d_x$ and $d_y$, which are the estimates, since I have to use those in the definition of the controller, but in the equation of the observer I am computing $\dot{\xi_x}$ and $\dot{\xi_y}$, so how do I output them in order to send them to the controller?

I am probaly saying something wrong in the question, but I have not clear how to work with observers.

If needed I can write here the Simulink model and the code insede the blocks. I have not written to avoid making the question  too long.

答:
I think the thing to recognize here is that you're not actually going to have an error solely in the x- or y-directions unless the tire is slipping. The errors instead would be better modeled as a linear speed error $v_{err}$ and an angular speed error $\omega_{err}$. Those errors then propagate through your system like you'd expect, with the sine/cosine modifiers, etc.

You mentioned that you're not clear on how to work with observers, so here's a quick tutorial on those.

Suppose you have a linear system with dynamics. If you have states $x$, an input $u$, outputs $y$, then the system is typically modeled as:

$$
\dot{x} = Ax + Bu \\
y = Cx \\
$$

You can't know the true states, though; you can only make approximations or estimates. Your estimates take the same form, though -

$$
\dot{\hat{x}} = A\hat{x} + Bu \\
\hat{y} = C\hat{x} \\
$$

What you want is a way to estimate the error in your system and to then drive that error to zero, so you add a term to your model. In the above model, you can include a "control signal" based on the measurement error.

You can measure the actual output of the system $y$ and subtract from that the output of your model $\hat{y}$. Your model should include some gain $L$ that will drive the state error to zero. This leaves you with a new model:

$$
\dot{\hat{x}} = A\hat{x} + Bu + L(y - \hat{y})\\
\hat{y} = C\hat{x} \\
$$

Now, for the state error. If you define it to be the difference between actual and estimated states:

$$
e = x - \hat{x} \\
$$

Then you can describe how the error changes as the difference between how the actual state is changing and how the estimated state is changing:

$$
\dot{e} = \dot{x} - \dot{\hat{x}} \\
$$

But we've got equations for $\dot{x}$ and $\dot{\hat{x}}$! You can say:

$$
\begin{matrix}
\dot{e} \\
\dot{e}
\end{matrix}
 = \begin{matrix}
\dot{x} & -\dot{\hat{x}} \\
A\hat{x} + Bu & -\left(A\hat{x} + Bu + L(y - \hat{y})\right)
\end{matrix}
$$

I can expand that and re-group terms:

$$
\dot{e} = A\hat{x} + Bu -\left(A\hat{x} + Bu + L(y - \hat{y})\right) \\
\dot{e} = A\hat{x} + Bu -A\hat{x} - Bu - L(y - \hat{y}) \\
\dot{e} = \left(A\hat{x}-A\hat{x}\right) + \left(Bu-Bu\right) - L(y - \hat{y})\\
$$

The input terms there $Bu$ cancel. Also, we can substitute in the expression for $y = Cx$ and $\hat{y} = C\hat{x}$:

$$
\dot{e} = \left(A\hat{x}-A\hat{x}\right)  - L(Cx - C\hat{x}) \\
\dot{e} = A\left(x - \hat{x}\right) - LC\left(x - \hat{x}\right) \\
$$

which, when you substitute back $e = x - \hat{x}$, leaves you with

$$
\boxed{\dot{e} = [A - LC]e} \\
$$

If you are assuming that your state feedback controller is going to use gains of

$$
u = -Gx \\
$$

then your controller winds up looking like:

$$
\dot{x} = Ax + B(-Gx) \\
$$

or

$$
\boxed{\dot{x} = [A-BG]x} \\
$$

That is, the general structure of your state feedback controller and your error dynamics controller are the same. The observer design process is commonly referred to as the "dual" of the controller design process for this reason. For the controller design you're trying to drive the states to zero and for the observer design you're trying to drive the state error to zero.

The error dynamics need to be "faster" than the state dynamics so you drive the error to zero first (and thus your controller acts on a "good estimate" of the states). You can choose whatever you want, but faster error dynamics (higher frequency response) requires more actuator authority. Typically the error dynamics are chosen to be 5 to 10 times faster than the state dynamics.


问:
Transform Velocity data from sensor frame to world frame
I am new to Robotics and transformation topics. I need help in understanding and solving the below problem.

I have data (surrounding obstacle position, orientation and velocity) which are in sensor frame. Basically it gives the relative speed of the surrounding obstacles (v_rx, v_ry)

I have converted the obstacle position and orientation to UTM coordinates (WCS) using Translation and Rotation matrix.

How the velocity can be converted to WCS if the received data (Vx, Vy, Vz) is in sensor frame?

Thank you,

KK

答:
You can use the rotation matrix.

linear_v= R*sensor_linear_v + p X sensor_angular_v
p is the translation vector and the X is the cross operator

angular_v=R*sensor_angular_v

ContentLicense: CC BY-SA 4.0


问:
How can I find the kinematics 2 differential drives attached together along their axes?
I have a system like shown in the diagram

where 2 robots having differential drive are physically constrained together. Traditionally for a single robot, we find the Instantaneous center of curvature (ICC) by equating the "omega"  for both wheels. That would work since there are 2 equations (the relationship between the wheel velocities and angular velocity) and 2 unknowns (the distance of ICC from the center of the wheels and the angular velocity). However, in my system, there will be 4 equations and 2 unknowns. So should I solve it as an over-determined system? Or should I only consider the extreme cases, i.e. left most wheel speed for the left robot and rightmost wheel speed for the right robot? If neither approach is correct then how do I proceed?

答:
You do not have an overdetermined system, you have an underdetermined or redundant system. There are multiple ways to deal with such systems, but all include adding further constraints or equations.

Simplest would be to consider an artificial coupling between the two subsystems. e.g. constrain the differential drives to have the same velocity vector. This way, you add two equations to the existing two equations and you have a fully defined system. Other ways of adding equations can also be considered.

Solving this as on optimization problem with a solver is also feasible. The cost function must be formulated. What is the function that should be minimized. This could be for e.g. deviation from the intended path/trajectory or similar.

EDIT:

After I managed to open the image you attached:
I still do not think this system is overdetermined. I think you have 4 equations and 4 unknowns and you can solve for each.
You can devise a generic formula for the rotational velocity of any wheel on the axis:

$V_i = f(\omega, d) = \omega \cdot d$

Where omega is the rotational velocity of the system around the ICC and d is the distance between the wheel and ICC. Just account for the distances between the wheels and it should be fine.


问:
Localize a Mobile Robot on a Mirror
I am currently busy with a project which requires me to construct a robot capable of cleaning a heliostat (movable mirror used to redirect sunlight). Heliostats are basically large flat mirrors that track and reflect the sun. In order to be cleaned, the heliostats would be stowed in a horizontal position so that the robot may drive over its surface.

My question is then how or what sensors would i use to localize the robot on the mirror. From what i have seen many robotic sensors are unable to effectively detect glass, which seems to be a problem as the systems only real reference is the mirror. I am considering using a type of cliff sensor similar to the ones on robotic vacuum cleaners, but how would i localize the robot when its in the middle region of the mirror? Will the cliff sensors and wheel odometers be enough to fully localize this robot or not? i.e. What sensors would work?

I have attached both a basic image of the robot as well as an image of a typical heliostat the robot will need to clean. Mirror sizes may vary but this size is roughly 1m x 2m Please let me know if i must provide more information to clarify the question.

答:
Maybe this answer comes a bit too late:

How about using a wide angle camera that sees the whole surface of the mirror?
It would be on a separate fixed mount next to the mirror.

Using only image processing to determine the robot position assuming that the camera can see the mirrors edges and the robot can be definitely distinct from the mirror (has an outstanding color for example).

I don't know how the robot is transported from mirror to mirror, but the same transportation means could be used for the camera mount as for the robot. If the robot is not transported, but fixed per mirror, you can have a retractable mount for each mirror.

Title: Localize a Mobile Robot on a Mirror


问:
Understanding import attributes of electronics speakers, by example
I'm new to electronics/robotics and I'd like to start with a simple project that uses a speaker to play sound clips when a certain event/input/stimulus is detected.

Looking on Digi-Key and similar sights, there's a billion little two-wire speakers like this one, but I'm not sure how to make sense of their characteristics/attributes to determine whether they will suit my needs or not.

Are all speakers capable of producing just about any sound, if driven correctly? Or are different speakers "capped" to simpler sounds, like the typical 8-bit audio sound of older video games? What characteristics of speakers determines what kinds of sounds they are capable of playing?

For instance, on Digi-Key, you can search for speakers by a large variety of attributes, such as:

Series (Agile, APS, ASB, etc.)

Technology (Magnetic vs Piezo)

Type (Exciter, General Purpose, Subwoofer)

Frequency Range

Impedance

Efficiency

list goes on

Again, I'm just looking for a speaker that can play some sound clips (that I'll probably record on a computer or phone). Once I know that I'm dealing with a speaker that can play sound clips, I'll start dealing with the headache of figuring out how to drive it and get it to play them.

I do need a small speaker that can fit on a small (bread loaf-sized) hobby project.

Thanks in advance for any and all help!

答: A small speaker like this one should be able to play tunes as you have mentioned. You can use an arduino or a raspberry-pi to stream audio over as shown in this link.</p>


问:
How do CAD programs solve for Inverse/Forward Kinematics problem in Assembly?
I am trying to solve for the Forward kinematics of a spatial parallel manipulator. Its loop closure (LC) equations are pretty long, and are being solved using numerical methods. As I am adding more links to my manipulator, loop closure equations are becoming bigger and more difficult for the numerical method to handle.

It just struck me then. In a CAD program, when I create an assembly of a manipulator and make its links move by dragging the links using mouse, CAD program is instantly solving forward kinematics of that manipulator.

How come the CAD programs respond so fast? Are they solving LC equations all the time? Even if I add more links to my manipulator in CAD program, it has no difference/delay in response!!

答:
EDIT: Improved based on the comments below.

If you have a CAD assembled, that means that you have one valid configuration given. You move the TCP (Tool Center Point) only a small amount, since your mouse  (which drags the mechanism) travels only a small amount between two update periods, that means that the two solutions are close to each other. Each refresh (probably) fills up a buffer of waypoints very close to each other, and for each point in the buffer the solution of the previous point can be used as an initial guess. This buffer essentially becomes a path with waypoints described by the mouse movements. Using the previous position as an initial guess, for the current one, which is only a slight change to the previous position will results in a very fast convergence, probably 5-8 iterations using a simple Newton-Raphson method.

The key to fast numerical solutions is a good initial guess. Using a solution for the kinematics problem in a position physically close to the current one is a great initial guess.

CAD software uses a numerical solver in the background, same as Matlab SimMechanics. If you implement it form scratch, make sure to re-use solutions as an initial guess for the neighbouring positions and you will get fast results.

ContentLicense: CC BY-SA 3.0


问:
Is it better to use Jacobians to compute IK when a closed form for IK is available?
I hope that my question is not too stupid ... but I have a hard time to understand why Jacobians computed from forward kinematics would allow a better and smoother control than using pure inverse kinematics equations when they exist.

I understand that Jacobian may map linearly cartesian coordinates to joints coordinates but why we could'nt get the same result whith small increments of inverse kinematics ?

With the example of a 3 joints robot having to reach the pose (x , y, z) from the current pose (u, v, w), if this new pose requires to increase its joints state from (q0, q1, q2) to (q0 + 10, q1 -20, q2 + 40) and if I order to my robot these joint goals computed form inverse kinematic equations with velocities (v0, v1, v2) proportional to the ordered angular motion (v0, v1 = v0 x 2, v2 = v0 x 4), why this would not provide the same result than those with jacobian control ?

Thanks for helping my understanding.

Ugo,

Many thanks for your detailed explanation. I understand from your reply that Jacobian is used for a large set of tasks I probably don't know. I realized that my questiion is not accurate enough. Practically, I am working on a demonstrator to get a proof of concept on microsurgery. I have designed a 4 DOF slave for which I have found FK and IK closed form equations. This slave is controlled with a custom master control for which I have also the FK equations. I applied a scaling factor from master to slave in order to convert large master motion to smaller slave motion. The scalling is applied on cartesian space. Since this is made within a loop, the motion increments are small.  Each joints velocity is, at each step, ordered to be proportionnal to each joint course to get a synchronized movement. I get a decent result but not as smooth as I expected (hardware is presumed optimally tuned). It is why I consider using only velocity control with numerical jacobians, but I don't understand why it could be better than using small steps of IK with proprtionnal velocities...

Ugo,

Thank you for interest. The slave robot is essentially made of 3 revolute joints which rotation axis are respectively q0: around z (= gravity axis), q1 and q2 both turn around x and q3 rotates around y axis. At the output of motor q3 we have an universal joint linking to a bar which end is constrained in a second universal joint itself linked to the ground.
The master control have similar structure. Right hand rule.

Here are the FK equations:
( Where p4 is the position of the center of rotation of the universal joint linked
to q3 output and p2p4 the constant distance beetween p4 and the center of rotation of motor q1)

```<code> 1- first we compute position of p4:
 p4x = qx - q1 * s0 - q2 * s0 * c1 + p2p4 * (s0 * s1 + s0 * c1)
 p4y = qy + q2 * s1 + p2p4 * (c1 * s1)
 p4z = qz + q1 * c0 + q2 * c0 * c1 - p2p4 * ( s1 * c0 +* c0 * c1)

2- Compute translation and orientation of link p4 to distal pivot (which is the tool)
pE is the part of the link outside the distal pivot (pivotX, pivotY, pivotZ).
(note that pivotZ = 0 by construction):
Ia = sqrt((pivotX - p4x)^2 + (pivotY - p4y)^2 + p4z ^2 )
Ib = IL - Ia //(Translation outside the distal pivot point)
Ibr = Ib / Ia
pEx = pivotX + (pivotX - p4x) * Ibr //(vector projection)
pEy = pivotY + (pivotY - p4y) * Ibr
pEz = -p4z * Ibr
fk.tr = Ib
## tool orientation:
alpha = atan((pEyy - p4y) / (pEz - p4z))
beta = atan((pEx - p4x) / sqrt((pEz - p4z)^2 + (pEy - p4y)^2))
//(gamma, the tool rotation is directly given by q3).
</code>```

A loop read at 650 Hz the pose of the 4 DOF master control, compute the FK and if a change occurs, apply a scaling factor to the cartesian change of mastercontrol and send a new pose to the slave by adding to its IK order the cartesian change to the starting pose of the slave. Velocity orders are sent with values proportionnal to the change in joints values. Basically the slave is position controlled, velocties are used only to synchronize joints motions.
This works, but the global motion is not as smooth as got when motors are individually controlled. And here (microsurgery), smoothness is very important.

答:
My question was probably badly formulated and, finally, I think the right answer is the following:

When a master-slave system is used and when the kinematics or geometry of both systems are not similar, we need to use jacobians for master-slave control due to the intrinsic dynamic differences between master and slave joints motion. So, algebraic IK is not usefull except for reaching some specific points without master control.

Howhever, if the master control velocity is low regarding the control loop speed (= increment betwwen two frames), controlling slave by using IK (if exists) and ordering velocities proportionnal to joint courses is equivalent to using pure jacobian based control.


问:
Mono VIO vs. Stereo-Camera to recover Depth Information
I have a question. I have found some papers, where they use a Mono-VIO to recover depth of a scene. My question is:
Suppose I have a robot arm and attach a mono-VIO system to it. Then I move this arm once over my desk, which is about 1m long. Is it possible to get depth information with metric scaling about the objects lying on my desk from the received data of the Mono-VIO system? With a stereo camera, a snapshot of my desk may be sufficient to accomplish this.

Can someone tell me if this works or if the drift is too high or the accuracy is too low.

答:
You are basically describing an object 3D-reconstruction device. Though usually they use a turntable and fixed camera, but the principle is the exact same. See how this dataset were created. I also know for sure that people sometimes instead use a robotic arm rather than a turntable, so your idea is definitely feasible. The field you want to look into is called multi-view stereo.

I am just going to assume you can find a working multi-view stereo algorithm. So you need to find a way to estimate the positions between the cameras. A Mono-VIO algorithm would work, but is probably not the best solution. One problem is that many Mono-VIO algorithms assume they are always moving to a new area. Basically it forgets past data, because it is irrelevant to the current position. However, in your case the camera is moving in a limited area(the span of the table). So you would you actually want your algorithm to store all the data related to the table, and just use that for pose estimation. They also tend to drift over time, which is again related to not using past data. If you are familiar with SLAM/VIO terms, you want your algorithm to always be doing localization, rather than odometry.

If you do decide to still go the Mono-VIO route then I would recommend ORB-SLAM3. It actually does do localization, so it should hopefully mitigate the drifting problem. However, it would still probably do a large amount of irrelevant work.

As I said before this is actually a pretty common sort of device to build. So you do have other potential options.

Use the robot arm positioning system. If you have a high quality robot arm with good encoders, then it will know how far it moves better than any Mono-VIO system can estimate. You need to calibrate your camera/robot arm together using Hand-eye calibration software, and now when your robot moves you also know how far the camera moves.

Use fiduciary markers like aruco/April tags. Basically put a couple of markers around the table. Your camera can then estimate its position relative to those markers.

Build custom VIO/SLAM system that does more relocalization, and is more customized to your specific problem.

To answer your questions:

Is it possible to get depth information with metric scaling about the
objects lying on my desk from the received data of the Mono-VIO
system?

Yes.

Can someone tell me if this works or if the drift is too high or the accuracy is too low.

Could work with the right Mono-VIO algorithm. A specialized version ,however, would be better.

Overall I would recommend options 1 or 2. Option 3 or  an off the shelf Mono-VIO algorithm should only be attempted if you have to.


问:
Turtlebot 2 dimensions
I am trying to drive the differential drive kinematics of Turtlebot 2. However, I couldn't find the distance between 2 wheels on the datasheet. I'd appreciate if anyone could provide me this dimension.

Thanks.

答: 23 cm from center to center. The wheel's width is 2.4 cm.</p>

Title: Turtlebot 2 dimensions


问:
Why do we say a robotic arm have 2 dof even though the two joints rotates along the same axis?
Why do we say a robotic arm has 2 degrees of freedom even though the two joints rotate along the same axis? Why isn't it called a 1 dof robot?</p>

答: The degrees of freedom of a serial manipulator equals its number of joints. A more general definition can be found on Wikipedia. It is about being able to describe the state (configuration) of the robot (in terms of position) and the length of the vector required to describe the configuration. For a serial kinematic chain the length of the vector equals the number of joints. Even when the setup is redundant, the objective is not to express the pose of the final frame (tool center point or end effector), but the robot itself.</p>


问:
Matlab code to take time derivatives
I have a velocity command, which is:

$v=k_1\rho cos(\alpha)$

where each quantity $\rho$ and $\alpha$ depend by the time.

I would like now to take the time derivative of this, in order to use it as feedforward. The problem is that I have also an angular velocity command, which is much more complex than this, and do it by hand would be almost impossible to do it without mistakes.

So, my question is:

What is a matlab code that takes the time derivative of expression of this type?

答:
In newer versions of Matlab (I can't remember when this change was made) you can define symbolic variables as a function of time, like

```<code>syms rho(t) alpha(t);
</code>```

Symbolic constants are anything defined not as a function of time, like:

```<code>syms k1;
</code>```

Then you can define your expression for v without needing to declare v itself as symbolic:

```<code>v = k1*rho*cos(alpha);
</code>```

Finally, if you want the derivative of this, since you've defined $\rho$ and $\alpha$ as being time-dependent, just call the diff command:

```<code>dvdt = diff(v, t);
</code>```

which yields the following result:

```<code>>> dvdt = diff(v, t)

dvdt(t) =

k1*cos(alpha(t))*diff(rho(t), t) - k1*sin(alpha(t))*rho(t)*diff(alpha(t), t)
</code>```

You can clean it up by recognizing that diff(rho(t), t) is Matlab's way of expressing $\dot{\rho}$ and likewise for $\alpha$, so you wind up with

$$
v = k_1 \rho \cos{\left(\alpha\right)} \\
\frac{d}{dt}v = k_1 \cos{\left(\alpha\right)}\dot{\rho} - k_1 \sin{\left(\alpha\right)} \rho \dot{\alpha}
$$

Title: Matlab code to take time derivatives

Body:
In newer versions of Matlab (I can't remember when this change was made) you can define symbolic variables as a function of time, like

syms rho(t) alpha(t);

Symbolic constants are anything defined not as a function of time, like:

syms k1;

Then you can define your expression for v without needing to declare v itself as symbolic:

v = k1*rho*cos(alpha);

Finally, if you want the derivative of this, since you've defined $\rho$ and $\alpha$ as being time-dependent, just call the diff command:

dvdt = diff(v, t);

which yields the following result:

>> dvdt = diff(v, t)

dvdt(t) =

k1*cos(alpha(t))*diff(rho(t), t) - k1*sin(alpha(t))*rho(t)*diff(alpha(t), t)

You can clean it up by recognizing that diff(rho(t), t) is Matlab's way of expressing $\dot{\rho}$ and likewise for $\alpha$, so you wind up with

$$
v = k_1 \rho \cos{\left(\alpha\right)} \\
\frac{d}{dt}v = k_1 \cos{\left(\alpha\right)}\dot{\rho} - k_1 \sin{\left(\alpha\right)} \rho \dot{\alpha}
$$


问:
Control method advice for Markov (?) process
I'm experimenting with a device for tuning piano strings. It attaches to the piano's tuning pins and turns them slightly by applying a torque impulse. It is a semi-automatic process, handled by a human operator.

Operator presses a piano key, control system records the tone and calculates the frequency error. (The set frequency is known.)

The control system calculates the required size of the torque impulse.

The device applies the torque impulse.

The operator presses the key again. If pitch error is still large, repeat from 1.

The change in frequency caused by a torque impulse is a function of the impulse size and the current frequency of the string.

I'm now going to design a control system for this. So far I've found that it probably is a Markov process, since it is not time dependent and not depends on previous states. But what could be a suitable control method for this application?

答:
There are multiple methods to pose this problem. The good news is, that you are right, and it is a time-invariant system, if you consider multiple keystrokes for tuning one key.

I have no idea about the intricacies of piano/guitar/other string instrument tuning, but it might be worthwhile to check if it is a linear time invariant system.

If you do not want to/cannot go down the LTI route, you can just disregard any highly theoretical controls approach and try an intuitive approach, similar to what you described in your steps, but instead of trying to come up with a torque value in step 2, you just use increments, a constant large increment if you are far away, constant small increment if you are close.

You can see a guitar tuning variant explained here.
A detailed description of a different motorized guitar tuning solution can be found here.

Obviously Machine Learning can also be used to solve this problem. You can pose it as a reinforcement learning problem, where your action space is either discrete (small increment to tighten or to loosen) or continuos (the torque range) your observation space could be the current value of the torque (for the increments) or the frequency response. The reward function is how far you are form the ideal frequency. This would be the lease efficient way to do it, but probably the most fun one...


问:
IMU-Camera Senor Fusion
I am working on fusing IMU and Camera Sensor Fusion for the Drone to precisely land on the target location.

With the Camera, I am tracking the April Tag which is on the ground. This gives me the x,y,z position of the camera in the drone with respect to the April tag on the ground.

With the IMU, I am measuring the Acceleration and Angular rates of the drone. From which I am integrating and finding the x,y,z position of the drone with respect to the starting point.

My question is,

In my case, the Camera provides the x,y,z position with respect to April Tag. And IMU provides x,y,z position with respect to its starting point. How these two different position information fused together help in improving the position accuracy of my system ??

Can I use the Camera x,y,z position to reduce the drift in the IMU. Or Should I only use GPS information to reduce the drift in IMU ??

答:
Short answers:

In my case, the Camera provides the x,y,z position with respect to
April Tag. And IMU provides x,y,z position with respect to its
starting point. How these two different position information fused
together help in improving the position accuracy of my system ??

With an Extended Kalman Filter(EKF). IMU for short term prediction step, and Camera measurements for the slower April Tags position updates. The IMU x,y,z positions are supposed to be integrated from the latest position, not some arbitrary starting point.

Can I use the Camera x,y,z position to reduce the drift in the IMU. Or
Should I only use GPS information to reduce the drift in IMU ??

Yes. And you should use both.

Longer discussion:

The way this is properly done is with an EKF. The IMU gives you position information at a much faster rate in the prediction step portion. The camera, and gps measurements update the EKF estimate at a much slower rate. You can find a ton of papers,tutorials and code online just looking for IMU+GPS EKF.

Should also show you that the way you are describing using the IMU is wrong. You integrate for x,y,z information from the IMU from the last known good position(e.g your latest camera measurement), not from some arbitrary starting point. After a couple of seconds integrating the IMU is already quite inaccurate, so can't use it from some far away position anyways.

The place where you do have a coordinate system mismatch is with the camera and the GPS. GPS gives you GPS coordinates and camera information is relative to the April tag. For this you have 2 options. For both you have to choose a main coordinate frame. For these examples I am going to pick the camera($c$).

1: Use relative updates.

We had a gps measurement at $p_1^g$ which coincided with our latest position $p_1^c$. We now get a new gps measurment $p_2^g$. We can now calculate the relative transform from the first gps to the second. $p_2^g-p_1^g=p_{2,1}$. And then update the position in the camera frame using this relative transform. $p_2^c=p_1^c+p_{2,1}$.

2: Use an offset

Maybe you know where the April tag is in GPS coordinates. Or the first time you observe the April tag you record the GPS and camera position. You can then cal offset between camera and GPS frames. So that when you get a GPS measurement $p_2^g$ you can calculate the position in the camera frame $p_2^c=p_2^g+offset$.

Title: IMU-Camera Senor Fusion


答:
The number of degrees of freedom any mechanism has (including a robot) is solely based on how many different ways there are to change its configuration (the position and orientation of every part of the system).

In the case of a robot arm with two joints, you can change its configuration in two different ways (by moving each joint) so it is said to have two degrees of freedom.

Title: Why do we say a robotic arm have 2 dof even though the two joints rotates along the same axis?

Body: Why do we say a robotic arm has 2 degrees of freedom even though the two joints rotate along the same axis? Why isn't it called a 1 dof robot?</p>


问:
Questions about time derivative of jacobian matrix
I find that in some robotic toolboxs(e.g. FROST https://ayonga.github.io/frost-dev/index.html) they use

to calculate time derivative of jacobian matrix.

Here is my guess about the reason of using this formula:

if this is right, could anyone please tell me how to prove this part which shows that derivative and partial derivative can exchange?

Thanks in advance!!

答:
If you use the partial differentiation you can get to that expression as

\begin{align}
\frac{dJ}{dt} &= \frac{\partial J}{\partial q}\frac{\partial q}{\partial t} \\
\frac{dJ}{dt} &= \frac{\partial J}{\partial q}\frac{d q}{d t}\\
\frac{dJ}{dt} &= \frac{\partial (J \dot q)}{\partial q}
\end{align}

In the last line $\dot q$ is a constant that can enter the partial differentiation part.


问:
Adding 90 degrees to DH parameter
I am trying to learn DH parameters for this anthropomorphic arm is.

What I understand is robot's/or serial arms can have different initial position.

But here, how is theta 3 = theta 3 + pi/2?

I am struggling to intuitively understand why the pi/2 is added

.com/AwLrb.png

答:
There are two kinds of (rotary or linear) position encoders: relative and absolute. A relative encoder only "knows" what the position is relative to what position it was in when the encoder was powered on.

The DH parameters define the arm's joint arrangement. It looks like your upper/first image would be the DH parameters with the joints all at an absolute zero value.

If the encoders were relative, you could turn power off to the arm, reposition it manually, and then power it back on. The relative encoder has no knowledge of what happened while it was powered off and so they always default to zero on startup.

The joint configuration didn't change, but your value for $\theta_3$ changed because it's now offset - this is the information that was lost when the joint was reconfigured.

The $\pi/2$ value is the "joint angle correction" to account for the fact that you are treating the joint angle $\theta_3$ as "zero" when the arm is straight.

Title: Adding 90 degrees to DH parameter


问:
How to consider gravity for the state space modeling
I'm trying to find the state-space model of the following ball-in-tube system.
I designed the SISO system, with the h(ball height), w(angular velocity of propeller), and I(current) as the system states. I tried to find out the stat-space model by using the state-space model of DC-motor and dh/dt = Kw - v0 (experimentally obtained, where K is constant, v0 is an intercept).
The question is how I can deal with v0 to obtain the state-space model form of dx/dt = Ax+Bu, y = Cx +Du.

答:
Make gravity a state that doesn't change, like:

$$
\left[
\begin{matrix}
\dot{x}\\
0
\end{matrix}\right] = \left[\begin{matrix}
A & 0 \\
0 & 0
\end{matrix}\right]\left[\begin{matrix}
x \\
g
\end{matrix}\right] + \left[\begin{matrix}
B \\
0
\end{matrix}\right]u
$$

Then gravity is a state and you can include it with whatever coefficients you need. You of course won't be able to control the system, because there is no path back to manipulate the gravity state, but you can go for the lesser "stabilizable" system and control the states that actually matter.


问:
how to find Singularity and jacobian Inverseof 5 DOF Robotic arm?
I am working on calculating the Jacobian Determinant to find the singularity of my 5 DOF Robotic arm, I have calculated the jacobian matrix, and the matrix I got is a very large value
As it is non square matrix(6x5),For singularity I am using Pseudo Inverse method( I studied in a Research Paper)
Jinv=(Jtrans)(Inverse(JJtrans))
But In Matlab when I calculate the Inverse of (J*Jtrans) It goes Out Of memory, what is the alternate or right method to do that
I know It is not the Matlab forum but I want to know is that right jacobian matrices Or I am doing some thing wrong in calculating the jacobian( as being very large matrice)I am also attaching the code  am using

答:
Are you trying to somehow use this to determine lengths of the linkages later or are you trying to find the singular pose of one specific manipulator?

In case you are doing a study on how to calculate linkages lengths, you need a PC with more RAM if you want to progress.

If you already have values for the lengths, you should not use these as symbols, just use them as values instead. The only symbols should be the joint angles. That will make the matrix smaller and will fit in memory.


问:
Is it uncommon to use a gearbox with a brushless motor?
I've spent far too long this evening researching whether it's possible to clone a Starship; for my own amusement and/or to terrorise the neighbourhood. A Starship delivery robot, that is, not the SpaceX Starship.

Amongst other detail there's a fair bit of info on the basic specifications knocking about:

Weight: 23kg empty

Payload: 10 kg

Battery: 18.5V 8000 mAh

Runtime: 2 hours / 6 km

Speed: 3 km/h nominal; 6 km/h max

Motors: brushless

Wheel diameter: 200mm (derived from Dimensions.com)

Utilising the calculation elaborated in this Medium post and Robot Shop's motor sizing tool, I reckon the six motors need to rotate at about 80 rpm, with a torque of about 1 Nm and power of 6 W each if I consider a similar weight. I can sort of get there with a geared DC motor something like this economy variant from Active Robots and can probably get even closer with a bit more research.

But I note the above spec lists use of "brushless electric motors." If the brushless motors are anything like those i used in aircraft then they'll turn at a high rpm. Unlike DC brushed motors, I'm struggling to find (m)any turnkey brushless motors with a gearbox ready-attached and then opening up a whole world of pain to find the right combination. Is brushless + gearbox a normal use-case, or am I going down blind alley?

答: Yes, brushless and grearbox is a normal usecase. Due to the popular application of using brushless motors on drone propellers other applications are harder to find. The keywords "Brushless Planetary Gear Motor" gives me plenty good search results.</p>


问:
How do I send text to a Torobot USB device?
I'm trying to get the "Torobot" USB servo controller to work with Angstrom Linux on a Beagle Board XM.

The servo controller registers as a USB device. The device just takes simple text commands, but there is no TTY associated with it. So I'm not sure how to send commands to it.

Can I just send data like this (assuming that 002/005 is the device):

```<code>$ cat file.txt >> /dev/bus/usb/002/005
</code>```

Or do I need to associate it with the generic USB device? If so, how do I do that?

答:
Finally Success:

I found that the Torobot USB board could be communicated with an Arduino serial driver.  Conveniently this is available through opkg:

```<code>opkg install kernel-module-cdc-acm
</code>```

When the board is plugged in, it comes up as

```<code>/dev/ttyACM0
</code>```

From here you can  simply echo commands to the device.

```<code>echo "#8P1500T100" > /dev/ttyACM0
</code>```

This basically says "set servo 8 to position 1500 with speed 100"

Body:
Finally Success:

I found that the Torobot USB board could be communicated with an Arduino serial driver.  Conveniently this is available through opkg:

opkg install kernel-module-cdc-acm

When the board is plugged in, it comes up as

/dev/ttyACM0

From here you can  simply echo commands to the device.

echo "#8P1500T100" > /dev/ttyACM0

This basically says "set servo 8 to position 1500 with speed 100"


问:
How can I define the saturation function in Matlab?
I would like to write a Matlab code for an angular velocity of this type:

$\omega=\omega_{fb}+sat(\omega_{ff})$

where $\omega_{fb}$ is a feedback angular velocity and $\omega_{ff}$ is a feedforward angular velocity.

As you can see, the feedforward term has been saturated.

The problem is that there is not a saturation function in Matlab. Moreover, I would like to do this inside a Matlab function block, and not use the saturation block of Simulink.

I have heard that some use the atan() function to perform the saturation, but I am not sure I can do this.

So, my question is:

How can I define the saturation function in Matlab?

答:
You could always employ conditional expressions that are clear and explicit.
Instead, if you like compact forms, you may implement saturation as below:

w = w_fb + min(hi, max(low, w_ff));
```

where hi and low are the upper and lower bounds of the saturation.

Body:
You could always employ conditional expressions that are clear and explicit.
Instead, if you like compact forms, you may implement saturation as below:

w = w_fb + min(hi, max(low, w_ff));

where hi and low are the upper and lower bounds of the saturation.


问:
How do I compute the feedforward terms in a control law using Matlab?
I have the following situation. I have computed the linear and angular velocity which are the controls for a mobile robot, which have the form:

$v_d=v_{fb}+v_{ff}$

$\omega_d=\omega_{fb}+\omega_{ff}$

now, I would like to define the acceleration controls, and I know that I can do it in the following way:

$a_v=(v_d-v_{actual})+\dot{v_d}$

$a_\omega=(\omega_d-\omega_{actual})+\dot{\omega_d}$

I would like to do this using Matlab\Simulink. This code is inside a Matlab function clock.

my question is:

Is there a way I can compute the feedforward terms $\dot{v_d}$ and $\dot{\omega_d}$ without computing them manually?

I would like to avoid to compute them manually since their expression is really complicated and it is almost impossible to not make mistakes.

答: How are you calculating $v_d$ and $\omega_d$? Simulink has a derivative block, have you tried using that?


问:
What causes rviz black screen at startup?
I have been running the same rviz conf for months and mostly have had no issues. But lately there is often a black screen at rviz startup and it happens seemingly randomly, without any error messages on the console. More percisely, the rviz visualization window where the map and robot TF-s are supposed to appear, just black color window appears and nothing else. The left and right rviz menus are present and look correct. At first it looked like just the map does not load but after trying with several different maps, it does not seem to be related to any specific map file. Also the console last rows say that the map is loaded successfully:

```<code>>> Map loaded from data with 651 lanes
******* Map V2 Is Loaded successfully from the Behavior Selector !!
</code>```

So far just closing everything and running it again has helped but the issue appears more and more often, approx 50% of the cases. What can be wrong? Can anyone help me to locate the problem?

I also posted the question in ROS answers forum but didn't get any feedback or answers.

ROS Melodic, Ubuntu 18.04, Nvidia GTX 2080 Super.

答:
```<code>Also the console last rows say that the map is loaded successfully
</code>```

What map are you loading? Could you share the rviz configuration you are facing issues with? And are you sure the map is what you expect it to be?

Also, could you try to launch rviz (bare) without the map and/or any other special plugins you might be using and see if you still face issues? If you don't, there is probably a bug in the plugin/viewer or the map you are using. I suggest turning off everything and launching them one at a time to see when the issues starts and if it persists.

Body:
Also the console last rows say that the map is loaded successfully

What map are you loading? Could you share the rviz configuration you are facing issues with? And are you sure the map is what you expect it to be?

Also, could you try to launch rviz (bare) without the map and/or any other special plugins you might be using and see if you still face issues? If you don't, there is probably a bug in the plugin/viewer or the map you are using. I suggest turning off everything and launching them one at a time to see when the issues starts and if it persists.


问:
Invoking "cmake" failed
I am unable to solve this problem. I tried to run catkin_make command in catkin_ws directory</p>

```<code>yograj@yograj-Inspiron-5537:~/catkin_ws$ catkin_make
Base path: /home/yograj/catkin_ws
Source space: /home/yograj/catkin_ws/src
Build space: /home/yograj/catkin_ws/build
Devel space: /home/yograj/catkin_ws/devel
Install space: /home/yograj/catkin_ws/install
####
#### Running command: "cmake /home/yograj/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/yograj/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/yograj/catkin_ws/install -G Unix Makefiles" in "/home/yograj/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/yograj/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /home/yograj/anaconda2/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/yograj/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
ImportError: "from catkin_pkg.package import parse_package" failed: No module named catkin_pkg.package
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/home/yograj/anaconda2/bin/python
  "/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/kinetic/share/catkin/cmake/../package.xml"
  "/home/yograj/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/kinetic/share/catkin/cmake/all.cmake:151 (_catkin_package_xml)
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:52 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/yograj/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/yograj/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
</code>```

答:
I found the solution by many tries. It is not guaranteed that it will help you, in my case, this helped.

A good start was "No module named catkin_pkg.package" on catkin_make w/ Hydro.

The main steps are already documented at a rather neighboured thread of Installing OpenCV fails because it cannot find “skbuild”.

But why do I need to have python -m pip -V = 2.7 and be in the Python base environment in order to get rid of that error?

The standard python -m pip command after having applied sudo apt-get install python-pip under Python 2.7 seems important. python -V must be Python 2.7.17 or the like. This is probably because the catkin installer simply needs the old pip as the standard assignment, in my case in order to deal with gazebo.

By the same time it seems important that sudo apt-get install python3-pip is installed as well, which is then installed automatically under Python 3.6.

If you are in a virtual environment, the configuration of the base environment that is used by the installer is conflicting with versions that are installed in the virtual environment.

This comment of a developer already in 2015 explains why 3.6 is installed even if you have another version like 3.7 or the like installed:

The issue you're running into is that the Python that is turned on by
default is a non-system Python 2.6 install which is unaffected by
installing Python packages with apt-get. By using the minimal image
you avoid having to deal with custom versions of Python.

The old standard 2.6 has now become 3.6; if you install with apt-get, 3.6 will likely be installed. But if you install python-pip instead of python3-pip, it will use a python 2.7 version by default.

apt-get does not at all care about any python version that you already have. That would mean that one should install as much as possible with apt-get to avoid any Python version conflicts / have an independent install. And using pip should at best be clear by putting the needed python -m / python3.7 -m / ... in front.

Quoting something else from catkin_make: No module named 'catkin_pkg':

You'll either have to install catkin_pkg (and a few others) for the
Python 3 interpreter (using the pip3 command shown by @...),
or make sure Catkin uses the Python 2 interpreter.

My recommendation would be the latter, as the rest of Melodic will
also have been built against Python 2. Not Python 3.

The next release of ROS 1 (Noetic) will support Python 3.

This was in 2019. In 2020, Python 3 is now supported by ROS, but that does not mean that a project that has started in 2019 supports it entirely. So better keep to python2.7 for pip and most of the installations that you do for a project that has started in 2019 and has cmake errors.

Further ideas:

Invoking “cmake” failed on Stack Overflow

Installing python3-catkin-pkg uninstalls ros-melodic-desktop packages

Title: Invoking "cmake" failed


问:
High derivative gain in PD control
Why does high derivative gain in PD control results in motor noise or chatter?
The graph that I see on MATLAB simulation is smooth enough, so following that it should not make noise..</p>

答: Real signals have noise. Because noise happens on a per-sample basis, you wind up with a derivative that is constantly fluctuating. A derivative gain acts on this fluctuation and feeds it to the motor, resulting in the noise or jitter you observe.</p>

Title: High derivative gain in PD control


问:
EKF SLAM Prediction Step
My question relates to the prediction step in EKF SLAM when we get measurements. This is a question I've encountered while implementing EKF SLAM in ROS.

At the beginning of the SLAM loop, we predict where we think the robot is by taking its expected location given the previous location and the previous controls. If we have valid measurements we then use those to compute the Kalman gain and update the robot position given these measurements.

These measurements, from a LIDAR scan, for example, will probably be captured in between SLAM loops, meaning that at time $t$ the measurements will be with respect to some time between $t-1$ and $t$.

Consider, for example, that the measurements come in at time $t-0.1$. In order to make the update step more accurate, shouldn't we predict up to time $t-0.1$, update, and then predict up to time $t$?

答:
Your intuition is correct. You run the prediction step to the timestamp with the measurement, and then keep on running the prediction step.

Basically prediction, and measurement update must always coincide on the same timestamp.

Now this is easy to do if you know your time delay. If ,however, you don't know it then you have to somehow figure it out, or design your system to be robust against it. Probably the most common method people use is to add the time delay to your state vector.

Title: EKF SLAM Prediction Step


答:
As Ugo Pattacini said, the experiment must be rethought taking into account the dynamics of the ball. In this case, your system will have 4 states: current $j$, angular velocity $\omega$, ball height $h$, and ball speed $s=\dot{h}$.

As pointed out, the dynamics of $s$, neglecting viscous friction and other aerodynamic effects, can be modeled as $\dot{s}={T\over m}-{g\over m}$. The last term (gravity) can be seen as a disturbance $\delta=[0\;0\;0\;{g\over m}]^T$ in your system that you can reject using your control loop.

You can rewrite your state-space model using $$\dot{x}=Ax+Bu+\delta.$$

You can estimate the thrust $T$ running an experiment where the ball gets balanced at multiple heights.

Title: How to consider gravity for the state space modeling

Body:
I'm trying to find the state-space model of the following ball-in-tube system.
I designed the SISO system, with the h(ball height), w(angular velocity of propeller), and I(current) as the system states. I tried to find out the stat-space model by using the state-space model of DC-motor and dh/dt = Kw - v0 (experimentally obtained, where K is constant, v0 is an intercept).
The question is how I can deal with v0 to obtain the state-space model form of dx/dt = Ax+Bu, y = Cx +Du.


问:
What micro controller should I use?
I am planning on building a robot with wheels (later legs, if possible), that can move around the room and analyze certain things, using a couple sensors.
In the later steps more functions such a grabbing are the things I want to add.

Could you recommend me a micro controller?

My concern about Arduino is that there aren't enough slots, Raspberry Pi seems like it constantly needs a screen for the user.

I am a complete amateur when it comes to robotics. However, I am quite familiar with the computer languages Java and Python. Since I wrote a fun app for Android for myself I would love the robot to be compatible with Android, too.

答:
I've used Arduino for a while now, and am very happy with it. It doesn't always need a screen to control it, as you can program it from the computer then run it from the wall. Your concern of low pins on the Arduino is irrelevant, as you could get the Arduino Mega to supply al lthe pins you need. If that is not enough, there are plenty of multiplexer shields you can get to stack on top to give it all the pins you need. However, the Arduino language is different from anything else, and the Raspbery-Pi uses Python, which I am very familiar with. I have not worked with the Raspberry-Pi before, so I don't know all of its functionality.

All in all, I would reccomend the Arduino. Of course, it is your choice, so I also suggest you do some research on your own to figure out if the board you choose has all the functionality you want.

Title: What micro controller should I use?


问:
How to obtain the state space representation of a computed torque control system?
Assuming I have a system:

$$
a \, \ddot{x}_1 + b \, \ddot{x}_2 + c \,\dot{x_1} + d \,\dot{x_2} + e = u_1 \\
f \, \ddot{x}_1 + g \, \ddot{x}_2 + h \,\dot{x_1} + i \,\dot{x_2} + j = u_2
$$

How would I write this system in state space representation:
$$\dot{x} = Ax+Bu$$
$$y = Cx + Du$$

Usually, I would isolate for $\ddot{x_1}$ or $\ddot{x_2}$, but in this case, they are functions of each other.
Would the only way be to rewrite the dynamics in matrix form after setting new state variables?

答:
Before the question can be answered with mathematical terms, a bit meta knowledge may help to understand the thought system. The goal of creating a state space formula for robotics problems is a typical application of the matlab software. The students are educated how to use a commercial software package for describing real world problems.

With this pre-knowledge in mind it is much easier to identify the correct answer. It was given in the internet already under the URL https://in.mathworks.com/help/control/getstart/linear-lti-models.html The website explains, how to use the famous mathematical software for creating a state space model for a torgue control. What is provided too, is how to create the differential equations and transform them into the matrix notation.


问:
Sensing torque of stepper motor
I need to sense the torque of a stepper motor at any given time. I'm planning to tension a wire by using a stepper motor, and in order to keep the wire at a fixed tension I would need to know the tension at any given time. Based on this I can turn the stepper motor to achieve the desired torque.

If this is not possible, appreciate some alternatives on how I can achieve this. I've looked into strain sensors as well, but not sure if this works.

答:
One could brainstorm alternatives to measuring the motor torque electrically.

Measure the tension force directly. Put a load cell  arrangement at the fixed (non-motor) end of the wire.

Route the wire (or a flexible leader) over an idler pulley. Wire tension tries to pull the pulley off its attachment.  Put a load cell there.

Measure the motor torque mechanically. Tension in the wire is trying to wrench the motor off its mounting. Put a load cell there.

Title: Sensing torque of stepper motor


Title: How to obtain the state space representation of a computed torque control system?

Body:
Assuming I have a system:

$$
a \, \ddot{x}_1 + b \, \ddot{x}_2 + c \,\dot{x_1} + d \,\dot{x_2} + e = u_1 \\
f \, \ddot{x}_1 + g \, \ddot{x}_2 + h \,\dot{x_1} + i \,\dot{x_2} + j = u_2
$$

How would I write this system in state space representation:
$$\dot{x} = Ax+Bu$$
$$y = Cx + Du$$

Usually, I would isolate for $\ddot{x_1}$ or $\ddot{x_2}$, but in this case, they are functions of each other.
Would the only way be to rewrite the dynamics in matrix form after setting new state variables?

Body:
$$
\begin{align}
a \, \ddot{x}_1 + b \, \ddot{x}_2 + c \,\dot{x_1} + d \,\dot{x_2} + e &= u_1 \tag{1} \\
f \, \ddot{x}_1 + g \, \ddot{x}_2 + h \,\dot{x_1} + i \,\dot{x_2} + j &= u_2 \tag{2}
\end{align}
$$
Let's write Eq(1) without $\ddot{x}_2$, hence:
$$
\begin{align}
a \, \ddot{x}_1 + b \, \Big[\frac{u_2-f \, \ddot{x}_1 - h \,\dot{x}_1 - i \,\dot{x}_2 - j}{g}\Big] + c \,\dot{x}_1 + d \,\dot{x}_2 + e &= u_1 \\
\left[a-\frac{bf}{g} \right] \, \ddot{x}_1 +  \, \frac{b}{g}u_2 - \frac{bh}{g} \,\dot{x}_1 - \frac{bi}{g} \,\dot{x}_2 - \frac{b}{g}j + c \,\dot{x}_1 + d \,\dot{x}_2 + e &= u_1 \\
%
\left[a-\frac{bf}{g} \right] \, \ddot{x}_1  = u_1 -  \, \frac{b}{g}u_2 + \frac{bh}{g} \,\dot{x}_1 + \frac{bi}{g} \,\dot{x}_2 + \frac{b}{g}j - c \,\dot{x}_1 - d \,\dot{x}_2 - &e \\
%
\ddot{x}_1  = \left[\frac{g}{(ag-bf)} \right] \left[u_1 -  \, \frac{b}{g}u_2 + \frac{bh}{g} \,\dot{x}_1 + \frac{bi}{g} \,\dot{x}_2 + \frac{b}{g}j - c \,\dot{x}_1 - d \,\dot{x}_2 - e\right]  \tag{3}
\end{align}
$$
Now we do same procedure which is eliminating $\ddot{x}_1$ from Eq(2) hence,
$$
\begin{align}
f \, \Big[\frac{u_1- b \, \ddot{x}_2 - c \,\dot{x_1} - d \,\dot{x_2} - e}{a}\Big] + g \, \ddot{x}_2 + h \,\dot{x_1} + i \,\dot{x_2} + j &= u_2 \\
%
\Big[ g - \frac{fb}{a}\Big] \ddot{x}_2 +  \frac{f}{a} u_1 - \frac{fc}{a} \,\dot{x_1} - \frac{fd}{a} \,\dot{x_2} - \frac{fe}{a} + h \,\dot{x_1} + i \,\dot{x_2} + j &= u_2 \\
%
\Big[ g - \frac{fb}{a}\Big] \ddot{x}_2  = u_2 -  \frac{f}{a} u_1 + \frac{fc}{a} \,\dot{x_1} + \frac{fd}{a} \,\dot{x_2} + \frac{fe}{a} - h \,\dot{x_1} - i \,\dot{x_2} - j \\
%
\ddot{x}_2  = \left[\frac{a}{(ag-bf)} \right] \left[ u_2 -  \frac{f}{a} u_1 + \frac{fc}{a} \,\dot{x_1} + \frac{fd}{a} \,\dot{x_2} + \frac{fe}{a} - h \,\dot{x_1} - i \,\dot{x_2} - j \right] \tag{4}
\end{align}
$$
Now let $y_1=x_1, y_2=\dot{x}_1, y_3=x_2, y_4=\dot{x}_2$, hence:
$$
\begin{align}
\dot{y}_1 &= y_2 \\
\dot{y}_2 &= \left[\frac{g}{(ag-bf)} \right] \left[u_1 -  \, \frac{b}{g}u_2 + \Big[\frac{bh-cg}{g}\Big] \,y_2 + \Big[\frac{bi-dg}{g} \Big] \,y_4 + \frac{bj-eg}{g}\right] \\
\dot{y}_3 &= y_4 \\
\dot{y}_4 &= \left[\frac{a}{(ag-bf)} \right] \left[ u_2 -  \frac{f}{a} u_1 + \Big[\frac{fc-ha}{a} \,\Big] y_2 + \Big[\frac{fd-ia}{a}\Big] \,y_4 + \frac{fe-aj}{a}  \right]
\end{align}
$$

where $ag\neq bf$. You can proceed from here.


答:
First, isolate the second order from the other terms:

$$
a \, \ddot{x}_1 + b \, \ddot{x}_2 =- c \,\dot{x_1} - d \,\dot{x_2} - e + u_1 \\
f \, \ddot{x}_1 + g \, \ddot{x}_2 = - h \,\dot{x_1} - i \,\dot{x_2} - j + u_2
$$

Then, put it in a matrix form:

$$
\left[\begin{matrix}a&b\\f&g\end{matrix}\right]\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]=\left[\begin{matrix}- c \,\dot{x_1} - d \,\dot{x_2} - e + u_1\\- h \,\dot{x_1} - i \,\dot{x_2} - j + u_2\end{matrix}\right].
$$

Supposing $\left[\begin{smallmatrix}a&b\\f&g\end{smallmatrix}\right]$ is invertible, we can left multiply both sides by $\left[\begin{smallmatrix}a&b\\f&g\end{smallmatrix}\right]^{-1}$:

$$
\left[\begin{matrix}a&b\\f&g\end{matrix}\right]^{-1}\left[\begin{matrix}a&b\\f&g\end{matrix}\right]\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]=\left[\begin{matrix}a&b\\f&g\end{matrix}\right]^{-1}\left[\begin{matrix}- c \,\dot{x_1} - d \,\dot{x_2} - e + u_1\\- h \,\dot{x_1} - i \,\dot{x_2} - j + u_2\end{matrix}\right].
$$

Thus, we get:
$$
\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]
=
{1\over ag-bf}
\left[\begin{matrix}g&-b\\-f&a\end{matrix}\right]\left[\begin{matrix}- c \,\dot{x_1} - d \,\dot{x_2} - e + u_1\\- h \,\dot{x_1} - i \,\dot{x_2} - j + u_2\end{matrix}\right],
$$

$$
\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]
=
{1\over ag-bf}
\left[\begin{matrix}(bh-gc)\dot{x_1}+(bi-gd)\dot{x_2}+(bj-je)\\
(fc-ah)\dot{x_1}+(fd-ai)\dot{x_2} + (fe-aj)\end{matrix}\right]
+{1\over ag-bf}
\left[\begin{matrix}
 g&-b\\
-f&a
\end{matrix}\right]
\left[\begin{matrix}
u_1\\
u_2
\end{matrix}\right].
$$

Using auxiliary variables:
$$
\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]
=
\left[\begin{matrix}\alpha\dot{x_1}+\beta\dot{x_2}+\gamma\\
\delta\dot{x_1}+\epsilon\dot{x_2} + \zeta\end{matrix}\right]
+
\left[\begin{matrix}
 \eta&\theta\\
\iota&\kappa
\end{matrix}\right]
\left[\begin{matrix}
u_1\\
u_2
\end{matrix}\right].
$$

Here, $\gamma$ and $\zeta$ can represent either uncontrolled inputs or disturbances.

As uncontrolled inputs:
$$
\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]
=
\left[\begin{matrix}\alpha\dot{x_1}+\beta\dot{x_2}\\
\delta\dot{x_1}+\epsilon\dot{x_2}\end{matrix}\right]
+
\left[\begin{matrix}
 \eta&\theta&\gamma\\
\iota&\kappa&\zeta
\end{matrix}\right]
\left[\begin{matrix}
u_1\\
u_2\\
1
\end{matrix}\right].
$$

As disturbances:
$$
\left[\begin{matrix}\ddot{x_1}\\\ddot{x_2}\end{matrix}\right]
=
\left[\begin{matrix}\alpha\dot{x_1}+\beta\dot{x_2}\\
\delta\dot{x_1}+\epsilon\dot{x_2}\end{matrix}\right]
+
\left[\begin{matrix}
 \eta&\theta\\
\iota&\kappa
\end{matrix}\right]
\left[\begin{matrix}
u_1\\
u_2
\end{matrix}\right]+
\left[\begin{matrix}
\gamma\\
\zeta
\end{matrix}\right].
$$

Creating the state $s=[s_1\;s_2\;s_3\;s_4]^T=[x_1\;\dot{x_1}\;x_2\;\dot{x_2}]^T$:

$$\dot{s}
=
\dot{\left[\begin{matrix}s_1\\ s_2\\ s_3\\ s_4\end{matrix}\right]}
=
\left[\begin{matrix}
0&1&0&0\\
0&\alpha&0&\beta\\
0&0&0&1\\
0&\delta&0&\epsilon
\end{matrix}\right]
\left[\begin{matrix}s_1\\ s_2\\ s_3\\ s_4\end{matrix}\right]
+
\left[\begin{matrix}
0&0\\
\eta&\theta\\
0&0\\
\iota&\kappa
\end{matrix}\right]
\left[\begin{matrix}
u_1\\
u_2
\end{matrix}\right]
+
\left[\begin{matrix}
0\\
\gamma\\
0\\
\zeta
\end{matrix}\right].
$$

Depending on your system, you can design a controller that rejects those disturbances; the presence of integrators in the system can help remove steady-state errors.


问:
What are the purpose of pre-trained weights for YOLO object detector?
Dear Research Community,

I am new to object detection research and currently working on a project which will detect people using YOLO from a top-down camera image.

While looking through tutorials for YOLO, I see all tutorials asks us to download 'pre-trained weights', but to the best of my knowledge, none of the tutorials talks about why(or how) we are using the pre-trained weights and whether we can train the YOLO model without it.

I will appreciate it if someone can shed some light into what are the pre-trained weights in YOLO?

With best,
Azmyin

答:
I found this post, which sheds some light to this question.
https://machinelearningspace.com/yolov3-tensorflow-2-part-3/

Hope this helps someone out


问:
please identify this switch
can anyone identify this switch type, please? I've been looking all day at various websites. I'm just looking for a very simple touch sensor, and this seems ideal

答: Looks like a broken limit switch. Something like this https://www.zencnc.com/product/limit-switch/</p>

Title: please identify this switch


答:
Firstly, this is a stupid nit-picky thing, but neither the Arduino nor RPi are micro controllers. Anyways, to answer your question:

Neither of your concerns are really problems. Arduinos come in all kinds of sizes and ALL of them should have enough pins to do what you want. And the RPi can easily be run headless, and programs can be run at startup with methods such as cron or by adding it to rc.local.

To simplify things your sensors, I would suggest going with the Arduino, since most sensors use 5v like the arduino does, whereas the Pi uses 3.3v. However, since the Arduino's programmed in a C variant, you may want to use the RPi because it works with Python natively, and you could use Java if you really wanted.

But all in all it comes down to preference, both could get the job done.

Title: What micro controller should I use?

Body:
I am planning on building a robot with wheels (later legs, if possible), that can move around the room and analyze certain things, using a couple sensors.
In the later steps more functions such a grabbing are the things I want to add.

Could you recommend me a micro controller?

My concern about Arduino is that there aren't enough slots, Raspberry Pi seems like it constantly needs a screen for the user.

I am a complete amateur when it comes to robotics. However, I am quite familiar with the computer languages Java and Python. Since I wrote a fun app for Android for myself I would love the robot to be compatible with Android, too.


答:
From what I understand, CNN's like Yolo here, require loads of images to train. These images must have lots of variations in them to be robust enough (in your case variability in types of people, lighting conditions, viewing angles, etc.). Therefore, a popular use case is to use transfer learning where a pre-trained model is used and the user can then train a new model by starting from this point. The idea here, I believe, is that the first few layers have already learnt what kind of features to extract, what to look for in the images, etc. It just needs to learn the last (or maybe last few) layers to work for your specific use case.

Another reason to use pre-trained models is to be able to use readily available images and get comfortable with the framework and see it in practice before starting your own work.

Intel's openvino has a lot of pre-trained models here including one for pedestrian (person) detection which can be converted and used with yolo. This could be used as a starting point in your work!

Title: What are the purpose of pre-trained weights for YOLO object detector?

Body:
Dear Research Community,

I am new to object detection research and currently working on a project which will detect people using YOLO from a top-down camera image.

While looking through tutorials for YOLO, I see all tutorials asks us to download 'pre-trained weights', but to the best of my knowledge, none of the tutorials talks about why(or how) we are using the pre-trained weights and whether we can train the YOLO model without it.

I will appreciate it if someone can shed some light into what are the pre-trained weights in YOLO?

With best,
Azmyin


问:
Best kit for prototyping/testing driving/vision algorithms
I'm wondering what's the best vehicle kit for testing control/navigation algorithms. I want something with some degree of hardware abstraction (in the sense of not having to write too much i/o, opening ports, etc.), but that is low-level algorithmically speaking. Like I want something that basically gives me arrays of pixels from a camera and possibly wheel speed/inertial measurements as input and motor speed/steering as output. Not something that's oriented toward high-level programs that "glue together" existing vision/control algorithms from lots of 3rd party code. If I end up reinventing something that looks like an existing algorithm from computer vision/machine learning/control theory then so be it, but I'd like the learning experience/freedom of starting "from physics/geometry/math". I.e I'd rather spend my time as a hobbyist inventing (or reinventing) rather than reading about existing solutions/learning jargon, etc. Also as I'm not a hardware person I don't want to spend most of my time buying/assembling/addressing incompatibilities in hardware. What kit sounds best for this?</p>

答:
Have you looked into ROS? It will abstract the lower levels for you and take care of the inter-process communication. There are several sensor drivers available and you just need to install them to use. There are also several examples available from the official wiki and the user base is awesome!

The turtlebot3 is a good starting robot. It has, I believe, a raspberry-pi for the processor and ability to add sensors as you please with native ros support.


问:
Adding 90 degrees to DH parameter
I am trying to learn DH parameters for this anthropomorphic arm is.

What I understand is robot's/or serial arms can have different initial position.

But here, how is theta 3 = theta 3 + pi/2?

I am struggling to intuitively understand why the pi/2 is added

.com/AwLrb.png

答: A joint angle $\theta_n$ is defined as the angle between $X_{n-1}$ and $X_n$ measured about $Z_{n-1}$. In the case of $\theta_3$, please notice that there is an initial angle of $+\pi/2$ (anti-clockwise direction) between $X_2$ and $X_3$, when measured about $Z_2$. Hence, that additional $+\pi/2$ comes in the picture.

Title: Adding 90 degrees to DH parameter


问:
Dynamics with error term
How do the dynamics of a system change when an error term is introduced?
For instance, if I have a system (computed torque control - robot manipulator):

$$M\ddot{q} + C\dot{q} + G = u$$
and $e = q-q_{ref}$, where $q_{ref}$ is a time varying reference, how would this system be rewritten in terms of the error $e$?

I was thinking it would be:

$$M\ddot{e} + C\dot{e} + G = u$$

but then I would be missing terms $-M\ddot{q_{ref}}$ and $-C\dot{q_{ref}}$ correct?

I am confused on how tracking errors manifest in the system equation.

答: You are confusing the “robot + controller” with the robot itself.   Every physical system has dynamic properties.  As shown by your first equation, the dynamics are related to joint accelerations, velocities, and positions (embedded within the matrices).   The desired state has nothing to do with how the physical system responds to its state variables.  That is the job of the computed torque controller.  The controller uses desired states, computes errors, and determines the torque/acceleration values to apply to the individual joints.  But regardless of what the controller commands, the physical robot’s dynamics depend on its state and not on some computed, or desired, state.</p>

Title: Dynamics with error term


问:
pid tuning the wheel velocity
I am using diff drive controller to control the wheels of my robot. Here i am trying to use the control toolbox pid class for making the input velocity and velocity measured from wheel encoder to be equal. Here i have used the computeCommand() to calculate the pwm output to the motors. Here is my code:

```<code>namespace rrbot_control
{

RRBotHWInterface::RRBotHWInterface(ros::NodeHandle &nh_, urdf::Model *urdf_model)
  : ros_control_boilerplate::GenericHWInterface(nh_, urdf_model)
{
    ROS_INFO_NAMED("rrbot_hw_interface", "RRBotHWInterface Ready.");
    nhp_ = ros::NodeHandle("~");
    if (!nhp_.hasParam("my_pid/p"))
        nhp_.setParam("my_pid/p", 100.0);
    if (!nhp_.hasParam("my_pid/i"))
        nhp_.setParam("my_pid/i", 10.0);
    if (!nhp_.hasParam("my_pid/d"))
        nhp_.setParam("my_pid/d", 0.0);
    if (!nhp_.hasParam("my_pid/i_clamp_min"))
        nhp_.setParam("my_pid/i_clamp_min", -10.0);
    if (!nhp_.hasParam("my_pid/i_clamp_max"))
        nhp_.setParam("my_pid/i_clamp_max", 10.0);
    nhp_.setParam("publish_state", true);

    my_pid_.init(ros::NodeHandle(nhp_, "my_pid"), false);

    x_to_control_ = 0.0;
    ROS_INFO_STREAM("Node ready");

    min_ang = 0.00119361423;
    prev_right_wheel_pos = 0;
    prev_left_wheel_pos = 0;
    max_pwm_to_max_vel_radio = 80.7501211252;
    time = ros::Time::now();
    Setup();
}

void RRBotHWInterface::read(ros::Duration &elapsed_time)
{
    const char* enc_data = Read();
    std::vector<std::string> result;
    boost::split(result, enc_data, boost::is_any_of(","));
    if(result.size()==2) {
        int curr_left_wheel_pos = atof(result[0].c_str());
        int curr_right_wheel_pos = atof(result[1].c_str());
        int delta_left_wheel_pos =  prev_left_wheel_pos - curr_left_wheel_pos;
        int delta_right_wheel_pos = prev_right_wheel_pos - curr_right_wheel_pos;
        joint_position_[0] += delta_left_wheel_pos * min_ang;
        joint_velocity_[0] = (delta_left_wheel_pos * min_ang)/elapsed_time.toSec();
        joint_position_[1] += delta_right_wheel_pos * min_ang;
        joint_velocity_[1] = (delta_right_wheel_pos * min_ang)/elapsed_time.toSec();
        prev_left_wheel_pos = curr_left_wheel_pos;
        prev_right_wheel_pos = curr_right_wheel_pos;
    }
}

void RRBotHWInterface::write(ros::Duration &elapsed_time)
{
  // Safety
  enforceLimits(elapsed_time);
  ros::Time tnow = ros::Time::now();
  // If any problem arises, make sure dt is > 0.0
  // as if its 0.0 the computedCommand will be 0.0
  ros::Duration dt = tnow - last_cmd_time_;

  double error1 = joint_velocity_command_[0] - joint_velocity_[0];
  double error2 = joint_velocity_command_[1] - joint_velocity_[1];

  double joint1_out_pow = my_pid1_.computeCommand(error1, dt);
  double joint2_out_pow = my_pid2_.computeCommand(error2, dt);
  std::cout<<"error1="<<error1<<"\t"<<"joint1_out_pow="<<joint1_out_pow<<"\t"<<
      "joint1_velocity_given="<<joint_velocity_command_[0]<<"\t"<<"joint1_velocity_measured="<<joint_velocity_[0]<<std::endl;

  last_cmd_time_ = tnow;
  ros::Duration(0.1).sleep();

  if(joint1_out_pow>255)
      joint1_out_pow = 255;
  else if(joint1_out_pow<-255)
      joint1_out_pow=-255;
  if(joint2_out_pow>255)
      joint2_out_pow=255;
  else if(joint2_out_pow<-255)
      joint2_out_pow=-255;
  std::string pwm_datas = std::to_string(joint1_out_pow)+","+std::to_string(joint2_out_pow);
  while(pwm_datas.length()<16) {
    pwm_datas.push_back(',');
  }
  const char *res = pwm_datas.c_str();
  if(pwm_datas.length()==16) {
    Write(res);
    usleep(10000);
  }
}
</code>```

Here when the input velocity is 20 the pwm is something 10... which is not rotating the wheels due to not having enough power. So the error is equal to 20-0 = 20 itself. My doubt is how do i properly use this pid controller such that the pid controller gives the pwm output which balances the input velocity and output velocity. What is the standard, right way to do it?

答:
If you're using a full PID controller then the integral error term should build until the output gets large enough to turn the wheel. I can't see your PID code so I'm not sure how your error terms are calculated, and I also can't see how that integral clamp is getting applied.

I would recommend against doing any kind of clamping on integral error terms unless you find some really good reason to use it - the integral term is what eliminates steady state error. It should be allowed to grow as big as necessary to do that.

Finally, as a side note, I thought it was odd that you are limiting the output to +/- 255. An 8-bit unsigned value is 0 to 255, but a signed 8-bit value is - 127 to 128. You should double check what the acceptable output range is. You might be correct but I thought it was odd.

Title: pid tuning the wheel velocity


问:
URDF_model_for_Create 2
Can someone has the URDF model for the Create 2.0 from iRobot, I need to simulate at Gazebo the robot and simulate the laserscan with the robot, I would like to know if someone know about something of this for ROS.</p>

答: Might be a bit late, but the create_robot/create_autonomy package has various URDFs for the Create here: https://github.com/AutonomyLab/create_robot/tree/melodic/create_description/urdf</p>

Title: URDF_model_for_Create 2


问:
Another SDK like OpenNI
I am taking information for my project and I need to see libraries ans SDKs. Searching in the web I found that OpenNI has a lot of functions and when I try to found another SDK, I dont find any other. I am working with a Kinect and a XTION so I need an SDK who works in both.

Is there any other SDK o set of libraries that works well in both?

Thanks!

答:
Try the Point Clound Library (PCL). They claim to have support for both. I've used it with Kinect, it works quite well. </p>

<p>------> Point Cloud Library</p>

Title: Another SDK like OpenNI

Body:
Try the Point Clound Library (PCL). They claim to have support for both. I've used it with Kinect, it works quite well.

------> Point Cloud Library


问:
Rotate coordinate frame using 2-axis inclinometer angles
How to rotate coordinate frame (transform point or vector coordinates) using angles from 2-axis inclination sensor if both X and Y angles are non-zero?</p>

答:
The output angle of an inclinometer is generally the angle between the axes of the sensor frame and the horizontal plane instead of the Euler angles. You can refer to the following article about how to use these two angles to get the rotation matrix:

Integrated calibration of a 3D attitude sensor in large-scale metrology

It is worth noting that the inclinometer cannot obtain a complete rotation matrix, and may need to cooperate with other sensors


问:
iRobot Create 2 - bypassing fuse for serial port power, other current limitations?
I've recently acquired a Create 2 and want to power a Raspberry Pi (and potentially other sensors/motors) off of the serial port. I've seen the official recommendations (e.g. power from the motor drivers instead) but am trying to see if I can make use of the more accessible power from the port.

Through testing, it looks like skipping the 200mA fuse (using an ammeter on the board) allows for at least ~1.5A of draw. However, the 26AWG wires of the serial-to-USB cable limit the current to ~360mA for power transmission, which I can bypass by unbundling the cable or just using header wires and recombining them for the USB converter. I also see D80 on the board in particular that could be a little small/have a low current limit, and the traces seem somewhat small in comparison to the traces that lead to the motor outputs.

Are there any other current limitations? If I were to replace or bypass the fuse, what might be an appropriate current limit?

答:
First the disclaimer - if you modify the robot by defeating or replacing the protection features you're on your own.

That being said here is some useful information that will hopefully help you make good design decisions.

The fuse is actually a PTC.  The benefit is when you eventually accidentally short battery to ground in your project the PTC protects but then resets after you clear the fault.  This saves you from having to disassemble the robot and perform additional soldering and eventually damage the SMD pads.  It also avoids you not having the right value fuse and just deciding to short it through because you tell yourself you know what you're doing and you promise yourself you'll be careful.  That never ends badly.

The connector pins are rated for 0.5A each, the diode is a 1A diode, the tracks are 12mil wide 1oz copper, also good for about 1A, and the power supply in the dock delivers 1.25A to the robot when the battery is charging.  A few tens of miliamps go to running the robot processors and the rest of the 1.25A goes to charging the battery.  This last bit is important.  While you are developing on your project it is likely that you will sit the robot on the dock assuming all is good because the dock is powering the robot.  If your project takes all of that 1.25A or more then the remainder actually comes from the battery so you can kill the battery by drawing too much power even while docked.  Be sure to use both pins 1 & 2 and 6 & 7 for power and ground on the connector so you don't overload the contact pins.

A 1A PTC doesn't protect at 1A, it will allow 1A to pass without tripping.  If you choose to replace the PTC choose one that is rated above your expected load but less than 1A.  Usually the goal for the PTC is to protect from a loose wire or failed component from damaging the robot.  The PTC needs to protect before the diode or tracks fuse themselves.  This ends up being a thermal mass race so picking a lower rated PTC biases the race in favor of protecting.  The 200mA PTC was chosen based on the anticipated load of powering processor in the communication cable.

What if you need 1A or more?  You will have to get it via the motor drivers.  The battery has built in protection as well.  Depending on which battery you are using it is either a 4.2A PTC or a 5.5A current limit.  The motor drivers in the robot run directly from the battery rail and have built in current limit.  Those current limits are based on the capabilities of the motor drivers and the anticipated motor loads when it was a Roomba.  You will need to pay more attention to the robot battery state of charge and will need to remember to turn off your project's heavy loads when the robot is docked to enable the battery to charge.

If you need more current then that you will need to provide power from a source other than the robot battery.


问:
Is easier to detect a large or a small marker? (Aruco / Apriltags)
I need to detect Aruco/Apriltags markers and perform pose estimation, but I've no particular constraint on their physical size. I'm not talking about the number of square (e.g. 4x4, 6x6, etc.), but of the dimension of the markers in millimeters.  Which size should I choose, in order to maximise the positive detection rate?
Are large markers easier to detect than smaller ones?

I suspect that the full answer will depend non trivially on the distance camera-markers, and possibly on lighting. Assume good lighting and 0.5-1m distance from the markers, if needed.

Any reference is appreciated.

答:
In general, a larger fiducial will always produce a more robust and accurate measurement.  This is because any sub-pixel detection errors will be reduced by the larger baseline.  (For example, the detector erroneously measures one corner of the fiducial to be 1 pixel too high.  The angular error will be greater if the tag in view is 20 pixels across as opposed to 200).

This is assuming the fiducial isn't so large as to be out of the camera frame.  So the exact dimensions of the tag is highly dependent on your physical robot and environment. And if your set up is sufficiently flexible so that the robot must see the tag from very far away and very close, then you must make the trade off where you need the robot to be able to see the tag.  Or possibly use multiple tags of different sizes.


答:
There is no such “best for prototyping vision algorithms” robot.

I second the ROS OS suggestion for decoupling the mobile platform from the vision processing platform.

If you want a well designed, supported, yet inexpensive mobile platform that already has a ROS node available, the GoPiGo3 has the hardware interface to motors, encoders, sensors, and camera worked out on a variety of programming languages.

Title: Best kit for prototyping/testing driving/vision algorithms

Body: I'm wondering what's the best vehicle kit for testing control/navigation algorithms. I want something with some degree of hardware abstraction (in the sense of not having to write too much i/o, opening ports, etc.), but that is low-level algorithmically speaking. Like I want something that basically gives me arrays of pixels from a camera and possibly wheel speed/inertial measurements as input and motor speed/steering as output. Not something that's oriented toward high-level programs that "glue together" existing vision/control algorithms from lots of 3rd party code. If I end up reinventing something that looks like an existing algorithm from computer vision/machine learning/control theory then so be it, but I'd like the learning experience/freedom of starting "from physics/geometry/math". I.e I'd rather spend my time as a hobbyist inventing (or reinventing) rather than reading about existing solutions/learning jargon, etc. Also as I'm not a hardware person I don't want to spend most of my time buying/assembling/addressing incompatibilities in hardware. What kit sounds best for this?</p>


问:
CNC: Linear motion without timing belt or lead screw
Is it possible to build a CNC whose Linear motion system does not contain any timing belt(pulley) or lead screw(threaded rod).
I was wondering whether I could directly control the Linear motion by securing wheels of a slider onto aluminum rails & directly connecting the wheels to a stepper motor.

The main objective of this question is to find the cheapest method for controlled Linear motion.

答:
In the most literal case, the answer to your apparent question (which is not terminated by an interrogation point but is otherwise phrased much like a question) is "No"... because no such thing as a "CNC" has ever existed in the sense you mean. "CNC" is an adjective, not a noun. Therefore, it is not possible to "build a CNC" at all.

Opening up our translation a little and assuming that by "a CNC" you really mean a CNC router or laser engraver or 3D printer or sewing machine... yes, it is possible to build such a machine using a linear motion system which does not contain any timing pulley or lead screw. You never asked how to accomplish that, but there are many ways of getting it done.

In response to your stated main objective... the cheapest method would be to manually drag you axis back and forth with tiedown twine stolen from Home Depot. That probably isn't going to feel very satisfactory to you, though. I think what you're actually looking for is going to be a stick of All-Thread rod and some clanky nuts that fit it, maybe even some shopmade ones so you don't have to weld them (or glue them) to your carriage. I wouldn't expect your accuracy and repeatability to be any great shakes, but it would do the job very cheaply.

Given that you'll likely want greater accuracy than that, you'd best get used to the fact that any reasonably accurate positioning system is going to be a bit more expensive than you're ready for. That's a good thing, since it means that every dog's man isn't wasting his time & money building a nasty CNC machine in a back bedroom with baling wire and bubble gum.

Just sigh and relax and surf Amazon and eBay looking for Asian import lead screws and ballscrews. They'll get you there. The lead screws will be the most accurate, the timing belts will be fastest, the ball screws will fit somewhere in the middle between speed and accuracy. Oh, they'll also wear worse than the lead screws but not as bad as the timing belts.


问:
Reliably enabling/disabling a PID loop via FSM in a microcontroller
I have a PID loop for a small vehicle implemented in a microcontroller. Currently the PID loop is implemented in a timer interrupt. I want to implement an FSM that will have states that enable or disable the function that the PID loop is controlling, so in some states the PID loop should be disabled and in some it's enabled. I want to implement this control in a way that minimally disturbs the PID loop.

I've been told that I shouldn't disable the timer interrupt if possible. Is a good option for this to implement the FSM itself inside of the timer interrupt and then update the PID loop inside the FSM states?

The alternative would be to have just the PID loop inside the timer interrupt and then the FSM implemented inside the microcontroller's main(), which I think would need to temporarily enable or disable the timer loop while updating state.

答:
Deciding where to deploy the FSM, either in the timer interrupt or in the main routine, is the easiest part. Either way will work just fine. Probably, the FSM is not that critical, hence it could be conveniently running within main(), whereas disabling/enabling the timer interrupt is not really necessary if you resort to the use of a dedicated flag (protected with a mutex) for that.

The trickiest part, instead, is represented by how you stop and reinstate the PID controller without yielding unwanted phenomena. As you know, a PID contains internal states that need to be carefully blended with the plant dynamics that certainly continues to evolve in the meantime.

There exist suitable ways to implement the so-called bumpless switching you may look for in literature or on the web. One interesting example is this practical resource.


问:
Soft LED Protection Material
I am looking for some material to build a soft clear protective covering for RGB LEDs. The material needs to be close to transparent to allow light to shine through, be soft and compliant but sturdy enough to withstand someone standing on it. The ultimate goal is to have a floor of these LEDs that someone can jump in barefoot and change led colors. </p>

<p>I have tried Gel Candle Wax and Silicone but neither worked very well. I am looking for other material ideas and this was the most relevant of the StackExchanges that I could find. </p>

答: Sounds like what you need is transparent vinyl. Opaque vinyl is routinely used as a floor covering ('Cushionfloor', for example)where it is durable and easy to use. The transparent product is readily available, and the price varies because of polishing treatments to render it more window glass like. As you're just shining LEDs thorough it, the cheapest kind should work well. It comes in sheets up to at least 1 mm thick, and you could sandwich layers. I can get 5' by 7' sheets here in Canada for approx ~2$...its sold in many stores as a tablecloth protector. There is also a thicker version with molded nubs that is sold as a floor runner - typically 2' wide and cut to length by many hardware stores. If installed upside down, the LEDs and wires could probably be wound through the nubs, affording them considerable protection.</p>

Title: Soft LED Protection Material


问:
PID control brushed motors via PWM using Encoder Clicks at SetPoints/Measurements
I've read numerous posts (1 , 2, 3 ) about using PID to control motors. All examples I've seen deal with the control signal being in the same units as the measurement signal. For example, use PID to set PWM values and measure PWM values as feedback or read stepper motor values in encoder clicks and then set new motor values also in clicks.

What I'm not understanding is how does one use PWM as the control when the measurements are in Encoder Clicks as would be common on a DC brush motor with encoder. How does the output of the PID taking Clicks as input, outputs and setpoint get translated to an appropriate 0 to 255 PWM signal (Assuming 8-bit PWM)?

It seems like there's a fundamental disconnect between the encoder clicks which can be though of as velocity (change of distance over time) vs PWM control signal which is an amount of power provided to the motor.

My naive guess would be to:

Determine the MAX encoder clicks per second at a given PWM value of 255 emperically.

Determine the MIN encoder value for the PWM value right before the motor stops moving under load. (For example my Pololu motors need at least 60 PWM on my motor controller to actually turn, below that value they just 'whine'.)

Linearly map the encoder readings from the MIN and MAX to an appropriate MIN and MAX PWM reading?

```<code>// Using the Arduino PID library
encoderLow = 60;   // determined empirically
encoderHigh = 8400;// determined empirically
PWMLow = 60; // determined empirically
PWMHigh = 255;  // PWM as which we reach encoderHigh

Input = reading_from_encoder();  // clicks per second
Setpoint = 1000; // also in clicks
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
translated_pwm = map(Output, encoderLow, encoderHigh, PWMLow, PWMHigh)
drive_motor(translated_pwm); // control signal to motor as PWM value.
</code>```

Where Input (the feedback from the encoders), Setpoint, and Output are in clicks. Output is the control signal from the Arduino PID library

Questions:

Is this the normal approach?

My map() function assumes a linear relationship between encoder values and PWM values. I doubt that's true. Is the PID going to compensate for the nonlinearities?

What is the correct way to do this?

答:
A PID controller takes an error as input (the encoder ticks) and yields an output whose unit of measurement $O$ (the PWM percentage, usually) is uncorrelated with the unit of measurement $I$ of the input.

To this end, the PID gains $K_P$, $K_I$, and $K_D$ do have units of measurement:

$[K_P] = \frac{O}{I}$

$[K_I] = \frac{O}{I \cdot s}$

$[K_D] = \frac{O \cdot s}{I}$


问:
Synthesis gradient observer
I ask the advice of specialists on control systems. We have the following system.

Where $u(t)$ and $y(t)$ time-varying input and output. The characteristic $y(t)=f(u(t))$ is assumed to be non-inertial.

Only input and output are available for measurement.

Let me make a reservation that the variant of estimating this derivative by the Euler method, i.e.

$g(t)=\frac{y_{n}(t)-y_{n-1}(t)}{u_{n}(t)-u_{n-1}(t)}$

is not suitable, since the system does not allow elements of delays (delay by 1 time step).

Is it possible to construct an observer estimating the gradient $g(t)=\frac{dy}{du}$?

答:
As you pointed out, $y=f\left(u\right)$ is a static map, hence it does not represent in any way the temporal evolution of a dynamical system.

With this in mind, resorting to an observer is fundamentally a wrong approach. An observer, in fact, provides you with an estimate of the temporal evolution of the dynamical system under subject; however, here $f\left(\cdot\right)$ has nothing to do with the time.

Thereby, you ought to fit a static map. There exist a plethora of methods to achieve this goal but you have to switch from designing an observer to a context where you deal with fitting.

You're already equipped with good knowledge to start: you essentially know the bases $b_1 = -v$, $b_2 = \exp(-v)$, and $b_3 = 1 / \left(v+1\right)$, where $v = u^2$.

You could then try to explore whether a linear combination of $b_i$ fits well $f$, or if you need to resort to polynomial fitting or even nonlinear fitting (e.g. by means of multilayer neural networks).

Once done, you can extract the gradient out of the fitted model.

If you want to fit directly the gradient $g = df/dx$, to avoid problems related to divisions by zero, you could:

feed in $x_i = at_i+b$, with $a>0$ and $b<0$ (to explore the whole range);

read back $y_i = f\left(x_i\right)$;

compute $\dot{\tilde{y}}_i = \left(y_i-y_{i-1}\right)/\Delta t$;

compute $g_i = \dot{\tilde{y}}_i / a$;

fit $g$ based upon the sampled points $g_i$ exploiting the same techniques discussed above.

Title: Synthesis gradient observer


问:
Does the roomba 675 have the same open interface spec and as the roomba create 2?
I see that the create 2 spec says it is based on the roomba 600 series, but I don't know if they are the same or if I should expect differences.  I want to send it a command to get it to turn around with a raspberry PI.  Bump, Virtual Wall, or whatever else works.</p>

答: Yes, the Roomba 675 supports the same Open Interface Spec as the Create 2.  You won't get the custom faceplate with mounting hole locations.  But you can download the locations here.  Remember the serial connector is under the faceplate, then you are good to go.</p>