问:
Can you find object distance using camera pose
I have bounding boxes detected in RGB images, but no information about the camera's intrinsic properties. Using deep learning (preferably) can I find the distance to the object from the camera in real world (meters or cm)? If I find the camera pose (using PoseNet) does that help? </p>

答:
Without going into detail, to answer your question, yes you can.  That is, the camera images do contain information about the distance of objects, but only in conjunction with information from the environment which is typically embedded in a model - for example a model about objects, how they appear and their sizes.

Essentially, it would have to work similar to how humans determine the distance to objects that are beyond the range where the separation of our eyes can utilize stereo cues.  That is, we estimate how far away a familiar object is using its apparent size.  If you see a car with a small apparent size, you assume it is far away because you know the typical size of a car.

This obviously requires an object recognition model that also provides actual size information that can be used in conjunction with your bounding-box apparent size to determine the distance.

Keep in mind that, not only will it only be as good as the object recognition model, but it can be fooled (- is it a real car in the distance or a toy car closer?).


问:
Microcontrollers and Python
So I am fairly new to robotics however I do have some background with the python coding language. Recently I set myself the task of learning some basics for robotics just to increase my knowledge base.

My question is about micro-controllers and specifically if I need to buy a certain type of microcontroller to be able to program with the python language. Also are there any recommended python libraries or starting points for robotics with python? I apologize if this question is a bit broad or not well formed as I am very new to understanding microcontrollers.

Thank you

答:
You may also consider the
PyBoard  which has a microcontroller specifically configured to run Python (Micropython).  There are many addon 'shield' board for robotics-related components and a book that will help to get started.

ContentLicense: CC BY-SA 4.0

Title: Microcontrollers and Python


问:
Encoder attached to output of gearbox of stepper motor
I'm building a SCARA robot controlled with stepper motors and want to use an encoder to close the loop. The main reason for this is I am using an experimental gearbox with nonlinearities and zero backlash so I cannot trust the stepper motor to move to a target position in an open loop configuration. It makes more sense for the output position to be specified and the input changed to match it.

Problem is that all examples and products I can find are meant to be attached to the output shaft of the stepper motor rather than the output of the gearbox. The reduction will is much smaller and I don't know if the PID controller can deal with large discrepancies in turning speed.

I want to know if I can use products such as the CLT57T from stepperonline to control an axis based on the output of a gearbox rather than on the output of a stepper motor.

The only other product I have found that can do this is kflop+kstep from dynamotion, but I idealy want something with a step/dir control interface.

Another less ideal option is using a BLDC servo driver such as this one instead of a stepper driver, but I would miss the stepper motor's holding torque.

答:
Here is the response from stepperonline about their closed loop stepper controller.

Glad to receive your inquiry.
  You can't install the encoder on the output of the gearbox. This is uncorrect and forbidden. For the driver can't control the motor
  The encoder must install on the shaft of motor.
  Have further question, please don't hesitate to contact us.
  Best Regards

Turns out it's not possible


问:
Choosing a platform to start
I'd like to start with robotics, but unfortunately I know very little about HW engineering. Moreover I used to use such languages as Python, C# and Java, and do not have much experience in C. Still I want very much to be able to program a robot, and I have very big interest in Computer Vision and AI. Are there any platforms/kits that you can buy, and with little time spent you already can program them, preferably in high-order languages?

I'd prefer something wheeled (something flying would also be nice, but it may be too hard to be the case for a first robot), with a camera and some additional sensors. Would be also nice to have there something, that could help to avoid obstacles, like laser distance sensor or ultra-sonic sensor. Ideally I would like to build a robot that can navigate in the room without the help of operator. I'd like to look at SLAM some time in future, but for now I just need something to get familiar with the robotics.

Also it should probably be not very expensive, at least not before I will be very sure that I am ready to go deeper into robotics. Something for 300-500$ would be awesome.

Can somebody suggest kits/platforms/tutorials/any other info?

答: I would suggest trying lego mindstorms. It removes a lot of the electronics, and mechanical barriers when starting to learn about robotics.</p>

ContentLicense: CC BY-SA 3.0

Title: Choosing a platform to start


问:
Calculating the cartesian position of each joint with DH transform
Premise: I am by no means an expert on Robotics, I have to deal with this project where we use a robotic arm (franka emika), so feel free to assume that I got the basics wrong!

I have this arm ( https://frankaemika.github.io/docs/control_parameters.html ) and I have its DH parameters for each joint. I need to compute each x-y-z joint positions.

I understand from here that you can compute, for each joint, a $
[^{n-1}T_n]$ matrix which represents a "change of frame" from the previous frame; I also understand that the product of the first n matrixes gives the change-of-frame from the initial frame to the n-th joint frame.
But, how do you use this T matrix to compute the x-y-z positions?

答:
By combining all the matrices, you'll end up having an homogeneous transformation $T \in SE\left(3\right)$ that can be expressed as:
$$
T= \left( \begin{matrix} \mathbf{R} & \mathbf{p} \\ 0 & 1\end{matrix} \right),
$$
where the matrix $\mathbf{R} \in \mathbb{R}^{3 \times 3}$ is symmetric and defines how the final frame is rotated with respect to the root, whereas the vector $\mathbf{p} \in \mathbb{R}^{3 \times 1}$ accounts for the translational part.

Indeed, it comes out that:
$$
\mathbf{p}=\left( \begin{matrix} x \\ y \\ z \end{matrix} \right).
$$


问:
Real world dynamic problem suggestion for PID
I need you guys to suggest me a problem that requires to change PID coefficients in different times. Lets say every 1 minutes the environment should change and readjust the PID’s parameters. Note that my knowledge about PID is limited. So just suggest me a problem which can be simulated in simulink or gazebo. Then I am going to use my algorithm to adapt the new environment to find the new parameters for the PID. Note that my algorithm is written with C++ and it is an optimization algorithm. It works very well on benchmark problems but for my graduation I have to test on a dynamic real world problem.

The structure will be like this: system will start with some random parameters and then the error will be parsed by my algorithm, and it will produce new parameters for the PID. It will continue with these parameters until the next environmental change. And all this will be in a infinite loop. I hope I could explain my problem. Thanks in advance.

答:
Look for highly nonlinear problems where a single PID is not suitable to work at its best within the whole operational range thus requiring multiple controllers.

Here's an example in Simulink.

In your case, instead of having a repertoire of PID controllers already tuned up to operate in different points, you might consider sticking to a single PID whose gains you aim to modify as the plant evolves over time.

Another typical example where adapting the PID is fundamental is when the plant under control undergoes wear and tear. And if your plant is the tire of a racing car and your controller is responsible for regulating the slip in a turn, you would certainly need to account for varying characteristics of your tire model throughout the race.

Here's a good reading on this argument.


问:
Algorithm for centering an object that is changing speed
I'm trying to use a pan / tilt alt-azimuth telescope mount to track an object that is moving in the sky. The problem is that the object is changing speed constantly. I can easily track objects that are moving at a steady speed.

I'm using the OpenCV library to compute the object's distance from the center of the image. I should be able to tell the telescope mount to speed up or slow down to follow the object. The actual algorithm though seems surprisingly hard to write.

For instance if I tell the mount to speed up to follow the object, then the apparent speed between the two is much less, but still not zero. So the object is slowly drifting out of the view. So I have to recenter it which is totally different than adjusting the speed. It's like I need a re-centering algorithm and a speed adjusting algorithm running at the same time.

Does anyone have any ideas how to do this or where to ask? Neither the OpenCV or telescope forums seems the right place to ask this question.

Thanks

答:
Thanks for the replies. I figured out to make it work. I divided the image into different regions using horizontal lines. Then, I have a timer in C# that every x milliseconds figures out which region the centroid of the object is in. (The centroid is obtained by finding the centroid of the OpenCV tracker bounding box). Then each timer cycle it checks to see if the object went from one region to another. So I have a set of rules. If the object goes from region 0 to region 1, then the motor speeds up. If it goes from region 1 to 0, no speed change happens. If it goes from 0 to -1 then the motor speed is decreased. This acts like a funnel guiding the object towards the middle of the image. I have 10 horizontal regions and 8 vertical regions for each movement axis.
There are opposite rules depending on if the motor is moving left or right.
I also have a boolean value to keep track of which way the motor is spinning. For example xMovingLeft, xMovingRight, yMovingUp, yMovingDown. There is a different, opposite set of region rules if the motor is turning a different direction.
The only downside to doing it like this is that the object is constantly moving left/right up/down towards the center of the image. But it's not that bad and often times the speed is exactly the same so the object is moving at exactly the same speed as the mount.


问:
3D Inverse Kinematics Jacobian
I am reading up on inverse kinematics and have a few questions I hope could be answered.

This example is from a 3-revolute-joint, where $ E $ is the end effector and $ G $ is the goal position of the end effector.

It states that the desired change to the end effector is the difference between the end effector and the goal position, given as follows:

$$ V = \begin{bmatrix}(G-E)_x\\(G-E)_y\\(G-E)_z \end{bmatrix} $$

This can then be set equal to the the Jacobian in the following form:
$$ J = \begin{bmatrix}((0,0,1) \times E)_x &(0,0,1) \times (E-P_1)_x & (0,0,1) \times (E-P_2)_x\\((0,0,1) \times E)_y &(0,0,1) \times (E-P_1)_y & (0,0,1) \times (E-P_2)_y\\((0,0,1) \times E)_z &(0,0,1) \times (E-P_1)_z & (0,0,1) \times (E-P_2)_z \end{bmatrix} $$

From this Jacobian term I do not understand where $ (0, 0, 1) $ comes from.

Also I do not understand what the $ P_1 $ and $ P_2 $ come from.

I would like to understand where they come from and what they mean?

答:
OK, I was able to find a copy of the book Computer Animation Algorithms and Techniques by Rick Parent.

As stated the problem was as follows:

Consider the simple three revolute joint, planar manipulator of Figure 2. In this example the objective is to move the end effector, E, to the goal position, G. The orientation of the end effector is of no concern in this example.

The axis of rotation of each joint is perpendicular to the figure, coming out of the paper.

The diagram and last point are the keys to understanding the terms that you found unclear.

As we can see from the diagram, $ P_1 $ and $ P_2 $  are the Cartesian coordinates of the revolute joints P1 and P2 respectively (E is the Cartesian coordinates of the end effector).

And $ (0, 0, 1) $ is simply the the “z” vector, defined by the axis of rotation of the revolute joints (i.e. perpendicular to the figure, coming out of the paper).

Thus, what you are calculating are the cross products of the joint axis ("z" vector) and the vectors from the joints to the end-effector ($ E - P_n $).

Title: 3D Inverse Kinematics Jacobian


问:
Difference between Single-Query and Multiple Query Algorithms?
I am spending a lot of time in understanding these two concepts, because in several papers that I read, they define them differently, and I do not know exactly what is the meaning of the two different queries.

I understand, from what I read, that single query algorithm, like RRT, they only compute a single path between an starting point and a goal point, and anything else.

However, multiple query algorithms, like PRM, you construct a roadmap, and once you have it, you can query it for multiples paths, I mean, you can select two points (init and goal), and then if you change your opinion you can change these two points with others.

But I do not know if this approach is correct. I  would love that someone can explain me in layman terms.

答:
Modern pathplanning algorithm like PRM and RRT allow to find a trajectory on a given map which avoids obstacles. Especially under realtime condition in computer games the techniques are providing an efficient path from start to goal. Apart from pathplanning itself, graph-based planning can be used as a meta-algorithm for motion planning in general.

RRT is faster than PRM because the number of calculated edges are lower. RRT was designed with minimalism in mind, which means that graph extension is seen as costly and should be avoided under all circumstances. In contrast, PRM invests more resources in building a complete graph which includes more nodes and more edges.

For the solver ontop of an existing graph, the PRM algorithm is more comfortable to query, because the number of possible paths is higher. Additional constraints can be matched more easily, while RRT has the problem that the shortest path looks in most cases a bit strange. The spline isn't the shortest one but goes a bit uncommon through the map. That is the reason, why RRT needs a postprocessing step to smooth the path.


答:
The description of the problem fits great to a technique which is called model predictive control. It can solve the problem of tracking an object with a telescope on a mathematical satisfying way. The first thing to do is to create a prediction model. The next step is to program a controller which is utilizing the estimation for the control the telescope itself. But let us go into the details.

The object at the sky is generating a trajectory during time at a gantt chart. On timestep 0 the object is at place #1 while on timestep 1 it is on place #2 and so on. A so called forward model is able to predict the future position of the object. The model takes as input the current position (x,y) and the desired future timestep (for example 100) and returns the position of the object. Creating such a forward model can be done with different techniques. A simple formula may be a starting point, but neural networks can do the same job.

The forward model itself is useless, because it doesn't answer how to move the telescope. This is done by the second software module called predictive control. This algorithm takes as input the current position of the telescope and the predicted position of the object and will move the telescope to the next position. Realizing the predictive control can be done also with many ways. In it's easiest case it's a behavior tree but some advanced mathematical equations can do the same job.

What is important to realize is, the separation between prediction and control. Both problems have to be treated independent from each other. The first question is what is the future position of the object in the sky, and the second problem is how to move the servo motor in reaction to this prediction.

Title: Algorithm for centering an object that is changing speed

Body:
I'm trying to use a pan / tilt alt-azimuth telescope mount to track an object that is moving in the sky. The problem is that the object is changing speed constantly. I can easily track objects that are moving at a steady speed.

I'm using the OpenCV library to compute the object's distance from the center of the image. I should be able to tell the telescope mount to speed up or slow down to follow the object. The actual algorithm though seems surprisingly hard to write.

For instance if I tell the mount to speed up to follow the object, then the apparent speed between the two is much less, but still not zero. So the object is slowly drifting out of the view. So I have to recenter it which is totally different than adjusting the speed. It's like I need a re-centering algorithm and a speed adjusting algorithm running at the same time.

Does anyone have any ideas how to do this or where to ask? Neither the OpenCV or telescope forums seems the right place to ask this question.

Thanks


问:
How to determine the direction of X-Axis in Denavit Hartenberg process? [Sketch inside]
The rules of assigning axes for DH parameters are (as I know them):
1- Z: in the direction of the axis of rotation/translation of revolute/prismatic joints.
2- X: perpendicular to the previous Z axis but not colinear with the current Z-axis.
3- Y: fill the cartesian coordinate.

But my question is: how do you assign the direction of X axis? you can have two directions for X-axis when assigning it. See the picture below

答:
You should use right-handed coordinate system, that means if you curl your palm/fingers of your right hand from +x to +y, then your thumb direction shows the +z direction.

For DH you have to follow these rules ,


答:
The DH method is ambigous. There are multiple solutions which are correct and leat to the same TCP pose.

Try to make a minumum amount of changes in the coordinate systems with the transition. If you can choose the x axis pointing in the same direction as the previous one then do so. If not, you can try to anticipate how the next X axis should be or how the TCP X direction will be and try to match that. In other words, as a rule of thumb, the more 0-s in the DH table the better.

Title: How to determine the direction of X-Axis in Denavit Hartenberg process? [Sketch inside]

Body:
The rules of assigning axes for DH parameters are (as I know them):
1- Z: in the direction of the axis of rotation/translation of revolute/prismatic joints.
2- X: perpendicular to the previous Z axis but not colinear with the current Z-axis.
3- Y: fill the cartesian coordinate.

But my question is: how do you assign the direction of X axis? you can have two directions for X-axis when assigning it. See the picture below


问:
Gravity compensation
I am just getting curious about this gravity compensation technique.
If we could compensate the force generated by the gravity (by feeding in the exact amount of force into the opposite direction), will the mass of the robot be 0 kg?

Could we then just swing a 1000kg robot arm with our hand?

答:
In an ideal scenario, yes, that should be the case. When gravity compensation is implemented on robots, all joints apply a torque to balance out the torque applied by the force of gravity. They should ideally turn into floating robots objects.

However, it is not always the case due to inaccurate modeling and gravity compensation implementation. Moreover, to swing a robot arm, you'll also need to overcome friction, stiction and other forces that oppose motion at the joint level.

If you have a Zero-Friction Zero-Gravity controller (you feed gravity compensation torques as well as friction torques in a tight closed loop), then the robot should be simply floating in space, massless. In such a case, you can definitely move a robot arm around with your hand, regardless of the mass. It is because all the forces that the robot needs to overcome and break into motion have already been overcome and the slightest of external efforts shall be extra input and sufficient to move the robot.

Title: Gravity compensation


问:
What frame of reference is used during Visual Servoing?
I'm new to the whole visual servoing area.

I'm now reading the tutorial Visual Servo Control
Part I: Basic Approaches" and I don't understand something fundamental - what information is available to the robot?

Is the 3D location of the tracked features in the current frame known?

Is it known for the desired frame?

Is it known for both?

If it's known for both - then what would be the best thing to do?
Would it be to compute the current and desired 3D location and orientation of the robot, and plan an optimal path accordingly, essentially knowing everything in advance?

Also, in what sense could a control law (i.e translation + rotation path) be optimal for a visual servo?

答:
Generally, visual servoing is a way to measure your position relative to features that are seen on the camera, without having to know your absolute position.  In other words, registering those features with those in a global frame would be a separate process.

Remember that visual servoing is not limited to simply providing more data about your static environment -- it's entirely appropriate to use visual servoing to maintain a position relative to something else in the environment that might move.


问:
How to create a stable 48V 10A power supply?
I'm shopping for batteries and it's easy to find a 48V lithium ion battery that has like 30A max continuous discharge rating. However, I know that the battery supply has a variable voltage from 54V - 42V depending on how much energy has been drained.

I'm using a 48V to 24V buck converter to power many of my electronics for a stable 24V power supply. However, I still have some 48V motors that takes 10A max for my robotics application. I can't figure out a way to power my 48V motors with a stable power supply.

I found a 36V to 48V step up converter but it only outputs 5A.

答:
Edit: I'm not sure if a 48V - 48V boost converter will work because it won't step down my voltage when the input is over 48V. I will continue looking into this and keep you updated.

From the looks of things, this a boost Voltage Regulator DC 8-60V to 10-120V 15A Boost Converter might work.

I found 2 on amazon that seems to fit the bill. I would go for the 96% conversion efficiency one since the other one is 85% efficient. In addition, it seems like I will need to add a fan/heat dissipation solution to the 96% efficient one.

(I am no way affiliated with these amazon links, sellers, and links are only provided for convenience for people with the same problem).

96% efficiency:
https://www.amazon.com/Aideepen-Converter-Step-up-Supply-Module/dp/B01MSYVMAL/

85% efficiency:
https://www.amazon.com/dp/B01GFVI6R6/


问:
How to balance a long vertical bar
I have a mobile base (1400x1800x400 mm) which has a vertical bar (1) mounted on its geometric center; this vertical bar has a length of 2500 mm and a diameter of 100 mm and I need to keep it always in its vertical position even if the mobile base is not correctly aligned as showed in the attached photo.

I use an inertial sensor to read the bar position.
I was thinking to use four electric linear actuators, but this could not be a good idea because they would be hard to control (if they are not perfectly synchronized, they can get stuck or broken very easily).
What about stepper motors? I would like to implement something like the system used on the 3-axis gimbal. Do you think there is any commercial solution I can use?

答:
I believe your intuition about using push-pull linear actuators is in the right direction: you would have a quite hard time to control such a structure.

Traditionally, to deal with a cart-pole system you are supposed to deliver torque to the actuators with a certain level of accuracy. In this respect, BLDC motors are certainly the best way to go, especially over step motors where instead you don't have fine control on the torque.

On the contrary, if you're not very interested in precise control of the bar position as well as the smoothness of the resulting movements, then you could consider a design based on step motors.

Title: How to balance a long vertical bar


问:
Stabilizing a quadcopter with optical flow
My quad copter can balance itself in the air using data collected from mpu6050. With the sonar sensor, it can hover at a specific height, but it  moves on the horizontal plane in a random direction.  If i put an object below it, it will ascend to keep the distance between the sonar senor and the object.

Now i want to make it have the ability to hover stably. Is it possible to add a downward-facing camera to calculate the speed of optical flow in order to keep it hovering on the same point in the horizontal plane?  Could I use a forward-facing camera to stabilize its vertical speed?

答:
It sounds like you want to control the position of your quadcopter, and although it's possible to do with a camera I don't think optical flow is the right way to approach the problem.

Rather than measure the motion of the quadcopter, you should measure the position.  For that, you'll want to use the camera to identify features in its field of vision, then attempt to keep them in the same place relative to the vehicle.  This is called Visual Servoing.


问:
How to transform raw accelerometer data into the Earth fixed frame to determine position
I have data from a TeleMega and do not understand how to apply the rotation matrix for the accelerometer data so that I can get the more accurate position estimate from my accelerometer. My data comes from a high powered rocket if that helps. I don't understand quaternions so that wont be much help to me unless you can show me how to run the madgwick c++ code. I have raw accelerometer, magnetometer, and gyroscope data stored into arrays but I have no idea how to incorporate that into the madgwick code into c++. I am trying to follow this link but I am stuck on how to apply step 4. I am a decent coder in c++. I have integrated the gyroscope data already but don't understand what to do with it. please help.
what is the algorithm to get position (Linear displacement and linear velocity ) using IMU (Like MPU6050)?

I wrote some code already that uses a Kalman filter to smooth the accelerometer data and then I applied numerical integration to obtain velocity and position and then implemented a 3D graph of the trajectory of the rocket but it was not what I was expecting which is why I am asking this question.

答:
There are several questions here, so I'll try to address them all.

First, using the integrated gyro output. Integrating the gyro output, which provides angular velocity, gives you an orientation estimate. A lot of people that use the term "Euler Angles" generally actually mean Tait-Bryan angles. Proper Euler angles only use two axes, like an X-Z-X rotation, where the Tait-Bryan angles use all three axes, like an X-Y-Z rotation. Aviation/navigation angles like Roll-Pitch-Yaw (RPY) are Tait-Bryan angles.

If your question is how to convert those angles to a rotation matrix, then the answer is on the Wikipedia page for the Euler Angles under the "Rotation Matrix" section.

Step 4 in my other answer then uses that rotation matrix to transform the accelerometer outputs. It's done with a matrix multiplication:

$$
\left[\begin{matrix}
\ddot{x}_w \\
\ddot{y}_w \\
\ddot{z}_w \\
\end{matrix}\right] = \left[R\right] \left[\begin{matrix}
\ddot{x}_b \\
\ddot{y}_b \\
\ddot{z}_b \\
\end{matrix}\right]
$$

The Eigen library would be a great starting place for getting the tools to easily do matrix math. You could do it all by hand, but you're reinventing the wheel and liable to make some math error that's going to cost you a lot of time.

The big alternative here is, as I mention in the other answer and you mention here, the Madgwick filter!. The C implementation available there (warning: direct download) has orientation in quaternion form, with q0, q1, q2, and q3 as global, and then there are two functions. The first is MadgwcikAHRSupdate, which uses gyro inputs (gx, gy, gz), accelerometer inputs (ax, ay, az), and magnetometer inputs (mx, my, mz).

If you don't have a magnetometer, use the second function, MadgwickAHRSupdateIMU. It only uses gyro and accelerometer outputs.

Be sure to update the sample frequency; the default is 512 Hz.

The Madgwick filter will do a better job of estimating orientation than just integration of the gyro output because the Madgwick filter uses the gravity vector from the accelerometer readings to eliminate orientation drift.

Once you have the output of the Madgwick filter, which again is the orientation in quaternion, you again convert that to a rotation matrix, transform your accelerometer readings, and then double integrate to get position. The conversion from quaternion to rotation matrix is also on Wikipedia.

Give these a shot and let us know how it goes! Best of luck!


问:
Navigation - GPS + IMU; how to make it more accurate?
Currently, I am trying to navigate a small robot car to point A from my current position. The car has a GPS sensor and a BNO055 IMU(Gyro + Mag + Acc). I know the GPS co-ordinates of point A. Using the GPS co-ordinates of my car, I can calculate the bearing angle and the distance. From the fusion mode in the BNO055, I get the tilt compensated heading again(It gives me heading, roll & pitch). Based on the heading angle and the bearing angle, my car makes its turns. However, here is what I want to build on this:

The GPS readings sometimes are a bit far from my actual position. How to get rid of these outliers? I've read of the use of EKF. But they seem to be all mathematical formulas and it's tough to keep up with them!

For when the GPS signal is lost, I've read about Dead Reckoning methods being used. I'm not sure how to implement those. Can someone shed some light on that?

Can I calculate the speed with just the GPS and an IMU?
Any help is appreciated, thanks!

答:
The simplest answer to all those questions, is to use an EKF. But since you are not familiar with the mathematical formulas of EKF here are some possible methods which might be useful for your problems. Here I'm trying to explain some steps of the EKF in a simple manner.

Let's start with your second question. Dead Reckoning method can be used to estimate the current position using raw odometry data such as wheel encoder readings. Assume that you know the current heading and the velocity of the robot at time t. Then you can calculate it's position in the next second (t+1) assuming that velocity is constant. But the calculated position may differs from the actual position due to various reasons such as drifts, velocity changes etc. This is what basically happens in dead reckoning. You can use the linear acceleration values from IMU to calculate the X and Y coordinates of the robot, using S = ut + 0.5at^2. But the problem in this method is, the error accumulates with the time. In that case we fuse GPS readings with IMU readings using an EKF.

For the third question, you can calculate the speed only with the IMU readings. First calculate the linear acceleration values in world coordinate frame, then use v = u +at to calculate the current velocity.

v - current velocity  u - starting velocity  a - acceleration   t- time

In this equation we assume that the acceleration is constant during the time step t. Therefore use a value for the time step as small as possible (around 0.01).

For the first question, I can suggest this method. usually GPS readings has a variance about 3.5m. You can measure the difference between two consecutive readings and if the difference is higher than a threshold (let's say 5m) that reading should be ignored. Until you receive a good measurement you can estimate your position with dead reckoning.

I strongly recommend you to use EKF since it provides the best solution for all these questions. No need to understand what is happening inside. MATLAB has an inbuilt function for EKF.


问:
How do I calculate the direction robot is facing, pose from velocity and yaw rate?
I have a simple car robot with four wheels moving relatively slowly (5~10 mph). The robot has a velocity magnitude and yaw rate sensor and the sensor samples about every 0.1 seconds. I want to map the location of the robot in the room in a global coordinates using these two values. What I am doing is robot starts out at location (x=0,y=0). I calculate the location by saying

```<code>x = velocity*cos(yaw_rate)*sample_interval
y = velocity*sin(yaw_rate)*sample_interval
</code>```

So far with this method, the location calculated is actually fairly good as long as the yaw rate is not so large. But if my understanding is correct, yaw rate is the rate of angle change and not the angle changed and to get a better model and the actual direction the vehicle is facing, I will need to say integrate the yaw rate. I want the angle the robot's face normal vector makes to vertical axis so I can figure out the direction robot is facing or it's pose.

Now this must be a very well known equation in robotics and mechanical engineering but my back ground is in programming and I have no idea where to start. I tried searching on google but my search words must not be right since I can't find a good page. Can you point me to the right direction, let me know of a starter page that I can look at?

答:
First of all, two equations you have mentioned above is completely wrong. If we consider the units, velocity - m/s, yaw rate -rad/s, time - s and after multiplying an additional 1/s is remaining. Maybe you are getting the yaw, instead of yaw rate. So its better to clearly mention what types of sensors you are using.

For these kind of position estimation, we usually use Extended Kalman Filter to fuse the measurements of several sensors. I recommend you to understand what is happening inside an EKF. There are plenty of online articles and youtube videos available. Further MATLAB has an inbuilt function for this.

After understanding concepts behind the EKF, you can identify two major steps are carried out when fusing measurements ; prediction step and update step. But since you dont have an absolute positioning system you can use only the prediction step. This is also known as dead reckoning. The main disadvantage of this method is that the error of the position estimation accumulates with the time.


问:
How can a motor be run at higher voltage for longer?
A 12V windshield wiper motor to run at 24V for more speed but near-equal driving force.

Testing with a variable DC supply between 21.6V & 26.4V showed the current maxes at 3.72 - 3.90A, as opposed to 3.28A with 12V. It did heat up around 24V but only really hot (enough to drop) at 26.4V.

Two of these in the back for drive but speed at 12V isn't enough, how can it run at higher & faster for longer. (Changing the motors isn't really an option.)

答:
Running a motor with a higher voltage might reduces its lifetime. However there are some cases where we want to run motors above the rated voltage. According to the equation V = IR, current increases with the voltage since the resistance is contant in a motor. But when it is getting heated, the resistance gets low and the current increases. This process will continue and burn up the motor. Here are some sugggestions to overcome these problems.

Remove the heat of the motor using a cooling system ( Heat sink with a fan, covering with low density oil).

Use a current limiting circuit to avoid drawing more current when heating up.


答:
Usually, motors in robots are speed controlled, for example using PWM.

Design your system so it meets the spec at the speed you get when the motors are running at 42V.

With the supply above 42V, your motor speed feedback reduces the PWM duty cycle and the motor speed is maintained.

Title: How to create a stable 48V 10A power supply?

Body:
I'm shopping for batteries and it's easy to find a 48V lithium ion battery that has like 30A max continuous discharge rating. However, I know that the battery supply has a variable voltage from 54V - 42V depending on how much energy has been drained.

I'm using a 48V to 24V buck converter to power many of my electronics for a stable 24V power supply. However, I still have some 48V motors that takes 10A max for my robotics application. I can't figure out a way to power my 48V motors with a stable power supply.

I found a 36V to 48V step up converter but it only outputs 5A.


答:
You can definitely use Visual Servoing for pose maintenance in the X-Y plane. You need to have sufficient distinct features on the ground to get a good estimate of drift/spin etc. For example, on an uniform and large ground/field, lack of features might become a problem. But things will be more in your control and you can add visual cues into the scene to assist the image processing.

The forward facing camera is quite different. If your quadcopter flies high enough and is staring right into the horizon, precise pose maintenance will be very difficult (roll/pitch stabilisation might become easy in that case). But stabilising the vertical speed based on solely its front facing camera may not be a very good idea.

Title: Stabilizing a quadcopter with optical flow

Body:
My quad copter can balance itself in the air using data collected from mpu6050. With the sonar sensor, it can hover at a specific height, but it  moves on the horizontal plane in a random direction.  If i put an object below it, it will ascend to keep the distance between the sonar senor and the object.

Now i want to make it have the ability to hover stably. Is it possible to add a downward-facing camera to calculate the speed of optical flow in order to keep it hovering on the same point in the horizontal plane?  Could I use a forward-facing camera to stabilize its vertical speed?


问:
How does a self-driving car locate itself when the environment changes?
There's something I don't quite understand about SLAM. When a self-driving car wants to locate itself using a prior map, how does it do that when the environment keeps changing, e.g., new cars parked on the curb, etc.? Even if it uses a 3D map, the current sensor would be quite different to the prior map if there're new objects on the road.</p>

答:
The landmarks chosen for a given location should include many that only infrequently change - for example, features of buildings, such as architectural motifs, corners of the structure, utility installations etc.
Parked cars would make for poor landmarks precisely because of their transience.</p>


问:
DH parameters to solve forward kinematics problem
When solving the kinematics problem for a robot using DH parameters, if there are some passive joints between the actuator and the end effector, do I have to define the axis and transformations of passive joints too just like for active joints?</p>

答: Yes.  Geometrically computing the static joint-space coordinates in terms of Cartesian coordinates (for example), it is irrelevant if a joint is active or passive.  For non-serial chains, some coordinates may be expressible in terms of others, so may be omitted from the IK calculation and computed by substitution afterward.</p>


问:
ROS Theoretical Question - How does work properly a node
I'm new at ROS and I'm trying to figure out how does the node works with a pyton/C++ code. I have two codes for the same situation:

Use a Xbox Controller to move the turtle in turtlesim

FIRST - Using class python and a while as a main:

```<code>#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy

# DEFINING CLASS
class pubSub:
    def __init__(self):
        # DEFINE VARIABLE TO KEEP LAST VALUE
        rospy.init_node('c2t')
        self.twt = Twist()
        self.hold = Twist()

    def callback_function(self,joyData):
        self.twt.linear.x = 4*joyData.axes[1]
        self.twt.angular.z = 4*joyData.axes[0]
        self.hold = self.twt

    def assuming_cont(self):
        pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)
        rospy.Subscriber("joy", Joy, self.callback_function, queue_size=10)
        pub.publish(self.twt)

ps = pubSub()
while not rospy.is_shutdown():
    ps.assuming_cont()
</code>```

SECOND - Using global variables and a if __name__  == '__main__' with rospy.spin()

```<code>#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy

# FUNCTION - GET JOY VALUES TRANSFORM TO TURTLE MOVE
def joy_to_twist_transform(jData):
    twt = Twist()
    twt.linear.x = 5*jData.axes[1]
    twt.angular.z = 4*jData.axes[0]
    pub.publish(twt)

# FUNCTION - START PROCESS
def process():
    global pub
    pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)
    sub = rospy.Subscriber("joy", Joy, joy_to_twist_transform, queue_size=1)
    rospy.init_node('control_2turtle')
    rospy.spin()

# MAIN
if __name__  == '__main__':
    try:
        process()
    except rospy.ROSInterruptException:
        pass
</code>```

My questions are more theoretical:

1 - What I understand about how a node works is: he run the code in a loop until is shutdown. But this does not answer Why can I still save the last value published in a topic (in my head, if I run my code in a loop I start from the beginning everytime)

2 - Why is necessary to keep creating a rospy.Publisher and rospy.Subscriber in every loop? it is possible to create those guy one time only?(for example using them into init function in the seconde example)

3 - What is the difference betweenwhile not rospy.is_shutdown(): and if __name__  == '__main__' with rospy.spin()?

4 - What is rospy.spin()? in any documentation says that keeps your node running, but the way I see he stuck the code in that line and keep there only.

If any could give any recommendation to read about those problems I would thanks a lot.

答:
if __name__  == '__main__': doesn't matter at here (in the second code), also you could run your code without it like here:

Second code:

```<code>.
.
.
# MAIN
try:
    process()
except rospy.ROSInterruptException:
    pass
</code>```

i.e. when you don't want your code to run when it imported in another python code, you should use if __name__  == '__main__':

More information.

The main difference between First code and Second code is that the Second code used the rospy.spin() method which is a built-in ROS loop that triggers the publisher and subscriber in another thread, so you wouldn't need to an inner while in your code like the First example.

Relevant Question.

Body:
if __name__  == '__main__': doesn't matter at here (in the second code), also you could run your code without it like here:

Second code:

.
.
.
# MAIN
try:
    process()
except rospy.ROSInterruptException:
    pass

i.e. when you don't want your code to run when it imported in another python code, you should use if __name__  == '__main__':

More information.

The main difference between First code and Second code is that the Second code used the rospy.spin() method which is a built-in ROS loop that triggers the publisher and subscriber in another thread, so you wouldn't need to an inner while in your code like the First example.

Relevant Question.


问:
Swarm Robot Simulation
Both V-rep and Webots simulator says that they can simulate multiple robots. Is these simulators are capable for simulate swarm robots? Can I simulate the swarm intelligence algorithms like ACO, BeeClust algorithm, Stick pulling Algorithm, Occlusion Based Collective pushing etc. on these simulators? Which robot I have to select for implementing above algorithms? For implementing these algorithms which simulator will be better? Any suggestions is appreciated.

答: The ARGoS simulator specifically targets swarm robotics development. There is also a really awesome swarm robotics programming language, Buzz, that plugs into ARGoS. There is even a ROSBuzz version. Lastly, I recently discovered this fantastic repo named TensorSwarm for reinforcement learning of robot swarms that plugs into ARGoS. </p>

Title: Swarm Robot Simulation


问:
What the best roadmap to learn building and programming drones in the deepest level?
I want to learn how to program the drone in C without using the available libraries and platforms. I want to be able to understand how everything is set at a fundamental level(SRAM). Also, I want to learn to implement complex algorithms, such as computer vision, in combination with drones.
How should I learn that?</p>

答:
Programming a drone consists of two levels. The first one is to create a remote control software. This task is done with microcontrollers and embedded system programming. The idea is, that the operator has a joystick, moves the joystick forward and the drone will react to the action. The first level is easy to master, and there are lot of tutorials available which can explain the details. In most cases, the microcontroller runs a realtime operating system and the drone controller sits on top, very similar to a firmware like the LeJOS operating system.

The second level in drone programming is way more complicated. Here is the idea not only to provide a remote control system but an artificial intelligence system. This kind of programming task has nothing to do with classical embedded system programming nor C programming at all. Instead, the task of creating an AI system is located in the domain of Academia / Matlab and deeplearning projects. It has to do with reading papers about pathplanning, implementing algorithms in software and thinking about reinforcement learning. Mastering the second level of drone programming is much harder and not real tutorials are available in the Internet.


答:
The following diagram (1) illustrates a method by which a Lancaster navigator determined airplane height above the water of a lake. Such a method is useful if the ground lacks features needed for other forms of Visual Servoing.  A program I saw about mission Chastise showed one spotlight shining green and the other red, to avoid confusion about which way to go to get to correct altitude.  Note, the bomb aiming rangefinder used similar geometric principles.

With a quadcopter, you could use red and green lasers, eg from a red laser pointer and a green laser pointer.  You could also add servos to rotate one or both of the lasers to adjust the altitude setpoint.  A camera or a line sensor would detect the relative positions where the lights hit the ground.


答: In addition to the DavidJ's comment, there is a technique called feature based odometer. Even the objects in the environment are not in the prior map, the robot use them to correct it's pose estimation. Scan matching is one of the methods use for this. When it sees a new landmark, move few steps further and if it's still able to see that landmark, it will match the current laser scan with a previous scan to calculate the pose error.</p>

Title: How does a self-driving car locate itself when the environment changes?

Body: There's something I don't quite understand about SLAM. When a self-driving car wants to locate itself using a prior map, how does it do that when the environment keeps changing, e.g., new cars parked on the curb, etc.? Even if it uses a 3D map, the current sensor would be quite different to the prior map if there're new objects on the road.</p>


问:
How are shells for robotic arms made?
I wonder how the shells of robotic arms are usually made. By the shell, I mean this:

This is taken from the project here, which is a University project. If the shells were injection moulded, how would a university project have sufficient funding for the moulds? Even if the work was contracted to prototyping companies, it'd cost a few thousand of dollars for just one part. If not injection moulding, how are the shells made?

答: In the case of Yaskawa Motoman, Rethink Robotics, Kuka, Fanuc or ABB the shells are cast (aluminium in most cases). Older (Kuka) industrial robots have a welded steel structure casing, but you rarely see operational ones with welded steel structure.</p>

Title: How are shells for robotic arms made?


问:
Harmonic drives in hobby projects
After a fair bit of research into industrial robot arms I've learned that a lot of them use components like harmonic drives and sometimes cycloidal gearboxes.

Two main questions:

How feasible are these for use in a hobby project? I do have several thousand dollars at my disposable to build a 6 DOF arm. Arm goals at a glance: 1m total reach, 5kg payload, reasonable speed.

What sources would you recommend? Online the sites seem very specialized, gotta go through sales reps, etc, which kind of worries me regarding the prices lol. Plus for Harmonic Drives I only found one vendor.

Side/related question: would buying from China work out alright or would I not get what I'm looking for (namely: good torque at <1 arcmin backlash)? E.g.
Another example.

--

I have little experience with this technology (precision eccentric gearing), but would definitely like to explore it and purchase test equipment to construct a basic arm. Thanks for any help, looking for a decent starting point.

EDIT -- I would like to use one of these special gearboxes with a NEMA stepper motor if possible (and if it saves cost) since we have a bunch of those lying around, heh.

EDIT2 -- Curious if this item would actually have some sort of strain wave gearing inside of it.

If so this seems very affordable and could provide decent precision on part of a robot arm.

答:
It is also worth thinking about why you want to minimize backlash.  Is it something intrinsic to the task your arm needs to perform?

Industrial robots use these drives to minimize backlash typically not because of any such intrinsic need, but because the control systems (software) were designed decades ago and at its core uses mathematics that assumes links are rigid and actuators can control angles independently of the overall configuration of the arm (Newtonian Rigid Body Dynamics, essentially).  Neither of these are true in the real-world, but rather than reformulating the core assumptions for the control, this is handled via specialized methods and additional modelling in conjunction with making the mechanical structure fit the assumption as closely as possible (- which unfortunately leads to engineering of stronger & heavier links, needing larger motors, which are heavier etc).

Maybe for your application, compliant joints and links with some non-rigidity and some amount of back-lash can be handled in the control and still attain your required precision and repeatability.

Title: Harmonic drives in hobby projects


问:
3D Inverse Kinematics Jacobian Construction
I am following this article: Overview of Jacobian IK

From the link, an example says:

O is a pose vector which represents the initial orientation of every joint

And following this, it gives an example of O:

For example, O would be (45°, 15°, -60°)

Later on it says for the 2D system, the Jacobian can then be constructed as follows:

I now have 2 questions if this was transferred to a 3D system:

How would O be represented?

How would the Jacobian be constructed?

答:
An alternative way to compute the Jacobian is to represent the kinematic chain transformation symbolically and symbolically differentiate it.  Then you can evaluate the expression for it at any point analytically.

For example (if you know C++) see the use of this technique in the implementation of the Expression::differentiate() function of OpenSim.


答:
To complete the comment of @FooBar on the Jaco Arm (The one from the Video), it use  Carbon Fiber as links

The old ones also used Plastic links with carbon fiber paint effect

You can copy the carbon fiber effect easily if you need it.

Title: How are shells for robotic arms made?

Body:
I wonder how the shells of robotic arms are usually made. By the shell, I mean this:

This is taken from the project here, which is a University project. If the shells were injection moulded, how would a university project have sufficient funding for the moulds? Even if the work was contracted to prototyping companies, it'd cost a few thousand of dollars for just one part. If not injection moulding, how are the shells made?


问:
For pose estimation, what is the typical range of the rotation values that are estimated? Is it from -180 to 180 degrees?
I am currently working with the Rutgers APC 2015 data set for pose estimation, and see that the pose estimates, specifically the rotation estimates, have seemingly been rescaled to range between -1 and 1. Does anyone know if these values were arrived at by dividing by 180? </p>

答: Check whether they are in radians. Most algorithms use radians for pose estimation.</p>


问:
Controllability of a car with a single trailer
I'm studying the kinematic model of a car with a single trailer. This picture shows the system:

I started from the following statements:

With these constraints, I got the Pfaffian form:

And then the kinematic model:

I hope the calculations are good. Now I should use the Lie brackets to verify the system controllability, by checking the accessibility first. To do this, I need to write the system in the following form:

The question is: how do I do it? Is g the two column matrix showed in the model above? In this case, should f be a null vector/matrix? I think this should make sense, but - assuming it's all right - I wouldn't know how to proceed with the Lie brackets, because the iteration I studied leads to the calculation of this sequence: g, [f,g], [f,[f,g]], [f,[f,[f,g]]] and so on. Does it make sense with a null vector as f?
In short, the doubt is about how to choose the inputs.

Maybe it's a stupid question, but I didn't really understand the topic and I don't manage to get any concrete results.

答:
Robot control problems are usually treated as computational problems. The software engineers are trying to realize an algorithm which is searching in the state space. So called pathplanning and motion planning algorithms are used to bring a robot-system into a desired state. The disadvantage of this classical approach is, that no mathematics but programming skills are important. It ignores the mathematical basics. The better way is to use a modern university driven mathematics to describe robot control problems in an elegant way. No digital computer is needed here.

The question implies that the robot control problem can be described with Lie algebra. Lie Algebra is an example for a topological group for transforming a nonlinear problem into a linear one. The first subquestion which has to be answered is, if Lie groups are powerful enough, which means if they are Turing-complete? The answer is yes, if we are talking about quantum Turing machines.

Now we can go on to solve the question itself. For controlling the robot trailer problem we have to create a recursive algorithm which is executed on a hypothetical quantum computer. The algorithm is using lie groups to determine the Lagrangian equations of motion.

Literature If the idea is to teach lie brackets without mention neural turing machine, ignoring quantum computers and stack-based computation. The resulting request for getting the right literature in Google Scholar is

```<code>"lie group" -"quantum computer" -"turing machine"
</code>```

The minus sign allows to exclude a keyword from the result list.

Body:
Robot control problems are usually treated as computational problems. The software engineers are trying to realize an algorithm which is searching in the state space. So called pathplanning and motion planning algorithms are used to bring a robot-system into a desired state. The disadvantage of this classical approach is, that no mathematics but programming skills are important. It ignores the mathematical basics. The better way is to use a modern university driven mathematics to describe robot control problems in an elegant way. No digital computer is needed here.

The question implies that the robot control problem can be described with Lie algebra. Lie Algebra is an example for a topological group for transforming a nonlinear problem into a linear one. The first subquestion which has to be answered is, if Lie groups are powerful enough, which means if they are Turing-complete? The answer is yes, if we are talking about quantum Turing machines.

Now we can go on to solve the question itself. For controlling the robot trailer problem we have to create a recursive algorithm which is executed on a hypothetical quantum computer. The algorithm is using lie groups to determine the Lagrangian equations of motion.

Literature If the idea is to teach lie brackets without mention neural turing machine, ignoring quantum computers and stack-based computation. The resulting request for getting the right literature in Google Scholar is

"lie group" -"quantum computer" -"turing machine"

The minus sign allows to exclude a keyword from the result list.


问:
What is the best adaptive controller for robotic arms?
I have a question that lays on practical experience. What is the best adaptive controller for a robotic arm?

Self Tuning Regulator (STR)

Model Reference Adaptive Controller (MARC)

Adaptive Model Predictive Control  (AMPC)

Iterative Learning Control  (ILC)

Gain Scheduling  (GS)

Auto-tuned PID (ATPID)

Notice that robotic arms are mechanical systems so the controller need to be fit into a microcontroller, e.g real time system due to the speed and robustness.

答:
The given strategies can be divided into two groups: model-based and model-free control. The AMPC and MARC suggestions are model-based the other are model-free. Theoretically, a pid controller can be combined with Model-based control but for reason of simplification the assumption is, that each technique is located in a certain group.

Now we can ask if model-based or model-free is the more practical robotic arm controller. The good news is, that the winner can be easily imagined, because only model-based control is able to predict future state-space and this is equal to an increased accuracy. It is interesting to know, that model-based control is seldom teached in universities, because it can't be described mathematically elegant.

It remains one point open which has to do with adaptive control. Adaptive means, that the system learns it's parameters on the fly. It will allow to use the same controller for different robot arms. A heavy one and also a lightweight kinematic chain. The holy grail in adaptive control is a system which adapts itself to any kind of robotic arm, no matter if it's underactuated or fixed, with a low amount of DOF or with more servo motors in it. Creating an adaptive forward model is a bit complicated, and I'm not aware if this problem was already solved in the literature.


问:
Why my stepper motor doesn't move when I attach a blade?
I wanted to use the NEMA 17 stepper to drive a blade/flapper that I have custom made for some physical application.As soon as I tighten the screw,the motor stops rotation in the usual way. Don't have any idea the reason for this.
Note:
1.The blade/flapper is not too heavy and the torque rating of the Motor is sufficient.
2. Doesn't spin even if I help with hand
3.It does a very slight movement almost at the same place.
4. Problem occurs as soon as I turn the screw to fix the blade on the shaft.
5. I've tried with using glue into the joint,the problem seems to be lessened but still present,also using the glue method wouldn't be suitable for my function as I need more rigid join.</p>

答:
I will take a wild guess - your accellerating to fast for the mass of the blade / power of the stepper motor.

You can check this by trying to step much slower - perhaps 1 step per second for testing


问:
rostopic list not showing topic
When I use the rostopic list commands, the output is only returning /rosout & /rosout_agg. Although when I rosrun both the subscriber and the publisher python files, that contain my new topic, they can communicate no problem. A few questions here:

Does the rostopic list command list all the topics that are part of the catkin workspace?
At what point is this rostopic 'created'. In other words what command is responsible for rostopic list to generate the new topic that is created in the publisher?
Thanks!

答:
In which order do you run your commands ?

rostopic list is used to list current topics registered with the rosmaster 'node', who is launched with the roscore commands

The publisher and subscriber topics are registered to the rosmaster with the python function rospy.Publisher('chatter', String, queue_size=10) for the publisher, and rospy.Subscriber("chatter", String, callback) for the subscriber (I assume that the python file you speak about are the one from the tutorial)

So if you want to see the topics from the publisher and subscriber tutorial , you need first to launch the rosmaster with roscore, then you can open 2 new terminals and launch the publisher and subscriber on each terminal with rosrun beginner_tutorials talker.py and rosrun beginner_tutorials listener.py (don't forget to source your catkin workspace on each terminal to be able to run your workspaces' nodes).

That will register the 2 nodes on the rosmaster, the talker node will register a publisher and the listener node will register a subscriber, both on the same topic.

And now, on an another terminal, if you run rostopic list you will be able to see the topic /chatter

And if you run the command rostopic info /chatter, you will see that this topic is used by 2 nodes, talker and listener, talker is a publisher and listener a subscriber.

If you can't see it, then there is a problem. You can use all the ros* commands to debug what's happening.
For example, run the command rosnode list to list which nodes are actually launched (there should be 3 nodes), run the command rostopic echo /chatter to see if your publisher is indeed publishing messages, or run the commands rostopic pub /test std_msgs/String "Hello" -r 10 and rostopic echo /test to see if you can indeed make 2 nodes works.

Also, you should ask your ROS question directly to the ROS Answers Forum, they are much more specialized :) .

Title: rostopic list not showing topic


问:
Finding correct RPY for approaching a known point on a plane
I have a robot with 6 DOF that I want to use to grab a hanging sheet at a specific point near its edge. The grip needs to be perpendicular to the edge and co-planar with the point of course.

I have the inverse kinematics and I have the XYZ-coordinate that I want to grab, however, I'm struggling a bit with finding the correct RPY needed to approach the point correctly. I have looked at the post How to calculate roll, pitch and yaw from XYZ coordinates of 3 planar points? on Mathwork Matlab Answers, which helped me find the normal to the plane, but there's something I'm not doing or understanding correctly in regards to the calculation of the RPY.

Here's a sketch of the problem:

P2 is the point I want to grab and the arrow illustrates the angle of approach I want to achieve. I know the angle (theta), but none of my robot's axes align with this axis of rotation so I can't simply add this.

Here:

I tried to follow the instructions in the MathWorks post above, ending up with a sketch of the sheet's coordinate frame looking like this:

(Z points into the plane).

Next I calculate the alpha, beta and gamma values like suggested in the post. But what do I do with these?

If I plug the results into my robot the TCP's angle is not even coplanar. I know I haven't taken the theta angle from the sketch into account yet, but I don't want to consider that until I see the TCP is coplanar with the sheet.

Can anyone give me a clue on what I'm doing wrong or if I'm missing some steps? Maybe there's even a better way of achieving what I want than what I tried here? And let me know if I need to clarify anything - this is my first post here, so please be gentle.

Here's the code I have written to do the calculations. p1t, p2t and p3t are the three homogeneous coordinates P1, P2, and P3 respectively in the robot's frame (what I call the global frame):

```<code>// Transform coordinates from cam to robot
Eigen::Vector4f p1t = H * p1;
Eigen::Vector4f p2t = H * p2;
Eigen::Vector4f p3t = H * p3;

Eigen::Vector3f p1t3D, p2t3D, p3t3D;
p1t3D << p1t(0), p1t(1), p1t(2);
p2t3D << p2t(0), p2t(1), p2t(2);
p3t3D << p3t(0), p3t(1), p3t(2);

Eigen::Vector3f v1, v2;
v1 = p2t3D - p1t3D;
v2 = p3t3D - p1t3D;

Eigen::Vector3f xUnitVec = ((p1t3D + p2t3D)/2) - p3t3D;
xUnitVec.normalize();

Eigen::Vector3f zUnitVec = v1.cross(v2);
zUnitVec.normalize();

Eigen::Vector3f yUnitVec = zUnitVec.cross(xUnitVec);

std::cout << "p2t: \n" << p2t << std::endl;

float x1 = xUnitVec(0);
float y1 = yUnitVec(0);
float z1 = zUnitVec(0);
float z2 = zUnitVec(1);
float z3 = zUnitVec(2);

float alpha = atan2(-z2, z3);
float beta = asin(z1);
float gamma = atan2(-y1, x1);

std::cout << "\nRotations: " << std::endl;
std::cout << "Alpha: " << alpha;
std::cout << ", Beta: " << beta;
std::cout << ", Gamma: " << gamma;

pickPoint.clear();
pickPoint = {p2t(0), p2t(1), p2t(2), alpha, beta, gamma};
</code>```

答:
It seems that you have successfully identified the RPY angles. In the comments it was made clear that the UR5 robot you are using expects the orientation as an XYZ extrinsic rotation (which corresponds to an ZYX intrinsic rotation).

As per the discussion in the comments the UR5 controller offers a function to convert RPY angles to the requires extrinsic XYZ representation called rpy2vecrot(). This function should be uest to convert the orientation angles calculated by you to the required format.


问:
Interference caused by multiple robots during task completion
Suppose there is an area to survey. If we deploy one robot it takes time T to sweep the area. Now if we deploy 2 robots, we would expect it to take time T/2. However in reality, because we are sending two robots, we would have to implement additional coordination planning routines and obstacle avoidance routines so that they do not collide with each other. These overhead computational costs add up and we will actually see the area being surveyed in time T/2+X. Now could you suggest papers where they talk about the estimation of X? It does not have to be in the context of area surveying. It can be any other multi-robot task also.</p>

答: I think the question relies too much on variable factors so that there is no definitive answer. In a worst case scenario, you want to map a tunnel system and all of your robots start at the single entrance to the system. All of your robots will have to drive together to the first intersection where they can spread. More robots will could decrease the performance of your fleet. In a best case, you have some swimming robots with sonars (so with limited sensor range) that should map the sea floor. If you don't have too many robots, the fleet performance will scale linearly as the boats are able to move immediately to unscanned areas. </p>


答:
Perhaps, the following related work can be somehow enlighting or provide useful insights, as per your request:

Jijun Wang and M. Lewis, "Assessing coordination overhead in control of robot teams," 2007 IEEE International Conference on Systems, Man and Cybernetics, Montreal, Que., 2007, pp. 2645-2649.

Title: Interference caused by multiple robots during task completion

Body: Suppose there is an area to survey. If we deploy one robot it takes time T to sweep the area. Now if we deploy 2 robots, we would expect it to take time T/2. However in reality, because we are sending two robots, we would have to implement additional coordination planning routines and obstacle avoidance routines so that they do not collide with each other. These overhead computational costs add up and we will actually see the area being surveyed in time T/2+X. Now could you suggest papers where they talk about the estimation of X? It does not have to be in the context of area surveying. It can be any other multi-robot task also.</p>


答: I came across one paper that had a good description of this issue from Kristina Lerman and Aram Galstyan at University of Southern California entitled "Mathematical Model of Foraging in a Group of Robots: Effect of Interference" </p>


问:
Dropping a box from a quadcopter
I am trying to estimate when and where to release a box carried by a delivery UAV such that it falls on a given target. I need to take the wind speed/direction into account. (See the visual below for reference.)

Through the pose estimator, I have access to the position and velocity of the UAV in $X,Y,Z$ axes, so as the position of the target. The box needs to be released from approximately 2.5m. Also, there is a wind speed/direction sensor located by the target location, in average the wind speed is around 6mph in the test area.

Note that the grabber that releases the box has a latency of 3.5s.

There are a number of examples online that solve this problem using SUVAT equation in two dimensions without taking the wind into account. But I couldn't find any information regarding a robot operating in three dimensions.

答:
Throwing an object from a moving UAV quadcopter isn't the easiest control problem to start in robotics. The reason is, that the system has a non-linear characteristics which means that the equations of motions have to do with ordinary differential equations. The box dropping problem is way more complicated than the famous three body problem which was researched by Isaac Newton in the 17th century. Newton was a professor at the Trinity college in Cambridge, which is one of the most prestigious Universities in the world.

This background information is important to understand which kind of theories are needed here. It has to be technology which is more advanced, that what Isaac Newton was using, because he struggles with the three body problem. The good news is, that such technology is available since the 20th century, it's called model predictive control. The first thing to do is to create the forward model of the problem. That means, a physics simulation has to be created which is calculating the position of the box under the influence of the wind parameter and the own speed of the UAV. Basically this task is equal to program a small game in which a graphics subsystem shows on the screen the movement.

The second subproblem is to use the forward model in the opposite direction. This is called predictive control. The controller gets as input the goal position of the box, and then he calculates the needed actions of the UAV to reach the state. In the literature, the concept is known as Receding Horizon Control. It contains of a prediction step, the result is stored in a graph and then a solver is searching in the graph for a goal node which fulfills the constraints. The edges on the graph are the action commands for controlling the UAV.

Title: Dropping a box from a quadcopter


答:
At a height of 2.5 meter, wind is negligible. Once the wind factor start to affect your precision, it is to windy to fly safely.

If the UAV has to move, you will have to fly the UAV over the target and use the basic equations for a falling body.

If you can 'park' your drone above the target location, you will be as precise as your GPS can be.
From experience, this option is best, and with good component, you could get it within 30 cm.

And you can read what other university has done for dropping 8oz water bottle from a minimum height of 90 meter here (last year competition) and get inspire.

Title: Dropping a box from a quadcopter

Body:
I am trying to estimate when and where to release a box carried by a delivery UAV such that it falls on a given target. I need to take the wind speed/direction into account. (See the visual below for reference.)

Through the pose estimator, I have access to the position and velocity of the UAV in $X,Y,Z$ axes, so as the position of the target. The box needs to be released from approximately 2.5m. Also, there is a wind speed/direction sensor located by the target location, in average the wind speed is around 6mph in the test area.

Note that the grabber that releases the box has a latency of 3.5s.

There are a number of examples online that solve this problem using SUVAT equation in two dimensions without taking the wind into account. But I couldn't find any information regarding a robot operating in three dimensions.


问:
Improving PID gain constants
I have started building and programming my own quadcopter. I used stm32 f103 and right now I'm testing PID controller. The issue is getting right gain constants. I have build a swing and attached quadcopter to test it in one Axis. My problem is that I cannot use Zeigler-Nichols algorithm because the swing don't have big angular space. Quadcopter can move only 86 degrees. Is there a possible way to calculate gain constants from tests where I have measured angle? </p>

答:
You can use angle measurement to find the proper gains. Check out this other SE, they have a few good algorithms for finding the gains by measuring the oscillations. Another option, though a bit more experimental, you could try what this paper proposes as "Probably the best simple PID tuning rules in the world"

My last thought is that you could try applying the improved Ziegler-Nichols rules (Page 7).

Title: Improving PID gain constants


问:
Making a motor controlled joint passive
Anyone know of a good (and economical) way to make a motor controlled arm become a passive link on trigger? That is, the joint can be active (motor controlled) or passive (rotate freely). The tip of the arm weights 3kg and the length is 15cm. There's a 5kg load as well. I suppose the motor and gearbox will need to provide around at least 25Nm torque. A gearbox with that much torque would be very difficult to back drive.

I guess one way could be to use an electric clutch, but electric clutches are expensive and I don't think I have enough battery capacity to power the electromagnets. Another way I've thought of is to use planetary gears by braking the ring gear with a servo-controlled ratchet to make the link active. But planetary gears are hard and expensive to make as well. Anyone know of any alternative?

答:
Here is my pitch: Collar!

Yes, you've read that right. You could use a same mechanism that is use in manual transmission. A collar that could slide and engage the arm with the gearbox.

The sliding action of the collar could be done by a small servo motor. A position sensor could be use on the arm and gearbox, so when you need to engage, both shaft will be in proper alignment to assure engagement/sliding of the collar.

I don't know if the price is good. It will also require sufficient room to operate.

Title: Making a motor controlled joint passive


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

答:
New and Simplest Approach:

Install ROS-Robot Operating System plugin on CLion:

you have to open the Settings (from the File menu); then from the left panel select plugin in order to show the plugin panel in the right side and select the marketplace tab; then search for ROS-Robot Operating System plugin and install it.

Import your ros_workspace by the installed plugin in File menu:

In order to import an existing workspace, you have to use the menu Import ROS workspace, selecting the workspace folder. In this case, the plugin will search from the configured ROS versions and it will setup the project in order to resolve the ROS dependency.

Reference

Title: How to setup CLion for ROS?


问:
Can P gain too high cause roll of death?
I've been sperimenting with PIDs on my quadcopter and I've noticed that pitch P = 65 causes double front and back flips which looks like a roll of death (or in this case a flip of death) and lowering pitch P to 60 solves the issue.
Why is that?
Can I mitigate this with filters or D gain?

I've also noticed that certain values of P and D mix well and make the quad smooth but if I bump up the I gain to twice as high as my P gain then my quadcopter bounces back.
Is this reasonable or there's a problem somewhere else?

答:
Actually i'm not fan with the PID algorithm in this field especially drones and rc plane. Think about fuzzy logics.

https://searchenterpriseai.techtarget.com/definition/fuzzy-logic


问:
How can Denavit-Hartenberg representation with only 4 variables describe rototranslations with 6 DOF?
I am wondering how the Denavit-Hartenberg representation is able to describe rototranslations with 6 DOF with only 4 parameters?

Some context:
Denavit-Hartenberg representations can be used to describe the rototranslation from frame 1 to frame 2. Frame 2 can be rotated as well as translated. Usually this involves 6 degrees of freedom (DOF).

I am pretty sure that's impossible and that I am missing something else.

EDIT (my current solution):
Systems that can be described using DHs only use joints with one joint variable. For example, a prismatic joint which can only move along one axis or a rotational joint which can only rotation around one axis. Then you lose 2 degrees of freedom => 6-2 = 4, thus 4 free variables are sufficient to describe the system.

答:
In a nutshell, 4 DOFs do clearly represent only a manifold on all the possible 6 DOFs spatial roto-translations. This is actually the manifold corresponding to the movements of the links of a mechanical structure that are bound together via prismatic and revolute joints.

The DH convention assumes to deal with such structures. Thereby, under these premises, the frame attached to the endpoint of a link sliding on a track (prismatic) or rotating around a given axis (revolute) can be readily specified in terms of only 4 parameters with respect to the frame of the link attached before/after on the same structure.

To sum up, to describe a roto-translation without assuming anything you need of course 6 parameters. Instead, if you impose constraints - as those present for example in a serial kinematic chain - you need only 4 parameters.

Here's a related Q&A on Robotics SE: https://robotics.stackexchange.com/a/4422/6941.


答:
In general you need 6 parameters to describe the position and orientation of any  joint with respect to a link coordinate frame.  The DH parameterisation includes 2 constraints so only 4 parameters are required.  The constraints are:

axis $x_j$ intersects axis $z_{j-1}$

axis $x_j$ is perpendicular to axis $z_{j-1}$

(see Robotics, Vision & Control, second edition, p.197)

Personally I don't think it is useful to save 2 parameters given the confusion it creates for almost everybody, especially beginners, but I still find them confusing.  Saving 2 parameters is pointless given today's computing capability, but back in 1955 when this notation was invented it was perhaps more pertinent.

Title: How can Denavit-Hartenberg representation with only 4 variables describe rototranslations with 6 DOF?

Body:
I am wondering how the Denavit-Hartenberg representation is able to describe rototranslations with 6 DOF with only 4 parameters?

Some context:
Denavit-Hartenberg representations can be used to describe the rototranslation from frame 1 to frame 2. Frame 2 can be rotated as well as translated. Usually this involves 6 degrees of freedom (DOF).

I am pretty sure that's impossible and that I am missing something else.

EDIT (my current solution):
Systems that can be described using DHs only use joints with one joint variable. For example, a prismatic joint which can only move along one axis or a rotational joint which can only rotation around one axis. Then you lose 2 degrees of freedom => 6-2 = 4, thus 4 free variables are sufficient to describe the system.


问:
Holonomics Movement vs Holonomics Constraint
I'm reading Mechanics of Robotic Manipulation by Matthew T Mason and I stumbled upon the concept of kinematic constraints. The book mentioned about two types of constraints: holonomic and nonholonomic constraints

Following is one example of a holonomic constraint mentioned in the book:

A rectangular block sliding in a channel with free variations in the coordinates x,y,and theta. The channel imposes a constraint so that the rectangle's y value is fixed. The holonomic constraint is described below:

While the following is an example of a nonholonomic constraint mentioned:

Suppose that we add a wheel to the block, so it behaves like a unicycle or an ice skate. At any given point in time, the block can move forward and backward, it can rotate about the wheel center, but it cannot move sideways. The nonholonomic constraint equation is described below as:

The author also wrote that:

".. it is evident that each independent holonomic constraint reduces
  the degrees of freedom of the system by one, but a nonholonomic
  constraint does not."

All of the explanations so far seem to contradict my understanding of the physical meaning of robotic holonomic movement:

I've always thought that a holonomic robot means that it can move in all directions and hence the total number of controllable degrees of freedom is equal to the total degrees of freedom. But how is that possible when every holonomic constraint reduces the degree of freedom of the system?

And how come doesn't a nonholonomic constraint reduce the degree of freedom of the system? Isn't the unicycle constraining the block from moving sideways? Why is the degree of freedom of the system not considered as reduced then?

I hope someone can help to clarify my understanding.

答:
A holonomic constraint applies to the configuration variables, it is represented by an equation is some or all of the configuration variables.

A constraint that applies to the rate of change of the configuration variables, and that cannot be integrated to a constraint in the configuration variables, is therefore non-holonomiw.  It is represented by an equation in some or all of the configuration velocities.  For example, a car can have an arbitrary configuration (x,y,$\theta$) but at any configuration it is limited in the velocity $(\dot{x}, \dot{y}, \dot{\theta})$ it can achieve due to the rolling constraints on its wheels.  Non-holonomy can be caused by under actuation or by rolling constraints.


问:
Digital servo shaking
i need your advice if someone experienced something similar. I try using digital servo but when i tried to connect it to board by this tutorial https://blogs.oracle.com/hinkmond/entry/connect_robot_servo_to_rpi3

servo motor only shakes for first ten cycles but after that turns normally. I have no idea why is that but in every article i read that controlling digital servo is same as analog with no need to program them after unboxing.
Thanks for any idea

答:
The tutorial is using software pwm from java code. If the PI is otherwise busy or the jvm pauses for garbage collection, the pwm signals to the servo will be erratic. Which could be causing your problems.

I have to admit to only looking at the first page of the tutorial.... The other problem I encountered which was very confusing was erratic behaviour caused by the servo drawing more powerr than the PI can supply... Yes I was powering my servo from the pi's 5 volt rail.

By far the most likely answer is that java does lots of small garbage collections for a while until it adjusts its settings and settles into a much longer garbage collection cycle causing your program to pause repeatedly.

When java does a garbage collection your code stops, therefore so does the pwm and this would cause the strange behavior your are describing.

For my servos I'm using the adafruit 16 Channel pwm board, it has it's own clock, you talk to it via i2c and it leaves your code free to do other stuff.

You should probably do some reading about java garbage collection, java and real-time processing don't go together so well. As long as you understand that you can only get near to real-time processing out of java, all is good.

Title: Digital servo shaking


问:
Driving a gearbox with another?
I'm trying to find a 1:1000 gearbox for NEMA 17, but the highest (affordable) one I've found is 1:100. Is it a good idea to drive a 1:100 planetary gearbox with a 1:10 planetary box? Is it common to drive a gearbox with another? Are there issues in this setup?

Is this an example of a gearbox 'series'?

答:
I think that on the attached picture, the two things from the right, are a stepper motor and encoder. Notice that both have wires coming out of them. So it is not an example of two gearboxes in series. </p>

<p>That being said, it should probably work. After all, most of the gearboxes are multistage internally. However, keep in mind that the more stages the gearbox has, the less efficient it is and the more backlash it has. You can also have problems assembling it all together, as the mounting holes of one gearbox may not fit into another. </p>

Title: Driving a gearbox with another?

Body:
I think that on the attached picture, the two things from the right, are a stepper motor and encoder. Notice that both have wires coming out of them. So it is not an example of two gearboxes in series.

That being said, it should probably work. After all, most of the gearboxes are multistage internally. However, keep in mind that the more stages the gearbox has, the less efficient it is and the more backlash it has. You can also have problems assembling it all together, as the mounting holes of one gearbox may not fit into another.


问:
What is a CIM motor?
I'm trying to make decisions for motors on a robot build. I keep running across CIM Motors. What is a CIM Motor? Where does the designation CIM come from? What does CIM mean?</p>

答:
I came across a site that referred to CIM as a Controlled Induction Motor. Confirmed by CIM at The Free Dictionary

It's entirely possible that the other answer is correct, as this datasheet has CCL Industrial Motor Limited (CIM) at the bottom.

Title: What is a CIM motor?


问:
Roomba stops responding to commands on the OI
So I just received my roomba create 2. I have managed to read and send commands to the roomba using the OI and an Arduino. I also got it to move using the USB cable provided by iRobot and the tethered app on windows. However after one or two min it either stop responding to any commands, or just turns off. If the last command was to move forward, it will continue to that. If it wasn't moving, then clicking on any of the buttons on the app will not make it do anything. I haven't figured out how to get the firmware version. Any help or guidance will be deeply appreciated.d

Thank you!
Sep

答:
I think the problem may be the standard timeout when it is running on the battery

Please note that this is not the same as the issue I described needing a firmware update while sleeping on the dock.

Frank


问:
3D Direction Sensor - Question from a Neuroscientist
I'm posting here on the advice of r/diydrones, who said you're the people to ask. I'm hoping you might be able to help out with a problem i've come across in my research?

I'm a Neuroscientist working on spatial cognition. Broadly, i'm looking to find out exactly how the brain represents the space around us, our position in it, and how we move through it. This should lead to a better understanding of diseases in which these processes are affected, such as Alzheimer's, and show us novel ways of treating it. To do this, I use mice and rats, trained to perform spatial tasks, such as navigating mazes.

Specifically, i'm investigating head direction cells. These are neurons which encode the direction which we are facing at any given point, up and down, left or right, etc. I'm looking for a way to record the direction that a mouse or rat is facing in real-time. Systems already exist for recording this, but only in two dimensions, that is to say, they lack the ability to be able to record up/down head movement, or inversion of the animal. Additionally, as they rely on tracking small LEDs, these systems can't be used in complex 3D mazes, as the lights are not always visible.

I initially asked r/diydrones for suggestions of electronic methods of tracking head direction in 3D. The best suggestion appeared to be using  the ICM-20948.

There are two problems with this that i'm trying to work through. The first is physical. I need to implement this chip in a way which is minimally invasive for the rat/mouse. That means that whatever processor and power source i use needs to be as small and light as possible. Ideally, it would be wireless. Using wired power and data transmission is definitely workable, but does have limitations.

The second problem is that I need to be able to synchronise the motion/direction data very closely to brain recordings which are being made simultaneously. Currently, this is fed as an analogue signal directly to a recording PC.

As someone with very limited coding and electrical engineering experience, the inclusion of any guide materials you know of along with any suggestions would be very much appreciated.

Please do come forward with any comments, suggestions, or questions.

Thanks

答:
It's clearly possible to do so with a gyro sensor and a blackbox. Take for instance micro quadcopter, those have full fledged flight controller with processor, gyro, blackbox, OSD, ESCs, accellerometer etc... all in one 20x20mm PCB!
I mean you could design your own PCB with just gyro, processor and blackbox (perhaps recording on a micro SD). I think the resulting PCB wouldn't exceed 10x10mm which shouldn't bother the rat too much. If you mind taking this advice into consideration take a look at the following link to check Drone Mesh Open Hardware project: http://dronemeshforum.com/viewtopic.php?f=37&t=5375&sid=a9f8c001e412814a4679909f96ca8cae

The rat could be equipped with the gyro on top of an helmet wired on a micro lipo battery attached on his back. The blackbox would track everything coming from the gyro along with a timestamp to syncronize data once you'll extract it...

Or you can buy a device as the one shown in the following link and ask the producer to help you: https://youtu.be/tyiuocPvUes


问:
What is the most appropriate SLAM algorithm for quadrotors with RGB-D camera?
I have been researching on SLAM. I came across EKF SLAM which uses odometry to measure the robot's initial position in the map and as well as landmarks which helps the robot's position to be more accurate. Based on the SLAM for dummies, it has a problem of loop closure. In another journal, it was compared to fastSLAM and EKF has a big-O function of $O(K^2)$ where $K$ is the number of landmarks while fastSLAM has $O(M\log(K))$.

It was also said that the most promising SLAM algorithm from the journal "The vSLAM Algorithm for Navigation in Natural Environments"
 is FastSLAM
However, the vSLAM used by an experiment done by the University of Pennsylvania is the occupancy grid SLAM.

I want to ask what would be the most approriate SLAM algorithm for vSLAM given an unmanned aerial vehicle like the quadrotor and RGB-D camera + IMU? Also are there any algorithm that can be extended to support co-operation?

答:
Besides the very educational comments, you may also want to take a look at Open Keyframe-based Visual-Inertial SLAM (OKVIS) which has open source implementations in ROS and non-ROS version using a generic CMake library.

OKVIS tracks the motion of an assembly of an Inertial Measurement Unit (IMU) plus N cameras (tested: mono, stereo and four-camera setup) and reconstructs the scene sparsely.


问:
If you move the RGBD camera to other places on a Turtlebot, same orientation, create a map, does ROS navigation stack with AMCL still works?
I got a Turtlebot, and I’m thinking of putting the RGBd camera to other places. If you move RGBD camera to other places on a robot, same orientation, create a map, does ROS AMCL still works? I am thinking since the package might have created a measurement model and motion mode of the Turtlebot for AMCL, then moving the camera around can fail the navigation stack if no transformation or adjustment made to the models?</p>

答:
Yes, It'll fail.

The system needs to know where the camera is in relation to the rest of the robot (e.g. it's wheels, base frame ... everything that contributes to how the robot moves in the environment).

You'll need to update the robots URDF file at the least with the new location of any sensors.


答:
Yes the proportional gain can cause overreaction. As it is only concerned with instant correction a larger gain value of P can make it over compensate. Basically I like to think of it as, in any instant point the grater the difference between the actual position or signal the more you have to accelerate to get there as quick as you can.

This can be corrected by using a derivative gain. The D gain is only concerned with compensating for the rate of change. This make it good to reduce the overshoot of your system (preventing death rolls).

What you are noticing in the last part of your question is a natural ratio of the gains. A good method to find those well performing ratios is to use the Ziegler–Nichols tuning method.

Also, if you are interested in control systems I would strongly suggest looking at Brian Douglas' YouTube series on control systems.

Title: Can P gain too high cause roll of death?

Body:
I've been sperimenting with PIDs on my quadcopter and I've noticed that pitch P = 65 causes double front and back flips which looks like a roll of death (or in this case a flip of death) and lowering pitch P to 60 solves the issue.
Why is that?
Can I mitigate this with filters or D gain?

I've also noticed that certain values of P and D mix well and make the quad smooth but if I bump up the I gain to twice as high as my P gain then my quadcopter bounces back.
Is this reasonable or there's a problem somewhere else?


问:
ROS Theoretical Question - How does work properly a node
I'm new at ROS and I'm trying to figure out how does the node works with a pyton/C++ code. I have two codes for the same situation:

Use a Xbox Controller to move the turtle in turtlesim

FIRST - Using class python and a while as a main:

```<code>#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy

# DEFINING CLASS
class pubSub:
    def __init__(self):
        # DEFINE VARIABLE TO KEEP LAST VALUE
        rospy.init_node('c2t')
        self.twt = Twist()
        self.hold = Twist()

    def callback_function(self,joyData):
        self.twt.linear.x = 4*joyData.axes[1]
        self.twt.angular.z = 4*joyData.axes[0]
        self.hold = self.twt

    def assuming_cont(self):
        pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)
        rospy.Subscriber("joy", Joy, self.callback_function, queue_size=10)
        pub.publish(self.twt)

ps = pubSub()
while not rospy.is_shutdown():
    ps.assuming_cont()
</code>```

SECOND - Using global variables and a if __name__  == '__main__' with rospy.spin()

```<code>#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy

# FUNCTION - GET JOY VALUES TRANSFORM TO TURTLE MOVE
def joy_to_twist_transform(jData):
    twt = Twist()
    twt.linear.x = 5*jData.axes[1]
    twt.angular.z = 4*jData.axes[0]
    pub.publish(twt)

# FUNCTION - START PROCESS
def process():
    global pub
    pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)
    sub = rospy.Subscriber("joy", Joy, joy_to_twist_transform, queue_size=1)
    rospy.init_node('control_2turtle')
    rospy.spin()

# MAIN
if __name__  == '__main__':
    try:
        process()
    except rospy.ROSInterruptException:
        pass
</code>```

My questions are more theoretical:

1 - What I understand about how a node works is: he run the code in a loop until is shutdown. But this does not answer Why can I still save the last value published in a topic (in my head, if I run my code in a loop I start from the beginning everytime)

2 - Why is necessary to keep creating a rospy.Publisher and rospy.Subscriber in every loop? it is possible to create those guy one time only?(for example using them into init function in the seconde example)

3 - What is the difference betweenwhile not rospy.is_shutdown(): and if __name__  == '__main__' with rospy.spin()?

4 - What is rospy.spin()? in any documentation says that keeps your node running, but the way I see he stuck the code in that line and keep there only.

If any could give any recommendation to read about those problems I would thanks a lot.

答: Well, I made this question in ROS Answers and I made the answer (I got some experience by now): answer</p>


问:
Short range stereo vision
I am designing a stereo vision system for short depth range (15 cm to 35 cm) and I have some problems about baseline, focal length and depth range.

My application is to scan an animal tissue (meat, chicken breast)
with the stereo vision system with a depth range between 15 cm and
35 cm, which is attached to a robotic arm. In this case, I need to
choose a short baseline for short depth range and a short focal
length. However, I have no idea how to pick these values (baseline
and focal length) and choose the specific camera.

Most of the commercial stereo camera are good for depth range 50 cm to 300 cm and they have a relative large baseline (6 cm to 10 cm). I am wondering if there any recommendations for the built-in stereo camera system that can target at short range (15 cm to 35 cm).

If I need to build the stereo system from two digital cameras for short depth range? What kind of parameters I need to consider? (except for focal length, baseline).

答: Check-out this paper "Theory of Stereo vision system" from e-con Systems. They go an equation for figuring out depth range based on focal length, baseline, and other characteristics. Should be able to manipulate their equation to figure out what baseline, and focal length would be good for your system. As well as help figure out what hardware you might need or be able to get away with.</p>

Title: Short range stereo vision