问:
Efficient sphere surface area search
As shown in the figure, there are objects of arbitrary shapes placed on the surface of the sphere at arbitrary locations. The problem is to search the surface to locate these objects in most efficient manner.

Assumptions:

For simplicity, the sphere is half in size

The points(X,Y,Z) on the surface of the sphere are labelled as occcupied or not occupied

The naive approach to solve this problem is to scan the entire 3D surface of the sphere and find the occupied regions. But the complexity of this search would be whole area(2πr^2).

So, what would be the efficient approach to locate all the objects in terms of time complexity of the algorithm.

Any useful insights would be helpful.

答:
I suppose this is a question of what is "most efficient" and what are you actually doing? And how are you going about simulating it?

Are you looking for a mathematical proof of how to find all infinite points on the surface of a sphere? Do you have a specific amount of points to look for, like only 200 scattered around the surface and need to find the shortest path to look at each one to find a value such as O or NO ?

One is a mathematical thesis, the other is a path planning problem....

How are you scanning? Is this just a matter of querying 200 sensors with an MCU? This would be microseconds of calculation time simply querying a table of sensors giving back answers of true or false...

Going under several assumptions:

You can Approximate your sphere with a polygonal mesh

"Efficiency" means: The least amount of time looking for O or NO While physically scanning with some kind of rotating optical sensor...camera?

As such you need to be time and energy efficient.

You only need to scan each point once.

I did this analysis using mathematica and igraphm (which you can get for free for a raspberry pi, but the methods are applicable  to other softwares.

First generate an approximate sphere with 200 points, Create a DelaunayMesh Graph to generate vertices and paths between them.

```<code>pts = SpherePoints[200];
mesh = DelaunayMesh[pts];
path = IGDelaunayGraph[pts]
</code>```

Add weights to each edge between the vertexes based on euclidean distances

```<code>wg = IGDistanceWeighted[path]
</code>```

Generate a Hamilton path between each vertex based on the distance weights,
A Hamilton Cycle could alternatively be generated via FindHamiltonianCycle[]

```<code>way = FindHamiltonianPath[wg]

{28, 41, 54, 67, 80, 93, 106, 85, 72, 59, 46, 33, 20, 12, 25, 38, 51,
64, 77, 90, 111, 98, 119, 132, 145, 158, 171, 184, 192, 197, 200,
195, 187, 179, 166, 153, 140, 127, 114, 101, 122, 135, 148, 161, 174,
182, 169, 156, 143, 130, 117, 96, 109, 88, 75, 62, 49, 36, 23, 15, 7,
2, 5, 10, 18, 31, 44, 57, 70, 83, 104, 91, 112, 125, 138, 151, 164,
177, 190, 198, 193, 185, 172, 159, 146, 133, 120, 99, 78, 65, 52, 39,
26, 13, 21, 34, 47, 60, 73, 86, 107, 94, 115, 128, 141, 154, 167,
180, 188, 175, 162, 149, 136, 123, 102, 81, 68, 55, 42, 29, 16, 8, 3,
11, 24, 37, 50, 63, 76, 89, 110, 97, 118, 131, 144, 157, 170, 183,
191, 196, 199, 194, 186, 178, 165, 152, 139, 126, 113, 92, 105, 84,
71, 58, 45, 32, 19, 27, 40, 53, 66, 79, 100, 87, 74, 61, 48, 35, 22,
14, 6, 1, 4, 9, 17, 30, 43, 56, 69, 82, 103, 124, 137, 150, 163, 176,
189, 181, 168, 155, 142, 129, 116, 95, 108, 121, 134, 147, 160, 173}

HighlightGraph[path, PathGraph[way3]]
</code>```

The final path between each point to scan....these points can now be programmed into your scanning device..the logic if something is at any one coordinate and it is O or NO and if the cycle should be broken off at this point, or just continue looking forever is up to the reader.

However this would be the method I would go about scanning things when it's required to find the shortest distance and least time.

I hope this is a method you're looking for...if this is a mathematical kind of question, I would suggest asking at maths.se

This of course can be scaled up to any number of points, depending on the "resolution" you're looking for...

Here's 1000 and the appropriate path to follow.

Title: Efficient sphere surface area search

Body:
I suppose this is a question of what is "most efficient" and what are you actually doing? And how are you going about simulating it?

Are you looking for a mathematical proof of how to find all infinite points on the surface of a sphere? Do you have a specific amount of points to look for, like only 200 scattered around the surface and need to find the shortest path to look at each one to find a value such as O or NO ?

One is a mathematical thesis, the other is a path planning problem....

How are you scanning? Is this just a matter of querying 200 sensors with an MCU? This would be microseconds of calculation time simply querying a table of sensors giving back answers of true or false...

Going under several assumptions:

You can Approximate your sphere with a polygonal mesh

"Efficiency" means: The least amount of time looking for O or NO While physically scanning with some kind of rotating optical sensor...camera?

As such you need to be time and energy efficient.

You only need to scan each point once.

I did this analysis using mathematica and igraphm (which you can get for free for a raspberry pi, but the methods are applicable  to other softwares.

First generate an approximate sphere with 200 points, Create a DelaunayMesh Graph to generate vertices and paths between them.

pts = SpherePoints[200];
mesh = DelaunayMesh[pts];
path = IGDelaunayGraph[pts]

Add weights to each edge between the vertexes based on euclidean distances

wg = IGDistanceWeighted[path]

Generate a Hamilton path between each vertex based on the distance weights,
A Hamilton Cycle could alternatively be generated via FindHamiltonianCycle[]

way = FindHamiltonianPath[wg]

{28, 41, 54, 67, 80, 93, 106, 85, 72, 59, 46, 33, 20, 12, 25, 38, 51,
64, 77, 90, 111, 98, 119, 132, 145, 158, 171, 184, 192, 197, 200,
195, 187, 179, 166, 153, 140, 127, 114, 101, 122, 135, 148, 161, 174,
182, 169, 156, 143, 130, 117, 96, 109, 88, 75, 62, 49, 36, 23, 15, 7,
2, 5, 10, 18, 31, 44, 57, 70, 83, 104, 91, 112, 125, 138, 151, 164,
177, 190, 198, 193, 185, 172, 159, 146, 133, 120, 99, 78, 65, 52, 39,
26, 13, 21, 34, 47, 60, 73, 86, 107, 94, 115, 128, 141, 154, 167,
180, 188, 175, 162, 149, 136, 123, 102, 81, 68, 55, 42, 29, 16, 8, 3,
11, 24, 37, 50, 63, 76, 89, 110, 97, 118, 131, 144, 157, 170, 183,
191, 196, 199, 194, 186, 178, 165, 152, 139, 126, 113, 92, 105, 84,
71, 58, 45, 32, 19, 27, 40, 53, 66, 79, 100, 87, 74, 61, 48, 35, 22,
14, 6, 1, 4, 9, 17, 30, 43, 56, 69, 82, 103, 124, 137, 150, 163, 176,
189, 181, 168, 155, 142, 129, 116, 95, 108, 121, 134, 147, 160, 173}

HighlightGraph[path, PathGraph[way3]]

The final path between each point to scan....these points can now be programmed into your scanning device..the logic if something is at any one coordinate and it is O or NO and if the cycle should be broken off at this point, or just continue looking forever is up to the reader.

However this would be the method I would go about scanning things when it's required to find the shortest distance and least time.

I hope this is a method you're looking for...if this is a mathematical kind of question, I would suggest asking at maths.se

This of course can be scaled up to any number of points, depending on the "resolution" you're looking for...

Here's 1000 and the appropriate path to follow.


问:
iRobot 600 series OI wake from sleep via BRC
I have attached an Adafruit Circuit Playground Express to my Roomba OI, and after manually waking it up I am able to successfully send opcode commands based on the Roomba OI Manual. I can even start, stop the OI and send the off op code, then restart with the RBC on LOW and get things going again.

Where things stop working is when I don't send any commands for more than 5 minutes and it enters sleep mode. I've seen a few questions on the board, but no definitive answers on how to successfully pulse the BRC from sleep so that I can begin to send commands to the OI. For my use case the need to start up could be random (could be hours between commands or days) so pulsing within 5 minutes off or on the dock to keep the OI alive seems excessive, but maybe that's what I have to do. It also seems like this means if the Roomba ever did enter sleep mode that human intervention would be the only way to get the OI started again. Has anybody had success waking the Create 2 or 600 series Roomba from sleep via the OI BRC?

Additional code, docs, pictures here

```<code>roomba.ino

//Setup pins
const int baudPin = A1;

//Setup roomba opcodes
//https://www.irobotweb.com/-/media/MainSite/PDFs/About/STEM/Create/iRobot_Roomba_600_Open_Interface_Spec.pdf?la=en
const int startOpCode = 128;
const int cleanOpCode = 135;
const int stopOpCode = 173;
const int powerOpCode = 133;
const int safeModeOpcode = 131;
const int fullModeOpcode = 132;

void setup() {
    pinMode(baudPin, OUTPUT);
    Serial1.begin(115200);
}

void loop() {
    digitalWrite(baudPin, LOW);
    delay(500);
    digitalWrite(baudPin, HIGH);
    delay(500);
    digitalWrite(baudPin, LOW);

    Serial1.write(startOpCode);
    Serial1.write(safeModeOpcode);
    Serial1.write(cleanOpCode);

    delay(4000);

    Serial1.write(powerOpCode);
    Serial1.write(stopOpCode);

    exit(0);
}

<span class="math-container">```
```

答: I've been using a Roomba 535 for years with Raspberry Pi and have not found a way to keep it awake. It still streams sensor data if set to. I just have a function called (wake) that I call every before I ask it to do anything. It pulses that wake pin, sends the start command (128 maybe? I forget), then sets the mode to safe mode. then back to my program. It doesn't have to run every 5 min 24/7  - just right before you need it. Work in progress but I'm slowly updating my website with some documentation about my Roomba and other robot projects www.lloydbrombach.com</p>

ContentLicense: CC BY-SA 4.0


问:
Simulating a robot
I try to simulate a robot, but with a GUI. I can make a simulation using pyopengl to simulate the movement of robot, but I cannot make the GUI with that. I need to make it easier to simulate, analyze, communicate and run the robot (and simulation).

My app so far :

Using python for image processing and communication with the robot

Using pyopengl to simulate 3D

Using matplotlib to display the log of robot movement

Is there any advice on how to create an app that is able to simulate, analyze, communicate and run in compact design?

My current app has no button and hard to analyze.

答: It sounds like what you want to do is all contained within ROS (http://www.ros.org/about-ros/). There is lots of functionality already with ROS, but it is really good for simulation, communication between hardware, etc. You can still write your codes in python, but all the things you want to do are massively simplified. </p>

Title: Simulating a robot


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

答:
Depending on the motor type, you may be able to freewheel the motor. With a brushed DC motor this could be achieved with most commercial H-bridges, controlled with fast current decay.

Flyback diodes allow the inductive current in the motor to be dumped back through it and dissipated, or you can control the MOSFETs in the H-bridge to dump current to ground.

From your description it will be a significant amount of current, but it should be possible.

Title: Making a motor controlled joint passive


问:
Use computer to throw a small switch
Would like a product that enables me to use my computer to throw an small DC ON / OFF switch. Seems like a stupidly simple thing to do, but for the life of me I can't seem to find such a device when I search online.

Is there a device floating around out there that I can order? Or is there some kind of term I should be searching for?

Thanks so much!

答:
There are two easy ways:

Use a relay

Use a transistor

In both cases, you can use the processor as the switch input...

ContentLicense: CC BY-SA 3.0

Title: Use computer to throw a small switch


问:
Path planning with potential field
Can shortest path be computed using potential field path planning algorithm? Or is it just for obstacle avoidance and navigative towards goal? As i studied potential field deals with attracrive/repulsive forces, its not for shortest path finding.</p>

答:
Potential field does not aim at computing the shortest path between two points.
Shortest paths often necessarily get infinitesimally close or touching obstacles. On the other hand, paths that potential fields generate are away from any obstacles, according to repulsive fields. Therefore, they are normally not the shortest ones.</p>

Title: Path planning with potential field


问:
What control circuit element will control an ESC while doing bench testing?
While doing bench testing of motor and prop combinations what simple device would I use in the circuit to properly control the ESC for the full range of power from 0% to 100% ?
I have seen a few videos where bench testing is demonstrated to measure the thrust and power usage of a brushless motor and propeller. Typically the control of the ESC is done with a very small device attached to the ESC? What is that device? (I find it hard to believe it as simple as a rheostat, or is it?)</p>

答:
To Control an ESC, or rather, give a control signal, one generally uses some kind of micro controller (arduino, esp32, Ti c2000, STM, countless others) with a ESC dependent control signal. The mcus themselves don't have to be large, they simply need to be able to provide a signal usually at 5v, which is trivial for them.

Some (most) of them require a PWM signal, such as the escons

The ESCON Module 24/2 is a small-sized, powerful 4-quadrant PWM OEM servo controller for the highly efficient control of permanent magnet-activated brushed DC motors and brushless EC motors up to approximately 48 Watts.

Others like the espos are controlled over a communcations protocol such as CAN.

The EPOS4 Compact 24/1.5 CAN is a dynamic, ready-to-connect positioning controller in a compact design. Designed for use with brushed DC motors with encoders and brushless EC motors (BLDC) with Hall sensors and encoders up to 36 W / 108 W.

If you're in the professional area, and in hobby areas

Things like the turnigy

Are also done with PWM,

Here is a post on using an esc with arduino.


问:
MPU6050 gyroscope giving wrong measure
i am trying to make an angle meter, using the UNO and MPU6050, following joop brokking video tutorials,

when utilizing the accelerometer, the results are fine,

however when i try to use gyroscope  (each one alone) do not get the expected result

when rotating the sensor from 0 to 90 degrees, the output change from 0 to 60~70 degrees only

so what is wrong is it the code, the gyroscope is damaged

here is the code

```<code> refresh ();
 angle += (gyro_x - cal_x) * (millis () - timer) / 1000.0;
 Serial.println (angle);
</code>```

refresh (); is a function that updates gyro_x

the MPU6050 is fixed so that it rotatea in one direction only

later on i took this false measure and applied it in a complementary filter,  the result was plausible, and varies around 0.5 degrees, i still need to get it to an accuracy of 0.0x

答:
This will be a bit troublesome to help with, as you didn't post all of your code or more importantly your exact errors (Serial.print()), but for general infos, and for others it's enough. Questions regarding troubleshooting your wiring/c code directly, I think should be directed to arduino.stackexchange.com There are countless questions and answers there.

You need to integrate the gyro if you plan on getting an angle...

An example code (in wiring) to integrate your gyroscope readings would be, with 0.01 being your sampling constant $\Delta t$

```<code>void update_int(double *u, double *y)
{
static double x[1] = {0};
double x1[1];
y[0] = x[0];
x1[0] = x[0] + 0.01*u[0];
x[0] = x1[0];
}
</code>```

However keep this in mind, gyros are accurate short term, but long term have 'drift' and will become unreliable.

You can read more infos about this at adafruits gyroscope comparison site.

Generally one "fuses" several different sensor readings to make one, such as your 'complimentary filter'

Other options are the Madgwick Filter and the Kalman Filter....achieving a variance of +/- 0 dps is nearly impossible, but you can get pretty close using some clever techniques and one of the mentioned filters. A comparison of all three filtering techniques can be found at OlliW's website.

Title: MPU6050 gyroscope giving wrong measure

Body:
This will be a bit troublesome to help with, as you didn't post all of your code or more importantly your exact errors (Serial.print()), but for general infos, and for others it's enough. Questions regarding troubleshooting your wiring/c code directly, I think should be directed to arduino.stackexchange.com There are countless questions and answers there.

You need to integrate the gyro if you plan on getting an angle...

An example code (in wiring) to integrate your gyroscope readings would be, with 0.01 being your sampling constant $\Delta t$

void update_int(double *u, double *y)
{
static double x[1] = {0};
double x1[1];
y[0] = x[0];
x1[0] = x[0] + 0.01*u[0];
x[0] = x1[0];
}

However keep this in mind, gyros are accurate short term, but long term have 'drift' and will become unreliable.

You can read more infos about this at adafruits gyroscope comparison site.

Generally one "fuses" several different sensor readings to make one, such as your 'complimentary filter'

Other options are the Madgwick Filter and the Kalman Filter....achieving a variance of +/- 0 dps is nearly impossible, but you can get pretty close using some clever techniques and one of the mentioned filters. A comparison of all three filtering techniques can be found at OlliW's website.


问:
Is it possible to implement VSLAM on Arduino?
If not, then which microcontroller will be suitable? </p>

答:
Not on nano and uno because of memory size. Really basic one with a low-resolution image and slower fps might be possible on mega. Still memory size might not be enough. Due is really marginal in acceptable processing speed with a low-resolution image but still have a memory problem. Just have a look at how much memory you need to store 2 or 3 images on your ram. That is the marginal ram requirement. You can use an external storage module which will take minutes to process a single frame.

Choose a board with more than 1.0GHz cpu, 128Mb ram with linux.


答:
I changed the code and now it works properly.</p>

```<code>rob.Xtree{1} = rotx(1.57) * xlt([0 0 0]);
rob.Xtree{2} = roty(1.57) * xlt([0.15,0,0]);
rob.Xtree{3} = xlt([0.34 0 0]);
</code>```

Title: Roy Featherstone toolbox robot model

Body:
I want to model these D-H parameters in spatial toolbox:

Link:          alpha,      a,        theta,      d

Link 1 :        -90        0        theta1*      d1

Link 2 :          0        a2       theta2*      0

Link 3 :          0        a3       theta3*      0

This is the code I have tried:

```<code>n=3;
rob.NB = n;
rob.parent = [0:n-1];
rob.jtype = { 'R', 'R', 'R' }

l2=0.28;    %link length
l3=0.2;     %link length
d1=0.05;    %link offset

rob.Xtree{1} = rotx(pi)*xlt([0,0,0]);
rob.Xtree{2} = rotz(0)*xlt([l2 0 0]);
rob.Xtree{3} = xlt([l3 0 0]);

ax1=0.03; ay1=0.03; az1=0.03;
ax2=0.28; ay2=0.05; az2=0.05;
ax3=0.2; ay3=0.05; az3=0.05;

rob.I{1} = mcI( 1, [0 0 -0.02], 1/12*[ay1^2+az1^2 0 0; 0 ax1^2+az1^2 0; 0 0 ax1^2+ay1^2] )
rob.I{2} = mcI( 4, [0.14 0 0], 4/12*[ay2^2+az2^2 0 0; 0 ax2^2+az2^2 0; 0 0 ax2^2+ay2^2] )
rob.I{3} = mcI( 3, [0.1 0 0], 3/12*[ay3^2+az3^2 0 0; 0 ax3^2+az3^2 0; 0 0 ax3^2+ay3^2] )

rob.appearance.base = ...
  { 'box', [-0.2 -0.3 -0.2; 0.2 0.3 -0.07] };

rob.appearance.body{1} = ...
    { 'box', [0 -0.07 -0.04; 0.05 0.07 0.04], ...
      'cyl', [0 -0.07 0; 0 0.07 0], 0.06 };

rob.appearance.body{2} = ...
    { 'box', [0 -0.07 -0.04; 0.28 0.07 0.04], ...
      'cyl', [0 0 -0.07; 0 0 0.07], 0.06 };

rob.appearance.body{3} = ...
    { 'box', [0 -0.07 -0.04; 0.2 0.07 0.04], ...
      'cyl', [0 0 -0.07; 0 0 0.07], 0.06 };

showmotion(rob)
</code>```

But this is what I get, with motion only along 1 axis:

Kindly help how to get the model right.

Body:
I changed the code and now it works properly.

rob.Xtree{1} = rotx(1.57) * xlt([0 0 0]);
rob.Xtree{2} = roty(1.57) * xlt([0.15,0,0]);
rob.Xtree{3} = xlt([0.34 0 0]);


问:
How are the optical encoders used in platforms like Rover 5?
I just got my rover 5 chassis with 4 motors and 4 quadrature encoders and I am trying to utilize the optical encoders. I know the encoders generate pulse signals which can be used to measure speed and direction of the motor.

I want to know how 4 separate optical encoders add value for the controller of rover 5 like platform. The controller normally uses PWM to control the speed of the motor. If two motors are running at same speed then the encoder output will be same. So, why should the controller monitor all 4 encoders?

答:
There are two use cases i can think of, which benefits of individual motor feedback.

If you are moving in strait line, you need to have both sides synced.

You can have motor that will degrade over the time and will not stay in sync with the other one at the same side (in case you control them by only one encoder), which will fail rolling the caterpillar band.


答:
I cannot recreate your issue, but you haven't posted all the steps you're taking, so I'm not sure if I'm following exactly what you've done.

What version are you using? I have Spatial_v2, and the README says (C) 2012. You have:

```<code>Error using  *
Inner matrix dimensions must agree.
Error in FDab (line 49)
    a{i} = Xup{i} * -a_grav + c{i};
</code>```

But that line isn't line 49 in my version of FDab, it's line 47 in my code.

Regardless, note that the FDab function doesn't get model.gravity directly; it calls get_gravity(model) and that function will return a 6x1 vector if the check size(model.Xtree{1},1) == 3 returns FALSE (lines 18 and 21 in get_gravity())

This could be where you're having the issue - you're saying your robot is non-planar, but it's passing the planar check size(model.Xtree{1},1) == 3 in get_gravity(). This is the only way you get a_grav as a  3x1 vector from get_gravity().

I don't know how you initialized your robot, but I managed to run your code without issue if I took the following steps:

Not provided in the OP: rob = singlebody;

I'm not sure if the above is correct because I had to manually empty appearance.body in order to stop errors when running your code: rob.appearance.body = []

Copy/paste your code from rob.NB = 3; to showmotion(rob); I got no errors and the animation played correctly.

You don't set gravity in the code snippet you provided, so I set: rob.gravity = [0,0,-9.81]

I ran the code in question:

>> FDab(rob, [0;0;0], [0;0;0], [0;0;0])

ans =

  -59.1867
   -3.8828
    6.9148
```

I would guess you've got an issue with your model declaration or configuration as there are steps required to get your snippet to run. Try clear all to flush your session variables and re-running the code. It might be something you had tried previously is still in memory and that's screwing up your results.

Title: Non-planar robot Dynamics error using Roy Featherstone's Spatial toolbox

Body:
I am using this code to test robot dynamics of above robot using Spatial Toolbox function:

```<code>FDab(rob, [0;0;0], [0;0;0], [0;0;0]) %a_grav = [0,0,-9.81]
</code>```

But it gives error:

```<code>Error using  *
Inner matrix dimensions must agree.
Error in FDab (line 49)
    a{i} = Xup{i} * -a_grav + c{i};
</code>```

This is because Xup is 6x6 double whereas a_grav is 1x3.

The 3 link non-planar robot used is given as:

```<code>rob.NB = 3;
rob.parent = [0:2];
rob.jtype = { 'R', 'R', 'R' }
model.gravity = [0 0 0];
rob.Xtree{1} = rotx(1.57) * xlt([0 0 0]);
rob.Xtree{2} = roty(1.57) * xlt([0.15,0,0]);
rob.Xtree{3} = xlt([0.34 0 0]);
ax1=0.03; ay1=0.03; az1=0.03;
ax2=0.28; ay2=0.05; az2=0.05;
ax3=0.2; ay3=0.05; az3=0.05;
rob.I{1} = mcI( 1, [0 0 -0.02], 1/12*[ay1^2+az1^2 0 0; 0 ax1^2+az1^2 0; 0 0 ax1^2+ay1^2] )
rob.I{2} = mcI( 4, [0.14 0 0], 4/12*[ay2^2+az2^2 0 0; 0 ax2^2+az2^2 0; 0 0 ax2^2+ay2^2] )
rob.I{3} = mcI( 3, [0.1 0 0], 3/12*[ay3^2+az3^2 0 0; 0 ax3^2+az3^2 0; 0 0 ax3^2+ay3^2] )
rob.appearance.base = ...
  { 'box', [-0.2 -0.3 -0.2; 0.2 0.3 -0.07] };
rob.appearance.body{1} = ...
    { 'cyl', [0 0 0; 0.11 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
rob.appearance.body{2} = ...
    { 'cyl', [0 0 0; 0.34 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
rob.appearance.body{3} = ...
    { 'cyl', [0 0 0; 0.26 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
showmotion(rob)
</code>```

How can I overcome the error?

Body:
I cannot recreate your issue, but you haven't posted all the steps you're taking, so I'm not sure if I'm following exactly what you've done.

What version are you using? I have Spatial_v2, and the README says (C) 2012. You have:

Error using  *
Inner matrix dimensions must agree.
Error in FDab (line 49)
    a{i} = Xup{i} * -a_grav + c{i};

But that line isn't line 49 in my version of FDab, it's line 47 in my code.

Regardless, note that the FDab function doesn't get model.gravity directly; it calls get_gravity(model) and that function will return a 6x1 vector if the check size(model.Xtree{1},1) == 3 returns FALSE (lines 18 and 21 in get_gravity())

This could be where you're having the issue - you're saying your robot is non-planar, but it's passing the planar check size(model.Xtree{1},1) == 3 in get_gravity(). This is the only way you get a_grav as a  3x1 vector from get_gravity().

I don't know how you initialized your robot, but I managed to run your code without issue if I took the following steps:

Not provided in the OP: rob = singlebody;

I'm not sure if the above is correct because I had to manually empty appearance.body in order to stop errors when running your code: rob.appearance.body = []

Copy/paste your code from rob.NB = 3; to showmotion(rob); I got no errors and the animation played correctly.

You don't set gravity in the code snippet you provided, so I set: rob.gravity = [0,0,-9.81]

I ran the code in question:

>> FDab(rob, [0;0;0], [0;0;0], [0;0;0])

ans =

  -59.1867
   -3.8828
    6.9148

I would guess you've got an issue with your model declaration or configuration as there are steps required to get your snippet to run. Try clear all to flush your session variables and re-running the code. It might be something you had tried previously is still in memory and that's screwing up your results.


问:
Mapping of unknown environment
My question is how do obtain occupancy grid map given sensor data of a robot? . I searched a lot and concluded that by using proximity sensors (rangefinders, sonar) and putting that data in occupancy grid mapping algorithm one can obtain grid maps. Am i right in that or not? If not kindly correct me because still i am stuck at that point after a lot of literature search. </p>

答:
Yes, you are correct that creating an occupancy grid map is as simple as taking sensor data and putting it into a map.  However, you will need to know the world location of your robot so that all your sensor measurements can be put into the same reference frame.  (I assume you want a standard world map.)

Obtaining the world location of your robot is a broader topic.  But assuming you have it, it is just a matter of some transforms to put sensor measurements into the same frame.

$$
T_{world}^{robot}*T_{robot}^{sensor}*T_{sensor}^{object}=T_{world}^{object}
$$

A few relevant frames shown in this diagram:

Typically, the occupancy grid map will designate free space (which is the space between the robot and the sensor reading, occupied space (which is where the sensor detected something), and unknown space (which is behind the occupied space).

Things get complicated because there is uncertainty in the robot position, and noise in the sensor measurement.  So that is why the modern way to do all this is probabilistically.

Title: Mapping of unknown environment


问:
problem of power on PIN 1 and PIN 2 of DIN connector of Roomba 521
I notice there is a problem of power on PIN 1 and PIN 2 of DIN connector of Roomba 521...I have only 0,5 V but it's expected 12V...motherboard damaged?</p>

答: This normally happens when you don’t use both power pins together, in order to get full voltage both pins must terminate into 1 wire or trace. </p>


问:
Is Ultrasonic Self Balancing Robot Possible?
a quick question, can i make a SBR using UNO and two HC-SR04 knowing that this configuration offers a 1.36 mm resolution  (i.e it increment 1.36mm) ?</p>

答: Probably not - it can take about 60ms to get a reading from those sensors†, which is quite slow for the loop updating a balancing robot.</p>


问:
Facing problems in Mask vector in Robotics toolbox
I am working on a 7 DOF serial manipulator and was trying to use ikine to get the joint coordinates for simple 2 DOF robot.

Even though I am using the masking vector as [ 1 1 0 0 0 0 ], I am getting error stating:

Number of robot DOF must be >= the same number of 1s in the mask matrix

This is my 2 DOF robot

```<code>L1 = Link('d', 0, 'a', 1, 'alpha', 0);
L1.m=50;
L1.r=[0.5,0,0];
L1.I=[0,0,0;0,0,0;0,0,10];
L1.G=1;
L1.Jm=0;

L2=Link(L1);

r2=SerialLink([L1,L2]);

r2.name='POLIrobot';
r2.gravity=[0;9.81;0];

q0=r2.ikine([eye(3),[0.2;0;0];[0,0,0,1]],[0,0],[1 1 0 0 0 0]);
</code>```

Can anyone please help and explain why is it happening?

答:
It depends on which version of the Robotics Toolbox you're using, but for RTB10 you need to use the 'mask' keyword before the mask.

You'll get much faster response to questions if you post them to the RTB support forum.  It's almost impossible to find all RTB related questions in Stack Exchange.


答:
If you are running the Rover 5 in a tracked configuration then, as you rightly point out, the two wheels on each side should rotate at equal speeds meaning that half of the sensors are redundant.
If you swap the tracks out for the mecanum wheels then the four encoders have more of a benefit.

It probably also makes sense from a manufacturing point of view to keep all the motor/encoder units the same. The increased cost of manufacture may be offset by the reduced complexity.

Title: How are the optical encoders used in platforms like Rover 5?

Body:
I just got my rover 5 chassis with 4 motors and 4 quadrature encoders and I am trying to utilize the optical encoders. I know the encoders generate pulse signals which can be used to measure speed and direction of the motor.

I want to know how 4 separate optical encoders add value for the controller of rover 5 like platform. The controller normally uses PWM to control the speed of the motor. If two motors are running at same speed then the encoder output will be same. So, why should the controller monitor all 4 encoders?


问:
Inverse kinematics showing incorrect results for 4 dof robot in MATLAB using Robotics Toolbox
I'm doing inverse kinematics for 4 dof robot using robotics toolbox matlab. The code is given below:

```<code>    preach = [0.326 0.223 0.342]; % reach point of end-effector
% create links using D-H parameters
% Link('d', 0.15005, 'a', 0.0203, 'alpha', -pi/2)
L(1) = Link([0  0     0.15   pi/2    0], 'standard');
L(2) = Link([0  0     0.15   0       0], 'standard');
L(3) = Link([0  0     0.15   0       0], 'standard');
L(4) = Link([0  0     0.15   0       0], 'standard');
  % set limits for joints
 L(1).qlim=[deg2rad(-160) deg2rad(160)];
 L(2).qlim=[deg2rad(-45) deg2rad(45)];
 L(3).qlim=[deg2rad(-60) deg2rad(60)];
 L(4).qlim=[deg2rad(-50) deg2rad(50)];
 %build the robot model
rob = SerialLink(L, 'name','rob');
qready = [0 0 0 0]; % initial position of robot
plot(rob,qready,'noname');
T1= transl(preach); % convert of reach point of 4x4 homogenous matrix
[qreach,err] =  rob.ikcon(T1, qready); % find inverse kinematics with error
</code>```

Matlab shows results like this(using robotics toolbox ):

```<code>    >> [qreach,err] =  rob.ikcon(T1, qready)
qreach =
    2.7925    0.7854    1.0472    0.8727
err =
    9.6055
</code>```

I'm not taking preach = [0.326 0.223 0.342]; randomly. Infact, first I do forward kinemtics to get these points. code is below:

```<code>    % to find forward kinemtics
qreadyrr = [0.6 0.45 0.63 0.22]; % setting the four angles randomly within range to get preach
T0 = fkine(rob, qreadyrr);
</code>```

then, I got T0 as

```<code>     >> T0
T0 =
    0.2208   -0.7953    0.5646    0.3267
    0.1510   -0.5441   -0.8253    0.2235
    0.9636    0.2675    0.0000    0.3421
         0         0         0    1.0000
</code>```

Also, when I put this T0 in place of T1 in inverse kinematics code as given above, the values I got is very accurate with negligible error.

```<code>    >> [qreach,err] =  rob.ikcon(T0, qready)
qreach =
    0.6002    0.4502    0.6296    0.2204
err =
   4.6153e-07
</code>```

The point is, in my case, I have only px, py and pz values for transformation matrix but with this, inverse kinematics is not solving it correctly. I want to do inverse kinematics px, py and pz values. how can I do it correctly.

Thanks.

答:
I wrote a short article about the problems with IK for 4-axis robots which might help explain the issues.

You should probably use the ikine() function with a 'mask' option.

You will get much fast answers to questions regarding the Robotics Toolbox for MATlAB at its own support forum.


问:
Forward Kinematics of non-planar robot using Roy Featherstone's Spatial Toolbox
I have a non-floatbase 3 DOF non-planar robot whose forward kinematics I need to compute using Spatial Toolbox. The code for this purpose is p = fbkin(q) but as my robot is 3 DOF (q is 3x1 vector e.g. [0;0;0]) and non-floatbase, I am unable to get kinematics of the model and get this error:

fbkin([0;0;0]) %input

```<code>Index exceeds matrix dimensions.

Error in fbkin>fwdkin (line 49)
c4 = cos(q(4));  s4 = sin(q(4));

Error in fbkin (line 41)
    o1 = fwdkin( i1 );
</code>```

My robot is:

```<code>rob.NB = 3;
rob.parent = [0:2];
rob.jtype = { 'R', 'R', 'R' }

model.gravity = [0 0 0];

rob.Xtree{1} = rotx(1.57) * xlt([0 0 0]);
rob.Xtree{2} = roty(1.57) * xlt([0.15,0,0]);
rob.Xtree{3} = xlt([0.34 0 0]);

ax1=0.03; ay1=0.03; az1=0.03;
ax2=0.28; ay2=0.05; az2=0.05;
ax3=0.2; ay3=0.05; az3=0.05;

rob.I{1} = mcI( 1, [0 0 -0.02], 1/12*[ay1^2+az1^2 0 0; 0 ax1^2+az1^2 0; 0 0 ax1^2+ay1^2] )
rob.I{2} = mcI( 4, [0.14 0 0], 4/12*[ay2^2+az2^2 0 0; 0 ax2^2+az2^2 0; 0 0 ax2^2+ay2^2] )
rob.I{3} = mcI( 3, [0.1 0 0], 3/12*[ay3^2+az3^2 0 0; 0 ax3^2+az3^2 0; 0 0 ax3^2+ay3^2] )

rob.appearance.base = ...
  { 'box', [-0.2 -0.3 -0.2; 0.2 0.3 -0.07] };

rob.appearance.body{1} = ...
    { 'cyl', [0 0 0; 0.11 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };

rob.appearance.body{2} = ...
    { 'cyl', [0 0 0; 0.34 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };

rob.appearance.body{3} = ...
    { 'cyl', [0 0 0; 0.26 0 0], 0.05, ...
      'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };

showmotion(rob)
</code>```

How can I use the fbkin function with 3x1 joint angle vector?

答:
You've got to open the functions you're trying to use and look through them if you're getting errors. You said you are trying to get the forward kinematics of your robot, and that it's a non-floatbase, and that you've got a 3x1 vector of joint values q.

Yet you're using fbkin which, if you type help fbkin into the console, will state (added bold for things relevant to you):

>> help fbkin

fbkin  Forward and Inverse Kinematics of Floating Base

[x,xd]=fbkin(q,qd,qdd) calculates the forward kinematics, and [q,qd,qdd]=fbkin(x,xd) calculates the inverse kinematics, of a spatial floating base constructed by floatbase.

So, right away, if you didn't use floatbase to make your base, then you're using the wrong function. The rest of the help message continues:

The vectors q, qd and qdd are the joint position, velocity and acceleration variables for the six joints forming the floating base; x is the 13-element singularity-free state vector used by FDfb and IDfb; and xd is its derivative.

And here it says it's a floating base, so naturally it's got six degrees of freedom, so if you're going to do anything with it then you can imagine the base as having six joints (x/y/z roll/pitch/yaw) and that's what this function is looking for when it uses q as an input. It is not saying that this is for use with a robot arm or a kinematic tree or anything else. Just the floating base.

Continuing:

The component parts of x are: a unit quaternion specifying the orientation of the floating-base frame relative to the fixed base, a 3D vector giving the position of the origin of the floating-base frame, and the spatial velocity of the floating base expressed in fixed-base coordinates.

That is the output for the forward kinematics code - quaternion orientation and x/y/z position, and spatial velocity, which is angular and linear velocities. The remainder of the help comment talks about different ways to call the function and things to look out for with regards to singularities.

This is not the code that's going to do forward kinematics for a robot arm. It's doing kinematics for a base.

You need to go to the \dyanmics folder and look at some of the FD__ functions; those are the Forward Dynamics functions. Actually I was going to suggest you try FDab and I remembered that was at the core of your other question, so I'm wondering why you're not using it.

Actually, in re-reading your question, it seems like you're not actually trying to do any dynamics simulations, rather you just seem to want to plug in a vector of joint values and get positions. In that case, I think the command you're looking for is jcalc. This function takes a joint type and joint value q and returns the spatial transform Xj (which is a 6x6 matrix and not a 4x4 homogenous transform!).

Function like FDab call jcalc to build a chain of transforms, as in:

for i = 1:model.NB
  [ XJ, S{i} ] = jcalc( model.jtype{i}, q(i) );
  vJ = S{i}*qd(i);
  Xup{i} = XJ * model.Xtree{i};
```

But I don't think there's any one function that's going to take your q vector and spit out a series of positions. You'll have to build your own with jcalc and work from there.

Body:
You've got to open the functions you're trying to use and look through them if you're getting errors. You said you are trying to get the forward kinematics of your robot, and that it's a non-floatbase, and that you've got a 3x1 vector of joint values q.

Yet you're using fbkin which, if you type help fbkin into the console, will state (added bold for things relevant to you):

>> help fbkin

fbkin  Forward and Inverse Kinematics of Floating Base

[x,xd]=fbkin(q,qd,qdd) calculates the forward kinematics, and [q,qd,qdd]=fbkin(x,xd) calculates the inverse kinematics, of a spatial floating base constructed by floatbase.

So, right away, if you didn't use floatbase to make your base, then you're using the wrong function. The rest of the help message continues:

The vectors q, qd and qdd are the joint position, velocity and acceleration variables for the six joints forming the floating base; x is the 13-element singularity-free state vector used by FDfb and IDfb; and xd is its derivative.

And here it says it's a floating base, so naturally it's got six degrees of freedom, so if you're going to do anything with it then you can imagine the base as having six joints (x/y/z roll/pitch/yaw) and that's what this function is looking for when it uses q as an input. It is not saying that this is for use with a robot arm or a kinematic tree or anything else. Just the floating base.

Continuing:

The component parts of x are: a unit quaternion specifying the orientation of the floating-base frame relative to the fixed base, a 3D vector giving the position of the origin of the floating-base frame, and the spatial velocity of the floating base expressed in fixed-base coordinates.

That is the output for the forward kinematics code - quaternion orientation and x/y/z position, and spatial velocity, which is angular and linear velocities. The remainder of the help comment talks about different ways to call the function and things to look out for with regards to singularities.

This is not the code that's going to do forward kinematics for a robot arm. It's doing kinematics for a base.

You need to go to the \dyanmics folder and look at some of the FD__ functions; those are the Forward Dynamics functions. Actually I was going to suggest you try FDab and I remembered that was at the core of your other question, so I'm wondering why you're not using it.

Actually, in re-reading your question, it seems like you're not actually trying to do any dynamics simulations, rather you just seem to want to plug in a vector of joint values and get positions. In that case, I think the command you're looking for is jcalc. This function takes a joint type and joint value q and returns the spatial transform Xj (which is a 6x6 matrix and not a 4x4 homogenous transform!).

Function like FDab call jcalc to build a chain of transforms, as in:

for i = 1:model.NB
  [ XJ, S{i} ] = jcalc( model.jtype{i}, q(i) );
  vJ = S{i}*qd(i);
  Xup{i} = XJ * model.Xtree{i};

But I don't think there's any one function that's going to take your q vector and spit out a series of positions. You'll have to build your own with jcalc and work from there.


问:
Effect of platform speed (how fast it is moving) on the quality of SLAM
I want to know how big of on an impact does the speed of the platform on which your sensors are mounted have on the quality of the outcome of a SLAM solution. Are there are any methods that are better suited to applications where the platform speed is higher ? What are the typical trade offs? Speed here refers to the actual motion of the platform and not the processing speed of computational elements.</p>

答:
That totally depends on the sensor type and moving speed.

Think about hand-held SLAM devices where angular velocity is typically way larger than ground vehicle types. Also, sensor type and fps are other main factors. If you use 1000 FPS global shutter camera you don't need to worry about the motion distortion much whereas 2-axises LiDARs is the opposite case.

Continuous-time SLAM is dedicated to tackle with the motion distortion.

You can see an extream case here: https://www.youtube.com/watch?v=Uj9BKcnXOyo

Refers to my paper if you want more details: https://arxiv.org/abs/1711.01691


问:
What robotic skills can I develop when working as a robot operator?
I find myself very interested to work in the field of robotics though my background is not robotics, I had a degree in Physics, master 1 in Hydrodynamics and this year I have studied just one semester about robotics and the internship that I am doing now aims to develop a numerical model but is not related to robotics.

So, the thing is I don't have enough practical or theoretical skills in robotics but I believe that my interest and my scientific background allow me to learn and integrate successfully while I am working, so I think I could do just fine even if I didn't have a solid experience in this field.

I have found a job for one year as a robot operator in a company, so I would like to try it (today is my interview). And while I am working I could learn courses online about robotics.

I would like to know about the skills I could develop as a robot operator especially practical skills.And also what kind of opportunities could I get after working as a robot operator? Anyone had an experience with such a job before?

答:
Considering your apparent education background, I’m surprised at this question...

But regardless. Working with robots, when compared to making robots are very different things.

This is not so much different than driving cars and fixing them compared to designing and building them.

As you studied physics, then you’re well aware that physics is the practical application of mathematics. (In a dumbed down way)

Much is the same that engineering is the practical application of physics.

A trade and/or the use of machines would then be the practical/end use of engineering.

Learning to operate robots, as in using them safely, programming them, and to a degree fixing them, will give a person all the knowledge required for said machine usage.

This would include machine specific programming (or a commonly used language depending on the machine(s)) spacial thinking, understanding multiple coordinate systems... world, joint, camera vs world, etc etc. These are things your education would help you understand easier than someone not formally educated.

Repairing said machines will give an insight into how they may be built, and the engineering thoughts that went into them...or maybe just confuse a person why some choice was made than the obvious one....

But it's unlikely that you would ever do this...and a maintenance person would normally be found anyways, these machines are expensive after all.

Using robots will teach the differences between precision, accuracy, and repeatability in a real world application.

Learning the use of machines will provide valuable insight into them, but is quite far removed when it comes to designing them, programming them (as in programming their embedded systems, not just their movement via gcode or something ), and controlling them.

However all of this is highly dependent on what you’re operating on.

Running a cnc mill is far different than running a 8 axis industrial arm, both provide valuable knowledge, but are very different kinds of robots with many overlapping and many non-overlapping usage cases and knowledge.

I suggest looking for Fanuc, ABB, Kuka training courses to see the things they describe you would learn about, and compare them to DMG or Siemans milling courses to have an idea of the differences between them, and simply waiting to take the job and see what you learn. Hopefully you'll be running older machines that you will actually have to do something, and not just hit the start button to run a CAM program someone in an office premade for you.


问:
Meaning of Roomba's charging states
I added an Arduino to control a Roomba 615 (similar to iRobot Create 2).
The Arduino is communicating with Roomba through the Mini-DIN connector with the Open Interface.

While Roomba is docked and in Passive mode, I would like to know when the battery is fully charged in order to know when Roomba is ready to clean/travel. I am currently watching the Charging State (ID 21 in Open Interface, p.28).

Could you explain to me the meaning of each state?

Which state corresponds to « the battery is fully charged »?

The 6 states are:

0 Not charging

1 Reconditioning Charging

2 Full Charging

3 Trickle Charging

4 Waiting

5 Charging Fault Condition

答:
maybe you want to look at Packet ID 25 also on page 28 of the documentation provided.

Battery Charge Packet ID: 25 Data Bytes: 2, unsigned

The current charge of Roomba’s battery in milliamp-hours (mAh). The charge value decreases as the battery is depleted during running and increases when the battery is charged.

Range: 0 – 65535 mAh

I guess if you request this packet and make a comparison for the value you can set a threshold to consider that the battery is fully charged, and the robot should be ready to go.

I would not set this comparison to be equal to 65535, as this value might not be attained as the battery starts to wear. Maybe it will be reasonable to compare if this value is equal or above 58981 (which is roughly 90% of the maximum value).

Title: Meaning of Roomba's charging states


问:
Is it compulsary to learn Arduino programming in order to use Udoo Neo as an IOT device?
I'm an absolute beginner, so please bear with me. I'm currently doing a project where I need to control 2 DC motors using the Udoo board. Should I first learn to use an Arduino or is it possible to program the board in Linux's terminal only?
PS. There isn't much documentation available for the Udoo board.

A Pan Tilt Unit(PTU) is to be attached to a robot. The PTU has 2 motors with perpendicular shafts. What I need to do is control the two motors and start & stop them at particular positions. Also, build a GUI after completing the hardware. Available resources are Udoo Neo board, Arduino Due and Arduino Uno. I've gone through the UDOO official documentation but other than that I couldn't find any discussion platforms concerning the Udoo board and it's still not clear if I need to learn to program an arduino for controlling the motor? Or if it could be done via python in Udoo's Linux only.

答:
It is difficult to answer your question without more information, but I would suggest that splitting your problem in two and dealing with the motor control and the GUI separately would probably be the easiest way to accomplish what you want to do, and the Neo may be the ideal piece of kit to do that.

As for the motor control, I would be inclined implement the low level real time motor control with an Arduino (either Due, Uno or the one integrated in the Neo) and then implement the GUI in soft real time on the Linux side. See Interaction between Linux and Arduino on Udoo for examples of linking the two.

There are lots of tutorials out there about controlling motors with an Arduino and a motor shield, the documentation for the shield you have should be able to step you through what you need to do. There are even tutorials about making Pan Tilt units controlled by an Arduino, such as this instructable: Pan & Tilt Servo Bracket Controlled by Arduino, which uses rc-servo motors rather than DC motors.

If you implement you system this way then yes, you will need to learn about Arduino programming.

The alternative is to try and do everything on the Linux side, but while the ARM core is much faster than the Arduino, it is also expected to do a lot more, and it is generally safer and more consistent for real time control to be done with a seperate embedded controller rather than try to control motors from a general purpose operating system.

If you decided to go the 'do everything from linux' route, then you won't have to learn Arduino programming, but you will have to learn how to do Linux GPIO manipulation, and that will require understanding the underlying principles of GPIO, PWM and writing your own libraries rather than just using the standard libraries available for Arduino.


问:
All Joint Angle values not converging to desired set point (I am using Roy Featherstone's Spatial Toolbox)
I need the robot joint angles to become the same as given (desired) joint angles. The kinematics and dynamics (used Spatial Toolbox) are correct and the motor models are realistic too. But out of 3 joint angles, only one is converging at the desired set point, while the other ones are 'converging' at a random point.

I have tried tuning the 'PD controllers', 'PI controllers' as well as the 'gain' but only the 1st value converges. I am unable to understand the reason behind it. Kindly check the code and suggest if any improvement is needed.

Simulink model:

Joint angles: current and desired:

Simulink model, robot model and motor parameters are given here: https://drive.google.com/open?id=0B1lgSdFRVsHGTVJ5ZWhURG05ZTg

答:
Sorry I saw this as I was checking emails. Just got off a very long international flight so my answer below may not be super coherent. tl;dr - You're not integrating your reference error anywhere and so there's nothing that would drive your reference error to zero.

The Simulink model is confusing to me. What are your units? I think it would be helpful to me (and you!) if you labeled or subdiagrammed this to show what each portion is doing.

The thing that's confusing for me is that feedback systems will typically operate on a feedback error, which is reference - feedback. The reference error is then modified and that's what drives the response - a PID controller is trying to drive the reference error to zero.

It looks like you've got a Jacobian*Force term to generate some a torque signal, which seems okay because the Jacobian lets you relate an end effector's force to the joint forces.

The way that I would expect you would be using it, the way you have the outputs done, is that you're going to use the current pose of the arm and provide a desired end effector force vector, and you're going to output the joint torques.

You've got the output Thm, but then it's not reference - feedback to try to drive the motor torques to that value. You've got instead a "Desired torque" vector, so you've got reference - other reference.

Then you've got a set of PD controllers, but there's no plant/dynamics involved directly after those controllers and so it's not clear to me what they're controlling. What are the input/output units? Are you doing PD control to accept a torque reference error and generate a terminal voltage to drive the motor?

But if that is what you're doing, that summing junction between the PD controllers and PI controllers doesn't make sense to me, because the input on the negative junction is the output of 3DOF Robot and/or the motor PI control block. That same output though also gets summed with the Thm torque output of the Jacobian function.

Basically your Jacobian is outputting a torque, which seems okay but then, assuming you're using the same units on both sides of your summing junctions, the output of Motor PI is torque and the output of PD controllers is torque and the output of Reference Torque is torque.

So you've got a reference torque, the Jacobian Thm, and you're building a controller(s) to do something with that reference, but then you skip to the end of your cascaded controllers and just add that Thm signal in there. What is it that the other controllers are doing then if you're going to throw the Thm signal in at the end?

In any event, the output of that last summing junction looks like a torque, which then makes sense to go into the next section, which I'm assuming is FDab or similar - takes inputs of q, qd, and tau, and you've got q and qd fed back from the integrators and what I'm assuming is tau out of that summing junction.

So then it goes from there into a forward dynamics, and then this is where your real reference - feedback is going on, except you've got it as feedback - reference, which ultimately doesn't matter because it's just a gain of -1, but anyways this is where your joint angle controller should go because this is the only place in your code that you seem to be comparing a reference (Desired joint angles vector) to a feedback (integrated dynamics simulation), but even here you're not comparing joint angles, you're comparing the output of forward kinematics, which would imply you're only looking at the end effector.

Looking a little harder at it, your forward kinematics output a 3x1 vector, which would only cover x/y/z or roll/pitch/yaw of the end effector; you don't have something like a quaternion + x/y/z for a 7x1 vector.

Finally, it would seem at a glance that you have something like a joint or end effector controller in that section of your code, but that block is a triangle, so it's just a gain. It's a gain acting on a reference error, so it's a proportional gain if you look at that like a PID controller. There's no integral term, so it's as though your integral gain is set to zero and you're never able to drive steady state error to zero.


问:
Error term formulation in Graph SLAM (conceptual doubt)
I am reading A Tutorial on Graph-Based SLAM.Grisetti, Kummerle,  Stachniss & Burgard

On page 5, the error function is introduced as follows
$$e_{ij}(x_i, x_j) = z_{ij} - \hat{z}_{ij}(xi, xj)$$

here $z_{ij}$ is the mean of virtual measurement and $\hat{z}_{ij}(x_i, x_j)$ is the prediction of the virtual measurement. The following image supplements the description

The Algorithm 1 (on page 6), requires $e_{ij}$ as input. My doubt is regarding the calculation of $e_{ij}$. I need both $z_{ij}$ and $\hat{z}_{ij}$ to calculate $e_{ij}$

The evaluation of $\hat{z}_{ij}$ is dependent on the robot poses $x_i$ and $x_j$.

In turn, these robot poses $x_i, x_j$ (as well as $z_{ij}$) are calculated using $z_{raw}$ (incrementally with Odometry?) and to calculate $\hat{z}_{ij}$ we are again going to (indirectly) use $z_{raw}$. And that does not make sense because then $e_{ij}=0$?

Surely, I'm missing something about how $z_{ij}$ and $\hat{z}_{ij}$ differ!

Kindly help me resolve the above doubt! Any concrete example of $z_{ij}$ and $\hat{z}_{ij}$ are appreciated.

答:
Good question. That is quite confusing in the beginning.

Let's say you have an observation of a relative pose zij between two positions(or nodes) from your wheel odometry.

Then, you accumulate the relative poses to create the trajectory of your robot. From the accumulated trajectory you can extract zij_hat.

Given obesrvation and prediction, the error function is

eij = zij - zij_hat

which are zero initially except the loop closure terms. For example, if you have 4 nodes with a loop closure at 4 and 1, your errors looks like this.

e12 = 0

e23 = 0

e34 = 0

e41 = big error!

During the optimization, your initially accumulated trajectory moves, therefore, e12..e34 are not zero anymore.

Optimization moves the nodes to reduce the error at e41 which result in distributing the error to other nodes.

The paper you are reading is not a good tutorial(in my opinion) by the way.


问:
Command line boolean parameters to ros node
I'm working with ROS melodic and Gazebo 9.9.0 on an Ubuntu 18.04.2 LTS.

I want to get two boolean parameters from command line. To do it, I have this code:

```<code>int main(int argc, char **argv)
{
  bool doDiagonalSteps = false;

  bool checkDiagonalCornerUnBlocked = false;
  /**
   * We must call one of the versions of ros::init() before using any other
   * part of the ROS system.
   */
  ros::init(argc, argv, "astar_controller");

  /**
   * NodeHandle is the main access point to communications with the ROS system.
   */
  ros::NodeHandle n;

  /**
   * Get parameters (if there are parameters to get.)
   */
  if (!n.getParam("diagonalSteps", doDiagonalSteps))
    doDiagonalSteps = false;
  else
  {
    std::cout << "Diagonal steps: " <<  std::endl;
  }

  if (!n.getParam("checkDiagonalStepCorner", checkDiagonalCornerUnBlocked))
    checkDiagonalCornerUnBlocked = false;
  else
  {
    std::cout << "Diagonal Corner: " << checkDiagonalCornerUnBlocked << std::endl;
  }
</code>```

When I run this command on terminal:

```<code>rosrun nav_astar_nodes astar_controller _diagonalSteps:=true _checkDiagonalStepCorner:=false
</code>```

I don't get anything on the output.

How can I get a boolean parameter from command line?

答:
When you create the node handle, you need to set it to the private namespace:

```<code>ros::NodeHandle n("~");
</code>```

Then the call to n.getParam("diagonalSteps", doDiagonalSteps) will look for the parameter in the namespace /astar_controller (the name of your node) where it was set when you passed an under-scored variable to it from the command line, instead of the global namespace which is what happens by default.

Body:
When you create the node handle, you need to set it to the private namespace:

ros::NodeHandle n("~");

Then the call to n.getParam("diagonalSteps", doDiagonalSteps) will look for the parameter in the namespace /astar_controller (the name of your node) where it was set when you passed an under-scored variable to it from the command line, instead of the global namespace which is what happens by default.


问:
Gyro yaw drift compensation
I'm looking for some kind of filter, algorithm which will allow me to compensate gyro yaw drift using heading of magnetometer. My project requires only yaw measurments and both sensors are flat. Is there any simple solution or i need to dig into more complicated filtering?

I've got acc in my system but i think it's not necessary for this task.

答:
Your best would be using the Madgwick filter, as its already implemented in several languages and programs. Yaw, pitch or roll can then be easily called from the filter.

Follow the link to a description from adafruit and their library.

Title: Gyro yaw drift compensation


问:
What is required to get the roll, pitch and yaw of an aerial vehicle?
TL, DR : What is the method(in terms of sensors and algorithm) to get the roll, pitch and yaw of an aircraft at any instant.

I am planning to build a hobby aircraft. I am so confused about which kind of sensors should I use and how to use them in order to get the roll, pitch and yaw angles of the aircraft.

I think I also have some problems about understanding the concept.

What are the ways/methods/agents to get the orientation of an aircraft at any instant?

In some sources there is something going on as the importance of order of the application of roll,pitch and yaw. But I cannot understand why this is related.

I have used accelerometer values by inputting them into some formulas on the internet(which everybody uses but nobody explains well) to get the roll and pitch values. However could not understand how to manipulate them in order to meet my requirements.

I also have basic understanding about what a gyroscope is.

Thanks in advance.

答:
The only sustainable long-term acceleration (for anything terrestrial) is gravity. The Madgwick algorithm uses gravity and a magnetometer to correct gyro drift. </p>

<p>Watch the video, then head to the site - there are open-source implementations already written for you in Matlab, C, and C#. </p>

Body:
The only sustainable long-term acceleration (for anything terrestrial) is gravity. The Madgwick algorithm uses gravity and a magnetometer to correct gyro drift.

Watch the video, then head to the site - there are open-source implementations already written for you in Matlab, C, and C#.


问:
DH Parameter for OpenManipulator X from Robotis
I try to solve forward kinematics problem for OpenManipulator X from Robotis by using standard DH convention. The figure and dimension of the robot like this pic

I try to find DH parameter and got result like this

To match frame assignment requirement, I move frame 2 to the left 0.024m. But when I verify the forward kinematics result, the position of end effector is wrong when I move joint 3. For example if I move joint 3 to 90 degree, the position of end effector should be X = 0.024m, Y = 0, and Z = 0.455M. But I got from the software X = 0, Y = 0, and Z = 0.455. It is because of I move the centre of frame 3 to the left. But if I dont move it, the DH frame assignment rule doesn't match.

How to figure out this problem?

Here is my code to find forward kinematics

def std_DH(theta, alpha, a, d):
    DH = np.array([[np.cos(theta),  -np.sin(theta)*np.cos(alpha),   np.sin(theta)*np.sin(alpha),    a*np.cos(theta)],
                   [np.sin(theta),  np.cos(theta)*np.cos(alpha),    -np.cos(theta)*np.sin(alpha),   a*np.sin(theta)],
                   [0,              np.sin(alpha),                  np.cos(alpha),                  d],
                   [0,              0,                              0,                              1]])
    return DH
```

<pre class="lang-py prettyprint-override"><code>def forward_kinematics(q1, q2, q3, q4):
    _0T1 = std_DH(q1, np.pi/2, 0, 0.077)
    _1T2 = std_DH(q2+np.pi/2, 0, 0.128, 0)
    _2T3 = std_DH(q3-np.pi/2, 0, 0.124, 0)
    _3T4 = std_DH(q4, 0, 0.126, 0)
    _0T4 = _0T1.dot(_1T2).dot(_2T3).dot(_3T4)
    return _0T4
</code>```

Is there any method to find forward kinematics without using DH convention?

答:
DH parameterisation is always hard.  Using Robotics Toolbox for MATLAB we can easily do the forward kinematics without DH parameters.  First create a string of simple transforms which I took directly from your diagrams

>> s = 'Rz(q1)Tz(0.077)Ry(q2)Tz(0.128)Tx(0.024)Ry(q3)Tx(0.124)Ry(q4)Tx(0.126)';
```

<p>which describes the kinematic chain with length constants and variable angles represented by <code>qj</code>.  Now the FK is simply</p>

<pre class="lang-matlab prettyprint-override"><code>>> trchain(s, [0 0 0 0])
ans =
    1.0000         0         0    0.2740
         0    1.0000         0         0
         0         0    1.0000    0.2050
         0         0         0    1.0000
</code>```

where the values in the second argument are substituted for the joint angles, in this case all zero.  The resulting SE(3) matrix shows a translation in the x- and z-directions which is correct.

You could use this to check your DH version.

My Toolbox also has an automated symbolic manipulation tool, not perfect, to convert a similar string format (all length parameters must be symbolic not numeric) to DH parameters

>> s = 'Rz(q1)Tz(L1)Ry(q2)Tz(L2)Tx(L3)Ry(q3)Tx(L4)Ry(q4)Tx(L5)'
>> DHFactor(s)
DHFactor: error: Incomplete factorization, no DH equivalent found

ans =

DH(q1, L1, 0, -90).DH(q2, 0, L3, 0).Ty(-L2).DH(q3, 0, L4, 0).DH(q4, 0, L5, 90)
```

but it fails for your example.  The translation L2 hasn't been assigned to any DH term.  This is more likely a problem with my code than your mechanism.

Body:
DH parameterisation is always hard.  Using Robotics Toolbox for MATLAB we can easily do the forward kinematics without DH parameters.  First create a string of simple transforms which I took directly from your diagrams

>> s = 'Rz(q1)Tz(0.077)Ry(q2)Tz(0.128)Tx(0.024)Ry(q3)Tx(0.124)Ry(q4)Tx(0.126)';

which describes the kinematic chain with length constants and variable angles represented by qj.  Now the FK is simply

>> trchain(s, [0 0 0 0])
ans =
    1.0000         0         0    0.2740
         0    1.0000         0         0
         0         0    1.0000    0.2050
         0         0         0    1.0000

where the values in the second argument are substituted for the joint angles, in this case all zero.  The resulting SE(3) matrix shows a translation in the x- and z-directions which is correct.

You could use this to check your DH version.

My Toolbox also has an automated symbolic manipulation tool, not perfect, to convert a similar string format (all length parameters must be symbolic not numeric) to DH parameters

>> s = 'Rz(q1)Tz(L1)Ry(q2)Tz(L2)Tx(L3)Ry(q3)Tx(L4)Ry(q4)Tx(L5)'
>> DHFactor(s)
DHFactor: error: Incomplete factorization, no DH equivalent found

ans =

DH(q1, L1, 0, -90).DH(q2, 0, L3, 0).Ty(-L2).DH(q3, 0, L4, 0).DH(q4, 0, L5, 90)

but it fails for your example.  The translation L2 hasn't been assigned to any DH term.  This is more likely a problem with my code than your mechanism.


问:
How are the optical encoders used in platforms like Rover 5?
I just got my rover 5 chassis with 4 motors and 4 quadrature encoders and I am trying to utilize the optical encoders. I know the encoders generate pulse signals which can be used to measure speed and direction of the motor.

I want to know how 4 separate optical encoders add value for the controller of rover 5 like platform. The controller normally uses PWM to control the speed of the motor. If two motors are running at same speed then the encoder output will be same. So, why should the controller monitor all 4 encoders?

答:
No two motors will ever turn with the same angular velocity given the same voltage. If you power each of your Rover 5 motors with 12V (I don't know what they're rated for), you'll see that each motor will spin at slightly different speeds. If you want to guarantee you're traveling in a straight line, you need to implement velocity control on both wheels. One method of doing this is implementing a PID controller on the drive wheels to ensure their velocity is the same, based on encoder ticks per unit time. Otherwise (let's assume you have two wheels that are driving the vehicle) one wheel will turn faster than the other, and you'll slowly drift in one direction.

However, you may want to turn a vehicle with no steering control! That means you want to turn your drive wheels at different velocities (albeit this will cause your wheels to slip horizontally and thus cause you to lose some traction/power), and so you need two different encoders that will be the input to two different velocity controllers. For a tank like system, if the front left wheel encoder is ticking and the rear left wheel encoder is NOT ticking, then maybe your tread has fallen off! It's really very useful to create a robust system.

Edit: Man I keep editing and adding more stuff...having multiple encoders will also allow you to identify failures. If you see that one wheel has stopped moving, it could be stuck on something and/or broken! This could allow you to halt the system and tell the operator that a mechanical failure has occurred with, for example, the front left wheel. This can only be done if you have more than one encoder.

As a side note, it's always good to have a redundant system in case one breaks!


答: When the charger detects that the battery is "fully charged", it switches to "Trickle Charging" to maintain the battery at "fully charged".</p>

Title: Meaning of Roomba's charging states

Body:
I added an Arduino to control a Roomba 615 (similar to iRobot Create 2).
The Arduino is communicating with Roomba through the Mini-DIN connector with the Open Interface.

While Roomba is docked and in Passive mode, I would like to know when the battery is fully charged in order to know when Roomba is ready to clean/travel. I am currently watching the Charging State (ID 21 in Open Interface, p.28).

Could you explain to me the meaning of each state?

Which state corresponds to « the battery is fully charged »?

The 6 states are:

0 Not charging

1 Reconditioning Charging

2 Full Charging

3 Trickle Charging

4 Waiting

5 Charging Fault Condition


问:
Does the mAh of a battery mean longer power or more power?
If a Lipo battery has more mAh will it be slower to run out of energy or will it have larger power output?

Thanks in Advance

答:
I am sure the others answered way-better than I will do, but I want to provide a shorter answer.

mAh is unit of charge(Amperes * seconds = Coulombs), then if a battery is called 10000 mAh, you have such charge that,

Battery can deliver(before it runs out of charge) 1 miliamperes for 10000 hours, or 1 Amperes for 10 hour, continiously.

The current drained from the battery * the duration of process = decrease in your total charge.

If you drain 15 miliamperes for 30 minutes then you lose 15mA*0.5h = 7.5mAh of charge.

Think your battery as a water tank and current as speed of water flow.

It's that simple actually.


问:
Is the information on the following link logical?
I cannot comment on the original answer, so I had to ask like this.

I am trying to learn IMU's, accelerometers, gyros etc. for a while.

So I came across with this answer below,

https://engineering.stackexchange.com/a/22182/21263

From the accelerator sensor data, you can only calculate pitch and
  roll. The bellow document from Freescale explains with plenty of
  information what you need:

[AN3461 - Tilt Sensing Using a Three-Axis Accelerometer][1]

Based on the sayings of the document,

$$\tan \phi_{xyz} = \frac{G_{py}}{G_{pz}}$$

$$\tan \theta_{xyz} = \frac{-G_{px}}{G_{py}\sin \phi + G_{pz}\cos
> \phi} = \frac{-G_{px}}{\sqrt{G_{py}^2 + G_{pz}^2}}$$

which equates to:

```<code>roll = atan2(accelerationY, accelerationZ)

pitch = atan2(-accelerationX, sqrt(accelerationY*accelerationY + accelerationZ*accelerationZ))
</code>```

Of course, the result is this only when the rotations are occurring on
  a specific order (Rxyz):

Roll around the x-axis by angle $\phi$

Pitch around the y-axis by angle $\theta$

Yaw around z-axis by angle $\psi$

Depending on the rotations order, you get different equations. For the
  $R_{xyz}$ rotation order, you can not find the angle $\psi$ for the
  Yaw around z-axis.

[1]:
  https://cache.freescale.com/files/sensors/doc/app_note/AN3461.pdf

  [2]: https://i.stack.imgur.com/hSXgP.png

But I don't see how the order of turn motions matters in case of getting pitch & roll from accelerometer data. Without the histoy of orders, the accelerometer will give specific outputs at specific orientations.

So what I am actually asking is whether the answer I shared is logical or not. Could you please clear the situation for me?

Thanks.

答:
The Answer is logical simply because its a mathematical statement that explains how calculate Euler angles..from accel measurements...it also explains one of the caveats of using said system. Namely what was suggested in the comments

Gimbal lock

From the wiki animation one can see that the system can get stuck if rotated in a specific way causing them system to lock up and entire angles being completely gone.

Gimbal locked airplane. When the pitch (green) and yaw (magenta) gimbals become aligned, changes to roll (blue) and yaw apply the same rotation to the airplane. -wiki

This is one of the reasons Quaternions Are used as a way to measure angle as the dont suffer from the same issue as Euler angles, but are however difficult to visualize.

Quaternions find uses in both pure and applied mathematics, in particular for calculations involving three-dimensional rotations such as in three-dimensional computer graphics, computer vision, and crystallographic texture analysis.5 In practical applications, they can be used alongside other methods, such as Euler angles and rotation matrices, or as an alternative to them, depending on the application.

However, accels...are generally...useless by themselves if you want to calculate a real angle. As such one generally fuses them with gyros and sometimes magnometers or other sensors to get a more stable and real measurement.


问:
How to suck using vacuum only first sheet of paper from pack of paper?
We are designing robot that will pick and place sheets of paper. We have found an issue that it is hard to suck only first sheet of paper of paper pack. Issue occurs because paper sheet passes vacuum through it and vacuum sucks additional (2 - 3) sheets of paper.

How to resolve this? Maybe we are using too small suction cups or incorrect design?

Current pneumatic system contains following:
1) Vacuum pump that produces 120 kpa vacuum
2) SGPN 20 FPM-65 suction cups 20 mm in diameter for paper handling
3) Need to hold standard office paper A4 80 gsm (210 x 297 mm)
4) Distance between suction cups is 100 x 125 mm
5) Paper pack could contain at least 30 sheets of paper.

Current experiments results.
1) 1 suction cup easely holds 5 sheets of paper because vacuum is flowing through paper
2) if pressure is decreased to minimum its stops sucking or sucks 3 sheets

Solution which we are trying to get is shown on this video:
https://www.youtube.com/watch?v=FT7NWbXyM7Q

Similar issue that we are getting is shown on this video:
https://www.youtube.com/watch?v=LKBDzkm3moo

Maybe somebody have other ideas how to make it possible to suck only first sheet of paper without mechanical holding of it?

答:
As I suggested, there can be several issues going wrong.

One of them is static, this can definitely cause issues. Though it's hard to know if that's specifically yours or not.

The other is your design is overkill.

I assumed you're trying to pick up a sheet of A4, 80gsm paper.

Do some basic mathemagics:

$$\text{sheet}=\frac{(0.08\text{kg}) \times\left(62370\text{mm}^2\right)}{1\text{m}^2} == 0.0049896\text{kg}$$

Add some gravity,

$$\text{sheet} \times\left(9.81\text{m}/\text{s}^2\right) == 0.048948\text{N}$$

Now calculate the force each cup is providing..with giving comment infos...

$$(30\text{kPa})\times \left(100 \pi \text{mm}^2\right)== 9.42478\text{N}$$

My first suggestion is drastically reducing your vacuum...30kpa at each cup is just way too much. After doing that, one could also consider other things..reducing cup size, spreading out your cups to the corners...dealing with possible static, etc etc.


问:
Am I calculating my drone's power consumption right?
I want to make an drone with these motors: https://www.amazon.com/XtremeAmazing-2200KV-Brushless-2212-6-helicopter/dp/B01M3UBGU9

1: First of all, are they good? If not, could you suggest me other motors?

2: If they need 12V and their max power is 342W, is the max current is 28,5A?

3: If the max current is 28,5A/motor x 4 motors x 65% power = 74,1A?

4: If the motors take 74,1A and I have a 3000mAh battery, does this mean I can only use my drone for 2,43 minutes?

(3000mAh / 74 100mA = 0,04...h = 2,429min)

5: If yes, 2,43min is not a lot, how should I do to be able to use my drone for at least 15min without having to recharge the battery?

答:
Your calculations assume that the motor will be running at full power all the time.

Assuming your quadcopter's weight is less than 4 times the max motor thrust (which it needs to be to have any control), then you won't be running at full power.


答:
Without the histoy of orders, the accelerometer will give specific outputs at specific orientations.

Correct, but you might define a specific orientation ambiguously, and if you are ambiguous about it then you need to clarify.

Consider this example:

Rotate 180 degrees about your head-to-toe axis. Now you're facing the opposite direction as your original pose, then

Rotate forward 90 degrees about your heel-to-heel axis. Now you're laying on your stomach (face-down), with your head pointed opposite of the direction you were originally facing.

Now, keep the rotations the same, but change the order:

Rotate forward 90 degrees about your heel-to-heel axis. Now you're laying on your stomach (face-down), with your head pointed in the same direction as you were originally facing, then

Rotate 180 degrees about your head-to-toe axis. Now you are laying on your back (face-up), with your head pointed in the same direction as it was originally.

Now, if you had an IMU/accelerometer in your hand, it would clearly give different readings for those two results, but that's because they're two different orientations. You can't just say it's 180 about this and 90 about that, you have to specify which rotation happens first if you want someone else to be able to understand.

The way I think about it is that the order of rotation is an extra parameter in the description of the orientation. An angle about each of three axes and then an ordering of those axes. Four things to track: x, y, z, and the order in which they're applied.

If you want to guarantee you're getting a pose right without having to worry about whether you're using the right formula, you may want to consider quaternions. They also happen to have four parameters, but they're not in any kind of sensible units. You can imagine what a 45 degree rotation about an x-axis looks like, but what does a quaternion look like?

Title: Is the information on the following link logical?

Body:
I cannot comment on the original answer, so I had to ask like this.

I am trying to learn IMU's, accelerometers, gyros etc. for a while.

So I came across with this answer below,

https://engineering.stackexchange.com/a/22182/21263

From the accelerator sensor data, you can only calculate pitch and
  roll. The bellow document from Freescale explains with plenty of
  information what you need:

[AN3461 - Tilt Sensing Using a Three-Axis Accelerometer][1]

Based on the sayings of the document,

$$\tan \phi_{xyz} = \frac{G_{py}}{G_{pz}}$$

$$\tan \theta_{xyz} = \frac{-G_{px}}{G_{py}\sin \phi + G_{pz}\cos
> \phi} = \frac{-G_{px}}{\sqrt{G_{py}^2 + G_{pz}^2}}$$

which equates to:

```<code>roll = atan2(accelerationY, accelerationZ)

pitch = atan2(-accelerationX, sqrt(accelerationY*accelerationY + accelerationZ*accelerationZ))
</code>```

Of course, the result is this only when the rotations are occurring on
  a specific order (Rxyz):

Roll around the x-axis by angle $\phi$

Pitch around the y-axis by angle $\theta$

Yaw around z-axis by angle $\psi$

Depending on the rotations order, you get different equations. For the
  $R_{xyz}$ rotation order, you can not find the angle $\psi$ for the
  Yaw around z-axis.

[1]:
  https://cache.freescale.com/files/sensors/doc/app_note/AN3461.pdf

  [2]: https://i.stack.imgur.com/hSXgP.png

But I don't see how the order of turn motions matters in case of getting pitch & roll from accelerometer data. Without the histoy of orders, the accelerometer will give specific outputs at specific orientations.

So what I am actually asking is whether the answer I shared is logical or not. Could you please clear the situation for me?

Thanks.


答:
You may want to have a look at this

https://www.ecalc.ch/xcoptercalc_mobile.php

or this kind of websites.

I cannot comment on answers, but wanted to share this.

Title: Am I calculating my drone's power consumption right?

Body:
I want to make an drone with these motors: https://www.amazon.com/XtremeAmazing-2200KV-Brushless-2212-6-helicopter/dp/B01M3UBGU9

1: First of all, are they good? If not, could you suggest me other motors?

2: If they need 12V and their max power is 342W, is the max current is 28,5A?

3: If the max current is 28,5A/motor x 4 motors x 65% power = 74,1A?

4: If the motors take 74,1A and I have a 3000mAh battery, does this mean I can only use my drone for 2,43 minutes?

(3000mAh / 74 100mA = 0,04...h = 2,429min)

5: If yes, 2,43min is not a lot, how should I do to be able to use my drone for at least 15min without having to recharge the battery?


问:
Mapping on Glass Surface
Hi i am building a robot that can travel on a transparent/glass surface but i want to map the whole surface. What is the best Solution for a 2D mapping of a transparent surface?

-Is Lidar mapping good enough for this project?

-I think it would also work with a hard-coded algorithm but which sensors are required to detect the edge of a Transparent surface?

Thank You !

答: I guess you can apply plaster tape which is non residue to glass on the point of laser and do gmapping and then remove it </p>

Title: Mapping on Glass Surface


答:
The surface itself won't help you, so the question is if you have a border of objects next to the surface that your laser can see.

You also don't have to fix your sensor to the robot. You can also mount a laserscanner on the glas surface (e.g. with some suction cups), locate the robot and then send it its position. (Same idea as a ground radar at an airport)

If your robot could drive off the surface, check the approaches used by vacuum robots (which should also not drive down the stairs). Downfacing IR- or Ultrasonic sensors work nicely.

Title: Mapping on Glass Surface

Body:
Hi i am building a robot that can travel on a transparent/glass surface but i want to map the whole surface. What is the best Solution for a 2D mapping of a transparent surface?

-Is Lidar mapping good enough for this project?

-I think it would also work with a hard-coded algorithm but which sensors are required to detect the edge of a Transparent surface?

Thank You !


答: Use mpu6050 gyroscope module and optional compass module to know where is the North. Mpu6050 can be calibrated by itself, but you have to write a code that calibrates readings with mpu6050's accelerometer sensor(using atan2 function) </p>

Title: What is required to get the roll, pitch and yaw of an aerial vehicle?

Body:
TL, DR : What is the method(in terms of sensors and algorithm) to get the roll, pitch and yaw of an aircraft at any instant.

I am planning to build a hobby aircraft. I am so confused about which kind of sensors should I use and how to use them in order to get the roll, pitch and yaw angles of the aircraft.

I think I also have some problems about understanding the concept.

What are the ways/methods/agents to get the orientation of an aircraft at any instant?

In some sources there is something going on as the importance of order of the application of roll,pitch and yaw. But I cannot understand why this is related.

I have used accelerometer values by inputting them into some formulas on the internet(which everybody uses but nobody explains well) to get the roll and pitch values. However could not understand how to manipulate them in order to meet my requirements.

I also have basic understanding about what a gyroscope is.

Thanks in advance.


问:
Is there any fault in my kinematic diagram?
I was doing forward kinematic test on a 6 D.O.F anthropomorphic robotic manipulator. So I modeled my kinematic diagram by D-H notation. But I am confused. Because I have simplified some terms here. I am showing you my workings.

Sorry. I know that they are hard to read and thanks for your support.

答:
You write down the kinematics of your robot as a series of simple transforms, translations and rotations.  In MATLAB this would be:

>> s = 'Rz(q1) Tz(L1) Tx(L2) Ry(q2) Tz(L3) Ry(q3) Tz(L4) Tx(L5) Rx(q4) Tx(L6) Ry(q5) Tx(L7) Rx(q6)';
```

<p>in words: rotate about the z-axis by q1, translate in the z-direction by L1, translate in the x-direction by L2, rotate about the y-axis by q2 etc.  Note that q2, q3 and q5 have the opposite rotation sense to your diagram because my tool can't express a rotation about the negative y-axis.</p>

<p>Then this string can be factorised into DH parameters terms using the Robotics Toolbox for MATLAB:</p>

<pre class="lang-matlab prettyprint-override"><code>>> DHFactor(s)
DH(q1, L1, L2, -90).DH(q2+90, 0, -L3, 0).DH(q3, 0, -L4, 90).DH(q4, L6+L5, 0, -90).DH(q5+180, 0, 0, 90).DH(q6+90, L7, 0, -90).Rz(-90)
In DHFactor, parseString is done

ans =
DH(q1, L1, L2, -90).DH(q2+90, 0, -L3, 0).DH(q3, 0, -L4, 90).DH(q4, L6+L5, 0, -90).DH(q5+180, 0, 0, 90).DH(q6+90, L7, 0, -90).Rz(-90)
</code>```

and the result is a series of Denavit-Hartenberg terms, different to yours because of the y-axis direction.  Note also there is a constant rotation, a tool transform, at the end of the sequence.

You could create a robot model by first defining the symbolic lengths then creating a SerialLink robot object

>> L1=1.33; L2=0.4; L3=1.1; L4=0.23; L5=0.766; L6=0.344; L7=0.244;
>> r = eval( dh.command('myrobot') )
r =

myrobot:: 6 axis, RRRRRR, stdDH, fastRNE
+---+-----------+-----------+-----------+-----------+-----------+
| j |     theta |         d |         a |     alpha |    offset |
+---+-----------+-----------+-----------+-----------+-----------+
|  1|         q1|       1.33|        0.4|    -1.5708|          0|
|  2|         q2|          0|       -1.1|          0|     1.5708|
|  3|         q3|          0|      -0.23|     1.5708|          0|
|  4|         q4|       1.11|          0|    -1.5708|          0|
|  5|         q5|          0|          0|     1.5708|    3.14159|
|  6|         q6|      0.244|          0|    -1.5708|     1.5708|
+---+-----------+-----------+-----------+-----------+-----------+
tool:    t = (0, 0, 0), RPY/xyz = (-90, 0, 0) deg
```

<p>and then compute the forward kinematics for zero joint angles</p>

<pre class="lang-matlab prettyprint-override"><code>>> r.fkine([0 0 0 0 0 0])
ans =
        -1         0         0     1.266
         0         1         0         0
         0         0        -1      2.66
         0         0         0         1
</code>```

and plot it as a stick figure

>> r.plot([0 0 0 0 0 0])
```

--
Peter Corke,
developer of Robotics Toolbox for MATLAB

Body:
You write down the kinematics of your robot as a series of simple transforms, translations and rotations.  In MATLAB this would be:

>> s = 'Rz(q1) Tz(L1) Tx(L2) Ry(q2) Tz(L3) Ry(q3) Tz(L4) Tx(L5) Rx(q4) Tx(L6) Ry(q5) Tx(L7) Rx(q6)';

in words: rotate about the z-axis by q1, translate in the z-direction by L1, translate in the x-direction by L2, rotate about the y-axis by q2 etc.  Note that q2, q3 and q5 have the opposite rotation sense to your diagram because my tool can't express a rotation about the negative y-axis.

Then this string can be factorised into DH parameters terms using the Robotics Toolbox for MATLAB:

>> DHFactor(s)
DH(q1, L1, L2, -90).DH(q2+90, 0, -L3, 0).DH(q3, 0, -L4, 90).DH(q4, L6+L5, 0, -90).DH(q5+180, 0, 0, 90).DH(q6+90, L7, 0, -90).Rz(-90)
In DHFactor, parseString is done

ans =
DH(q1, L1, L2, -90).DH(q2+90, 0, -L3, 0).DH(q3, 0, -L4, 90).DH(q4, L6+L5, 0, -90).DH(q5+180, 0, 0, 90).DH(q6+90, L7, 0, -90).Rz(-90)

and the result is a series of Denavit-Hartenberg terms, different to yours because of the y-axis direction.  Note also there is a constant rotation, a tool transform, at the end of the sequence.

You could create a robot model by first defining the symbolic lengths then creating a SerialLink robot object

>> L1=1.33; L2=0.4; L3=1.1; L4=0.23; L5=0.766; L6=0.344; L7=0.244;
>> r = eval( dh.command('myrobot') )
r =

myrobot:: 6 axis, RRRRRR, stdDH, fastRNE
+---+-----------+-----------+-----------+-----------+-----------+
| j |     theta |         d |         a |     alpha |    offset |
+---+-----------+-----------+-----------+-----------+-----------+
|  1|         q1|       1.33|        0.4|    -1.5708|          0|
|  2|         q2|          0|       -1.1|          0|     1.5708|
|  3|         q3|          0|      -0.23|     1.5708|          0|
|  4|         q4|       1.11|          0|    -1.5708|          0|
|  5|         q5|          0|          0|     1.5708|    3.14159|
|  6|         q6|      0.244|          0|    -1.5708|     1.5708|
+---+-----------+-----------+-----------+-----------+-----------+
tool:    t = (0, 0, 0), RPY/xyz = (-90, 0, 0) deg

and then compute the forward kinematics for zero joint angles

>> r.fkine([0 0 0 0 0 0])
ans =
        -1         0         0     1.266
         0         1         0         0
         0         0        -1      2.66
         0         0         0         1

and plot it as a stick figure

>> r.plot([0 0 0 0 0 0])

--
Peter Corke,
developer of Robotics Toolbox for MATLAB


问:
PID control: zero out integral on error sign change?
I am learning about PID as a novice to robotics (background in software engineering).

One common problem with PID is that if the PV is below the SP for a long time, integral term will accumulate a large positive value which causes us to overshoot the SP. In particular, after crossing the SP we have to spend time in the negative error region to offset the large positive integral. This overshooting problem seems different from integral windup (which involves bounds on the output) and seems inherent in the integral contribution to PID control.

It occurred to me that this overshooting problem could be solved if we just zero out the integral when the error term changes sign. This prevents us from doing what seems like the silly thing of continuing to increase PV when it is already higher than SP just because historically PV was below SP.

I haven’t seen anyone mention this technique online, so I assume that I am missing something that makes this a bad idea, as it seems very natural to me (another way of stating the intuition is: never move PV farther away from SP).

Please tell me what I’m missing!

答:
Generally, in a well-tuned PID, most of the job is done by the P term, which is responsible for driving PV to SP. Then, D and I serve as corrections: the D term regulates the profile as of how we reach for SP, whereas the I term kicks in essentially when we are already in the neighborhood of SP to attempt to get a 0 steady-state error.

Bearing these basic considerations in mind, having a PID that struggles to reach for SP, thus charging the integral too much, is an indication to fine-tune the P part.

You shouldn't cut out the output of I when the error changes its sign, right because the I part plays its major role exactly when the error continues to oscillate in the closeness of 0, hence when you'll observe sign changes more frequently.

Moreover, when we are around the set-point, the only part of the PID delivering an effort to the plant (e.g. the torque controlling a link against gravity) is the integral term ($e \approx 0 \implies P \cdot e \approx 0$), so we cannot zero it, otherwise we will lose the possibility to control PV (e.g. the link will fall). We may want to use feed-forward in this case, but the same considerations still hold: the model-based open-loop part is not perfect, thus requiring the closed-loop part to guarantee some given control performances. As a result, the I term needs to be always engaged and operative.

In short, we can think of the I part as composed of two contributions:

the biggest portion is responsible for letting the plant stay close to the steady-state when the P part cannot be effective (given $e \approx 0$);

a smaller modulation helps compensate for the final error.

Both contributions cannot be zeroed.


问:
How can we manage stepper motor cables?
I need to actuate 3 or 4 Cnc-like Nema 23 (~1N.m torque) stepper motors, I would like some cable solution to connect easily the motor to the motor driver.

I have not yet bought anything, I have searched various robotic stores and ebay, but did not yet found a triple (motor, cables, driver) which would be "plug and play".

As stepper motors usually have 4 to 6 cables, and there are multiple motors, manual soldering everything would be too time consuming, error prone and messy.

Is there a standard way to deal with cables for stepper motors ?

答:
Stepper motors usually have 4 to 6 wires, often bundled up into one cable.

There might be some pro industrial solution out there that's 100% plug and play, but I would consider myself lucky if I found connectorized motors and drivers for which I could make up cables.

Making up cables is not rocket science.  Find the matching connectors for the motors and drivers (this is much less trivial than you would either think or like), make up your cables (by soldering, most likely -- someone has to do it), and have fun.

Be sure to make the cables long enough.  I'm always too stingy the first time around and have everything stretched way too much.

Title: How can we manage stepper motor cables?


问:
PID tuning - can't get stiffness without going unstable
I'm trying to tune a low-friction actuator. This actuator is controlled via a 24peak amp drive.

I'm running into the problem where the system goes unstable prior to reaching good stiffness. I start off with the PID controller having P = 0, I = 0, D = 0 gains. Because this actuator is low friction, I provide a D gain of 1 to start such that energy is removed the system. I then start ramping up the proportional gain in hopes obtaining stiff control.

However, I keep running into the issue where the system seems to go unstable prior to reaching desired stiffness regardless of how much I increase D.

Essentially I need my P gain to grow such that the actuator resists external forces, yet this just causes the system to go unstable.

Does anyone have any tips as to what I'm doing wrong? I'm fairly confident my feedback signal is good (not too noisy) and I know that the drive is beefy enough to generate enough force to resist any attempts of pushing on the actuator.

答:
Well you have two methods to go with really. As I don't know you're system at all, it's mostly difficult to tell you what to start with.

Model it and Auto tune, then fine adjust by hand (how I would generally do things)

Your system is a pretty basic mechanical system with damper...so you can use an equation such as: $$x''(t)+2 D \omega _0 x'(t)+\omega _0^2 x(t)=0$$ to model and run that through PIDTune in mathematica or the equivalent in Matlab.

Ziegler-Nichols Method.

This seems to be the method most people use, (and myself also successfully for simple things, where modeling wasn't worth the effort).

The Ziegler–Nichols tuning method is a heuristic method of tuning a PID controller. It was developed by John G. Ziegler and Nathaniel B. Nichols. It is performed by setting the I (integral) and D (derivative) gains to zero. The "P" (proportional) gain, ${\displaystyle K_{p}} K_{p} $is then increased (from zero) until it reaches the ultimate gain ${\displaystyle K_{u}} K_{u}$, at which the output of the control loop has stable and consistent oscillations. ${\displaystyle K_{u}} K_{u}$ and the oscillation period ${\displaystyle T_{u}} T_{u}$ are used to set the P, I, and D gains depending on the type of controller used.

Follow the chart on wiki, then fine tune afterwards to get the desired result.

You're basically doing the same kind of method, however you're starting with the wrong term first :).