问:
Create 2 losing serial communication after toggling full to passive while charging
We are having an issue where after toggling the create 2 from passive to active, then waiting a few seconds and toggling back to passive while on the charger, all serial communication fails a certain percentage of the time. (Links to images of current and serial communication down below illustrating it).

Detail

We are working to have the Create 2 power a NUC, auto-charge and stay alive for long (multi-month) periods of time.

Because we are taking power directly off of the battery (Need higher current), we found that we have to toggle the mode from passive to full and back so that it checks the voltage and goes back from trickle charge to full charging if it has been a few hours and the computer has discharged the battery. This is because the trickle charge algorithm does not check voltage as it assumes the load on the roomba is not high enough to discharge.

We started with it failing this way and have now verified that if we just plug a laptop into the create through the usb serial cable with nothing else plugged in and then toggle passive/full/wait/passive, a percent of the time we also get comm failures without any separate hardware.

Because the create 2 turns off after 5 minutes of no communication, we have tried toggling it every 4 minutes and see that reliably happening, so this is not an issue where the create 2 is just going into sleep mode.

Reproducibility

We are seeing a very repeatable issue where the serial communication (Using current generation USB serial cable from iRobot) loses serial communication with the robot some percentage of the time exactly at the point where it starts charging the robot again. After that, no packets come in from the robot for a long while. Some time later, when we have repeatedly tried to toggle from passive to full and back, communication re-appears.

We have verified this using the ROS stack (create_autonomy) and also by directly echoing characters on the command line echo -e "\x07" > /dev/ttyUSB0 to reset things.

When it is in this state, no software resets work, unplugging and replugging the serial cable does not work, etc. We have to take it off the charger physically (or wait for a long time until our system toggles it again and it does work.

We have verified that this occurs (When the create 2 is on its charger) on:

Mac only plugged in over the create cable with no power taken from the system.

NUC taking power directly off the battery through a dc/dc converter.

NUC taking power off an intermediate battery charging from the create.

Mitigating it

We have added ferrite beads on all the cables to mitigate any high frequency noise and that does not seem to solve it either.

We have also tried 3 different create cables w/ different serial/usb chips and even built our own from scratch and not fixed it.

We have tried separately powered usb hubs, unpowered ones and plugging directly in to the computer.

We have tried it on 3 separate create 2's.

I have attached links below with graphs of the output data when it fails. When there is a straight line on current/voltage, that is repeated data, showing that it was stuck and not updating. It always happens right when the system steps up the current to start charging again, so it seems to be linked to a current spike - but only breaks it 1 / 5 or 10 times - it just happens that once broken, it stays that way for a very long time.

Communication fails after multiple successful toggles

Detail showing exactly when communication fails

After many minutes, it is working again

When it has been broken, I have tried turning off our software and addressing the system by echoing data to it directly for OI to turn off, on, reset, etc and do not see communication resume correctly.

If we unplug the roomba from the charger by hand (pull it off), then many times it does work, but not always. If we then reset everything by holding down the buttons, it does seem to work 95% of the time and sometimes we have even had to pull the battery itself to make it work.

If someone has encountered this before, advice would be helpful. We had thought that it was ground loop issues, but given it is on so many different cables, roombas, power situations and compute devices, we are trying to figure out what is fundementally wrong with our setup.

Thanks!

答:
When the Create 2 gets into the state where you can't communicate with it, have you tried manually pressing the Clean button?

If that reliably works, have you considered adding a relay controlled by the NUC to close those contacts through a direct connection to the Clean button contacts.

An alternative is to add a NUC solenoid or servo with an arm to manually push the Clean button

Frank


问:
What materials can I put in front of a RGB camera and LED IR lights to hide the sensors as much as possible?
I'm making a consumer camera prototype and want to make the front look as clean as possible. Right now I use a completely transparent material and the camera and the IR Lights (with their red hue) are clearly visible. I'd like to move to a dark (as black as possible) material that makes the cover look flush and hides the sensors as much as possible.

What materials should I consider, if I want to minimize the impact on what the sensors perceive?

答:
You probably want a plastic cover that is opaque to visible light but transparent to IR, like is used over the LEDs in many TV remote controls. Then the lights will not be visible, but the relevant illumination can still get in and out.

The camera will also see much less visible light that's not coming from your own illumination, but that may be a pro or a con depending on whether you care about seeing anything besides returned IR.

ContentLicense: CC BY-SA 3.0


问:
How to plan path for robotic arm with RRT?
I have written simple RRT planner however I am not sure how to apply it to a robotic arm path planning.

The issue is that of analytical solution absence to inverse kinematics problem. Let me explain.
There are two possible spaces which can be used to plan path:

Joint space.

Since we know exact joints' angles at each planning step it allows us to easily account for end effector orientation and collisions. However it requires goal position to be defined in joint space which requires inverse kinematics solution but I am not sure how to solve IK for the exact angles without analytical solution which not always exists. I use inverse jacobian method which is iterative and requires small timestamps(i.e. trajectory and not a geometric path) to have precise movement therefore it is not clear how to use it to calculate goal position in joint space.

Operational space

Does not require goal to be defined in joint space however on each planning step it is also necessary to solve IK to be able to account for orientation and collisions.

The only way I can see is to make RRT step small enough to be able iteratively compute IK on each planning step however it casts doubts on performance.

Question

So the question is how can I account for orientation and collisions(including self collisions) when planning motion without analytical solution to inverse kinematics problem?

答: Maybe there is a bit of misunderstanding about iterative methods for solving IK problems. Actually, an iterative IK solver does not necessarily require timestamps (or anything related to time). The general principle is that you start with some robot configuration (i.e. joint values) then you iteratively modify the configuration such that it eventually satisfies IK relation (kind of like gradient descent). There should be no problem using an iterative IK method regardless of the space in which RRT operates.</p>


问:
Understanding and implementing belief space planning
I am currently working on state estimation/navigation for a system with multiple robots. As of now, what I have is each robot localizing itself with a Kalman filter, given vision based measurements. As next steps, I am aiming to do two things:

Extend this filtering framework to span over all robots so that they can cooperate and improve each other's localization

Along with the above, construct a path planning framework such that they can navigate in a way that their localization accuracy is always maximized, thereby eliminating the problem of losing position etc.

To this end, I've been reading about multi-robot state estimation and planning strategies, and have come across belief space planning: or planning under uncertainty. While the math intuitively makes sense, I am having issues with how to implement these techniques in my real world scenario, especially for multiple robots. I have experience using algorithms such as EKF, UKF etc., and sampling based planning strategies like PRM/RRT, but I am having trouble with the probabilistic link between these two.

So far, I've been looking into research papers, but as someone who's mainly a programmer, I'm trying find something more approachable that will help me link the (somewhat abstract) math to my specific problem: for instance, helping me define terms such as 'joint belief of the entire group', using the data I have in hand. What are my best options, and are there any better resources I can consult?

答: The kalman filter that you've already been using on single robots can be broadened to apply to the swarm of robots. If you previously represented the state of a single robot with 5 variables, and you have 3 robots, then combine all 3 robot states into one state with 15 variables. That larger state representing the entire group could reasonably be called the "joint belief of the entire group" and would be updated in response to any sensor measurement by any member of the group.</p>


问:
How to use tensor flow on arduino robot
I'm in the process of learning Tensor Flow, and I really want to use it on a new robot I'm going to build. I want the robot to be able to do image recognition, and move towards an image of interest, or follow a path, using neural networks. Is this even possible with tensor flow?

Is the Arduino capable of running neural network frameworks, such as Tensor Flow?

Thanks.

答:
The Arduino is a microcontroller and not a "full" computer.  (See my other answer here.) As such, you will have a difficult time running TensorFlow on the Arduino.

Deploying TensorFlow, or another Neural Network Framework, on your robot has at least two parts:

Training: teaching your network, best performed on a computer or server with a powerful GPU

Deployment: loading your trained model onto your platform for realtime operation.

You would have an easier time training on a desktop computer and deploying to a robotic platform that uses a Raspberry Pi for high-level tasks and an Arduino for low-level tasks.  On the Pi, you could use TensorFlow or OpenCV in either C/C++ or Python.

Depending on your objectives, you may be able to get away with using specialized camera hardware like the Pixy, which would work directly with the Arduino.

Title: How to use tensor flow on arduino robot


问:
Track a moving object
If this has already been answered, by all means please point me to it.

I am in the process of building a quadcopter which I eventually plan to run autonomously by allowing it to track an object and take a video feed of it moving.

GPS is one of the options I've considered, basically:

GPS antena on moving object (person, car, bike, surfer)

GPS antena on quadcopter

Radio to transmit coordinates from moving object to quad copter

Some of the challenges I can foresee are

Line of sight for camera. How does the camera know exactly where to point?

Angle, how can I pre-program the quad to always record, say... 10m to the right of the moving object, or even better, program a set of angles to record from whilst keeping up with the object

GPS accuracy, what happens if the GPS lock is weak?

What are some of my other options? I saw this TED Talk where the quads are following a ball shaped sensor? I believe it uses Kinect cameras and lots of them which is not really an option for this challenge.

So I'm open to hearing some ideas before I start research and development of these features.

答:
Research the accuracy of your proposed GPS receivers.  You may be disappointed.  You can augment GPS accuracy by fusing the GPS receiver output with data from an inertial sensor, but as far as I know you can't get a hobbyist-price system where that's already done, and the problem isn't at all trivial to solve.

For pointing, consider a compass on your quad copter.

It's going to be a pretty rough problem to solve, particularly if you want the quad copter to be small and not tied to a ground station (there's lots you could do if you had video processing capabilities, and the time to get them working, but that's not something that'll readily fit on a small copter).

Title: Track a moving object


答:
This problem can be made easier when formulating an equivalent problem using unit quaternions

$$
q\,q_a = q_b\,q \tag{1}
$$

where each quaternions can be expressed as $w + x\,i + y\,j + z\,k$ while satisfying that $w^2 + x^2 + y^2 + z^2 = 1$, where $i^2 = j^2 = k^2 = i\,j\,k = -1$ (it can be noted that $i$, $j$ and $k$ do not commute, for example $i\,j \neq j\,i$).

For quaternions multiplication it can be shown that it can be written as a matrix vector product, where the matrix is a function of one of the two quaternions. Namely when considering the quaternions $q = q_1 + q_2\,i + q_3\,j + q_4\,k$ and $r = r_1 + r_2\,i + r_3\,j + r_4\,k$, then their product can be written as

$$
\begin{align}
q\,r &=
\begin{bmatrix}
1 & i & j & k
\end{bmatrix}
\begin{bmatrix}
q_1 & -q_2 & -q_3 & -q_4 \\
q_2 &  q_1 & -q_4 &  q_3 \\
q_3 &  q_4 &  q_1 & -q_2 \\
q_4 & -q_3 &  q_2 &  q_1
\end{bmatrix}
\begin{bmatrix}
r_1 \\ r_2 \\ r_3 \\ r_4
\end{bmatrix} \\
&=
\begin{bmatrix}
1 & i & j & k
\end{bmatrix}
\begin{bmatrix}
r_1 & -r_2 & -r_3 & -r_4 \\
r_2 &  r_1 &  r_4 & -r_3 \\
r_3 & -r_4 &  r_1 &  r_2 \\
r_4 &  r_3 & -r_2 &  r_1
\end{bmatrix}
\begin{bmatrix}
q_1 \\ q_2 \\ q_3 \\ q_4
\end{bmatrix}
\end{align}
$$

Dividing by a unit quaternions is the same as multiplication with its conjugate, which is defined as negating the complex parts: $w - x\,i - y\,j - z\,k$. This allows us to write equation $(1)$ as

$$
q\,q_a\,q^{-1} = q_b
$$

which is equivalent to

$$
\begin{bmatrix}
q_1 & -q_2 & -q_3 & -q_4 \\
q_2 &  q_1 & -q_4 &  q_3 \\
q_3 &  q_4 &  q_1 & -q_2 \\
q_4 & -q_3 &  q_2 &  q_1
\end{bmatrix}
\begin{bmatrix}
 q_1 &  q_2 &  q_3 &  q_4 \\
-q_2 &  q_1 & -q_4 &  q_3 \\
-q_3 &  q_4 &  q_1 & -q_2 \\
-q_4 & -q_3 &  q_2 &  q_1
\end{bmatrix}
\begin{bmatrix}
q_{a,1} \\ q_{a,2} \\ q_{a,3} \\ q_{a,4}
\end{bmatrix} =
\begin{bmatrix}
q_{b,1} \\ q_{b,2} \\ q_{b,3} \\ q_{b,4}
\end{bmatrix}. \tag{2}
$$

It can be shown that, while using the fact that $q$ is a unit quaternion, the two matrices in the above equation can be combined into the following expression

$$
\begin{bmatrix}
q_1 & -q_2 & -q_3 & -q_4 \\
q_2 &  q_1 & -q_4 &  q_3 \\
q_3 &  q_4 &  q_1 & -q_2 \\
q_4 & -q_3 &  q_2 &  q_1
\end{bmatrix}
\begin{bmatrix}
 q_1 &  q_2 &  q_3 &  q_4 \\
-q_2 &  q_1 & -q_4 &  q_3 \\
-q_3 &  q_4 &  q_1 & -q_2 \\
-q_4 & -q_3 &  q_2 &  q_1
\end{bmatrix} =
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1-2(q_3^2+q_4^2) & 2(q_2q_3-q_1q_4) & 2(q_2q_4+q_1q_3) \\
0 & 2(q_2q_3+q_1q_4) &  1-2(q_2^2+q_4^2) & 2(q_3q_4-q_1q_2) \\
0 & 2(q_2q_4-q_1q_3) & 2(q_3q_4+q_1q_2) & 1-2(q_2^2+q_3^2)
\end{bmatrix} \tag{3}
$$

the lower right $3\times3$ matrix of the the right hand side of $(3)$ is just the rotation matrix representation of $q$, denoted as $R(q)$. Substituting this result back into equation $(2)$ then we can conclude that there can only be a solution for $q$ given $q_a$ and $q_b$ if and only if $q_{a,1} = q_{b,1}$. This essentially comes down to that both $q_a$ and $q_b$ represent a rotation of the same angle, which would be identical to the requirement that the rotation matrices $R_1$ and $R_2$ have the same eigenvalues/are similar. Another way of writing a quaternion is the axis-angle representation $\cos\left(\theta\over2\right) + \sin\left(\theta\over2\right)(u_x\,i+u_y\,j+u_z\,k)$, where $\theta$ is the angle and $\begin{bmatrix}u_x & u_y & u_z\end{bmatrix}^\top$ the (unit-)axis of rotation. So therefore we can conclude from equation $(2)$ and $(3)$ that $R(q)$ has to map the rotation axis of $q_a$, $\vec{u}_a$, to the rotation axis of $q_b$, $\vec{u}_b$, so $\vec{u}_b = R(q)\,\vec{u}_a$. There are infinitely many rotations which would satisfy this mapping.

The rotations with the smallest angle can be found by using a rotation axis perpendicular to both given axes, which can be obtained using the cross product of the two axes

$$
q_{\min} = \sqrt{\frac{1 + \vec{u}_a \cdot \vec{u}_b}{2}} + \sqrt{\frac{1 - \vec{u}_a \cdot \vec{u}_b}{2}}
\begin{bmatrix}
i & j & k
\end{bmatrix}
\frac{\vec{u}_a \times \vec{u}_b}{\|\vec{u}_a \times \vec{u}_b\|} \tag{4}
$$

where $\vec{u}_a$ and $\vec{u}_b$ are both assumed to be of unit length.

The rotations with the largest angle can be found by rotating 180° around the average of the two axis

$$
q_{\max} =
\begin{bmatrix}
i & j & k
\end{bmatrix}
\frac{\vec{u}_a + \vec{u}_b}{\|\vec{u}_a + \vec{u}_b\|}. \tag{5}
$$

And if it is desired these could be converted to rotation matrices. For example the rotation matrix corresponding to equation $(5)$ can simplified down to the following expression

$$
R_{\max} = \frac{1}{s_1^2 + s_2^2 + s_3^2}
\begin{bmatrix}
s_1^2-s_2^2-s_3^2 & 2\,s_1\,s_2 & 2\,s_1\,s_3 \\
2\,s_2\,s_1 & s_2^2-s_1^2-s_3^2 & 2\,s_2\,s_3 \\
2\,s_3\,s_1 & 2\,s_3\,s_2 & s_3^2-s_1^2-s_2^2
\end{bmatrix} \tag{6}
$$

with $s_n = q_{a,n+1} + q_{b,n+1}\ \forall\,n\in\{1,2,3\}$.

Title: A closed-form solution of $\textbf{R}\textbf{R}_1=\textbf{R}_2\textbf{R}$ w.r.t $\textbf{R}$

Body:
Is there a closed-form solution of $\textbf{R}\textbf{R}_1=\textbf{R}_2\textbf{R}$ with respect to $\textbf{R}\in SO(3)$?

$\textbf{R}_1$, $\textbf{R}_2 \in SO(3)$ are given.

Added:

I tried holmeski's solution but it fails because of rank deficiency in A matrix.(why?) The following code simulates holmeski's solution in matlab. (please correct me if the code is incorrect)

```<code>clear all
cTl=rotx(rand*100)*roty(rand*100)*rotz(rand*100)
lTc = inv(cTl)

for k = 1: 9
    l1Tl2{k}=rotx(rand*100)*roty(rand*100)*rotz(rand*100)
    c1Tc2{k}= cTl*l1Tl2{k}*lTc;
end
R = calib_RR1_R2R_closedform(l1Tl2,c1Tc2)

function R = calib_RR1_R2R_closedform(l1Tl2,c1Tc2_klt)

Astack=[]
for k = 1:length(l1Tl2)
    R1 = l1Tl2{k}(1:3,1:3);
    R2 = c1Tc2_klt{k}(1:3,1:3);
    A = [ R1(1,1) + R1(1,2) + R1(1,3) - R2(1,1) - R2(1,2) - R2(1,3), R1(2,1) + R1(2,2) + R1(2,3) - R2(2,1) - R2(2,2) - R2(2,3), R1(3,1) + R1(3,2) + R1(3,3) - R2(3,1) - R2(3,2) - R2(3,3), R1(1,1) + R1(1,2) + R1(1,3) - R2(1,1) - R2(1,2) - R2(1,3), R1(2,1) + R1(2,2) + R1(2,3) - R2(2,1) - R2(2,2) - R2(2,3), R1(3,1) + R1(3,2) + R1(3,3) - R2(3,1) - R2(3,2) - R2(3,3), R1(1,1) + R1(1,2) + R1(1,3) - R2(1,1) - R2(1,2) - R2(1,3), R1(2,1) + R1(2,2) + R1(2,3) - R2(2,1) - R2(2,2) - R2(2,3), R1(3,1) + R1(3,2) + R1(3,3) - R2(3,1) - R2(3,2) - R2(3,3)]
    Astack = [Astack; A];
end

det(Astack)

[U S V] = svd(Astack);
x=V(:,end);
R=reshape(x,3,3);
</code>```


问:
Drones classification based on flying mechanism and communication link
I am confused about autonomous drone flight. Thats why I am asking the question here so that a drone expert can help me to understand.

I have heard about tow kinds of drone

drones that work through controller based on radio transmitter

GPS based drones that work together with autopilot and make autonomous flight possible.

Is there any third category available or do I understand it wrong? I mean if you have an autopilot then can you make autonomous flight. Do radio transmitter based drone usually don't have autopilot and GPS facility?

答:
Drones is a commonly used terms for Unmanned Aerial Vehicles (UAVs) also named Unmanned Aerial Systems (UASs). The name drone comes from the first UAVs prototype which was making a humming noise like the drone (male bee).

The terms UAV or UAS are clearer, they define unmanned systems, meaning that there is no human operator inside the system.
So how is it flying ?
Well  as you pointed out there are two solutions:
1. remote piloting (a human operator flies the system remotely)
2. autonomous piloting (a computer flies the system on-board or remotely)

As you pointed out remote piloting relies on radio transmission.
The autonomous piloting, do not necessarily relies on GPS, other sensors might be available to provide enough information for autonomous flight (cameras, laser sensor, ...).

Of course the possibility to have a system allowing both remote piloting and autonomous flight is possible, and advisable for testing the autonomous algorithms. There can also be so kind of complementarity for example for position control, when the low-level control (i.e. attitude and position stabilization) is done autonomously while high-level way-points are define by remote operator.


问:
KF/ EKF - Modelling and tuning noise matrices and other parameters
I am developing C++ code to estimate roll and pitch of a camera using accelerometer and gyroscope. The roll, pitch and yaw are in my state space ($X_t$) and the process is modeled as:

$\bar{X_t} = X_{t-1} + Eu$

Here $u$ is a vector of gyro rates in x, y and z axis while $E$  is the matrix to convert gyro rates to Euler rates. Note that even though yaw is part of the state space, it is not corrected by accelerometer. It is present so that the short term reliability of gyros can be made use of, in the future development of the project.

Now, the covariance matrix($P_t$) is calculated as:
$\bar{P_t} = GP_{t-1}G^T + Q$

and the Kalman gain($K_g$) is calculated as:
$K_g = PH^T(HPH^T + R)^{-1}$

The $Q$ is the process noise matrix and $R$ is the observation noise matrix. The $G$ is the Jacobian of process model. The observation model $H$ is an identity matrix (This model gets multiplied by state space vector to produce predicted observation. The actual observation contains roll and pitch angles calculated from accelerometer, and yaw angle which simply is a copy of predicted yaw).

I am getting good results in most poses of the camera. However, when one of the angles (roll or pitch) is close to zero, I see drift or zero crossing patterns in the plots of roll or pitch. Can I avoid them by better modeling or tuning parameters? I would like to know if there are any systematic methods for modeling:

1) The process noise $Q$? I am currently using a Gaussian matrix with  mean = 0 and std deviation of 1. I used this as reference. How can I model them better? What should be its order of magnitude?

2) All diagonal values of $P$ are set to an initial value of 0.05 to represent uncertainty in initialization. The initialization of state space vector is done by calculating roll and pitch values from initial readings of accelerometer. The yaw is initially set to 0. I prefer the accelerometer to be trusted more than gyro. Hence the initial uncertainty, 0.05, is a value lower than the lowest value(0.059) in $Q$. Is this a good approach? Are there better ways?

3) The observation noise $R$? Right now, I have calculated std deviation of accelerometer readings in x, y and z. I use their square as first, second and third diagonal elements of $R$. The rest of the values in the matrix are 0. As I type this question, I have realized that I should first convert accelerometer readings to roll, pitch angles before calculating std deviation. However, are there better suggestions to model this?

Edit:
1) In the above situation only either roll or pitch are close to zero. Not both.

2) My intention is to code the Gaussian noise models in C++, rather than using readily available functions in Matlab or Excel, if they are the most suitable models. I am also looking for suggestions on better models, if any.

答:
You are suffering from “gimbal lock” when roll and pitch are close to zero. If you want to minimize the effects of that you might consider using quaternions, it is another form of representing angles.

For the standard deviation of the signals is simple. Just give the sensor a fixed input value and read the output. The output has to be a noisy signal around the mean, so you can make a Gaussian fit of that (excel, matlab can do it) and get the standard deviation.


问:
Better way to use info. received from ROS subscriber nodes
I want to use information together received from the different ROS subscriber nodes. One way I think of is to make separate callback functions for each subscriber node and then receive messages from corresponding nodes, store info of messages in some global variable and the use other function for manipulation of those variables or there is a better way to do this.</p>

答: You can have as many callbacks as you want in a single program. Usually I save the values in internal variables within the program. They do not have to be global, that depends on your application.</p>


答:
A Vicon motion capture system system is used in the TED Talk that you referenced. It is similar to a Kinect in that gives the 3D coordinates of any object being tracked within its field of view. Like the Kinect it uses IR, but uses IR reflective balls attached to the quadrotor and the presenters pointer to identify and track objects. Not to mention it is a considerably more expensive system.

Systems like Vicon and the Kinect do not work outdoors because they use IR and the sun blinds them. The GPS solution you propose is a common approach to this problem for outdoor venues. Another approach might be to use Quuppa, an RF based motion capture system.

Regardless of which tracking method you use, once you know the position of the robot and the target the problem of calculating the direction to the target, or ahead of it, is a basic geometric problem. Subtracting the robot position from the target position will give you the direction to point the camera. To track a few feet ahead of the target you would first add vector to the target position representing the direction of travel and lead distance (10m in your example).

If you don't actually need to know the location of the robot, only its relative position to the target, then you could use computer vision techniques to track the target and move with it. Of course you will need to avoid obstacles in the process. Also the obstacles themselves could occlude your view in which case you would need some way to predict the targets movement. This could be particularly difficult to come up with if your tracking humans outdoors.

The reality is that the problem you are addressing is a highly active area of research. I know of several research groups, both in academia and industry, that are trying to address this problem. I have only scratched the surface here.

Title: Track a moving object

Body:
If this has already been answered, by all means please point me to it.

I am in the process of building a quadcopter which I eventually plan to run autonomously by allowing it to track an object and take a video feed of it moving.

GPS is one of the options I've considered, basically:

GPS antena on moving object (person, car, bike, surfer)

GPS antena on quadcopter

Radio to transmit coordinates from moving object to quad copter

Some of the challenges I can foresee are

Line of sight for camera. How does the camera know exactly where to point?

Angle, how can I pre-program the quad to always record, say... 10m to the right of the moving object, or even better, program a set of angles to record from whilst keeping up with the object

GPS accuracy, what happens if the GPS lock is weak?

What are some of my other options? I saw this TED Talk where the quads are following a ball shaped sensor? I believe it uses Kinect cameras and lots of them which is not really an option for this challenge.

So I'm open to hearing some ideas before I start research and development of these features.


问:
Quadcopter mathematical model and controller design

if we just examine the translational dynamics (X and Y direction), the dynamics are coupled, So if I want to design a PID controller to control the position, the outcome will be unpredictable because of the coupling.I some research papers , I have seen people assume  (psi =0 ) at the equilibrium point  to remove the coupling in x and y dynamics. But I would like to design a controller along with the couple system? Is there any solution like decoupling the dynamics equations or something.

答:
Quadrotors are coupled systems because you  have 4 inputs for 6D motions.

Usually people are using cascade controllers to regulate both orientation and position and assume that desired orientation is achieved when considering the control of position.

see this famous RAM tutorial paper to get familiar with quadrotors: https://ieeexplore.ieee.org/document/6289431/?arnumber=6289431

Also, quadrotors are flat, in the control theory sens, for position and yaw, this means that the internal orientation dynamics are stable, if the flat output are stabilized. That is the reason why you can easily fly them controlling the position.


问:
Inter-robot Collision Avoidance
I try to understand some MATLAB code (see below) i found from the web for inter-robot collision avoidance. But I'm not really understand, how the theory behind this code work. Can anyone help me explained the theory behinds this code?  </p>

```<code>% Collision avoidance using distance-based velocity scaling (scale by alpha)
% along the vector between an agent and the agent nearest to it
%        1 |          _______
%  alpha   |        /
%          |      /
%        0 |___ /
%          0   R2    R1    ++++
%            distance
%  u: velocity
%  p: position

    function u = avoidCollisions(states, n, u)

        R1 = COLLISION_RAD*3;
        R2 = COLLISION_RAD;
        dist = Inf;
        % checking for the nearest robot
        for j = 1:N
            d = norm(states(n).p-states(j).p);
            if (j ~= n) && (d < dist)
                k = j;
                dist = d;
            end
        end
        pDiff = states(n).p - states(k).p;

        if dist > R2
            alpha = (dist-R2)/(R1-R2);
        else
            alpha = 0;
        end
        if dot(u, pDiff) < 0
            v2 = project(u, [pDiff(2); -pDiff(1)]);
            u = alpha*u + (1-alpha)*v2;
        end
    end

% Vector projection of b onto a
    function v = project(b, a)
        v = dot(a, b)/sum(a.^2)*a;
    end
</code>```

答:
General Idea

This assume that each agent as a velocity trajectory it is following, to avoid collision this velocity is going to be scaled by a factor $\alpha$ computed at each step.
At every step, the distance to the nearest agent is computed, then as the illustration at the beginning of the code suggests

if the distance is superior than $R_1$ then $\alpha=1$, i.e. no
scaling of the velocity;

if the distance is smaller than $R_2$ then  $\alpha=0$, i.e. the agent stops;

if the distance is between the two radius then a linear scaling is applied

This means that when the agents are sufficiently far away the collision avoidance has not impact on them. If they come close in a certain neighborhood they will slow down, and if they are to close they will stop.

Implementation

From the codes it seems that the parameters of the function avoidCollisions are:

states: the state of all agent

n: the index of the considered agent

u: the desired velocity of this agent

It also seems that this is applied to 2D cases.

In the code once the smallest closest agent is found (index k) the distance is stored (dist) and also the relative coordinates of the agent n w.r.t. to agent k (pDiff).
The value of $\alpha$ is computed as described below put leaving the possibility to have it greater than 1 if the distance is greater than $R_1$.
Then the code check if the desired velocity is orthogonal to the position of the agent k relatively to agent n, if this is the case n is not going toward k so no collision avoidance is necessary (not that if pDiff was the relative position of agent k w.r.t. agent n, the sign would be more intuitive).
Then $v_2$ is introduced, it is the projection a vector orthogonal to the position of agent k relative to agent n, and the velocity vector u.
This way the velocity u is scaled by alpha only in the direction non-orthogonal to the relative position.

Note that $\alpha$ should be forced to remain less than or equal to 1.

Title: Inter-robot Collision Avoidance


问:
Which one is faster? Hexapod or Quadruplets
I am preparing for Trinity Firefighting Robot Contest America. and I need fast legged robot of the max size 30cm X 30cm X 30cm that use RX-24 servo  from Robotis.  The arena will be maze and perfectly flat. My robot upper body is perfectly symmetric so its  lower body or leg doesn't need to rotate its face to another direction but still need turn its motion for maneuver inside the maze. </p>

答: Hexapod robot with tripod gait cycle will be both more stable and faster in terms of the locomotion speed. It is more stable because the support polygon of the tripod gait is a triangle. But in return you have 6 more joints and hence 6 more servo motors, which increases the power consumption and the complexity of the system.</p>


问:
Fixed point arithmetic on microcontrollers
Often we use microcontrollers to do things in our robots, but need to make some calculations in decimal. Using floating point variables is very slow, because a software floating point library is automatically included (unless you have a high-end microcontroller). Therefore, we generally use fixed point arithmetic.

Whenever I do this, I just use an integer, and remember where the decimal place is. However, it does take some care to ensure that everything is consistent, especially when calculations involve variables where the decimal point is in a different place.

I have implemented a fixed point atan2 function, but because I was trying to squeeze every last drop of limited precision (16 bits), I would often change the definition of where the decimal point is, and it would change as I tweaked it. In addition, I would have some constants, as a quasi look-up table, which themselves have an implied decimal point somewhere.

I want to know if there is a better way. Is there a library, or set of macros, that can simplify the use of fixed point variables, making multiplication and division between mixed variables easier, and allowing declaration of decimal numbers or constant expressions, but automatically converting to the desired fixed point representation at compile time?

答:
If you use an integer to remember where the "point" is, they are kind of using floating point arithmetic. Fixed point, really has fixed point.

I suspect that for every function there would be a different "preprocessing" to make your "floating" point number suitable for the function. For example, for atan, you would want to shift the number so that it's decimal point matches that of your fixed-point function. For cos, you may want to get it in the range of $\pi$ and $-\pi$ and then shift it.

This depends on the range of values your application needs, but you may want to completely move to a fixed point representation. That is, for example, instead of keeping a number like this:

```<code>struct num
{
    uint16_t number;
    uint16_t decimal_point;
};
</code>```

where number is the whole number and decimal_point says where the decimal point is, you can store it like this:

```<code>struct num
{
    uint16_t integer;
    uint16_t fraction;
};
</code>```

where the whole number is integer.fraction, which has the same memory usage, higher range of values and in general simpler to use.

Body:
If you use an integer to remember where the "point" is, they are kind of using floating point arithmetic. Fixed point, really has fixed point.

I suspect that for every function there would be a different "preprocessing" to make your "floating" point number suitable for the function. For example, for atan, you would want to shift the number so that it's decimal point matches that of your fixed-point function. For cos, you may want to get it in the range of $\pi$ and $-\pi$ and then shift it.

This depends on the range of values your application needs, but you may want to completely move to a fixed point representation. That is, for example, instead of keeping a number like this:

struct num
{
    uint16_t number;
    uint16_t decimal_point;
};

where number is the whole number and decimal_point says where the decimal point is, you can store it like this:

struct num
{
    uint16_t integer;
    uint16_t fraction;
};

where the whole number is integer.fraction, which has the same memory usage, higher range of values and in general simpler to use.


答:
Your proposed GPS solution is the best option by a significant margin, as long as you are in an environment where GPS is available (aka you are always outdoors).

Vision-based solutions might seem tempting, but they are really not appropriate in this situation.  Not only are you limited in terms of camera quality and processing power, but object tracking in arbitrary locations outdoors is a horrendously difficult problem, especially once you start have partial/complete occlusions.

You also have a very nice advantage because the vast majority of GPS errors will affect both receivers simultaneously. Their "global" position might be off by dozens of meters, but their relative locations are likely to be much, much closer. (This is essentially DGPS.)

As soon as you know the location of your quadrotor relative to the location of the target the problem reduces down to high-school trig or basic linear algebra.

Note that as soon as you start talking about obstacle avoidance, or robustness when sensors drop out things become genuinely complicated again.

Frankly, a reliable solution to this problem that does not involve placing a beacon on the target would be at the minimum worthy of a PhD thesis, and probably worth a lot more.

Title: Track a moving object


问:
Which is a good and cheap 3D LIDAR or other options?
Our team is planning to go for European Rover Challenge (ERC) 2018 for which we are designing an Autonomous rover. In order to implement SLAM, we need a way of mapping (with a range of atleast 2-4 meters) for which we considered using a LIDAR or a stereo cam. Could anyone suggest a good, cheap and accurate enough LIDAR, Stereo cam or some other option by which we could achieve this?</p>

答:
There is no cheap outdoor 3D LiDAR (as long as the definition of your "cheap" is under USD1000).

This might suit your purpose. There are low cost (USD100~500) 2D LiDARs. You may need to combine camera and LiDAR if you need to cope with pattern-less scenes or dark scenes.

By the way, a good engineer should not use terms such as "good, cheap, accurate" without explanation. Try to quantify your requirements next time.


问:
Why do roboticists choose a bird-like leg over a humanoid leg?
When thinking about robots that emulate animals, I would think roboticists would try to emulate humans which have distinctly forward jointed legs. Yet, I see in many instances that robots have more bird-like legs with shorter femurs.

Why are robots designed with these legs? What advantage do they provide over more human-like legs?

答:
One chooses different leg designs for different reasons. Sometimes there are specific design goals, involving the workspace, manipulability, and dynamics,  but sometimes the designs are less intentional, with choices made for other reasons.

Petman, the predecessor to the Atlas series was designed to mimic human kinematics for testing protective clothing. The iCub series were also specifically mimicking humans rather than designed to a performance spec, and the first generation of those could not walk.

Hurst (the lead person behind Cassie which is the robot you pictured) switched from his previous approach (Atrius) to the bird approach after collaborating with people that studied bird walking.

http://jeb.biologists.org/content/217/21/3786


问:
Why do we need a marginalization in Bundle Adjustment?
A common practice in Bundle Adjustment is to reduce the state dimension by marginalizing structure or pose states to improve the optimization speed.

In case 3d points(structure) $\textbf{p}_i$ are marginalized out as follows, $\textbf{p}_i$ are triangulated to calculate residual $\textbf{e} $.

$\textbf{e} = \textbf{z}_{ij} - \pi(\textbf{T}_j\textbf{p}_i)$

where $\textbf{T}_j\in SE(3), \textbf{p}_i\in R^3$ are the states we want to estimate and $\textbf{z}_{ij}$ is the observed feature in $R^2$.

And just optimize the pose related terms only.

$\begin{bmatrix}
 \textbf{H}_{cc}& \textbf{H}_{cs} \\
\textbf{H}_{sc} & \textbf{H}_{ss}
\end{bmatrix}
\begin{bmatrix}
 \mathbf{\xi}_c \\
\textbf{p}_s
\end{bmatrix}=
\begin{bmatrix}
 \textbf{g}_{c} \\
\textbf{g}_{s}
\end{bmatrix}$

$\bar{\textbf{H}}_{cc}=\textbf{H}_{cc}-\textbf{H}_{cs}{\textbf{H}_{ss}}^{-1}\textbf{H}_{sc}$

$\bar{\textbf{g}}_{c}=\textbf{g}_{c}-\textbf{H}_{cs}{\textbf{H}_{ss}}^{-1}\textbf{g}_{s}$

$\bar{\textbf{H}}_{cc}\mathbf{\xi}_c =\bar{\textbf{g}}_{c}$

Here my question arises. If we can calculate 3d points $\textbf{p}_i$ by the triangulation, only $\textbf{T}_j$ are the state variable to be estimated.

Then, why are we bothered to calculate marginalization related terms $-\textbf{H}_{cs}{\textbf{H}_{ss}}^{-1}\textbf{H}_{sc}$ and $-\textbf{H}_{cs}{\textbf{H}_{ss}}^{-1}\textbf{g}_{s}$ instead of optimizing only poses by ${\textbf{H}}_{cc}\mathbf{\xi}_c ={\textbf{g}}_{c}$ (note that H and g are without bar).

I guess  ${\textbf{H}}_{cc}\mathbf{\xi}_c ={\textbf{g}}_{c}$ is enough to find the optimal poses $\textbf{T}_j$.

So, my question is why do we use $\bar{\textbf{H}}_{cc}\mathbf{\xi}_c =\bar{\textbf{g}}_{c}$ instead of ${\textbf{H}}_{cc}\mathbf{\xi}_c ={\textbf{g}}_{c}$?

答:
Let's have a look at the Hessian H of simulated BA.

Yello represents non zero element and upper 60 by 60 matrix represent ${\textbf{H}}_{cc}$. When a structure is observed over multiple poses, Hessian make correlation terms.

Obiously, ${\textbf{H}}_{cc}\mathbf{\xi}_c ={\textbf{g}}_{c}$ ignores the correlation terms. Therefore, each poses loose information of linkage, whereas in $\bar{\textbf{H}}_{cc}\mathbf{\xi}_c =\bar{\textbf{g}}_{c}$ off diagonal terms are added to Hessian which represents the rumped relationship miginalized from $-\textbf{H}_{cs}{\textbf{H}_{ss}}^{-1}\textbf{H}_{sc}$.

The benefit are faster convergence and low final error in optimization.


答:
In this case, your absolute-positioning technology is a red herring.  If you are trying to track an object, all that matters is your relative position.  We did such vision-based navigation (relative to an underwater structure) with an underwater vehicle -- unable to receive GPS signals while submerged.

Assuming that you've established the ability to locate an object in a video frame (and deduce your range and bearing relative to it), all that remains is to calculate your desired position and feed that into your X/Y PID control.  The only difficult part is getting the object into the frame initially.  (Presumably, your coarse GPS control will get you in the right ballpark.)

I can think of 3 fairly simple ways that you might get your range and bearing from an input video stream.  The best way would be to have native 3D support in the camera (such as in a Kinect).  Failing that, if you know your target's size (and how to detect it in the frame) then you should be able to calculate the range based on how many pixels it occupies.  Worst case, just use an augmented reality glyph on your target -- they are fairly easy for computer vision to detect.

Title: Track a moving object


问:
Using gmapping without ROS?
Is gmapping on OpenSLAM.org still maintained? Or is the maintenance entirely over in ROS ( https://github.com/ros-perception/slam_gmapping/tree/hydro-devel/gmapping ). When trying to compile gmapping without ROS I noticed that it still has Qt3 as a dependency which made me think no one uses or maintains OpenSLAM's gmapping anymore. Is this accurate? How does OpenSLAM's gmapping vs ROS's gmapping compare in terms of performance and accuracy?

Thanks!

答: Open slam is completely out of updating better you can go with the ROS stack for perception thereby you can work on your stuffs to run the codes</p>

Title: Using gmapping without ROS?


问:
Obstacle Avoidance: Detection of goal inside the obstacle
It is easy to understand how a robot can avoid obstacle if the goal point is not within the obstacle (Point A) as shown in the figure. But I'm curious how could a robot know that the the goal point is within the obstacle (Point B)? For example in an area exploration using random motion, the way-point is generated randomly. If the generated way-point located inside the obstacle, how could robot know? How to detect this problem?

答:
The same obstacle detection and path planning approach that can get you from O to A should be able to also tell you that B is not reachable. </p>

<p>It will depend on the planning strategy for how this manifests. It should be able to say though that either every option has been exhausted (if that's finite and realistically achievable) or that it needs to give up after making a reasonable number of attempts. It may, therefore, not always be possible (or at least practical) to distinguish between B being fully inside an obstacle versus being surrounded by obstacles with only a very narrow opening between them. </p>

Body:
The same obstacle detection and path planning approach that can get you from O to A should be able to also tell you that B is not reachable.

It will depend on the planning strategy for how this manifests. It should be able to say though that either every option has been exhausted (if that's finite and realistically achievable) or that it needs to give up after making a reasonable number of attempts. It may, therefore, not always be possible (or at least practical) to distinguish between B being fully inside an obstacle versus being surrounded by obstacles with only a very narrow opening between them.


问:
Methods for state estimation and real-time path planning of a mobile robot
I'm looking to start a project that incorporates some form of state estimation and path planning for a simple simulated robot dynamic model, in an environment that contains obstacles. I'm hoping to use the combination of state estimation and path planning to allow the robot to efficiently navigate through its environment from an arbitrary starting position A, to another arbitrary ending position B, but was unsure where to start. With regards to the state estimation, I thought it would be good to implement a variant of SLAM (possibly Fast SLAM if it isn't too complicated), but I'm quite lost about where to start when it comes to the path planning side of the project, since there seem to be many different ways to do it. The first algorithms that seem to pop up are variants of A* and RRT*, but I was wondering if there are any "state-of-the-art" algorithms that may allow for real-time path planning. My previous work has looked at the use of convex optimization for optimal guidance and control of various dynamic systems, but it seems that using convex optimization would be very difficult in a highly constrained environment (i.e. environment with lots of obstacles). Any help would be much appreciated. </p>

答:
I am assuming that by real time path planning, you mean starting off in a partially known environment and updating your 'plan' as you gain more knowledge through your SLAM algorithm. For a real world scenario, two of the biggest concerns here would be a) taking into account new information from the sensors to update your obstacle map and plan, b) being computationally efficient to actually compute plans quickly during navigation.

Real time sampling based path planning has been examined in some recent papers: for state of the art algorithms, you can possibly look into Real Time RRT* (RT-RRT*) or RRTx, that does real time replanning as the environment information changes.

There are various other perspectives of looking at this as well. On the most basic end of the spectrum, if you're only concerned about, say, dynamically moving obstacles, the simplest algorithm to implement that can deal with planning in that scenario would be the D* algorithm or its anytime variants. On the more advanced side, you can look into the idea of SLAP: simultaneous localization and planning, that attempts to capture factors such as uncertainty and rewiring path plans as SLAM builds your environment and constructs the robot's belief.


问:
Does marginalization increase the number of edges in Graph SLAM?
I thought marginalization does not change the number of the edges but this material (page 11) describes that as a result of marginalization we will have more edges in graph. Why does it increase the edges?

For those who does not want to open the page, it is written as follows.

Marginalization: Cons
Con: More edges in graph

Feature with N observations leads to O(N2) edges

Slower/harder to solve, (Information Matrix less sparse)

答:
Exact marginalization will change the number of edges, because once a node (pose) is eliminated, the information in the edges that were incident to that node would have to be stored as edges between the existing nodes. This densification of the graph automatically means that the information matrix is dense because of the newly added edges. This results in what is known as an 'elimination clique'.

A nice example of this is shown in this paper, which I am reproducing here:

When moving from pose $x_t$ to $x_{t+1}$, the SLAM algorithm would naturally want to marginalize the $x_t$ node away: but that means the direct landmark-pose observations that were encoded in the edges connecting $x_t$ and $L_i$ would now have to be rewired to be incident on $x_{t+1}$, which is equivalent to obtaining new observations of $L_i$. Notice how the information matrix becomes denser.

The alternative to this is called approximate marginalization. As an example, this paper attempts approximate marginalization by using Chow-Liu trees, where the graph is pruned such that each node connects only to one other node that affords the maximum mutual information.


问:
Is it possible to put the irobot create2 in a mode where it will not charge?
I recently purchased an iRobot Create2 and have had a lot of issues in the last few weeks with the battery being dead when I go to use it. The robot almost never leaves its charger at this time because I am still working on coding it. This makes me wonder if there is a state I could be leaving the robot in that is preventing it from charging. The only way I can get it to charge is to do a hard reset which then allows it to start charging. My suspicion is that if you put it in full mode and disconnect from it that it can not charge. Can anyone confirm or deny this?</p>

答: While the Roomba is charging in a trickle mode it will only supply enough power for its internal circuity. If your controller is using power from the min-din the battery will run down as its supplying the extra power. You can confirm this by using the OI to note the "-" sign on the charge current during Passive mode trickle charging</p>


问:
iRobot Roomba 620 (similar to create 2) enters power saving mode although the is a pulse at BRC pin and wakes up at next pulse
Sorry for asking again, but there is still no solution and I am not able to comment this question from Aaron: Cannot disable sleep in passive mode for iRobot Create 2

Create 2 spec says:

In Passive mode, Roomba will go into power saving mode to conserve battery power after five minutes of inactivity. To disable sleep, pulse the BRC pin low periodically before these five minutes expire. Each pulse resets this five minute counter. (One example that would not cause the baud rate to inadvertently change is to pulse the pin low for one second, every minute, but there are other periods and duty cycles that would work, as well.)

Here you see the signal at the BRC pin at the connector:

Is there a newer firmware? Roomba output:

```<code>bl-start
STR730
bootloader id: #x47135160 6BFA3FFF
bootloader info rev: #xF000
bootloader rev: #x0001
2007-05-14-1715-L
Roomba by iRobot!
str730
2012-03-22-1549-L
battery-current-zero 258
2012-03-22-1549-L
r3_robot/tags/release-3.2.6:4975 CLEAN
bootloader id: 4713 5160 6BFA 3FFF
assembly: 3.3
revision: 0
flash version: 10
flash info crc passed: 1
processor-sleep
</code>```

If Roomba is already sleeping it wakes up from the pulse. So there is no chance for not receiving it.

Any idea?

答:
I have the same problem in that pulsing the BRC line keeps the Roomba alive when its OFF the charger, but not when its ON the charger

I'm starting to wonder if the "iRobot Create 2 Open Interface (OI) Spec" was only referring to the undocked state

To disable sleep, pulse the BRC pin low periodically before these five minutes expire. Each pulse resets this five minute counter.


问:
What iRobot products support the open interface besides the iRobot Create?
I have read that certain iRobot products support or can be hacked to support something close to the open interace. There is even a book about hacking Roomba. What Robots have this capability?</p>

答: The Create 2 is a remanufactured series 600 Roomba. In my case, mine was a Roomba 650 as evidenced by pulling back the little "2" sticker over the location where 650 was marked</p>


问:
If you can create pure yaw motion with a quadcoptor then why won't this work with a tricoptor?
An answer to the question Why are quadcopters more common in robotics than other configurations?  said:

You need 4 degrees of freedom to control yaw, pitch, roll and thrust.

Four props is therefore the minimum number of actuators required. Tricoptors require a servo to tilt one or more rotors which is more mechanically complicated.

In a comment, I asked:

How do you get pure yaw motion with a quadcoptor and if that's possible why won't this work with a tricoptor? I don't understand how can you get yaw motion with any system where all rotors are in a plane without first tilting and moving. I would have thought that the main difference between quadcopters and tricoptors would be the kinematic calculations would be more complex.

Another answer explained:

you get pure yaw in the following way:

North and South motors rotating the same speed but collectively at a higher (or lower) speed than East and West Motors which are also at the same speed.

This explains why it works with a quadcopter, but doesn't explain why it won't work with a tricopter.

Is it simply the fact that the asymmetry means that you can't imbalance the torque effects to provide yaw movement while still keeping the thrusts balanced to keep pitch and roll constant?

答:
Let's look at how a quadrotor flies, then apply that to a trirotor.

Let's assume that we want to remain in a stationary hover position. To do that, you need to balance all the forces: thrust from the propellers vs. gravity, and the torques of each motor.

Each motor produces both thrust and torque according to the equations:
$$
T = K_T\rho n^2 D^4
$$
$$
Q = K_Q\rho n^2 D^5
$$
Where $T$ is thrust, $Q$ is torque, $K_T$ and $K_Q$ are system dependent constants, $\rho$ is the air density, $n$ is rotor speed, and $D$ is rotor diameter.

If you increase thrust then you increase torque, and vice versa. A quadrotor remains stationary by balancing all the forces. This is possible because the quadrotor is symmetrical: two motors spin clockwise, and two motors spin anti clockwise. If all the motors rotate at the same speed then the torques balance, and the thrust balances.

The only question then is what speed? The four rotors need to spin fast enough to collectively generate enough lift to remain in a stationary hover.

What about a trirotor?

Intuitively, the easy base case is when the arms holding the motors are all the same length (such that you can ignore the effects of the motor's displacement from the center of mass). In this case you must set the force of each motor to be equal (to hover without falling) then the torques will be unbalanced (2 in one direction, 1 in the other). The result is a spinning trirotor.

The slightly more difficult case is when the rotor arms are not the same length. To solve that, let's solve the general case. The equation for torque is:
$$
\tau = rFsin(\theta)
$$
$sin(\theta)$ is 1 (at a right angle), so we can ignore it and rearrange our torque equation as follows:
$$
F = \frac{\tau}{r}
$$

Let's make a trirotor and label it as follows:

Then, we can balance all the torques:
$$
\frac{\tau_A}{r_A} + \frac{\tau_B}{r_B} + \frac{\tau_C}{r_C} = 0
$$
Substitute in the motor equation for torque from above:
$$
\frac{ K_Q\rho n_A^2 D^5}{r_A} + \frac{K_Q\rho n_B^2 D^5}{r_B} + \frac{K_Q\rho n_C^2 D^5}{r_C} = 0
$$
And get rid of the common constants:
$$
\frac{n_A^2}{r_A} + \frac{n_B^2}{r_B} + \frac{n_C^2}{r_C} = 0
$$
To solve this equation, we need to make a system of equations with the thrust for each motor:
$$
T_A + T_B + T_C = mg
$$
$$
K_T\rho n_A^2 D^4 + K_T\rho n_B^2 D^4 + K_T\rho n_C^2 D^4 = mg
$$
$$
n_A^2 + n_B^2 + n_C^2  = \frac{mg}{K_T\rho D^4} = C
$$
Where C is some constant. We don't really care what it is as long as it's non-zero (if it's zero then we don't need the motors to do anything).

Now, make our system of equations and solve them:

$$
\frac{n_A^2}{r_A} + \frac{n_B^2}{r_B} + \frac{n_C^2}{r_C} = 0
$$
$$
n_A^2 + n_B^2 + n_C^2  =  C
$$

Right away we see that there is no solution except when $C=0$.

Thus, a trirotor needs the servo to rotate at least one motor in order to generate more torque without generating more thrust (in the z direction).


问:
Ontology/marketplace of robotics components and integration environment (BPEL or CAD for robotics)?
It should be possible to take the formal description of robotics components (in form of ontology, formal API descriptions or other kind of formal specification of the capabilities and requirements of this component) and import them in universal design studio and then use this studio for the integration and the building of the final robot of the final robotics systems. There are BPEL, component service architecture and business services in software development that offers to build the final software by simply integrating available services. So - my thought is - that there should be similar ecosystem for building robots and robotic systems.

I have heard about ROS and that each component provider tries to create ROS API/interface for its own component to facilitate the easy use of its component from the ROS-based robot. I am looking something like that but with self-description capabilities (as BPEL services self-describe themselves). And I am looking also for the Integrated Development Environment that can use those component descriptions, that can import them, that can model and simulate and build (compile) the final robot desing. There are lot of CAD software for architecture, for mechanical design, for EM design but is there CAD for final multipurpose robot?

May dream is to use off-the-shelf components and compose in optimal way using https://math.stackexchange.com/questions/1083338/structural-design-meta-optimization-is-there-mathematical-theory-optimiza and https://en.wikipedia.org/wiki/Structured_prediction In some cases I dream to achive the optimal robot and in some cases I dream to arrive the formal specification of the component that is not yet available but whose design (e.g. for 3D printing or other kind of manufacturing) I can derive from design of my robot.

I know that Stack prohibits asking for direct recommendations of some software of components but in my case I am not asking for direct recommendation. I have idea about workflow of robot development and I am just interested:

How acceptable and desirable is such workflow?;

Is such workflow already implemented in one or other way?;

Maybe my idea about workflow is the failure and I should look for other kind workflow (what?) which is already implemented in the community and which  achieve the same goals that my idea.

答:
Do professional robot designers use semi or fully automated toolchains to implement physical systems?

Of course. Especially if you broaden your definition of robot to electro-mechanical system. Proprietary toolchains have different levels of sophistication, some no more than an internal process to speed things up, others integrating solid modeling kernels and custom electro-mechanical math models to let you input specs and speed through design trade-off selection to a final design quickly. I have helped develop both ends of the spectrum.

These are kept as trade secrets. If you find much public info on them, someone messed up...

ContentLicense: CC BY-SA 4.0


问:
Create 2 losing serial communication after toggling full to passive while charging
We are having an issue where after toggling the create 2 from passive to active, then waiting a few seconds and toggling back to passive while on the charger, all serial communication fails a certain percentage of the time. (Links to images of current and serial communication down below illustrating it).

Detail

We are working to have the Create 2 power a NUC, auto-charge and stay alive for long (multi-month) periods of time.

Because we are taking power directly off of the battery (Need higher current), we found that we have to toggle the mode from passive to full and back so that it checks the voltage and goes back from trickle charge to full charging if it has been a few hours and the computer has discharged the battery. This is because the trickle charge algorithm does not check voltage as it assumes the load on the roomba is not high enough to discharge.

We started with it failing this way and have now verified that if we just plug a laptop into the create through the usb serial cable with nothing else plugged in and then toggle passive/full/wait/passive, a percent of the time we also get comm failures without any separate hardware.

Because the create 2 turns off after 5 minutes of no communication, we have tried toggling it every 4 minutes and see that reliably happening, so this is not an issue where the create 2 is just going into sleep mode.

Reproducibility

We are seeing a very repeatable issue where the serial communication (Using current generation USB serial cable from iRobot) loses serial communication with the robot some percentage of the time exactly at the point where it starts charging the robot again. After that, no packets come in from the robot for a long while. Some time later, when we have repeatedly tried to toggle from passive to full and back, communication re-appears.

We have verified this using the ROS stack (create_autonomy) and also by directly echoing characters on the command line echo -e "\x07" > /dev/ttyUSB0 to reset things.

When it is in this state, no software resets work, unplugging and replugging the serial cable does not work, etc. We have to take it off the charger physically (or wait for a long time until our system toggles it again and it does work.

We have verified that this occurs (When the create 2 is on its charger) on:

Mac only plugged in over the create cable with no power taken from the system.

NUC taking power directly off the battery through a dc/dc converter.

NUC taking power off an intermediate battery charging from the create.

Mitigating it

We have added ferrite beads on all the cables to mitigate any high frequency noise and that does not seem to solve it either.

We have also tried 3 different create cables w/ different serial/usb chips and even built our own from scratch and not fixed it.

We have tried separately powered usb hubs, unpowered ones and plugging directly in to the computer.

We have tried it on 3 separate create 2's.

I have attached links below with graphs of the output data when it fails. When there is a straight line on current/voltage, that is repeated data, showing that it was stuck and not updating. It always happens right when the system steps up the current to start charging again, so it seems to be linked to a current spike - but only breaks it 1 / 5 or 10 times - it just happens that once broken, it stays that way for a very long time.

Communication fails after multiple successful toggles

Detail showing exactly when communication fails

After many minutes, it is working again

When it has been broken, I have tried turning off our software and addressing the system by echoing data to it directly for OI to turn off, on, reset, etc and do not see communication resume correctly.

If we unplug the roomba from the charger by hand (pull it off), then many times it does work, but not always. If we then reset everything by holding down the buttons, it does seem to work 95% of the time and sometimes we have even had to pull the battery itself to make it work.

If someone has encountered this before, advice would be helpful. We had thought that it was ground loop issues, but given it is on so many different cables, roombas, power situations and compute devices, we are trying to figure out what is fundementally wrong with our setup.

Thanks!

答:
I have one more suggestion for you as disassembling the Create 2 to access the Clean button contacts is quite a bit of work.

I purchased a standard Roomba IR Remote and added a relay that the EZB controller can activate.  I can happily report that it DOES indeed wake a sleeping trickle charging Roomba on its dock. In fact, it does acts very similar to pushing the Clean button.

By using this technique, you would NOT have to disassemble the Roomba to add a relay across the Clean button contacts. You could clean up this mod by replacing the IR remote with an Arduino board with a IR LED and software.

However, I need to warn you about a couple of non-show stopping issues. The IR remote acts similar to the Clean button but not exactly the same. A short press on the Clean button turns on the green LED and a second short press starts the cleaning cycle. A long press has no effect. Short presses can be used to interrupt and restart the cleaning cycle

On the IR remote, a short pulse (500ms) will do nothing while docked, but a single long pulse (> 1500ms) will start the cleaning cycle.
You can interrupt the cleaning cycle and restart the cleaning cycle with short pulses. Long pulses just seem to toggle the green LED.

One more thing… If you choose to stop the cleaning cycle using the OI movement commands from the controller, which is what we really want to do for a telepresence robot, the IR pulses will no longer be able to control the Roomba. If you wish to regain control via IR, you must send a Stop (173) command

You can find some additional details here. http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=10953&page=11


问:
Can the A* Algorithm be implemented on an Arduino easily?
I am not very experienced in working with C++. Working with Python is much more easier for me because of the large number of built-in mathematical functions present such as multidimensional array sorting and more. I went through the Udacity document on Motion Planning (Programming a Robotic Car) in Python and it seemed simple enough for me to implement. However, I would like to use the Arduino due to its simplicity and my need to interface other modules with it. Can someone suggest me an easier way or lead me to some resources that can help me code it in C++ for the Arduino? All the A* algorithm C++ source codes I've found online are either huge or difficult to understand. In my case, I'm planning to use a simple grid based implementation of the A* Algorithm. Thanks in advance.</p>

答: Adafruit.com has a version of python that will work on the Arduino, Circuit Python. It's downloadable for free. I'm not sure who created it.</p>


问:
zero-g mode for UR10 gravity compensation
I would like to freely move my UR10 arm in response to an external force, just like the zero-g mode for Baxter robot, which can be activated by holding its wrist. The Baxter documentation on zero-g mode says the following:

Zero-G mode can often be confused with the mode obtained by disabling the gravity compensation torques. By default, the gravity compensation torques will always be applied when the robot is enabled. In Zero-G mode, the controllers are disabled and so the arm can be freely moved across. In this case, the effect of gravity would be compensated by the gravity compensation model applying gravity compensation torques across the joints, there would be no torques from the controllers since they would not be active, and so the arm can be moved freely around, hence the name.

So apparently this means that the controller torques need to be disabled in order to achieve the zero-g mode. I am using ur_modern_driver for my UR10 arm. Any ideas on how can I implement this mode with the running modern driver?

答:
If I understand your question correctly, You want to move the robot freely, its possible but only in the following case( as far as my understanding goes, in fact my experience on other robot):

The control mode should be in torque mode( mean the controller output is torque not position i.e send torque command not a position to each joint)

Compensate the torque of gravity which is induced to each joint based on the specific robot configuration, mass of each link, and center of mass of each link.

The equivalent way to say this is do dynamic modeling of your robot

i.e.

$a_{g} = [0,0,-g_{0}],g_{0} = 9.8$ this is acceleration due to gravity in base coordinate frame (CF)so you need to use Transformation matrix to have acceleration due to gravity for each link in its joint CF

in fact its the right technical term is inverse dynamics control.

If your goal is gravity compensation only you need to know(you can estimate from CAD robot model or given by manufacturer):
 the mass, the center of mass of each robot link and current joint configuration ($q_i$ i=1,...,6).
Then you can determine torque required to support the robot at the given configuration recursively(start from last joint and determine sequentially for the other joints/links ).

for more refer:
 https://studywolf.wordpress.com/2013/09/07/robot-control-3-accounting-for-mass-and-gravity/


问:
Hexapod walking algorithm
I am making a hexapod project with my friend. There is a issue about its walking style. Generally tripod gait is formed as two steps: first move legs 1,3,5, then 2,4,6 which corresponds to moving one leg from one side and two legs from other side but the legs are located circular instead side by side. So, this situation makes us wondering if it would rotate or not instead of moving forward when the
tripod gait is implemented.

Our robot's legs are like this one: https://www.youtube.com/watch?v=iPdRUbJcNzM

What kind of walking algorithm is suitable for that kind of robot?

Thanks in advance.

答:
It does not matter whether the legs are mounted in a circle or not. You should be using inverse kinematics to place the tip of each foot on the ground.  </p>

<p>If you know the dimensions of your robot and share the hexagon arm is attached you can account for the joint offset in your calculations. After that, there is some geometry involved to solve for the angles. </p>

Title: Hexapod walking algorithm

Body:
It does not matter whether the legs are mounted in a circle or not. You should be using inverse kinematics to place the tip of each foot on the ground.

If you know the dimensions of your robot and share the hexagon arm is attached you can account for the joint offset in your calculations. After that, there is some geometry involved to solve for the angles.


问:
Ackermann Motion Model Does not Drive in an Arc, but Turns on the Spot
Im trying to implement an ackermann motion model which estimates the x,y and theta for a robot I have.

I have a gazebo simulation running which publishes a steering angle for the virtual tricycle wheel and I have a linear velocity for the back wheel.

I publish the ground truth odometry and transform which I can display in Rviz.

I then use the published values to compute a deltaX, deltaY and deltaTheta for a pose update. If the steering angle is 0, it works fine as the deltaX = linear velocity. However, when I have both values non zero, my robot moves in an arc, but my motion model turns on the spot instead.

The formulae for motion estimation and pose update are taken from "Simultaneous Localization and Mapping for Mobile Robotics" by Juan Antonio Fernandez-Madrigal.

Any ideas where I have made a mistake?

Edit: I will provide the formulae I use here

$ u = (v,alpha)$ , where v is the linear velocity form the driving wheels and alpha is the steering angle (in radians)

$ l = wheel base$ i.e the distance between the front and back wheel

$ w = \frac{v*sin(alpha)}{l}$

$ dx = \frac{l * sin(w)}{tan(alpha)}$

$ dy = \frac{l * (1-cos(w))}{tan(alpha)}$

Pose Update:

$ x_{new} = x + (dx*cos(theta) - dy*sin(theta))*dt $

$ y_{new} = y + (dx*sin(theta) + dy*cos(theta))*dt $

$ theta_{new} = theta + w*dt $

Ofcourse if alpha = 0 then $delta_x = v$

edit #2. I fixed the problem, but I do not understand the solution.

The first issue was that I did not incorporate the linear velocity into my equation when rotating.

This gives :

$ dx = \frac{v*l * sin(w)}{tan(alpha)}$

$ dy = \frac{v*l * (1-cos(w))}{tan(alpha)}$

Now the robot drives in an arc! But the arc is wrong.

Now I changed the update equation to:

$ dx = \frac{v*l * cos(w)}{tan(alpha)}$

$ dy = \frac{v*l *sin(w)}{tan(alpha)}$

The rotational arc now seems correct. The rotational speed is still lower (not such an issue), but I dont understand why this works rotation works. I.e. why the $1-cos(x)$ factor gets changed to $sin(x)$ etc.

答: You may get this behavior if your model has no offset between the steering and drive wheels.</p>


问:
Beginner Sets for intermediate devs
For a longer time I'm looking for some kind of robotic set, which is programmable, but most things I've found are related to child education or involves a lot of putting all the hardware parts together by yourself.

I'm working as a Software engineer for a longer time, so I have a good knowledge of software languages also on c/c++ .

I've taken several steps in on the Raspberry pi which was very interesting but shortly it turns out I'm not that much interested in soldering hardware parts or something like that.

Can you guys give me some advice on where to start with robotic Programming for adults, without getting to deep into elektronics or hardware engineering, if possible, but to conenctrate on Programming?

Any advice would be great

Thanks

答:
If you want to start programming a robot that's already built, the Scribbler 3 (S3) robot by Parallax, inc. is relatively affordable and comes already assembled. The programming relies on Blockly, a GUI-based programming language for robotics systems. I think it's popular in schools.

If you're interested in something a bit more robust, why not look into the iRobot Create® 2 Programmable Robot? It's built from remanufactured Roomba® platforms and comes preassembled. You could customize and program it (direct connection, Arduino, or RaspberryPi).

Finally, since you are already and experienced software engineer and are not interested in assembling hardware, you could look into Gazebo and MoveIt! which are two robot simulation system used in the industry (as far as I understand). They both offer a bridge to ROS the Robot Operating System.

I hope this helps!

Title: Beginner Sets for intermediate devs


答:
The Turtlebot 3 robots are designed to be ROS (Robot Operating System) reference implementations. There are two versions, the Burger and the Waffle. The Burger is the least expensive.

They are built of plastic pieces which need to be bolted together. They are very sturdy. It is also possible to use a 3d printer to make more pieces if you want a larger robot, and they have instructions for different types of robots if you don't want one with differential steering.

Dexter Industries sells a board that allows a Raspberry Pi to connect to Lego Mindstorms sensors and motors. This allows you to use a much more powerful computer to control robots using the Lego Mindstorms system.

And then are a number of systems from Vex Robotics. They might look like toys, but I put them a bit above the Lego Mindstorms in strength.

If you prefer metal, then Servo City has a number of kits and parts (including motors, motor controllers, beams, plates, hardware, wheels, etc.) to build robots, though generally you'll have to do your own electronics. I'm planning on using the electronics that came with my Turtlebot 3 robots with my tracked robot from ServoCity. Plus a bunch of other stuff I've collected.

One thing I suggest if you want to build less toy-like robots is a 3d printer. This can be useful to make parts that would be difficult or expensive to buy. YMMV, but I prefer the Original Prusa i3 MK3. Of course, I say that because it's what I'm used to.

Title: Beginner Sets for intermediate devs

Body:
For a longer time I'm looking for some kind of robotic set, which is programmable, but most things I've found are related to child education or involves a lot of putting all the hardware parts together by yourself.

I'm working as a Software engineer for a longer time, so I have a good knowledge of software languages also on c/c++ .

I've taken several steps in on the Raspberry pi which was very interesting but shortly it turns out I'm not that much interested in soldering hardware parts or something like that.

Can you guys give me some advice on where to start with robotic Programming for adults, without getting to deep into elektronics or hardware engineering, if possible, but to conenctrate on Programming?

Any advice would be great

Thanks


答:
The first ackermann model presented is based on dead reckoning, i.e. it needs wheel encoders. The ackermann model in edit 2 is based of velocity.

It can be found here:

https://pdfs.semanticscholar.org/5849/770f946e7880000056b5a378d2b7ac89124d.pdf

Title: Ackermann Motion Model Does not Drive in an Arc, but Turns on the Spot

Body:
Im trying to implement an ackermann motion model which estimates the x,y and theta for a robot I have.

I have a gazebo simulation running which publishes a steering angle for the virtual tricycle wheel and I have a linear velocity for the back wheel.

I publish the ground truth odometry and transform which I can display in Rviz.

I then use the published values to compute a deltaX, deltaY and deltaTheta for a pose update. If the steering angle is 0, it works fine as the deltaX = linear velocity. However, when I have both values non zero, my robot moves in an arc, but my motion model turns on the spot instead.

The formulae for motion estimation and pose update are taken from "Simultaneous Localization and Mapping for Mobile Robotics" by Juan Antonio Fernandez-Madrigal.

Any ideas where I have made a mistake?

Edit: I will provide the formulae I use here

$ u = (v,alpha)$ , where v is the linear velocity form the driving wheels and alpha is the steering angle (in radians)

$ l = wheel base$ i.e the distance between the front and back wheel

$ w = \frac{v*sin(alpha)}{l}$

$ dx = \frac{l * sin(w)}{tan(alpha)}$

$ dy = \frac{l * (1-cos(w))}{tan(alpha)}$

Pose Update:

$ x_{new} = x + (dx*cos(theta) - dy*sin(theta))*dt $

$ y_{new} = y + (dx*sin(theta) + dy*cos(theta))*dt $

$ theta_{new} = theta + w*dt $

Ofcourse if alpha = 0 then $delta_x = v$

edit #2. I fixed the problem, but I do not understand the solution.

The first issue was that I did not incorporate the linear velocity into my equation when rotating.

This gives :

$ dx = \frac{v*l * sin(w)}{tan(alpha)}$

$ dy = \frac{v*l * (1-cos(w))}{tan(alpha)}$

Now the robot drives in an arc! But the arc is wrong.

Now I changed the update equation to:

$ dx = \frac{v*l * cos(w)}{tan(alpha)}$

$ dy = \frac{v*l *sin(w)}{tan(alpha)}$

The rotational arc now seems correct. The rotational speed is still lower (not such an issue), but I dont understand why this works rotation works. I.e. why the $1-cos(x)$ factor gets changed to $sin(x)$ etc.


问:
How can I stream Kinect V2 tracking data from PC to Raspberry Pi 3 through WiFi?
I'm currently working with Kinect v2. I can do all sort of stuff on PC with it. What I want to do next is, to get the data I want on PC and control the Raspberry Pi with that data (for example, I will move the Pi with motors when I tilt my head to right). I have sorted out the motors and everything but I just don't know how to use that tracking data I have on PC to control the Pi.

I hope the question makes sense, i'm just extremely new to both Pi and Kinect.

Edit: Further clarification of what I'm trying to achieve.

I have a Raspberry Pi which is connect to 2 step-motors through a motor driver. With this setup, I can run a Python script and turn on or off the motors with that.

Now I also have a Kinect V2 connected to my PC.

What I want to achieve is, to issue the 'turn on - turn off' commands from the Kinect which is connected to my pc and not the Pi. I want to tell the pi from my computer, for example, when I turn my head left, turn on the motors connected to the Pi. I can issue the commands through the python script inside the Pi. Now I want to issue those commands from my PC which has the Kinect data and I want to do it through WiFi connection.

Step1: Get the head movement data from Kinect on my PC.

Step2: Send that data to Raspberry Pi, somehow(The step where I have the problem).

Step3: Pi turns on motors according to that data.

I hope this clerifies the problem.

Thanks for the help!

答:
You either need to write a communications layer that will allow the PC to send commands to the Pi, or use a system that already has this communications layer in place.

You also need to write programs for both the PC and the Pi that implement this communications layer, as well as the logic.

The PC program needs to read the kinect and figure out what the Pi needs to do. Then send the information to the Pi

The Pi program needs to listen to the communications layer and translate the communication into movements of the motors.

The communications layer will probably (if I were writing it) use TCP/IP sockets.

Or you could use ROS which has all of the implementation details done so that you can just work on the logic.

One of the easiest communication layers to set up is MQTT. I currently have a mosquito (sudo apt install mosquito) server running on a Raspberry Pi. This can be the same machine that is running your motors. Or you could run the server on another machine, it doesn't matter.

There are libraries and clients for MQTT available for most languages. Currently I'm running my commands using Gobot, which is a robot/IoT framework written in the Go language. This uses a basic publish/subscribe system. To be notified of messages with a specific topic, a program subscribes to the topic. To send a message to all the subscribers of a topic, you publish a message with that topic. In addition to the topic, there is also a message, which is an array of bytes defined by the user. You can also use the topic as a way of passing the message.

For example, the "motors-on" topic could tell the Pi to turn on the motors. The "motors-off" topic could tell the Pi to turn off the motors.

My test program used the same program as both publisher and subscriber.

It really is that simple.


问:
Doing a project for college for a manned drone theortically only
Weight of the Drone in total will be 240 Kg.

It Will be a quad copter drone setup but with 8 rotors(two on each corner) for redundancy purpose.
Aim is achieve Thrust/weight ratio of 2.
So need total needed thrust will be 500 KG.
Considering 500 kg thrust by 4 rotors only(because the 2nd rotor on each corner if fails the 1st motor should be able to compensate thrust) , each should be able to produce 125 kg thrust.
The propeller Diameter will be 1.2 m  ( Total 8 propeller)
Now coming to the question:
What should be the power rating of the motor if i want 125 kg thrust from each Propeller (When running at 85%-95% of the max RPM.)

If you have any Doubts or any details please ask ,will reply as soon as possible.

答:
Thrust vs. power is not constant -- it depends strongly on prop diameter (bigger diameter = more thrust/watt).  It depends less strongly on a bunch of other factors that I would know in detail if I were an aerodynamics expert, which I'm not.

Getting that part right would be a huge part of a real design.  I suggest, since this is a theoretical preliminary study, that you find some books on propeller design, and some on helicopter rotor design, and make a stab at estimating the prop size and motor power, with enough material for a section on the relevant trade-offs so that your instructors know you paid attention to it, and so that any follow-on researchers know where to look for more information.


问:
Tracking vehicle 6 states extended kalman filter required?
I'm trying to track an accelerating vehicle using a camera, an IMU, and a GPS.
I use for the state space equation a constant acceleration model:

The states are the position, the velocity, and the acceleration of the vehicle in the x- and y-direction. No input is used.
All the measurement equations are linear.
I'm wondering if I should use a discrete normal Kalman filter, or a discrete extended Kalman filter. (i.e. is my process non linear?)

答:
If you can write the dynamics with a matrix, which you have, then a normal kalman filter will be best.

However, your measurements will probably be nonlinear. You will find that you won't be able to write your measurements equations using matrices. You will almost certainly need an extended kalman filter because your measurements will be nonlinear.


问:
How can I simulate a changing environment with non-rigid objects?
Many robot applications (actually - the most practical and appealing ones) include the robot's reaction to (and impact on) the evironment, e.g. due to stochastic nature of the environment (e.g. when robot should handle non-rigid objects like clothes) or due to the variability of environment (e.g. harvesting robots should be prepared to pick fruits of different sizes and shapes).

The question is - is there a robotics simulator that can simulate not only robot but also the environment as well? E.g. that can simulate the response of robots action on cloth folding or fruit picking and so on. I guess that such simulator is really non-trivial but maybe there is some ongoing project for it?

答: I think Gazebo is the most popular, but Morse is also worth checking.</p>


问:
Using python to create AI
Just asking a quick question about implementing some python AI. I have a home built circuit running an ATmega32u2 chip and I was wondering if it’s possible to use this code on the chip? Or do I have to code that in C?</p>

答: For that microcontroller yes, you need to program in C++. But likely it's not powerful enough to do what you want to do. You should consider using a Raspberry Pi, or doing the higher-level computations on a desktop or laptop and communicating decisions about motor control etc to the atmega over serial.</p>

Title: Using python to create AI


问:
Finding relative location of Raspberry Pi robot indoors
I would like to have a Raspberry Pi robot that can find its location in a room relative to an origin point.

What methods would be cheapest?

What would the most accurate be?

Are there any others that might be in a sweet spot between the two that I should look into?

答:
I think that the methods which require no modification to the environment--e.g. gmapping with 2D lidar or ORB-slam with camera--are probably too computationally intense it to run on the pi alone. You would need to run a separate server and connect over Wi-Fi. This approach works, and I've actually gotten it to work over the internet instead of just a local network.

However, if you're willing to limit yourself to one room, you could try putting up some visual fiducials with known locations.

You could try an approach somewhat like what Paul suggests in a comment, with a bird's eye view camera that just tracks the robot as it moves around the room and computes its location directly. With this approach, you're going to need an external computer anyway, so you might as well do visual slam with a camera mounted on the robot.

A camera is significantly cheaper than a lidar, though you can get a salvaged Neato xv 2d lidar on eBay for about $70.

All of this would be easier if you had wheel encoders to provide an odometry estimate.


问:
Stereo Camera calibration with different camera types
I'm trying to perform stereo camera calibration, rectification and disparity map generation. It's working fine with normal sample data. However, I'm trying to use the dual cameras on an iPhone 7+, which have different zoom. The telephoto lens has 2X zoom compared to the wide angle camera. I ran the images through the algorithm, and it is succeeding, although with a high error rate. However, when I open up the rectified images, they have a weird spherical look to the edges. The center looks fine. I'm assuming this is due to the cameras having different zoom levels. Is there anything special I need to do to deal with this? Or do I just need to crop any output to the usable undistorted area? Here is what I'm seeing:

EDIT:

I tried using the calibration result from these checkerboard images to rectify an image of some objects, and the rectification was way off, not even close. If I rectify one of my checkerboard images, they are spot on. Any ideas why that happens?

These are what my input images look like that result in the spherical looking output image. They are both taken from the exact same position, the iPhone was mounted to a tripod and I used a bluetooth device to trigger the shutter so the image wouldn't get shaken, my code automatically takes one image with each lens. I took 19 such images from different angles, all images show the full checkerboard. The more zoomed in image is the one that rectified to the top spherical looking image.

This is the code I am running. I compiled it and ran it using the sample images, that worked fine. Ran it with my own images and here I am.  https://github.com/sourishg/stereo-calibration

I might just need to crop the result to a certain area. Regardless, it doesn't seem to work cropping or not when I use a picture I took of normal objects. Here is the output of an image of normal objects I ran through the filter:

答: Maybe you should rectify the wide-angle camera images with cv::fisheye::stereoRectify, which outputs a pair of undistort images with aligned epipolar lines.</p>


问:
Radio triangulation with Raspberry Pi
Currently, I am thinking that since electromagnetic waves loose energy over distance, you might be able to figure out the relative distance to each of three radio "beacons" and use this information to triangulate the position of a Raspberry Pi robot with a radio sensor on-board.

What kind of radio receiver may I need to use, and what information about the radio signal could I use to calculate the distance to the beacon? Amplitude, perhaps? The entire system would be running indoors as an Indoor Positioning System.

In short, my question is what specific type of radio receiver would be adequate for using radio signal strength for triangulation. If amplitude contains the information of the strength of the signal, then I need a sensor that is sensitive enough to pick that up, and can provide amplitude readings in the first place.

答:
Unfortunately, There is too much interference for this to work probably, as Olin Lathrop said here on the Engineering SE:

While your concept is theoretically correct, it doesn't work well in practice except for rough locations.

The problem is interference. Radio waves get absorbed, reflected, diffracted, and in some cases even refracted. All those mean that there isn't just a single point source from the receiver's point of view. The various components of the signal bouncing around the environment can interfere constructively and destructively, making received amplitude only a very rough estimate of distance.

Title: Radio triangulation with Raspberry Pi


问:
RobotC startMotor command useless?
I learned recently that robotc has a command called startMotor. it has two parameters, a motor and a speed, and it sets the motor to the speed.

But the same thing can be accomplished in one line like this:

```<code>motor[desiredMotor] = desiredSpeed;
</code>```

the above line is perfectly readable, and doesn't push a whole new frame to the call stack. Why would anybody choose to use startMotor in this case?

答:
You have to set something else, cause this instruction is telling the programm to set the motor speed to x and because after that, there is nothing else to do, it is going to end the programm, faster then it is able to turn on the motors.
In order for it to do something, you have to make it do something else.
e.g. idle

```<code>wait1Msec(100);
</code>```

You could also put it into a while loop

eather

```<code>while(true){motor[desiredMotor] = desiredSpeed;}
</code>```

or you can do something like this

```<code>while(SensorValue[light]> 50) {motor[desiredMotor] = desiredSpeed;}
</code>```

or

```<code>motor[desiredMotor] = desiredSpeed;
waituntil(SensorValue[light]> 50)
motor[desiredMotor] = 0;
</code>```

you are welcome to use this function I found and edited to move a fixed distance

```<code>const float WHEEL_DIAMETER = 55; //diameter of the wheel in mm.
const float DISTANCE_BETWEEN_WHEELS = 140;//distance between wheels in mm.
const float ENCODER_RESOLUTION = 360; //the encoder's resolution.
const float MOVEMENT_FACTOR =((WHEEL_DIAMETER * PI) / ENCODER_RESOLUTION);
// for using just red motor speeds do (red motor value * MOVEMENT_FACTOR )

void drive2distance(int FLEngineSpeed, int FREngineSpeed,int FLEmm, int FREmm)
{
// set distance
nMotorEncoderTarget[FLEngine] = FLEmm / MOVEMENT_FACTOR;
nMotorEncoderTarget[FREngine] = FREmm / MOVEMENT_FACTOR;

//straight

motor[FLEngine] = FLEngineSpeed;
motor[FREngine] = FREngineSpeed;

while (nMotorRunState[FLEngine] != runStateIdle || nMotorRunState[FREngine] != runStateIdle) {}

//stop

motor[FLEngine] = 0;
motor[FREngine] = 0;

}
</code>```

Title: RobotC startMotor command useless?

Body:
You have to set something else, cause this instruction is telling the programm to set the motor speed to x and because after that, there is nothing else to do, it is going to end the programm, faster then it is able to turn on the motors.
In order for it to do something, you have to make it do something else.
e.g. idle

wait1Msec(100);

You could also put it into a while loop

eather

while(true){motor[desiredMotor] = desiredSpeed;}

or you can do something like this

while(SensorValue[light]> 50) {motor[desiredMotor] = desiredSpeed;}

or

motor[desiredMotor] = desiredSpeed;
waituntil(SensorValue[light]> 50)
motor[desiredMotor] = 0;

you are welcome to use this function I found and edited to move a fixed distance

const float WHEEL_DIAMETER = 55; //diameter of the wheel in mm.
const float DISTANCE_BETWEEN_WHEELS = 140;//distance between wheels in mm.
const float ENCODER_RESOLUTION = 360; //the encoder's resolution.
const float MOVEMENT_FACTOR =((WHEEL_DIAMETER * PI) / ENCODER_RESOLUTION);
// for using just red motor speeds do (red motor value * MOVEMENT_FACTOR )

void drive2distance(int FLEngineSpeed, int FREngineSpeed,int FLEmm, int FREmm)
{
// set distance
nMotorEncoderTarget[FLEngine] = FLEmm / MOVEMENT_FACTOR;
nMotorEncoderTarget[FREngine] = FREmm / MOVEMENT_FACTOR;

//straight

motor[FLEngine] = FLEngineSpeed;
motor[FREngine] = FREngineSpeed;

while (nMotorRunState[FLEngine] != runStateIdle || nMotorRunState[FREngine] != runStateIdle) {}

//stop

motor[FLEngine] = 0;
motor[FREngine] = 0;

}


问:
H-bridges and stall current
For a DC motor with a stall current of 950 mA, what should the H-bridge's current rating be?  What will happen if we use our H-bridge L293D whose max. output current is 600 mA?</p>

答:
First a bit about motors. Stall current is the current drawn by the motor when the recommended voltage is applied and the motor is not turning due to a load. Alternatively, the no load speed is the speed the motor will spin at under no load. In this state it will draw a minimum current.

Here is an example torque/speed current for a DC motor:

Source: societyofrobots.com

So whether or not you can use your H-Bridge depends on how you are using the motor. If you are using the motor at a high speed and thus low torque state, you will not approach the stall current and may stay within the spec for the motor driver.

Furthermore, torque/speed curve is voltage dependent. If you operate at a lower voltage, you will draw less current and could possibly stay within spec for the H-bridge.

If you exceed the recommended current draw for the H-Bridge, it will heat up and possibly burn out or in the worst case start a fire. The L293D has overtemp protection so it may just stop functioning.

There are ways to increase the max current capacity of the H-bridge by introducing cooling in the form of a heat sink or fan or liquid cooling, etc. The current through the H-bridge is causing resistive heating of the chip. The heating raises the temperature of the chip eventually causing damage. If you increase the flow of heat out of the chip, you will be able to heat it more (more current) without raising the temperature too high.

Another option is use two L293D chips in parallel (H-bridge piggybacking). Adafruit suggests this with their motor arduino shield which uses L293D chips. They state this will double the current capacity. http://learn.adafruit.com/adafruit-motor-shield/power-requirements

Other H-bridges you could checkout are the L298 and DRV8801.

Title: H-bridges and stall current


问:
Denavit-Hartenberg Exam Question
I am having a bit of trouble with the pictured question:

I am able to do part a and b, however c is proving very difficult. My lecturer never really explained much beyond what is asked in a and b. Any hints about how to do it would be greatly appreciated. I have looked at inverse kinematics but that seems to be for determining the angles of the joints, not the length of links and distances.

Thanks in advance for any help!

Paul

Here is the diagram of the robot also:

答:
The question is meant to see if you have learned anything about the underlying math and geometry associated with kinematics rather than just blindly following the basic steps for calculation.

Draw the robot, compare the symbolic version of the calculation with the numerical results listed, and it should be straight forward. Using what you know about figure Q1 will let you simplify the symbolic calc.

Title: Denavit-Hartenberg Exam Question