答: The forward kinematic will become useful e.g. if you want to compute the working envelope of your robot. </p>

Title: Is it correct to think of forward kinematics as merely a 'check' for the inverse kinematics?

Body: When the only inputs to your robot are the next x,y,z coordinates of the next point on and on, I can simply just calculate IK to find the angles and make my actuators move to these angles. Whats the point in calculating forward kinematics in this case? does it merely act as a check for your inverse kinematics integrity? (this shouldn't be accurate because I don't think an analytical solution of the IK will have errors). I see no purpose in calculating the forwards kinematics in this application.</p>


问:
iRobot Create 2 Wake over Serial on Rpi
So this thread is similiar to this one:
IRobot Create 2: Powering Up after Sleep

All except I am trying to do this on an RPi.

I have followed these intstruction:
https://www.irobotweb.com/-/media/MainSite/PDFs/About/STEM/Create/RaspberryPi_Tutorial.pdf

I have put together the little RPi top that uses the buffering chip. Everything is working great.

However I cannot get it to wake over serial!

iRobot even has examples of this, I can't get it to work.

From here:
https://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/RoboCam-WebInterface.pdf
They show:

```<code>GPIO.setmode(GPIO.BCM) # as opposed to GPIO.BOARD # Uses 'import RPi.GPIO as GPIO'
GPIO.setup(17, GPIO.OUT) # pin 17 connects to Create2 BRC pin
GPIO.output(17, GPIO.HIGH)
time.sleep(1)
GPIO.output(17, GPIO.LOW) # pulse BRC low to wake up irobot and listen at default baud
time.sleep(1)
GPIO.output(17, GPIO.HIGH)
</code>```

They also have an example python script with this code:

```<code>
GPIO.setmode(GPIO.BCM)   # BCM for GPIO numbering
GPIO.setup(17, GPIO.OUT) # Make pin 17 (which is hooked up to the BRC pin) an output

while True:
    # Pulse the BRC pin at a low duty cycle to keep Roomba awake.
    GPIO.output(17, False)
    sleep(1)
    GPIO.output(17, True)
    sleep(59)
</code>```

Neither work.

Now this code runs perfectly fine without issue on the RPi. I pip installed all the right libraries. I am using Python3.7, every other function over serial is working fine.

But this wake command does not work. It also does not prevent it from going back to sleep!

I followed the instruction for making the 3.3v to Logic circuit exactly from here:
https://www.irobot.com/~/media/MainSite/PDFs/About/STEM/Create/Create_2_Serial_to_33V_Logic.pdf
Again I made the one at the bottom with the '5V-tolerant 3.3V buffer' which does explicitly show the green pin being soldered to IO17. Which is where I soldered it.

The only different is I put the pi hat on a RPi 3 rather than an RPi, I assume the GPIO pins still align the same?

Can anyone think of any more ideas? I am running out of them myself.

答:
Have you tried this tutorial which is for RPi-3

https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/

Also can you share the picture of your RPi-3 and point out your soldered "green pin"?

ContentLicense: CC BY-SA 4.0

Title: iRobot Create 2 Wake over Serial on Rpi


问:
Is it correct to think of forward kinematics as merely a 'check' for the inverse kinematics?
When the only inputs to your robot are the next x,y,z coordinates of the next point on and on, I can simply just calculate IK to find the angles and make my actuators move to these angles. Whats the point in calculating forward kinematics in this case? does it merely act as a check for your inverse kinematics integrity? (this shouldn't be accurate because I don't think an analytical solution of the IK will have errors). I see no purpose in calculating the forwards kinematics in this application.</p>

答: Forward kinematic has many uses, but for your case YES it can be used “merely” as a check.  However the check is probably redundant since most IK solvers will give you some kind of residual which indicates the quality of the solution.</p>


问:
Fusing absolute robot localization from markers
I have a system which is composed of a rig of 8 cameras which are used for detecting markers in the environment and which outputs 8 estimates of the absolute robot's position and orientation.

Now, I need to fuse these estimations. I don't know if the best way is using a Kalman Filter or something like that.

On the other hand, I do not know if it would be convenient to track the position of each camera through a particle filter before fusing.

答:
If you just have 8 redundant transformations, I think taking an average on se3 is the simplest way. Or you can fuse them on se3 if you can estimate the uncertainty of each pose estimation. You can define the uncertainty e.g, by the distance of markers from the camera.

EKF is the best if you have complementary sensors or good estimation of uncertainty. But it seems this is not your case.

I don't see any meaning of using PF in your case.


问:
How can I receive Genicam packets from a device in a docker container?
I installed a command line tool which accepts genicam packets from a device as input into a docker image. If I use the option --network host in the run command for the container the packets are received. If I use -p 3956:3956/udp to expose the Genicam default port 3956 (e.g. stated here: RoboRealm - GenICam - Instructions) in the run command of the container I don't get packets. What did I wrong? Could the port be different from the default? How could I get the changed port then?

答:
Because Genicam will actually use another 2 random ports to establish the connection. You are supposed to be able to force those to a specific value but that's not well documented.
The way I tried to solve it was by creating a macvlan network.
https://docs.docker.com/network/macvlan/

If you are networking with unfamiliar protocols Wireshark is always a good place to start. It lets you see every single packet that passes in/out/between your computer.


答:
If you think of classical Jacobian-based methods for IK (still representing the majority), then you ought to consider that they make use of forward-kinematics (FK) maps internally in order to compute the error in the operational space as well as the Jacobian itself, which is actually a differential FK law.

In particular, the IK method based on Jacobian pseudo-inverse generates iteratively joint velocities profiles $\dot{q}$ that drive the system toward the target. In formula:

$$
\begin{cases} e=x_d-f\left(q\right) \\
\dot{q}=J^{-1}\left(q\right) \cdot \left(\dot{x}_d+Ke\right) \end{cases},
$$

where $x=f\left(q\right)$ and $J=\partial f/\partial q$ are the standard and differential forward-kinematics maps, respectively.

This reasoning and/or considerations apply also to other IK methods.


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

答:
You can also run roslaunch files from directly within CLION as mentioned here:
http://wiki.ros.org/IDEs#CLion
however when I start my launch files in the IDE, I get the following error:
roslaunch: error: no such option: --master-logger-level

Apparently the plugin starts the launch file via:

```<code>/opt/ros/kinetic/bin/roslaunch --master-logger-level=info FOLDERNAME/FILENAME
</code>```

However I did not specify this parameter myself. Does anyone know why it is introduced?

ContentLicense: CC BY-SA 3.0

Title: How to setup CLion for ROS?

Body:
You can also run roslaunch files from directly within CLION as mentioned here:
http://wiki.ros.org/IDEs#CLion
however when I start my launch files in the IDE, I get the following error:
roslaunch: error: no such option: --master-logger-level

Apparently the plugin starts the launch file via:

/opt/ros/kinetic/bin/roslaunch --master-logger-level=info FOLDERNAME/FILENAME

However I did not specify this parameter myself. Does anyone know why it is introduced?


问:
need help to get inverse kinematics
I have a 3 degree of freedom arm robot and by using D-H representation method get the forward kinematics but I can't derive the inverse kinematics can someone help me please ? </p>

答:
The D-H-representation is a good starting point for an inverse kinematics solver. Usually, DH means, that the joints of the kinematic chain are stored in a matrix. This can be converted into an array in computer code. As a result, the forward model can be built. A forward model takes as input the angle of the joints and prints out the xy-coordinates for each link. The xy-coordinates can be copied to the graphics engine which will display the kinematic chain to the screen.

So the open question is how to use the forward model in the inverse direction? That means, the solver gets the x/y coordinates and should calculate the angles for each joint. At first let me explain which technique doesn't work. Calculating the values with algebra equations isn't a good choice. It might work for simpler models, but if the kinematic chain gets more complicated and has some underactuation in it, the equation will fail to return the correct values. The better way is a sampling approach. The existing forward model is used by a sampling based solver to determine the angles with trial and error. A possible sampling technique is Monte-carlo-tree-search.

Title: need help to get inverse kinematics


问:
How to choose the right propeller/motor combination for a quadcopter?
There are many sites which explain briefly this problem and even propose combinations. I however would like a much more detailed explanation. What is going to give my quad the most agility? Do I need bigger motors/props in a heavy quad to achieve the same level of agility than in a lighter quad?

EDIT:
Here is what I have understood on the subject:

A quadcopter doesn't need high revving motors as there are 4 propellers providing thrust and high revving motors require more battery power.

Larger propellers give more thrust per revolution from the motor.

The question is focused more on the general characteristics of various combinations but some specific questions do spring to mind:

For a given combination what would be the effect of upgrading propeller size in comparison to installing higher revving motors?

What changes would need to be made to lift a heavier quad?

How can I achieve more agility in my quad?

答:
Just to add to user65's good answer.

Rapid rotation about a horizontal axis will come from a large difference between the thrust produced by opposite motors. The larger the difference, the greater the rotation rate. So motors that can produce much more thrust than is needed to simply hold the 'copter in the air will help to achieve fast rotations.

Rapid rotation about the vertical axis comes from a large difference in torque between one opposite pair and the other. So now you need not only plenty of spare thrust, but also a lot of propeller drag.

Sadly, both of these requirements (spare thrust, and prop drag) imply lower efficiency.


问:
Singular configurations of a 7-dof robotic arm
I want to check for singular configurations of a 7-dof robotic arm (RRRRRRR). I have found the geometric Jacobian and it is a 6x7 matrix. If my theoretical background is solid when the Jacobian loses a rank (in this case <6) the robot is at a singularity.

So one should check when the determinant of the Jacobian equals zero.In this case since it is not a square matrix i multiplied the Jacobian by its transpose and calculated that determinant in matlab.

My problem is that the elements of the matrix,well those that are not equal to zero or 1, are terrible to look at.I mean, you can see a lot of cosine and sine terms which make the computation really complicated.

Is there a way to make things easier?

I appreciate all the help,
Victor

答:
Search "Reciprocity-Based Resolution".  You should find a lot of publications address the issue you have.
There is more sophisticated approach that is based on the gradient of a singular value.  If interested, I might find you a recent publication address this issue as well.
Thanks </p>


问:
Motor encoders randomly start counting backward, then go back to normal
I am making an Arduino-controlled differential drive robot, and I am having the following problems:

the encoders built into the motors are being used for measuring the rotary displacement, and while running they will randomly start counting the opposite direction of their rotation for a second then start counting the right direction again

What can I do in terms of differential and integral control that will lead to a consistent turn every time?

MY CODE:

```<code>'#'include <DueTimer.h>

'#'define MOT1 5 //right motor speed pin (PWM)

'#'define MOT2 6 //left motor speed pin (PWM)

'#'define DIR1 4 //right motor direction pin

'#'define DIR2 7 //left motor direction pin

'#'define EN1A 10 //right motor encoder phase A pin

'#'define EN1B 11 //right motor encoder phase B pin

'#'define EN2A 8 //left motor encoder phase A pin

'#'define EN2B 9 //left motor encoder phase B pin

volatile long right_enc = 0;

volatile long left_enc = 0;

volatile long left_enc1 = 0;

volatile long left_enc_diff = 0;

void setup() {

  // put your setup code here, to run once:
 //set pin mode, attach external interrupts to encoders with ISR vector, set initial direction and speed of motors.

  pinMode(MOT1, OUTPUT); // Set ENC1 as output

  pinMode(DIR1, OUTPUT); // Set DIR1 as output

  pinMode(MOT2, OUTPUT); // Set ENC2 as output

  pinMode(DIR2, OUTPUT); // Set DIR2 as output

  attachInterrupt(digitalPinToInterrupt(EN1A), countRight, CHANGE);

  attachInterrupt(digitalPinToInterrupt(EN2A), countLeft, CHANGE);

  digitalWrite(DIR1, HIGH);

  digitalWrite(DIR2, LOW);

  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:

left_enc = 0;

//left_enc1 = left_enc;

while (-left_enc < 1023){

analogWrite(MOT2, 100);

analogWrite(MOT1, 50);

Serial.println("left_enc: ");

Serial.print(-right_enc);

Serial.println(" ");

Serial.print(" ");

}

analogWrite(MOT2, 0);

analogWrite(MOT1, 0);

for (;;) {
   // statement block
}

}

void countRight(){

  if (digitalRead(EN1A)){

    if (digitalRead(EN1B)){right_enc++;}

    else if (!digitalRead(EN1B)) {right_enc--;}

  }
}

void countLeft(){

  if (digitalRead(EN2A)){

    if (digitalRead(EN2B)){left_enc++;}

    else if (!digitalRead(EN2B)) {left_enc--;}

  }
}
</code>```

=======

答:
This is just a guess, but I think that your measuring cycle is too slow (not enough measurements per time, therefore the phases get mixed up).
Does this occur, when the motors turn slower?</p>


答:
For a three DOF arm the IK is pretty simple.
You can find a closed form with a bunch of sin / cosine operations to derive the angles for a given TCP pose directly.

If you are too lazy to do the math, have a look at OpenRAVE's IK-Fast. It is an open source lib that can generate IK solvers for almost all kinematic types.

Title: need help to get inverse kinematics

Body: I have a 3 degree of freedom arm robot and by using D-H representation method get the forward kinematics but I can't derive the inverse kinematics can someone help me please ? </p>


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

答: Did you try giving three pulses Low High Low? I read somewhere that it depends on pulse train instead of single pulse.</p>


答:
The firmware update described in this answer fixed my problems in this area:

There is a bug in the implementation of sleep/wakeup on Create 2 which was fixed in release-3.8.2 for robots with an older processor, or release-stm32-3.7.7 for robots with a newer processor.

Title: iRobot 600 series OI wake from sleep via BRC

Body:
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">```
```


问:
Equal proportional and derivative gains of PID
Is it common to take equal values for the proportional and derivative gains of a PID controller? if so what does it mean?</p>

答:
Typically, whenever someone asks about PID gains, my immediate reaction is to refer them to the Ziegler-Nichols tuning method as it's a pretty standard way to get good response from a PID controller.

As you can see from the table there, no, the proportional and derivative gains are not typically equal.

I don't know what you're asking when you say "what does it mean" for a gain to be a particular value, but remember that the gains act on reference error. If your reference value is a speed then the derivative gain acts on the derivative of the speed error, which means it acts on the acceleration difference between the reference and feedback signals.

If you're looking for more meaning for the gain values, I would refer you to the original paper (from the references section of the Wiki page) but, as you can see from the gain values, the integral and derivative gains depend on the period of the control oscillations, which means they depend on the properties of the plant. I don't believe there's a general statement you can make about the absolute values of any gain.


问:
Why is the endeffector of a delta-robot on the slant?
A delta-robot is a nice design for a robot, because it allows to separate the motor from the moving parts. As a result, large and heavy motors with 800 Watt can be used and at the same time the construction remains lightweight and the robot can move very fast. Instead of building a delta robot in real hardware, a first prototype was created in Box2d which is a physics engine to simulate diverse robotics types in realtime.

The joints in the middle can move freely, only the links ontop have a builtin servo motor. But something is wrong with the parallel kinematics. If the endeffector is moved away from the middle to the left, the angle is no longer 90 degree, but the endeffector gets a little bit diagonal. This makes it hard to grasp an object. Has this effect a name, and can it be fixed with improvements in the parallel kinematics?

答:
The name of the phenomenon is coupled motion. The rotation motion of the moving platform (the middle linkage) in this case is coupled to the translational motion of the platform due to the (geometric) contraints in the mechanism. If you change the translation the orientation will also change.

In other words the translation motion of the platoform is not an independent, pure translation motion, it is coupled to the rotation. Parallel kinematics are not the only ones affected by this, a simple 2 degrees of robot behaves the same way, suffers from the same problem.

As for ways around this, you can add a 3rd degree of freedom and make an actual delta robot (your model is commonly called a 5 bar linkage, it is not a delta robot). More about the delta robot here. One interesting trait of the delta robot is pure translations, decoupled from rotation.

Another popular way around it is adding mechanismsm with additional geometrical constraints to make sure the orientation is correct, like a paletizing robot, e.g. this. But this is more for serial kinematic chains.


答:
What kind of motors are you using? Because the behaviour you describe makes me think of a brushless motor, due to the fact that you have a rotating magnetic field having the rotor spin. But in the beginning it will not necessary start on the right direction (during a very very little lapse of time).

Your program's frequency can also be related to this behaviour. So, have you tried with only one encoder (for this you need to comment all the code calling the interrupts you are not using)? If it occurs only when you have 2 encoders then your micro-controller may not be fast enough (or your motor is to fast).

Have you tried this library ? Usually this code is giving good results!

Title: Motor encoders randomly start counting backward, then go back to normal

Body:
I am making an Arduino-controlled differential drive robot, and I am having the following problems:

the encoders built into the motors are being used for measuring the rotary displacement, and while running they will randomly start counting the opposite direction of their rotation for a second then start counting the right direction again

What can I do in terms of differential and integral control that will lead to a consistent turn every time?

MY CODE:

```<code>'#'include <DueTimer.h>

'#'define MOT1 5 //right motor speed pin (PWM)

'#'define MOT2 6 //left motor speed pin (PWM)

'#'define DIR1 4 //right motor direction pin

'#'define DIR2 7 //left motor direction pin

'#'define EN1A 10 //right motor encoder phase A pin

'#'define EN1B 11 //right motor encoder phase B pin

'#'define EN2A 8 //left motor encoder phase A pin

'#'define EN2B 9 //left motor encoder phase B pin

volatile long right_enc = 0;

volatile long left_enc = 0;

volatile long left_enc1 = 0;

volatile long left_enc_diff = 0;

void setup() {

  // put your setup code here, to run once:
 //set pin mode, attach external interrupts to encoders with ISR vector, set initial direction and speed of motors.

  pinMode(MOT1, OUTPUT); // Set ENC1 as output

  pinMode(DIR1, OUTPUT); // Set DIR1 as output

  pinMode(MOT2, OUTPUT); // Set ENC2 as output

  pinMode(DIR2, OUTPUT); // Set DIR2 as output

  attachInterrupt(digitalPinToInterrupt(EN1A), countRight, CHANGE);

  attachInterrupt(digitalPinToInterrupt(EN2A), countLeft, CHANGE);

  digitalWrite(DIR1, HIGH);

  digitalWrite(DIR2, LOW);

  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:

left_enc = 0;

//left_enc1 = left_enc;

while (-left_enc < 1023){

analogWrite(MOT2, 100);

analogWrite(MOT1, 50);

Serial.println("left_enc: ");

Serial.print(-right_enc);

Serial.println(" ");

Serial.print(" ");

}

analogWrite(MOT2, 0);

analogWrite(MOT1, 0);

for (;;) {
   // statement block
}

}

void countRight(){

  if (digitalRead(EN1A)){

    if (digitalRead(EN1B)){right_enc++;}

    else if (!digitalRead(EN1B)) {right_enc--;}

  }
}

void countLeft(){

  if (digitalRead(EN2A)){

    if (digitalRead(EN2B)){left_enc++;}

    else if (!digitalRead(EN2B)) {left_enc--;}

  }
}
</code>```

=======


答:
If you have the next target position you can convert that in joint space and make a PTP or point to point type motion and there is no need for forward kinematics.

The forward kinematics is crucial when geometrical contraints to the path are considered, e.g. a circular motion (CIRC), linear motion (LIN) or spline motion (SPLINE). Usually these are set also with a desired speed. In this case converting the current joint space coordinates to cartesian space and computing the trajectory (incl. velocity and acceleration) from the current end effector coordinates to the target in cartesian space will assure that the set parameters (path shape and target velocity) will be (more) precisely executed.

Also in the case where robos are programmed or operated (monitored) it is useful to know what the current cartesian coordinates of the end-effector is. This is done by calculating the forward kinematics. For determinig the current velocity of the robot differential forward kinematics are used.


问:
quadcopter parameters calculations for simulink model
I want to make a mathematical model of quadcopter in simulink. I have studied quadcopter, although I am new and not build any flying robot before. I studied so far that I have to use four brushless DC motors PID speed control, two motors will rotate clock wise and two anti clock wise. I want to make very simple mathematical model.

The input of the model will be the xyz locations on 3d space, copter will always fly from 0,0,0 path.

So far I decided that I will increment the coordinates step by step for example if I want the next location of the to be x=10, y=10, z=10; then I will increment in these locations and input to a flight control block.

My question is how can I decide the speed of motors according to x,y,z next location and how to convert that speed into Yaw Pitch and Roll and finnally convert the Yaw, Pitch and Roll into X,Y,Z coordinates.

I need the convertion formulas that can be easily implemented into simulink.
Please provide help thanks

答:
A linearized quadrotor model can be found in the results section of my paper Kinodynamic RRT*: Asymptotically Optimal Motion Planning
for Robots with Linear Dynamics. This is a state space model that includes the 3D position, 3D velocity, 2D angular position, and 2D angular velocity. The angular position and angular velocity are 2D because it restricts the quadrotor from yawing. If you want to model yaw then you need to add a couple of equations to describe how the yaw at its associated angular velocity changes.</p>


问:
What are robot task planners?
What are robot task planners? And how are they implemented? I don't think they are just FSM or behavior tree right? What are the popular and robust task planning algorithms? And what are the state of the art algorithm?

I'm guessing task planning does priority assessment then choose to do certain task or not, for example, delivery robot that choose the optimal orders to drop-off.

答:
Task and motion planning describes different levels of abstraction in a domain. Motion planning is about lowlevel actions for example move the car forward for 1 meter, while task planning is about high level actions for example to overtake another car. Task planning is usually treated under the umbrella term PDDL which is a dedicated planning language for formalizing abstract tasks. Or to be more specific: PDDL creates a simulation in which actions can be executed. The reason why task and motion planning are analyzed separate is to reduce the state space. So called hierarchical planners are providing a much better sampling efficiency than a normal motion planner.

For example, a car should overtake another car. On the first look this can be planned with moving the car forward by a half meter. And the complete maneuver consists of many repetitions of this action. The result will be a large state space which produces a huge load for the planner. The better idea is to see the sequence as a separate high-level task and not try to use a low level planner for solving it.

All organizations which are focused on plan-based robotic control have experience with PDDL. Either with the original specification or with it's derivative like OWLS-Xplan, OPL and Golog.

Title: What are robot task planners?


问:
Likelihood Field Matching
I have LIDAR data of an environment in my hand and I want to apply likelihood field matching to this data. I found a source. But I don't understand what the variables of the algorithm mean and how it works. Can you help with that?

Note : We're trying to apply the particle filter to a mobile robot. And we will use this algorithm for this.

the algorithm that I found and suggested by my teacher :

And the desired result :

Thank you for help.

答:
Basically, you are comparing the measurements of your scan with your previously computed map.

You compare all your scans (line 2) for a certain time step that are not range_max (line 3).

You compute the position of your scan based on the position of the robot and the measurements of the scan (lines 4 and 5).

Then, you get the closest occupied cell to your calculated scan position, and compute the distance between the computed scan position and that closest cell (line 6).

Then you get the importance weight based on a normal distribution for that calculated distance (line 7).

Title: Likelihood Field Matching


问:
Scan Matching finds right rotation but false translation
I'm currently developing a SLAM software on a robot, and I tried the Scan Matching algorithm to solve the odometry problem.

I read this article :
Metric-Based Iterative Closest Point Scan Matching
for Sensor Displacement Estimation

I found it really well explained, and I strictly followed the formulas given in the article to implement the algorithm.

You can see my implementation in python there :
ScanMatching.py

The problem I have is that, during my tests, the right rotation was found, but the translation was totally false. The values of translation are extremely high.

Do you have guys any idea of what can be the problem in my code ?

Otherwise, should I post my question on StackOverflow or on the Mathematics Stack Exchange ?

The ICP part should be correct, as I tested it many times, but the Least Square Minimization doesn't seem to give good results.

The parts that might be problematic are the function getAXX() to getBX() (starting at line 91).

As you noticed, I used many decimal.Decimal values, cause sometimes the max float was not big enough to contain some values.

答:
I have not checked your code, but I have faced the same problem and this is what I found (again, I don't know if it could be the same problem as you).

One key point for ICP is where your 'zero' is defined. The result of the translation of the ICP highly depends on this, but the rotation does not. See the image below:

As you can see, the rotation in both cases is the same, but the translation changes completely depending on that 'zero'.

I would suggest you to check if your point coulds have global coordinates or relative coordinates. Normally, ICP will work fine if you use relative coordinates of the scans to your robot, making the robot pose as the 'zero'.

Hope this helps.


问:
How do I create a broken line follower? [RobotC] [Legomindstorm] [Ev3]
Trying to create an algorithm/code in order to get my robot to follow a track which it currently can do, using a color sensor and following the inside edge. So I'm wondering how to transition to the track with broken parts the track has gaps with a max length of 20cm and only on straight parts. I also have a distance sensor available? any ideas</p>

答:
Currently your robot is only controlled by external factors. It always responds to external stimuli, it does not have any other operating mode.

In order to cope with missing line segments, you could add operating modes (or states) to the logic. You could detect the point where the line disappears and transition to an operating mode which goes straight on. In order to do this, it must store what does straight on  mean (direction vector) and it probably should get a limit how far should it go straight on without a line present. Afterwards it could transition to a stopped sate (or operation mode).

If the line reapears in the sensors, it should switch back to line following state.

Although this problem only requires two states, as a learning exercise, you might want top look at state machine based programming approaches.


问:
Robotic hand simulation in MatLab?
We are doing graduation project and require simulation of the robotic hand to be submitted. And we want to control various parameter in for movement for fingers of robotic hand. We tried it in other software but it was not feasible. After searching on YouTube and Internet we came to know that, simulations can be done on Matlab also.

We somehow imported our CAD assembly inside Matlab. But the problem is that, the software is quite complex. After watching many video we are not able to figure it out what is going on & how to start.

When I imported ONE of the finger of the robotic hand's .xml file and then I ran it it was just rotating. And we are just like wow! it is performing a circus.

So I want to know how to represent tension of the finger created by the string and servo motor to control the motion of finger and its angle simply. Can you provide any idea? Or maybe any tutorial providing such kind of information. I have gone through some official Matlab YouTube video but that didn't help.

答:
The CAD file which describes the robotic hand is good starting point but for controlling the movement something else is needed. It's called a forward model or system identification which can be realized in Matlab too. It will output the position of the fingers if a certain action is executed in the model. For example, if the model gets the command “finger up”, the simulated hand will produce a movement. The forward model answers the question what the new position of the finger is.

Realizing such a prediction engine can be done in the easy case with a geometrical description. This looks similar to what is used by inverse kinematics solvers. More advanced forward models includes the kinodynamic properties and the grasping of objects. After a forward model is available a planner can bring the robotic hand into a goal position. This is called inverse model. The idea is to define a goal, for example that the finger should be at position (x,y,z) and the model is asked which action will realize this goal. Usually a dedicated solver is used which samples the forward model until the constraints are fulfilled.

Title: Robotic hand simulation in MatLab?


答:
I'm afraid I don't have the time at the moment to write a more detailed answer, but if you're trying to alter the behavior of the joint then you can:

Double click the joint,

Go to the axis you're interested in altering (Z Revolute/Prismatic Primitive for Revolute/Prismatic Joints),

Expand the Actuation box,

Change "Torque" (or "Force" for prismatic joints) from "None" to "Provided by Input."

If you previously had "Motion" as "Provided by Input" then you'll need to change it to "Automatically Computed." You can either tell it what the force is or what the (I believe) position is, but not both.

There's no stock servo block, so if you want more detailed actuator simulation then you'll need to model it yourself.

I will say that, frustratingly, only the z-axis can be used for motion. I've already complained to Mathworks about this, but it means you wind up needing to use frame transforms to rotate your joints around until the joint's z-axis coincides with the axis of motion for your system. I think it's an artifact of their use of DH parameters.

Finally, if you're having trouble with unexpected motion, I would double check your CAD model parameters. A lot of modeling software will use generic part properties if you don't assign the materials, which means a metal part might wind up with the density (and mass, moment of inertia) of a plastic part or vice-versa. You may also have a problem if your CAD model used a lazy approximation and has solid parts where they should actually be hollow/shell parts.

Title: Robotic hand simulation in MatLab?

Body:
We are doing graduation project and require simulation of the robotic hand to be submitted. And we want to control various parameter in for movement for fingers of robotic hand. We tried it in other software but it was not feasible. After searching on YouTube and Internet we came to know that, simulations can be done on Matlab also.

We somehow imported our CAD assembly inside Matlab. But the problem is that, the software is quite complex. After watching many video we are not able to figure it out what is going on & how to start.

When I imported ONE of the finger of the robotic hand's .xml file and then I ran it it was just rotating. And we are just like wow! it is performing a circus.

So I want to know how to represent tension of the finger created by the string and servo motor to control the motion of finger and its angle simply. Can you provide any idea? Or maybe any tutorial providing such kind of information. I have gone through some official Matlab YouTube video but that didn't help.


问:
Roller Screw drive - axial movement instead of friction
I need an equation or a some hints to solve the following problem.

Imagine a roller screw drive. I apply a torque of T to translative move my load mass M. I assume my screw has an efficiency of 90%. Now an additional axial force affects my mass in the opposite moving direction. Is this force completely transformed into torque (of course considering the efficiency) or is it possible, that my whole roller screw is moving, because it is not fixed? I just found papers/books/articles for movable slides/loads, but fixed shafts. But in my case motor and shaft are part of an osciallation system.

I'm not a mechanical engineer, so I'm sorry if the answer may is trivial.

I made a little sketch now

The process force Fp is pushing my mass, most of the force is transformed into a load torque Tp which acts against my drive torque TD. Some of the energy is lost by friction. The question is, if there is also a partial force Tp? which is affecting the bearing and therefore exciting my chassis.

答:
OK.  as drawn, ignoring mass and accelerations, the force $F_p$ will appear as a torque on your ball screw.

However, the total force on the ball screw, and hence the torque, depends on the mass of the thing you're moving with the ball screw interacting with gravity (if it's being moved in anything other than a horizontal plane), and on whether or not the whole assembly -- frame and load -- is moving at anything other than a steady velocity.

On a bad day, your mass-spring-damper system will have an overall resonance that interacts with your control system, making oscillations happen where you never expected them.


问:
Walking on the spot before moving
my question revolves around 4 limbs robot ( but maybe even 2 limbs ) walking.
As i see in many videos robots start "walking on the spot" in order to balance before actually moving somewhere. Why is that ? Has someone managed to start walking immediately skipping the "walking on the spot" phase?

Thanks in advance for the time spent answering this!

EDIT: Just to clarify, this is the behaviour that i'm talking about

https://www.youtube.com/watch?v=kgaO45SyaO4

at 11 sec

答:
The behavior of going on the spot is the consequence of a hierarchical control system. The motion controller on the lower level can balance the robot, while the controller on the task level is able to execute a longer trajectory. The programming of such hierarchical control architecture is done independent from each other. The biped robot is in reality a combination of a car-like motion model which can drive forward and backward plus a walking controller which is able to maintain the center of gravity.

It is surprisingly easy to overcome this phenomena. All what the programmer has to do is to modify the animation script. If the high-level planner has a goal from the beginning at timecode 0, the robot will not wait but it will move as fast as possible into the direction. The robots behavior at a certain point in time are determined by the script, very similar to animating a virtual human.

An animation script is a notation for writing down a time-schedule. It defines, at which point in time the robot is doing which action. It can be visualized as a gantt-chart in which behaviors can overlapping at the same time.

Title: Walking on the spot before moving


问:
SLAM Scan Matching. Scan vs previous-scan OR scan vs previous-map?
When using Scan Matching ICP for FastSLAM, which is the proper way to use it?

Between the current scan and the previous one, or between the current scan and the stored map?

Can both be used? If so, what are the point of using each one?

Thanks.

答:
From my experience what I saw is the following:

-> Using the ICP against the previous reading is generally a way to simply estimate robot motion. This way you can't match against an old reading to close a loop closure, for instance.

-> Matching against the map maybe slower(if the map is not stored correctly), but offers the possibility to verify if you passed by someplace already. This offers quite stronger meanings to update the map and the robot pose w.r.t. the inertial frame. Also, matching against the map may reduce robot's pose uncertainty, specially in FastSLAM2.0. Remember PFs are multimodal by nature, and is always good to have only one mode.


问:
iRobot Create 2 Wake over Serial on Rpi
So this thread is similiar to this one:
IRobot Create 2: Powering Up after Sleep

All except I am trying to do this on an RPi.

I have followed these intstruction:
https://www.irobotweb.com/-/media/MainSite/PDFs/About/STEM/Create/RaspberryPi_Tutorial.pdf

I have put together the little RPi top that uses the buffering chip. Everything is working great.

However I cannot get it to wake over serial!

iRobot even has examples of this, I can't get it to work.

From here:
https://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/RoboCam-WebInterface.pdf
They show:

```<code>GPIO.setmode(GPIO.BCM) # as opposed to GPIO.BOARD # Uses 'import RPi.GPIO as GPIO'
GPIO.setup(17, GPIO.OUT) # pin 17 connects to Create2 BRC pin
GPIO.output(17, GPIO.HIGH)
time.sleep(1)
GPIO.output(17, GPIO.LOW) # pulse BRC low to wake up irobot and listen at default baud
time.sleep(1)
GPIO.output(17, GPIO.HIGH)
</code>```

They also have an example python script with this code:

```<code>
GPIO.setmode(GPIO.BCM)   # BCM for GPIO numbering
GPIO.setup(17, GPIO.OUT) # Make pin 17 (which is hooked up to the BRC pin) an output

while True:
    # Pulse the BRC pin at a low duty cycle to keep Roomba awake.
    GPIO.output(17, False)
    sleep(1)
    GPIO.output(17, True)
    sleep(59)
</code>```

Neither work.

Now this code runs perfectly fine without issue on the RPi. I pip installed all the right libraries. I am using Python3.7, every other function over serial is working fine.

But this wake command does not work. It also does not prevent it from going back to sleep!

I followed the instruction for making the 3.3v to Logic circuit exactly from here:
https://www.irobot.com/~/media/MainSite/PDFs/About/STEM/Create/Create_2_Serial_to_33V_Logic.pdf
Again I made the one at the bottom with the '5V-tolerant 3.3V buffer' which does explicitly show the green pin being soldered to IO17. Which is where I soldered it.

The only different is I put the pi hat on a RPi 3 rather than an RPi, I assume the GPIO pins still align the same?

Can anyone think of any more ideas? I am running out of them myself.

答: It was caused by a bug in the create2 firmware. If you email iRobot they can send you an upgrade.</p>

Title: iRobot Create 2 Wake over Serial on Rpi


问:
What factors determine the number of joints in a robotic arm?
I am starting studying robotics from tomorrow. This is my first question to get started with robotics. Pardon me if this question is too naive.

What factors determine the number of joints in a robotic arm?

For instance, suppose, I am going design a robotic arm for, say, a bicycle industry.

How can I determine the number of joints needed in robotic arm for that specific task?

答:
There are two extremes available. The first one is a robot arm with only one joint. This is equal to a pinball machine in which the paddle is controlled by a single motor. In contrast, a snake manipulator contains of many degree of freedoms and can move very flexible.

The human body has surprisingly a high number of joints. Humans and snake manipulators have both a high amount of joints. This allows the human arm to reach unusual places in the 3d space. What medical doctors are using as a robotic endoscope looks the same. The number of joints is high and ultra-high. The reason why such robots are expensive is because the software control of a snake manipulator is complicated. The solver provides more than a single solution and moving the arm into a goal position is similar to play a realtime strategy game. The minimum requirement in doing so goes beyond simple differential equations and is equal to a full flown blackboard system with multi-agent communication which are scheduling different hierarchies and constraints at the same time.

The amount of joints which are available in a robot depends on the background knowledge of the programming team to realize complicated kinematic chains. If the skills are on the beginner level, the number of joints will be lower. Controlling a one joint or a two joint robotic arm is not that hard. It can be realized sometimes with a simple pid controller and no further software is needed.

In a comment user366312 asked:

Can you recommend any study resource?

Google Scholar is the only resource available which provides reliable information about robotic manipulators. To get the needed information there are some tricks needed. For example, the user needs to know the exact search string, it make sense to write some sourcecode by it's own to verify the results and it's important to make notes. But that are only fine tuning techniques to request Google Scholar more efficient.


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

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

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

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

Thanks

答:
It seems that your algorithm that controls the speed of your telescope does not make use of any integral part, thus you've been observing drifts while tracking.

Let $e_x$ be the error in the image plane between the x-coordinate $o_x$ of the object and the center $c_x$:
$$
e_x=o_x-c_x.
$$
Then, the azimuth velocity $\dot{a}$ of your telescope should be:
$$
\dot{a}=K_p \cdot e_x + K_I\int e_x dt,
$$
being $K_P$ and $K_I$ the two gains you have to tune up to obtain a nice tracking. In particular, the integral gain $K_I$ is responsible for compensating the drift so as for delivering non-null velocity when $e_x=0$.

There exist many methods to tune the gains. In your case, my suggestion is to start with $K_I=0$ and play with $K_P$ up to the point when you'll get small $e_x$ at steady-state and a residual drift. Only then, slowly increase $K_I$ until the small difference in velocities is brought to zero.

Analogous reasoning applies to the elevation velocity.


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

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

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

答:
I know this is a very old thread but I stumbled across it searching for something else and just wanted to mention that EZ-builder now supports Arduino. The Arduino is programmed with custom code available at Synthiam.com and then it communicates over a USB serial COM port to the Computer, laptop, tablet.

There's also a feature limited version of EZ-builder available for the Raspberry Pi, it's in beta at this moment in time and is having features added to it as time goes on.


答:
First you must study the tasks that the robot is to perform.  If you can describe them mathematically that is even better.  For some tasks, you might only care about the position of the tool, and not its orientation.  In that case, you would need at most three degrees of freedom (for example, x, y, and z).  But you may find that all of the motions of the task are contained in a single plane, in which case the number of degrees of freedom can reduce to two.  If all task positions are along a line, you would need only one. Look for coordinates which are changing during the execution of the task, coordinates which are constant can be usually disregarded.

Add to the positional requirements any task needs that relate to the orientation of the tool.   Worst-case is that you need three positional degrees of freedom, plus three degrees of orientation.   You might refer to this as (x, y, z, roll, pitch, yaw), although other ways of modelling orientation are also possible.  Just like with position requirements, you may be able to reduce the number of orientation degrees of freedom - for example, if you do not care about the rotation of the tool about its main axis (such as with a pen-holding tool), then you may only need two orientation degrees of freedom.

You add up the position and orientation degrees of freedom to arrive at the degrees of freedom needed for the task.

The robot design would then need to ensure that all of the required task degrees of freedom can be achieved by the kinematics of the mechanism.   Don’t get bogged down by controls, or dynamics, or simulations yet, until you can first determine that the task motions can be accomplished by the mechanism.

Body:
I am starting studying robotics from tomorrow. This is my first question to get started with robotics. Pardon me if this question is too naive.

What factors determine the number of joints in a robotic arm?

For instance, suppose, I am going design a robotic arm for, say, a bicycle industry.

How can I determine the number of joints needed in robotic arm for that specific task?


问:
how to plugin orientation of 6R robotic arm in inverse kinematics
I had all the DH parameters and calculated transformation matrix. From that I know the end-effector value position. But I don't understand how to integrate orientation.</p>

答:
Orientation is already integrated in the transfomration matrix.
A transformation matrix is a $4x4$ matrix, which can be written as:

$$\begin{pmatrix}R_{3x3} & P_{3x1}\\\ 0_{1x3} & 1\end{pmatrix}$$

$R_{3x3}$ represents a $3x3$ matrix, the upper left part of the transformation matrix which is the describes the rotation. For the 6 DoF inverse kinematics, you can build up such a transformation matrix by multiplying pure transfomration matrices. This will result in a matrix with know values which then equals the DH chain of unkown values.

$T_{TCP} = X_{trans}(x)\cdot Y_{trans}(y)\cdot Z_{trans}(z)\cdot X_{rot}(\alpha)\cdot Y_{rot}(\beta)\cdot Z_{rot}(\gamma)$

You can plug in here the end-effector coordinats, translations $x, y, z$ and orientation $\alpha, \beta, \gamma$. You can also change the types of rotations to XYX or ZYZ if it better suits your application, see here.

Plaese see also this R.SE question and answer here.


问:
Finding Mass/Inertia Matrix of a robot
Hi I am trying to model my humanoid robot. The general EoM is

$M(q)\ddot{q}+C(q,\dot{q})+G(q)=U$

I know $M(q)$ is Inertia matrix which depends on joint positions $\textbf{q}$. However, I am having difficulty to find this matrix for my robot.

I searched on internet and found that in order to find the inertia matrix I have to use the relation between the kinetic energy of the robot and inertia matrix. Is it right? I don't know how these two quantities are related to each other.

答:
The inertia matrix of a robot is important for creating a forward model. In a simulator like Gazebo the inertia matrix is given by an XML tag:

```<code><inertial>
  <mass value="5"/>
  <inertia ixx="0.2" ixy="0.0" ixz="0.2" iyy="0.4" iyz="0.0" izz="0.4"/>
</inertial>
</code>```

This allows the underlying physics engine to calculate the rigid body simulation correctly. If a framework outside of the ROS ecosystem is utilized, the parameters of the physics engine are determined by the user manual. It is even possible to calculate the parameters from the raw data. The is called system identification.

Predicting the position and the velocity of a dynamic system is more complicated than only put six numbers into an xml-tag. Especially if the robot contains of different parts like torso, wings and legs the overall system will move different from a simple ball which is flying around.

Title: Finding Mass/Inertia Matrix of a robot

Body:
The inertia matrix of a robot is important for creating a forward model. In a simulator like Gazebo the inertia matrix is given by an XML tag:

<inertial>
  <mass value="5"/>
  <inertia ixx="0.2" ixy="0.0" ixz="0.2" iyy="0.4" iyz="0.0" izz="0.4"/>
</inertial>

This allows the underlying physics engine to calculate the rigid body simulation correctly. If a framework outside of the ROS ecosystem is utilized, the parameters of the physics engine are determined by the user manual. It is even possible to calculate the parameters from the raw data. The is called system identification.

Predicting the position and the velocity of a dynamic system is more complicated than only put six numbers into an xml-tag. Especially if the robot contains of different parts like torso, wings and legs the overall system will move different from a simple ball which is flying around.


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

答:
There are now some sub and around ~1000USD 3D Lidars available. I wanted to provide an answer for future reference if anyone else comes looking for "cheap" Lidars.

LeddarTech M16 ~500 USD on Ebay

Range: 110 m

FOV: 19x3.0 degrees (up to 8.0 degrees depending on model, with 30 m range at that FoV)

Refresh rate: 6.25 Hz

https://store.leddartech.com/

BeneWake CE30 ~1000 - 1500USD on ebay

Range: 30 m

FoV: 60x4 degrees (up to 132x9 for 4 m range)

Refresh rate: 30Hz

http://en.benewake.com/product/detail/5c34571eadd0b639f4340ce5.html

Livox Mid40/Mid-100 ~600 - 1500USD

Range: 90m

FoV: 38.4 circular (Mid-40 has a 38.4 circular pattern FoV, so its a bit special, but it can technically be used as a 3D lidar, however the pointcloud pattern is a bit different, the Mid-100 is 3 mid-40 providing up to 100 degree FoV)

Refresh rate:

https://store.dji.com/product/livox-mid?vid=48991

A really good review on the Mid-40 can be found here. It also explains some of the challenges with the circular patterns, as some SLAM algorithms and fusing algorithms might needs to be adapted to this new pattern, thus not working out of the box.


答:
The third line comes from what it is called Markov Assumption and it is Stochastic Processes stuff. Basically, it says that a distribution is not altered by the insertion and/or remotion of variables that the distribution does not really depend on. It goes like this:

Is assumed that $ z_t $ simply does not depend on the previous reading history, inputs $ u_{1:t} $ and $ c_{1:t-1} $, so one can write (Assuming Markov Process)

$$ p(z_t | x^{k}_{1:t}, z_{1:t-1}, u_{1:t}, c_{1:t}) = p(z_t | x^{k}_{t}, c_{t}) $$

which makes sense, since the probability of observing a reading depends on the robot pose itself and not on the commands used to get there.

The same goes for the other component. I just do not remember exactly what is $ c $. In the second term, $ c_{t} $ is considered to not alter the probability, therefore it is removed from the expression based on Markov Assumption.

Title: Help with Probabilistic Robotics Equation 13.22 detailed derivation

Body:
Equation 13.22 from Probabilistic Robotics below:

Here's how I get from first line to second line:

$$
p(x_{1:t}^{[k]} | z_{1:t},u_{1:t}, c_{1:t}) = \frac{p(x_{1:t}^{[k]}, z_{1:t},u_{1:t}c_{1:t}) }{ p(z_{1:t},u_{1:t}, c_{1:t})} \\
p(x_{1:t}^{[k]}, z_{1:t},u_{1:t}c_{1:t})  = p(z_t|x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})p(x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t}) \\
p(x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t}) = p(x_{1:t}^{[k]} | z_{1:t-1},u_{1:t}, c_{1:t}) p(z_{1:t-1},u_{1:t}, c_{1:t})
$$
Just setting up conditional probabilities above, then I'm subbing back to the first equation:

$$
\\
p(x_{1:t}^{[k]} | z_{1:t},u_{1:t}, c_{1:t}) = \frac{p(x_{1:t}^{[k]}, z_{1:t},u_{1:t}c_{1:t}) }{ p(z_{1:t},u_{1:t}, c_{1:t})} = \frac{p(z_t|x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})p(x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})}{p(z_{1:t},u_{1:t}, c_{1:t})} = \frac{p(z_t|x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})p(x_{1:t}^{[k]} | z_{1:t-1},u_{1:t}, c_{1:t}) p(z_{1:t-1},u_{1:t}, c_{1:t})}{p(z_{1:t},u_{1:t}, c_{1:t})} = \frac{p(z_{1:t-1},u_{1:t}, c_{1:t})}{p(z_{1:t},u_{1:t}, c_{1:t})} p(z_t|x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})p(x_{1:t}^{[k]} | z_{1:t-1},u_{1:t}, c_{1:t}) = \eta \ p(z_t|x_{1:t}^{[k]} ,z_{1:t-1},u_{1:t}, c_{1:t})p(x_{1:t}^{[k]} | z_{1:t-1},u_{1:t}, c_{1:t})
$$

how do I get to the third line from here?


问:
How to get constant motor RPM regardless of battery voltage?
I have a brushless motor with a propeller attached, driven by an ESC and a LiPo battery. I noticed that as the battery level drops, the motor spins slower, which makes sense. My question is is it possible to get constant performance out of the motor (constant RPM) as the voltage of the battery drops from 4.2 to 3.7V?</p>

答:
For DC motors, RPM depends on volts and Torque depends on current. To keep constant RPMs you need to have some volts (corresponding to the required RPM).

I am not sure though how do you want to keep constant performance when your energy source is getting depleted.


问:
Sensor fusion to calculate joint angles between segments of a robot arm using IMU data
I have an IMU attached to each of the segments of a robotic arm, which gives me accelerometer and gyroscope data. My goal is to first of all improve the quality of the sensor readings and subsequently get the angles of each of the joints.

I'm new in robotics, but as far as I can see, I need a sensor fusion algorithm (e.g., complementary filter or Kalman filter) to improve the quality of the sensor readings. Subsequently, how can I calculate the angles between each of the joints using this data?

Can this be done in one go (i.e., can you use the output of the complementary filter to get the angles)? Are there reference implementations in Python available?

答:
I don't understand which type of sensor fusion you like to do. You said you are using IMU and generally it gives you the orientation and accelerations.

If you have the quaternion $\textbf{q}=(w,x,y,z)$ then your axis of rotation is vector $\textbf{v}=(x,y,z)$ and joint displacement (angle) is given by

$\alpha=2cos^{-1}w$


答:
Finding the Mass, Coriolis and Gravity Matrix for a robot, which is basically forward dynamics of the robot. Now, they are two very well-known techniques to solve this, mentioned in the Robotics Handbook as well as Robot modeling and Control book by Spong - 1) the Euler-Lagrange formulation that basically uses the kinetic and potential energy you're talking about, to derive the complete system dynamics and 2) the recursive Newton-Euler approach that recursively computes forces and corresponding torques on the end-effector and the joints respectively to obtain the dynamic equation. The final dynamic equation obtained in either of the approaches can be rearranged and compared with the standard equation you have mentioned in your question to obtain the MCG matrices.

However, both the approaches get difficult as the DOFs increase. Also, avoiding reinventing the wheel, I would suggest defining the URDF of the robot correctly with all individual link inertia tensors, COMs and the kinematic chain and then use the Orocos KDL library to directly obtain the MCG matrices. KDL already has implementations for general kinematics and dynamics principles and is pretty easy to use.

The KDL::ChainDynParam is the class class you should be looking to use.

Title: Finding Mass/Inertia Matrix of a robot

Body:
Hi I am trying to model my humanoid robot. The general EoM is

$M(q)\ddot{q}+C(q,\dot{q})+G(q)=U$

I know $M(q)$ is Inertia matrix which depends on joint positions $\textbf{q}$. However, I am having difficulty to find this matrix for my robot.

I searched on internet and found that in order to find the inertia matrix I have to use the relation between the kinetic energy of the robot and inertia matrix. Is it right? I don't know how these two quantities are related to each other.


问:
Add control and planning trajectory to double pendulum
How do I control a double pendulum to get the end effector link to go in the trajectory shaped in a perfect circle? </p>

<p>I have the equation of the circle to go in but I don't know how to get the double pendulum links to move in on that planned trajectory. What steps should I take? </p>

答:
If I understand correctly, this is a double pendulum.

This is a 2-DOF simple kinematic chain so trying make it go along a trajectory, shouldn't be really difficult. You can get analytical solutions to inverse kinematics for this and easily solve the IK at each timestep. This would get you the desired joint angles for the same and you can actuate your joints accordingly.


问:
Get a signal from position array data
I'm working with position data from a hand sensor, and need to apply an FFT to it to get the level of tremor based on the frequency of the signal. I get two arrays, one with +1000 frames of position data, the other with +1000 timestamps related to position data, both in .csv files. I'm having trouble formatting the data for the FFT function on matlab. How i transform my position (and probably timestamps) data to a signal who can be processed on function FFT()?</p>

答: FFT in matab uses a dataset as a vector or an array. If the array is X, the FFT is calculated using FFT(X). Therefore first make an array using the csv file. You can use X = csvread(filename). Then use FFT(X) command. You dont need the time stamp for this.</p>

Title: Get a signal from position array data


答:
The inverse dynamics of a robot is given by the relationship

$\tau = D^{-1}(q, \dot{q}, \ddot{q})$

where $\tau \in \mathbb{R}^N$ is a vector of the required torque per joint and $q \in \mathbb{R}^N$ is a vector of joint coordinates.  The function is a complex mixture of trig terms and robot kinematic and inertial parameters.  Over the years various algorithms have been developed to compute it, most notably the recursive Newton-Euler algorithm (Luh, Walker and Paul 1983) which is $O(N)$.

Orin and Walker 1982 showed how the $D^{-1}(\cdot)$ algorithm can be used to compute $M$, $C$ and $G$ terms and this has complexity $O(N^3)$.  Featherstone's articulated body method has complexity $O(N)$ but for $N<9$ has no advantage over the Orin and Walker method.

To make this tangible, here's an example using my Robotics Toolbox for MATLAB. We start by defining a model of a Puma560 robot (this model has full kinematic and inertial parameters)

>> mdl_puma560
```

<p>which defines a <code>SerialLink</code> object called <code>p560</code></p>

<pre class="lang-matlab prettyprint-override"><code>>> p560
p560 =

Puma 560 [Unimation]:: 6 axis, RRRRRR, stdDH, fastRNE
 - viscous friction; params of 8/95;
+---+-----------+-----------+-----------+-----------+-----------+
| j |     theta |         d |         a |     alpha |    offset |
+---+-----------+-----------+-----------+-----------+-----------+
|  1|         q1|          0|          0|     1.5708|          0|
|  2|         q2|          0|     0.4318|          0|          0|
|  3|         q3|    0.15005|     0.0203|    -1.5708|          0|
|  4|         q4|     0.4318|          0|     1.5708|          0|
|  5|         q5|          0|          0|    -1.5708|          0|
|  6|         q6|          0|          0|          0|          0|
+---+-----------+-----------+-----------+-----------+-----------+
</code>```

we can examine the inertial parameters of link 1

>> p560.links(1).dyn
Revolute(std): theta=q, d=0, a=0, alpha=1.5708, offset=0
  m    = 0
  r    = 0           0           0
  I    = | 0           0           0           |
         | 0           0.35        0           |
         | 0           0           0           |
  Jm   = 0.0002
  Bm   = 0.00148
  Tc   = 0.395      (+) -0.435     (-)
  G    = -62.61
  qlim = -2.792527 to 2.792527
```

<p>where <code>m</code> is the link mass, <code>r</code> is the centroid of the link wrt the link frame, <code>I</code> is the link inertia, <code>Jm</code> is the motor armature inertia, <code>Bm</code> is motor viscous friction, <code>Tc</code> is Coulomb friction and <code>G</code> is the gearbox ratio.</p>

<p>We'll pick a random joint angle and velocity vector</p>

<pre class="lang-matlab prettyprint-override"><code>>> q = rand(1,6); qd = rand(1,6);
</code>```

and now can compute the M, C and G terms

>> M = p560.inertia(q)
M =
    2.7694   -0.6330   -0.0746    0.0011    0.0007    0.0000
   -0.6330    4.3572    0.3227   -0.0006    0.0002    0.0000
   -0.0746    0.3227    0.9380   -0.0007    0.0010    0.0000
    0.0011   -0.0006   -0.0007    0.1925    0.0000    0.0000
    0.0007    0.0002    0.0010    0.0000    0.1713    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1941

>> C = p560.coriolis(q, qd)
C =
   -0.2524   -0.1852    0.1824   -0.0014    0.0013   -0.0000
    0.1388   -0.3675   -0.5775    0.0002   -0.0035    0.0000
   -0.0055    0.2099   -0.0002   -0.0006   -0.0025    0.0000
   -0.0005   -0.0002   -0.0000    0.0000    0.0004   -0.0000
    0.0012    0.0016    0.0012   -0.0004   -0.0000   -0.0000
   -0.0000    0.0000    0.0000    0.0000    0.0000         0

>> g = p560.gravload(q)
g =
   -0.0000   14.7643   -7.4059    0.0114   -0.0205         0
```

Title: Finding Mass/Inertia Matrix of a robot

Body:
The inverse dynamics of a robot is given by the relationship

$\tau = D^{-1}(q, \dot{q}, \ddot{q})$

where $\tau \in \mathbb{R}^N$ is a vector of the required torque per joint and $q \in \mathbb{R}^N$ is a vector of joint coordinates.  The function is a complex mixture of trig terms and robot kinematic and inertial parameters.  Over the years various algorithms have been developed to compute it, most notably the recursive Newton-Euler algorithm (Luh, Walker and Paul 1983) which is $O(N)$.

Orin and Walker 1982 showed how the $D^{-1}(\cdot)$ algorithm can be used to compute $M$, $C$ and $G$ terms and this has complexity $O(N^3)$.  Featherstone's articulated body method has complexity $O(N)$ but for $N<9$ has no advantage over the Orin and Walker method.

To make this tangible, here's an example using my Robotics Toolbox for MATLAB. We start by defining a model of a Puma560 robot (this model has full kinematic and inertial parameters)

>> mdl_puma560

which defines a SerialLink object called p560

>> p560
p560 =

Puma 560 [Unimation]:: 6 axis, RRRRRR, stdDH, fastRNE
 - viscous friction; params of 8/95;
+---+-----------+-----------+-----------+-----------+-----------+
| j |     theta |         d |         a |     alpha |    offset |
+---+-----------+-----------+-----------+-----------+-----------+
|  1|         q1|          0|          0|     1.5708|          0|
|  2|         q2|          0|     0.4318|          0|          0|
|  3|         q3|    0.15005|     0.0203|    -1.5708|          0|
|  4|         q4|     0.4318|          0|     1.5708|          0|
|  5|         q5|          0|          0|    -1.5708|          0|
|  6|         q6|          0|          0|          0|          0|
+---+-----------+-----------+-----------+-----------+-----------+

we can examine the inertial parameters of link 1

>> p560.links(1).dyn
Revolute(std): theta=q, d=0, a=0, alpha=1.5708, offset=0
  m    = 0
  r    = 0           0           0
  I    = | 0           0           0           |
         | 0           0.35        0           |
         | 0           0           0           |
  Jm   = 0.0002
  Bm   = 0.00148
  Tc   = 0.395      (+) -0.435     (-)
  G    = -62.61
  qlim = -2.792527 to 2.792527

where m is the link mass, r is the centroid of the link wrt the link frame, I is the link inertia, Jm is the motor armature inertia, Bm is motor viscous friction, Tc is Coulomb friction and G is the gearbox ratio.

We'll pick a random joint angle and velocity vector

>> q = rand(1,6); qd = rand(1,6);

and now can compute the M, C and G terms

>> M = p560.inertia(q)
M =
    2.7694   -0.6330   -0.0746    0.0011    0.0007    0.0000
   -0.6330    4.3572    0.3227   -0.0006    0.0002    0.0000
   -0.0746    0.3227    0.9380   -0.0007    0.0010    0.0000
    0.0011   -0.0006   -0.0007    0.1925    0.0000    0.0000
    0.0007    0.0002    0.0010    0.0000    0.1713    0.0000
    0.0000    0.0000    0.0000    0.0000    0.0000    0.1941

>> C = p560.coriolis(q, qd)
C =
   -0.2524   -0.1852    0.1824   -0.0014    0.0013   -0.0000
    0.1388   -0.3675   -0.5775    0.0002   -0.0035    0.0000
   -0.0055    0.2099   -0.0002   -0.0006   -0.0025    0.0000
   -0.0005   -0.0002   -0.0000    0.0000    0.0004   -0.0000
    0.0012    0.0016    0.0012   -0.0004   -0.0000   -0.0000
   -0.0000    0.0000    0.0000    0.0000    0.0000         0

>> g = p560.gravload(q)
g =
   -0.0000   14.7643   -7.4059    0.0114   -0.0205         0


答:
There has been a lot of research done in joint angle estimation using IMUs and it works as the principle technology behind segways, self-balancing robots and humanoid robots as well.

The theoretical concept is that gyroscope gives you the orientation of the sensor and using it in conjunction with the pre-determined mounting orientation of the sensor, you can find the orientation of the link itself. An accelerometer basically computes acceleration and its double integration can give you the linear motion. Additional resource to understand IMUs is the this lecture from the Virtual Reality course EE267 at Stanford.

Improving and cleaning up the sensor data is very important for the IMU due to drifting and biasing reasons and Kalman Filtering and its variants are definitely the most used technologies to resolve this. Theoretical concepts are well explained in this presentation on Inertial Navigation and Kalman Filtering by Navlab while TKJ Electronics has a highly-starred Kalman Filtering implemented on IMUs codebase on Github.

However, I am not sure by what you mean by doing it in one go.

PS: You shoudl refer to this paper IMU-Based Joint Angle Measurement for Gait Analysis for and end-to-end discussion on your concerned task.

Title: Sensor fusion to calculate joint angles between segments of a robot arm using IMU data

Body:
I have an IMU attached to each of the segments of a robotic arm, which gives me accelerometer and gyroscope data. My goal is to first of all improve the quality of the sensor readings and subsequently get the angles of each of the joints.

I'm new in robotics, but as far as I can see, I need a sensor fusion algorithm (e.g., complementary filter or Kalman filter) to improve the quality of the sensor readings. Subsequently, how can I calculate the angles between each of the joints using this data?

Can this be done in one go (i.e., can you use the output of the complementary filter to get the angles)? Are there reference implementations in Python available?


问:
Question about programming approach of a dog like quadruped robot
I and my friends are planning to build a dog like quadruped robot. We have designed  it like MIT Cheetah Mini like legs structure, each leg having 3 Servos, 3rd DOF for rotation. We have calculated inverse kinematics equation for each leg. But I am not able to figure out what our approach should be for programming. We were planning to have trot gait, and to travel on straight path, we planned to find safe distance by each leg and plan next point for each leg on the foot and then just transition legs to that point in trot gait.
But still I don't think it will be a great idea. I need to ask what should be our approach to get the walk done smoothly. </p>

答:
The walkthrough tutorial for programming a walking dog contains of some simple steps. The first step is to put the dog into a harness. This is a holder which bring the robot into the air and the legs can move freely without loosing the balance. A harness is similar to a hydraulic ramp used for car repair.

The next step is to program a walking gait. Thanks to the harness the motion controller doesn't need to balance the legs but has to move them similar to a computer animation. In it's easiest case the gait pattern is fixed. That means, it contains of gait phases like 1. left-foot up, 2. right-foot middle, 3. right-food down which results into a continuous movement. In this step the robot dog is able to move it's legs in the air because the torso is hold by the harness.

In the third step the idea is to take away the harness. The requirements for the motion controller is higher because now he has to balance the dog. The principle is called model predictive control and contains of a forward model which predicts the balance situation, and a controller which is producing a control action.


答:
First of all, I would implement a simple gait type with static stability. It is the easiest to implement and if you have already figured out the leg inverse kinematics it should bring fast results. Fast in terms of implementation time, the gait itself is slow.

Afterwards you can transition to trot or other gaitn types, but a statically stable one will be the fastest to get running and it will offer you some insights on how to continue with more complex ones.

A good description (incl. code) on how to do this using an arduino can be found here.

Title: Question about programming approach of a dog like quadruped robot

Body:
I and my friends are planning to build a dog like quadruped robot. We have designed  it like MIT Cheetah Mini like legs structure, each leg having 3 Servos, 3rd DOF for rotation. We have calculated inverse kinematics equation for each leg. But I am not able to figure out what our approach should be for programming. We were planning to have trot gait, and to travel on straight path, we planned to find safe distance by each leg and plan next point for each leg on the foot and then just transition legs to that point in trot gait.
But still I don't think it will be a great idea. I need to ask what should be our approach to get the walk done smoothly. </p>


问:
Obstacle width measurement
On non-lidar equipped rovers, how is the width of an obstacle detected such that it can be avoided? If the ultrasonic sensors are used for obstacle detection, these sensors usually don't give data about the width. How is the width derived? </p>

答:
You may use a rotating mechanism such as a servo with the ultrasonic sensor mounted on. The ultrasonic measurements can be fused with the servo arm angle to calculate the width. Usually ultrasonic sensors have a higher field of view. This degrades the accuracy if you assume the ultrasonic wave is focused to a point. If you need more accurate measurements, you may use a mathematical sensor model to fuse the measurements.

ToF sensors have a low field of view compared to ultrasonic sensors

Title: Obstacle width measurement


问:
How to limit large acceleration and jerk from PID controller?
I am trying to control a robotic arm with force input. The output of the force sensor is filtered, and fed through a PID controller to command the end-effector velocity. However, the robotic arm has strict limits for maximum acceleration and jerk. I've therefore tried limiting the jerk and acceleration after the PID, before sending the velocity command, but it doesn't feel right. The PID controller in the next iteration gets completely different values than was calculated in the previous iteration, and the limiters are "taking control".

Any ideas of a better way to handle maximum acceleration and jerk limits?

答:
As a general remark, a PID controller can be designed to take into account only constraints occurring at the commanded variable - the end-effector velocity in your case - through the so-called antiwindup mechanism that is responsible for detaching the integral whenever those constraints are reached. This way, the PID is somehow informed that something "bad" is happening and thus is able to take countermeasures.

Unfortunately - and to my knowledge - there is no equivalent mechanism to deal with rate limiters of first and second order in the exact same way described above for the antiwindup, where the PID is aware of what's going on.

In your scheme, instead, the PID is unaware of the presence of cascaded rate limiters and reacts according to the plant feedback, where "now" the plant is to be considered the ensemble of the actual process you want to control plus the rate limiters themselves. These latter elements make the overall process highly nonlinear and, as a consequence, the PID that is tuned up to work within linearity starts off struggling.

To circumvent this, you might consider the following ideas:

Try to avoid nonlinear zones at all by detuning your PID. Of course, you still need to guarantee some given performances hence this solution is often not viable.

Do Input Shaping to feed the controller with a reference signal that doesn't elicit too many vibrations by design and whose frequency content is such that the limitations in acceleration are satisfied.

Do Gain Scheduling and tune a family of PID controllers to work in different operational points.

Give up with an intrinsic liner control approach to switch to more sophisticated techniques like Model Predictive Control that makes use of optimization to tackle actuation constraints so as other properties of the plant.


问:
How to accurately navigate from one GPS coordinate to another using just GPS & IMU?
I'm looking for ways to accurately navigate from one GPS location to another. I have a GPS sensor and an IMU. I can calculate the distance with the help of GPS I believe and with the help of magnetometer sensor on the IMU(acc + gyro + mag), I can calculate the heading angle and know which way to go. But the GPS data has a lot of outliers and I need to do this navigation accurately. Any suggestions are appreciated.

Thanks.

答: GPS itself has about 3.5m of variance. To obtain a better accuracy it is usually fuse the measurements from the IMU with GPS using Kalman filters. The problem of navigation can be decompose into two sections as localization and path planning. Under localization the robot tracks its position after every time step. Then it plans the path for the next move. These two steps need to be iterated until it reaches to the goal. For your concern about outliers, I would suggest to use a Kalman filter and fuse the GPS and IMU measurements. Then you can identify your current position and heading precisely. Then you can use a path planning algorithm. </p>


问:
What's the difference between the term "pose estimation" and "visual odometry"?
I'm reading a paper:

Choi C, Trevor A J B, Christensen H I. RGB-D edge detection and
  edge-based registration[C]//Intelligent Robots and Systems (IROS),
  2013 IEEE/RSJ International Conference on. IEEE, 2013: 1568-1575.

which refers:

Visual features such as corners, keypoints, edges, and color are
  widely used in computer vision and robotic perception for applications
  such as object recognition and pose estimation, visual odometry, and SLAM

I previously assume pose estimation to be roughly equal to visual odometry, yet the text above seems to deny.

So what's their difference? I didn't find much info from google. IMHO, it seems pose estimation is estimating the pose of moving object with the camera static, while visual odometry is estimating the pose of camera in a static(mostly) scene, is that precise enough?

答:
Odometry is a combination of two Greek words οδος = odos and μετρων = metro.

Translating directly to English, it means measures.

Odometry is a general term that should include all the measures of a sensor.

Considering, for example, a camera in a robot,  Visual odometry (or camera codometry) includes localization (camera position in the world - map), camera pose (position/orientation relative to an origin), camera motion (egomotion) and extrinsic parameters (position of the camera in robot).


问:
How is the GPS fused with IMU in a kalman filter?
I've been trying to understand how a Kalman filter used in navigation without much success, my questions are:
The gps outputs latitude, longitude and velocity.

While the IMU outputs acceleration and rate angles. To use A Kalman filter, measurements needs to be in the same units ? The solution I would think about is to first define an origin. then each time my robots move, convert the latitude and longitude into Cartesian frame in meters, then use these displacement in the Kalman filter along with the acceleration. Is this the way used in practice ?

Or, is there a relation between quaternions and latitude and longitude change ?

Or, is the velocity from the GPS alone used in the position estimate in a Kalman filter ?

答:
Yes, you have to match units. If you are fusing position you have to agree to use either rectangular units or degrees.

I saw you are from aviation background, so allow me to use some jargons. In general what people do is to use ECEF or some NED reference inertial frame. You set the vehicle origin w.r.t. to the IF and start integrating from there.

Is quite non orthodox to use gps velocity, but if this is the info you have, than you should use it. The more information, the better. If you do not have a magnetometer and a compass you can't track orientation very well, but you can estimate based on the velocity vectors you have.

Don't forget to account for coriolis effect, and centripetal acc when integrating.


问:
How do I determine the required encoder resolution for a control system?
I'm designing a joint which will have to move with a velocity of ~60RPM and I have to come up with resolution requirement for the encoders within this joint. I notice however that this is easier said than done.

A 1m beam will be connected to the joint, I figured I would need to know the position of the tip of the beam with a resolution of approximately 1mm. with some simple calculations I found that for this a 12-bit encoder will be sufficient.

However, I was wondering whether this would be sufficient to actually control the joint in a smooth manner. I found some information about how the resolution influences the joint behavior but didn't find anything about how to use this to find resolution requirements. For example I found:

"When you tune the constants right, you should be able to run your arm
  at a constant speed. However, this is dependent that you have a fairly
  high-resolution encoder,"

I have no idea what a "fairly high-resolution encoder" is. I was wondering if any of you have any experience with this or know any methods to determine the required resolution.

答: For rotary encoders, position is calculated by dividing the number of edges counted by the product of the number of pulses per revolution and the encoding type described above (1, 2, or 4), and then multiplying the result by 360 in order to get degrees of motion.</p>


问:
Uploading a trained ANN to an ESP32 board
I am working on a project that requires training a neural network with humidity and temperature values. After spending a while googling on how to run a neural network on ESP32 (Wemos LOLIN D32 Pro), I came to the conclusion that off-board training and then uploading would be the best option. But I didn't get any resource on doing that.

How can I upload a trained neural network model(TensorFlow, scikit-learn ...) to an ESP32 board?

答:
If you develop and train you model with tensorflow you can probably (only experimental releases, no guarantees) use Tensorflow lite to deploy your neural network models. The idea is to train usig Tensorflow, export the serialized model and import that in TF Lite. You can see the intended workflow for deployin models here.

TF Lite is meant for Android and iOS devices, but it has experimental support for other devices (incl. running bare metal on microcontroller). There is also a tutorial for Raspberry Pis.

An alternative route would be to use Matlab. It has a Statistics and Machine Learning toolbox and a seperate Deep Learning Toolbox. However, this it not enough, you will also need the Matlab Coder toolbox. The Matlab Coder toolbox can generate c/c++ source code for (trained) neural network models that can run without external library dependencies and therefore can be easily ported to any platform. Costs invoving the needed Matlab toolboxes are signifcant comparted to the free open source solutions.


答:
Knowing that you want to keep the motor RPM at a fix value, the watt at the motor need to stay the same and the mechanical resistance at that fix RPM also remain the same (mainly air resistance).

It is possible, IF:
1)  Regulate the voltage between the battery and the ESC so that the voltage seen by the ESC stays the same. You could use a buck-boost circuit. Note that, as the battery voltage drop, the current will increase to maintain the same Power. You might then be limited by the internal resistance of the battery, keeping it from discharging the required current.

2)  You change the pitch of the propeller (thus changing the air resistance). The RPM will stay the same but the overall performance will take the hit (lower torque and lower max speed).

Title: How to get constant motor RPM regardless of battery voltage?

Body: I have a brushless motor with a propeller attached, driven by an ESC and a LiPo battery. I noticed that as the battery level drops, the motor spins slower, which makes sense. My question is is it possible to get constant performance out of the motor (constant RPM) as the voltage of the battery drops from 4.2 to 3.7V?</p>


问:
Esc calibration
I want to make a calibration setup for BLDC ESC in the simulink model. I'm using arduino mega (3,9,10,11 pins) and quatro 30Ax4 esc. Normally I can set it to it's max, min, and incrementally increase/decrease duty cycle with transmitter throttle signal by mapping (1000,2000,160,255) and there is no problem. But when I try to map it 0,255 it doesnot work (sounds every 2 seconds like a throttle signal is abnormal).

I need two suggestions;

1. why I cannot map the signal on the full range (0-255).

2. is it possible to make calibration by just sending the max and min values such as shown in the figure instead of using any mapping techniques?

答:
Missing a few information, so I will assume the following:
 - Using the instruction analogWrite() to send pulses to the ESC.
 - Not using the Mega pin 4 or 13.
 - your map() instruction is converting from your receiver pulse length to your analogWrite() function.

ESC require a pulse between 1000uS and 2000uS.
Therefore, analogWrite(160) is about a 1280uS pulse.
(as per analogWrite() reference note, the PWM frequency is 490Hz)
Sending a PWM lower than 125 will send an invalid pulse length.

Some ESC wont arm if the pulse length  is off by even a few uS, so it's good to calibrate them when you do a change in your map() function.

Can't help you for your Simulink model

Title: Esc calibration


问:
Parallel connection of batteries with equal voltage but different Ah?
I bought some batteries for a project with the recommended voltage but too weak Ah.

The batteries are to be connected in parallel. I can't currently afford to upgrade both batteries, but I was curious if I can try upgrading one of them and connecting it in parallel to one of the ones I have now? My robot is going to weigh less than the one on which it is based, so perhaps just upgrading one is sufficient.

Or is that unsafe?

答: I think you should always use a resistor to limit the current when directly connecting batteries in parallel. Since they will never start at the same voltage the current will start flowing from the higher voltage into the lower one (like when you jump-start a car battery) this could melt your cable connections if you aren't using a resistor until they stabilize at the same voltage.</p>


问:
Omni vs mecanum wheels for drawing robot
I'm designing a mobile robot which will have to draw some lines (straight and/or curly) on the floor while it moves.
The floor will always be flat with almost no obstacles.
The robot will have four wheels and its speed won't exceed 0.8 m/s.

I would like to receive some suggestions about the wheels: is it better to use omni or Mecanum wheels in this case?
I know that both wheels have advantages and disadvantages (i.e., Mecanum wheels require more torque when you move sideways), but which one is suitable for this project?

Should I use a X-shape with the omni wheels to improve the accuracy while drawing the lines, or would the Mecanum wheels in a tank configuration be more suitable?

答:
The Omni wheels are your best option. The math required for it is “symmetric”. The setup for each wheel will be the same.

You can achieve holonomic  movement with mecanum wheels but as you said you will have to calculate the difference of power when you move sideways.

If your robot is circular, you won’t have to worry about front and back so much.

So, unless your robot carries a sensor that requires a specific configuration I will go with omniwheels.


问:
Is there a more accurate feedback loop with less overshoot or disturbances than PID?
So I was starting a robotics project and turns out that PID hasn't served very well in the past. So I was wondering if there was another feedback loop mechanism which has less overshoot and is more accurate than PID in terms of overshoot. Thanks in advance!
For reference, we are using a 4 wheel mecanum drivetrain</p>

答:
You might want to try a Non linear controller if you want disturbance rejection. But I will suggest you to fine tune your PID first.

Now, back to non linear controls, you need to develop a very good mathematical model of the dynamics of your robot.

You can use a scheduler controller: first linearize you plant at different operating points an design a controller for each of the operating points. This technique is useful if you use LQR controllers. Matlab has a lot of documentation and examples on this.

You can also use more robust techniques like H2 or H infinity controls if you are eager to take your math abilities to the limit.

On the other hand, I also suggest you to double check your sensed signals, wheels, actuators, sensor, etc. Corroborate that they give you what they are supposed to give you.

Finally, you can try a Kalman filter to aid the PID performance.


问:
How Yaw, Pitch and Roll effect the flight of Quadcopter?
I am doing simulation of Quadcopter in simulink. I want to know how Yaw, Pitch and Roll effect the flight of Quadcopter? and How these are different from a single rotor helicopter?
Mainly how to change the RPM to change the x,y,z coordinates of the Quadcopter?
Is there any Differential Equation that can convert the rpm to yaw pitch and roll? Please help.</p>

答:
In a helicopter (which has 2 rotors, one main rotor and one tail rotor) the angle of attack of the main rotor controls the altitude, pitch, and roll. The yaw is controlled by the counter-torque rotor (tail rotor) which counter acts the reaction torque exerted by the rotation of main rotor which acts on the body of the helicopter.

Cyclic Control for Pitch and Roll
The blades of the main rotor are pitched up or down cyclically, that is, the pitch depends on the blades current position in the rotation cycle.

Collective Control for Altitude
The blades are pitched up or down "collectively", that is, at the same time. This produces a balanced lift force that can move the helicopter up or down.

Throttle control
The throttle controls the speed of rotation of the blades. Through mechanical or electro-mechanical control systems this is often automatically controlled to maintain constant power while altering the other two control mechanisms.

More information here:
http://en.wikipedia.org/wiki/Helicopter_flight_controls

In a quadcopter, the pitch of the blades doesn't change. Instead, the rotation speed of the rotors change to control the flight dynamics.

In a plus configuration

Pitch
Pitch is controlled by increasing and decreasing the rpms of the front and back rotors causing a moment which causes the copter to pitch up or down.

Roll
Same mechanism as pitch but using left and right rotors instead of front and rear.

Yaw
In a quadcopter the rotors are counter rotating. Two of the rotors rotate in one direction and two rotate in the other. If the rpms of all rotors are the same then no moment about he yaw axis is created. By altering the rpms of the sets of counter rotating rotors, a moment will be created and the copter will yaw.

Here is a paper that models and simulates the dynamics of a quadcopter:
http://andrew.gibiansky.com/downloads/pdf/Quadcopter%20Dynamics,%20Simulation,%20and%20Control.pdf


问:
Minimum distance for a shaft coupling
What is the minimum shaft distance required to do a shaft coupling.

I want to mount encoders on my motors but the shaft length is only 15 mm long. My encoders are 12 mm wide. So, I only have 3 mm to do a shaft coupling.

The motors are this

The shaft have a diameter of 6 mm and the motors have a stall torque of 416 oz-in (30 kgf-cm). I am planning to do a 6mm to 6mm shaft coupling and I was wondering if 3 mm is enough distance. I want to mount the encoders like in the picture. From a graph in the motor website I think the power is around 15 Watts.

答:
If it is the same type of shaft coupling as the one in the picture, as long as the set screw is completely on the motor shaft, it will transfer adequate torque.
To help with the limited clearance, ensure no pulling force is apply to the coupler since it might slip out of the coupler. The motor shaft and the coupled rod must perfectly straight to reduce the chance of the set screw to "dig" itself out of the motor shaft.</p>

Title: Minimum distance for a shaft coupling


问:
Dual vs single ultrasonic sensors
What is the difference between dual ultrasonic sensors (sensors with two round elements) and single ultrasonic sensors (the ones with a single cylindrical sensing element)?  What are the advantages/drawbacks of each design?</p>

答:
Sensors with two elements have separate transducers acting as the transmitter and the receiver.

A sensor with a single element uses the same transducer as a transceiver to create the sound pulse and to listen for the echo.  These sensors need time to switch from one mode to the other (Tx or Rx).  This means that the minimum sensing distance is likely to be longer that would be the case if separate elements were used for the transmitter and receiver.

To give a specific example, the range of the AJ-SR04M sensor is 20cm - 500cm in air.  It simply cannot detect objects closer than 20cm.  (The speed-of-sound in water is about 5x the speed of sound in air.  If this 'waterproof' sensor is actually used underwater, the minimum distance will therefore be about 1m)

However, a benefit of sensors that employ a single element is that they are likely to require less space than a sensor with two elements.  They may also be more cost effective (although this will depend on a range of other factors).

Beyond that, the relative advantages/drawbacks will depend on the particular sensor characteristics and the application(s) in which it is to be used.

Sensors Online published a two-part article titled Choosing an Ultrasonic Sensor for Proximity or Distance Measurement a couple of years ago, which was intended to help people select ultrasonic sensors with the optimal acoustical properties (frequency, beam pattern, etc.) for their particular application:

Part 1: Acoustic Considerations

Part 2: Optimizing Sensor Selection

Title: Dual vs single ultrasonic sensors