问:
Matrix Algebra vs Trigonometry for Inverse Kinematics
What method is “better” for solving inverse kinematics for a robot arm: matrix algebra or trigonometry?

To define “better”:

efficiency/performance vs memory usage

generality (how well can it be adapted to different arm configurations)

I know trigonometry/geometric methods get very complicated when solving for more that a few DOF so matrix algebra would probably be the best solution there.

But for 2-3 DOF robot arms which method is preferred?

Update: As others have pointed out and more research has showed me, using matrix algebra compared to trigonometry for increase kinematics doesn’t affect performance. They are just different methods of setting up and solving the inverse kinematic equations. Once you solve the IK equations using either of these methods, it’s implemented the same way in the code. I think I prefer the matrix method for solving IK because it’s a little more general that trigonometry, it scales to more joints more easily, and I’m already using matrices for forward kinematics so it provides a better symmetry.

答:
I may not be the most experienced person to answer your question. However, I wanted to share my experience from a year ago.

On an online course I learned about the Screw Theory, which seemed like a very good way to approach the Robot Arm Kinematics. During an homework/mini-project of the course I needed to calculate the Inverse Kinematics of a 6-DOF robot arm using the Screw Theory and an analytical solution. You may already know this, however I want to explain this solution in few sentences. You calculate the Screw Axes for all of the joints (which was pretty straight-forward and easy, this will not be very hard if we have good visual model of the robot) and construct the Screw Matrix. Then for the given end-effector configuration, you make an initial "guess". Then, you run your algorithm, which was an iterative Newton-Raphson root finding method, to find the solution of the Inverse Kinematics. One draw-back of this method was the initial "guess". If you do not enter a good initial guess, your algorithm never converges to the solution. My potential solution to that was to create a Look-Up table of Forward Kinematics results which than could be used to pick a proper initial guess. However, I felt lazy and never tried it.

Since you asked for a 2-3 DOF Robot Arm, I would go with an Analytical Solution. Especially for SCARA type Robot Arms, Inverse Kinematics calculations are not too hard to handle and can be generalized for certain types. Also, in the end, you are left with equations that yields the joint displacements in terms of the end-effector configurations.  Therefore as I said, I would go for an Analytical Solution for a Scara-Type Robot.

Also, maybe you can check "MoveIt for ROS", which provides an amazingly extensive framework for Robotics manipulators.


问:
How can I achieve a square pulse train while sending pulses one pulse at a time to a stepper motor?
I am trying to control Stepper motors which has a pulse input driver.

I have a speed of 1000pps, and I want to move 1 pulse at a time. So that means 1 pulse will take 1ms.

After I send a command to move 1pulse, I sleep for 1ms so the pulse can be completed before I can send another pulse

Below is my pseudocode

```<code>while(1)// loop forever
      speed = 1000pps
      pulses = 1;
      move(pulses) //move the motor 1 pulse
      sleep(1 millisecond) //sleep for 1ms
</code>```

How ever when when I specify a distance of say 10000 pulses and instruct the motor to move at once, I get a perfect square pulse train with a period of 1.

Expectation
I am expecting to see a square pulse train on the oscilloscope, where the on time will be equal to the off time. But instead the on time is 0.5ms and the off time is becoming 1ms. Is it possible to have the off time and off time both at 0.5ms while moving one pulse at a time?

答:
Split the sleep() into two halves if you want your software to control both halves of the pulse.  Your loop body would then look like

```<code>set_output(1)
sleep(0.5)
set_output(0)
sleep(0.5)
</code>```

Your 'scope might show a period slightly greater than 1.0 msec -- besides the sleeps, those other statements take time too. If that's a problem, you could manually tune the sleeps, which is both tedious and fragile. Or change the code to consult a clock:

```<code>now = clock()
while 1:
    next1 = now + 0.5
    next2 = now + 1.0
    set_output(1)
    while (clock() < next1) do_nothing;
    set_output(0)
    while (clock() < next2) do_nothing;
    now = next2
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Split the sleep() into two halves if you want your software to control both halves of the pulse.  Your loop body would then look like

set_output(1)
sleep(0.5)
set_output(0)
sleep(0.5)

Your 'scope might show a period slightly greater than 1.0 msec -- besides the sleeps, those other statements take time too. If that's a problem, you could manually tune the sleeps, which is both tedious and fragile. Or change the code to consult a clock:

now = clock()
while 1:
    next1 = now + 0.5
    next2 = now + 1.0
    set_output(1)
    while (clock() < next1) do_nothing;
    set_output(0)
    while (clock() < next2) do_nothing;
    now = next2


问:
What kind of distance sensors should I use for outdoors applications?
I want to measure two or more distances between two or more sensors and a truck-trailer front face in an outdoors (night/day, rain/shine) environment. I've been looking at the different types of sensors, but I still am having trouble deciding between ultrasonic, IR, lidar, and time of flight sensors. For example, I read that infrared sensors are not good in outdoor situations, but also read that you can find filters that will mitigate this problem. I want some tips or advice on which option I should lean towards for reliability and accuracy in an outdoors environment, at ranges of around 2-5 m. Any help would be greatly appreciated, thanks!</p>

答: You can ideally use any or all the above mentioned sensors for the task you have in mind. Ultrasonics, RADAR and LiDAR are commonly used sensors for this purpose. Each sensor has its own merits and if you want to operate them in varying conditions you will have to account for sensor uncertainty. To be robust, you should use more than just the one sensor and run it through a kalman filter type estimator.</p>


问:
Basic question about Markov Localization, probability and belief distribution shift
I am starting in robotics, and reading about Markov Localization, I have one doubt, probably very stupid, but, well, I want to solve it.

Let's take the CMU Website example: https://www.cs.cmu.edu/afs/cs/project/jair/pub/volume11/fox99a-html/node3.html

Basically and very summarized:

The robot does not know its location (uniform probability of being
at any point), but knows there are 3 doors.

It senses a door, and since that door could be any one out of the 3, the belief distribution spikes at those 3 doors.

It moves to the right, and the belief distribution shifts to the right also, let's say "following the robot movement", and then the convolution is done when finding the 2nd door... This gets described in the next graphic, from the CMU:

But why does the belief distribution get shifted to the right, and not to the left, as the door is left behind?

Shouldn't the robot sense that there's no door between door 1 and 2 (starting from the left)?

Is there something about probability theory I've forgotten (I studied it like 14 years ago)?

答:
Here is what I 'believe'.

Lets make the diagram more labeled. Say door 1 starting from left most is at 4 meters from the origin at left, door 2 at 7 meters, door 3 at 15 meters.

When the robot senses a measurement corresponding to a door it thinks that it has high and equal probability of standing in front of any of those doors and very low probability that it is not in front of a door. Now it believes that it is highly at either 4,7 and 15 meters and low likely to be any other x meters. The position of a peak is where it think it might be(4,7 and 15). Here there are 3 doors so there are 3 peaks. Clear till now?

Now it moves 1 meters lets say. Now it will believe that it has high probability of being at either 4+1, 7+1 or 15+1 meters. Now you can see that the peaks has to be at 4+1, 7+1 and 15+1 meters as this is just a simple shift to update its current belief (Now it believes it is highly 1 meter right to any of those doors). That said the peaks has to be shifted or ultimately the whole distribution about its current belief. This is the reason why the distribution shifts towards right.

Rest of the answer is a bonus! Lets move ahead

Dang!!! but it knows that it might has not moved exactly to be 1 meter and has errors in movement (lets say 0.1 meters for every meter it moves). so it now might be at 4+1+-0.1 and so on. So the graph flattens a bit as now it thinks it is highly nearby 4+1, 7+1 and 15+1 but not exactly there!. So the peaks flatten.(black as in original "Probabilistic robotics book figure 1.1") If it has moved by 3 meters the uncertainty would be more to be at exactly 4+3, 7+3 and 15+3 meters (4+3+-0.3 etc). This explains, as answered above the more it moves the more its belief gets uncertain for those peaks(current highly possible positions)!

Now again it moves(by lets say 'nearly' 2 meters) and senses a door. So it shifts its distribution and changes it to 'around' 7,10 and 18 meters. Now as it has sensed a door it again thinks that it is in front of any of those doors. So 3 red peaks again at 4,7 and 15 meters. But given the black peaks already at around 7, 10 and 18 meters, logically it can only be at 7 as the intersection of those beliefs sets {4,7,15} and {7,10,18} is 7, Here we are talking about intersection of peaks (highly possible positions!!) now it is certain that it is at 7 meters. This can be done by just multiplying the probabilities distributions(of prior belief and belief according to 2nd measurement) as the two measurements are independent (that's why we took red peaks when it sensed a second door) as supported by Markov's independent assumption rule.

Now wherever it moves it belief of where it is moves.

Hope that helps.


问:
How to find state-space representation of quadcopter?
I want to design a linear controller for a quadcopter which is 6dof nonlinear.

I have non-linear equations. But in order to design a linear controller, I need to find a linear state-space model of the vehicle.

I skimmed bunch of articles and thesis without any result. Most of them have some approximations for separate parts of the model to linearize.

I need the state-space as a form like below,

$$\dot{x}=Ax(t)+Bu(t)$$

I couldn't find the $A$ and $B$ matrices. I made the small angle and hover condition approximations so that equations become simpler yet they are still non-linear.

Non-simplified equations are as follow,

答: State-space equations for your case.

ContentLicense: CC BY-SA 3.0

Body: State-space equations for your case.


问:
Is it possible to track position using gyroscope and accelerometer without a magnetometer?
I'm looking for help on a project where I will be placing sensor data in 3D space using augmented reality. Most solutions I have found for finding position with an IMU involve the magnetometer, but for my implementation that will not work because I am measuring magnetic fields so the magnetometer value will definitely not be pointing towards any poles. How would I be able to calculate position?

Relevant info:

I am using four IMUs, so I could possibly filter noise by averaging their values.

I will only be measuring for a short time (15-20seconds).

The magnet being measured will be stationary, so it could possibly be used as some sort of reference point?

Any help is appreciated!
Thanks in advance!

答:
We developed this for pipeline inspections and used this to map a pipeline. We found magnetism not to be very reliable and did it without. It works, but you have accumulative errors that can be significant. In our case you will try to find reference points and make corrections for these accordingly. And with a pipeline you always have 2 reference points anyways. The beginning and the end.

Joey


问:
Servo motor vibration problem
I'm working on DIY robotic arm. Robotic arm has 5 servos. The problem is that servo motors are shaking. I found different solutions but none of them works. What happens is that when I connect one PWM pin it works fine. Then add second pin and it works fine and so on. But when I connect power supply when all 5 pins are connected to ESP32 microcontroller it starts vibrating. I tried to power all servo motors separately but it doesn't work either. Does anyone have similar experience?
P.S. I use JMT200 servo motors with 50 Hz frequency and 800 ~ 2200 uS pulse width. Here is link https://www.amazon.com/JMT-Happymodel-Steering-Suitable-12v-24v/dp/B086HKQTC5</p>

答:
In my experience, when a servo is shaking, that's how it tells you its power source (battery, etc) is inadequate. Especially if the servo hums or buzzes at around the command frequency (50 Hz in your case).

That beefy servo model you cite is rated at 12V-24V with a stall current of like 11 amps. Normal operating current will be less, but running all five servos at once will be demanding.

Personally I would try two multimeter measurements.

Voltage sag. Set up to measure the voltage as close to the servo as you can, then run the servos in "shaking" mode. I suspect the voltage will be significantly less than the 12 V those servos need at minimum.

"Normal" current. Set up to measure the current drawn by one servo. With a mechanical load on it (e.g., robot arm parts) command the servo to move from one end of its range to the other end. I hope your ammeter reading will stabilize in the time the servo takes to travel its full range.

If your voltage measurement is low, that confirms the voltage-sag hypothesis. If it's normal, that still leaves the possibility of a bad connection between where you measured and the servo itself.

Your power source must be capable of supplying well in excess of the measured "normal" current, times five (the number of servos).  In fact, you may want it to be capable of delivering stall current to all five (like 50A) -- otherwise one stalled servo could disable all the other degrees of freedom.

If all that's ok too, I would (re)check the connections, and confirm the wires are fat enough to carry the current. Beyond that, ask for more help, providing more detail.

Title: Servo motor vibration problem


问:
Can the tangent space vector of SO3 be interpreted as Euler angles?
I want to compare the rotation of two cameras with respect to a common frame. Let's call these R_World_Cam0 and R_World_Cam1. When comparing these two rotations, one common approach is to compute the Euler angles (for example XYZ) and compare the components. This comparison is nice because it tells us which part of the rotation changes more (roll, pitch, or yaw).

I wonder if it is possible to do something similar with the tangent space vectors of the rotations. More specifically, we can compute V_World_cam0 = Log(R_World_Cam0) and V_World_cam1 = Log(R_World_Cam1). But I understand that we cannot compare these directly as we would do with Euler angles, because we are talking about components of a vector which represents
the rotations with the angle-axis representation (potentially not normalized).

Is my understanding that the tangent vectors should not be used for comparison? I have done some synthetic experiments trying to compare the Euler angles and the tangent space vectors, and they are different, but their numerical values are very close, which is something I wasn't expecting. For example (I omit code for brevity), I create a rotation using the Euler angles XYZ convention and I apply Log operator to the created matrix:

```<code>Input: XYZ Euler angles: [ 45.00000936 -0.         30.00000624]
Output:  tangent vector: [43.94588114  11.77526336 28.42800051]

</code>```

Is this just a coincidence?

Thank you in advance!

答:
But I understand that we cannot compare these directly as we would do with Euler angles, because

-> Because of singularity around PI.

Instead of directly comparing the value in R3, you can do it like this.

V_cam1_cam0 = Log(inv(R_World_Cam1)*R_World_Cam0)

Now with V_cam1_cam0, cam1 is the reference coordinate and V_cam1_cam0 encodes the rotation axis of cam0 with respect to your cam 1. You can visualize the difference in rpy form if you want.

Is this just a coincidence?

-> Yes. Some might look similar according to your rotation configuration.


问:
Relative scale problem
I am doing Monocular Visual Odometry, and I have problem with relative scale. Most of the time its value is between 0.8-1.1, but sometimes it goes crazy and it has value 3,4 and once it had value 25. This ruins me my translation vector t, and then my vehicle trajectory become shifted a lot. I extracted 3D points normally, I can't resolve why this is happening. I don't know if 3D points cloud making this problem, but I used triangulatePoints method for getting 3D points. For relative scale, I take median of all calculated distances between points of 3D cloud.

Does inliers and outliers have something to do with this problem? Should I get rid of all outliers first? I mean there are not too many outliers in keypoints set.

P.S. I tested this for 2 datasets. One had about 110 frames, and another had about 20 frames. One with 20 frames had no problems, this with 110 frames had problems. Relative scale had value 25 when I was computing it between frames 3 and 4. It is dataset from KITTI. You can find it on KITTI webpage: Raw data - 2011_09_28_drive_0001 (name of dataset).

I hope you will help me to understand why this is happening.

Note: KITTI dataset is stereo camera. So I used right camera as monocular.

答:
Does inliers and outliers have something to do with this problem?

-> Yes, your odometry estimation error will be accumulated in the point cloud and it will eventually end up what you are experiencing now. Obviously, the error accumulates more over time. That explains why your longer dataset fails.

Should I get rid of all outliers first? I mean there are not too many outliers in keypoints set.

-> That's very tricky. It might improve if you do it well. But how would your algorithm know which one is the true outlier? Removing outliers is the most tricky part of mono slam. I recommend you to read ORB-SLAM paper. It has all the answer you want to know.

Title: Relative scale problem


问:
What is the purpose of electronic braking in motors?
I have a Micro Magician v2 micro controller. It has a A3906 Dual FET “H” bridge motor driver built in.

In the manual it states "Electronic braking is possible by driving both inputs high."

My first question is, what is the purpose of these brakes? If I set the left/right motor speed to 0, the robot stops immediately anyway. What advantage is there to using these brakes, or am I taking the word "brake" too literally?

My second question is, the driver has "motor stall flags that are normally held high by pullup resistors and will go low when a motor draws more than the 910mA current limit. Connect these to spare digital inputs so your program will know if your robot gets stuck." But when my robot hits a wall, the wheels just keep on spinning (slipping if you will), I take it these stall flags can be used on a rough surface where the wheels have more friction?

答:
Question 1: If you are satisfied with your robots stopping distance, than you don't need electronic braking. With a heavier or faster robot, its quite useful. The larger the machine, the more inertia becomes a important design factor. For example, a form of electronic braking is used by open-pit mining dump trucks. Ordinary dump trucks, being much smaller, make do with ordinary brakes.

Question 2: The stall flags are useful to detect that the wheel is not moving despite full power being applied. I'm presuming we're still talking about a small robot here - what would happen if the wheel got tangled in something like a long hair or thread?

I had a two-inch long robot once that got its powered wheels jammed on a tiny piece of toothpick it encountered while crossing a carpet. Freak luck, but it does happen. If you only run your robot on clean surfaces, and it'll spin the tires when it bumps into something, than you probably don't need the flags. Personally, though, I would use them -- but I'm a belt AND suspenders kinda guy.


问:
How to use Jacobian Method for path following?
I am currently doing a personal project and get stuck in something as below. In this project, I am going to use the RRT algorithm on the ur5 robot to make it reach the target frame without any collision. So after the RRT algorithm, a path (i.e. a series of poses) would be generated. And my question is how I can use the Jacobian pseudo inverse method to make the end-effector follow the path smoothly. I am only allowed to perform differential method instead of IK solutions.

Of course the easiest way for this is to do interpolation, such as defining 10 intermediate points in the path. But such operation would make the movement not very smooth, i.e. it would first accelerate and then decelerate between each pair of points.

Can anyone provide any idea? Thank you very much!

答:
You can use some Trajectory Generators to create intermediate points between the points calculated by RRT Algorithm. You can use Moden Robotics Library by Neuroscience and Robotics Lab at Northwestern University on Github for example to find some functions which can help you at this time step. You can take a look at "CartesianTrajectory" and "ScrewTrajectory" functions of the library for example. They allow you to create trajectories between two configurations by a specified time input. I mentioned this Trajectory Generation, because as far as I know, the reason Jacobian Inverse method is used is, the fact that it allows you to calculate the Inverse Kinematics between very small time steps.

You just calculate the Jacobian Matrix of the robot and take its inverse. Then you can use the following equations to (1) calculate the joint displacements according to the translational movement, (2) to calculate the Pseudo Inverse of the Jacobian matrix, according to the article proposed by Robert Krasnansky, Peter Valach, Dávid Soós, Javad Zarbakhsh (Reference trajectory tracking for a multi-DOF robot arm; you can find some useful information from this article as well).

The reason Pseudo-Inverse Jacobian is used is, most of the time the inverse Jacobian leads to a matrix which is not full-rank, especially with robots which have many joints, like UR5. When that is the case, Pseudo-Inverse is used instead of the direct inverse method. However, I worked with youBot once in a project, which uses Pseudo-Inverse method for trajectory planning and I dealt with so many singularity cases. So singularities are not guaranteed to be prevented with Pseudo-Inverse Method. To avoid singularities, you can use some tolerance levels (you are able to select a tolerance value with built-in Pseudo-Inverse functions), or make sure that your trajectory is physically feasible and not too fast for your robot.

Also you might want to use some type of Control System for the trajectory following task. Here is a video that may help you on that; it is actually part of the videos which belong to my project which I mentioned earlier. Even though it is for a Mobile Manipulator; the idea is not very different for a Robot Arm; instead of acquiring joint and wheel velocities, you receive only joint velocities:

https://www.youtube.com/watch?v=1MgpqD7v2x0&list=PLggLP4f-rq02vX0OQQ5vrCxbJrzamYDfx&index=97&t=185s


问:
Now Unable to Communicate with Create2 and Getting repeated Bat: messages via the serial port
After hooking up my Raspberry Pi4 to the Create2 for the second time, I am now unable to communicate with the Create2. When I open minicom on the pi I see the following messages repeated on the screen. I tried resetting the Create 2 and got the messages again. Has anyone seen something like this?</p>
```<code>================Pasted from minicom on the Pi4===========================================

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyUSB0, 17:57:46

Press CTRL-A Z for help on special keys

key-wakeup
batt-rx-decode-error: 1 invalid-bit (0)
batt-rx-decode-error: 6 invalid-sync (20)
bat:   min 16648  sec 33  mV 16028  mA 16  rx-byte 90  mAH 1902  state 18  mode 9
    Flash CRC successful: 0x0 (0x0)
bat:   min 16648  sec 34  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 35  mV 16028  mA 0  rx-byte 65535  mAH 1902  state 14  mode 9
initial-lithium-battery-capacity: set to 2068 mAH
initial-lithium-battery-level: set to 1902 mAH
bat:   min 16648  sec 36  mV 16028  mA -16  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 37  mV 16028  mA -8  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 38  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 39  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 40  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16648  sec 40  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
key-wakeup
batt-rx-decode-error: 6 invalid-sync (2)
bat:   min 16649  sec 26  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 27  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 28  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 29  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 30  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 31  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 32  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 33  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 34  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 35  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 36  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 37  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 38  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 39  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 40  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 41  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 42  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 43  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 44  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 45  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 46  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 47  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 48  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 49  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 50  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 51  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 52  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 53  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 54  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 55  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 56  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 57  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 58  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16649  sec 59  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 0  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 1  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 2  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 3  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 4  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 5  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 6  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 7  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 8  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 9  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 10  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 11  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 12  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 13  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 14  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 15  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 16  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 17  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 18  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 19  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 20  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 21  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 22  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 23  mV 16056  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 24  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 25  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 26  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 27  mV 16028  mA 0  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 28  mV 16028  mA -56  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 29  mV 16028  mA -56  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 30  mV 16028  mA -56  rx-byte 90  mAH 1902  state 18  mode 9
bat:   min 16650  sec 30  mV 16028  mA -56  rx-byte 90  mAH 1902  state 18  mode 9
key-wakeup-wheel-drop
batt-rx-decode-error: 1 invalid-bit (0)
saving bbox vars
<span class="math-container">```</span>
</code>```

答:
Ok...So I have now more information. I did not have the inductors necessary hooked up to the motor power connectors so I think the internal circuits of the Create2 were reporting errors.

I have now connected the recommended inductors and the robot works and I can control it but ONLY if it is OFF the charger. That is a big problem since I wanted the robot to function autonomously and return to the charger to charge and then resume once the battery was fully charged. If it is on the charger I cannot communicate with it unless I press the CLEAN button and then I can only communicate for 30 secs or so before it goes back to sleep (??).  Has anyone run into the same issue? I am using the python pycreate2 library (which I have expanded).


问:
Scale factor of Monocular SLAM (Simultaneous Localization and Mapping )
I am using ORB-SLAM3 with a monocular camera on a drone for Augmented Reality application. I need to know the absolute scale of the map formed by the SLAM.

I cannot use a stereo or RBG-D setup. Tthe scale of the monocular SLAM is defined every time the SLAM is started. Can someone please suggest any ideas how can I get the scale factor/ absolute scale of the map?

Can GPS be used to do this? To measure the distance between points in GPS co-ordinates and the corresponding distance in SLAM map and just divide those to get the scale factor?

答:
GPS is a good idea. Draw a trajectory using the GPS and align/scale it to your slam trajectory. But if your drone movement is small (few meters) it is not a solution.

Or you can just put a scale known object in the scene around the initial position. By comparing the reconstructed size of the object and the actual object size, you will find the scale factor.


问:
How do robotics startups work?
In software engineering startups, you generally go to a room with a computer or bring your own laptop, and write code. I'm interested in how robotics startups work: Is there a separate location for designing the robots? Take for example, Anki. Do they have separate research labs for designing robots? How does a robot get from a single design to being manufactured?

I couldn't find a better place on SE to post this (the startups business section is defunct): Please link me to another SE site if there is a better place to ask this question.

答:
I work at a robotics startup. To sum up my long answer below,  robotics startups are slower, more expensive, and often more distributed in location than their more famous software counterparts.

Robotics or hardware startups do have a lab for design. It holds owned or rented equipment:  3D printers, machine shop lathes and drills, soldering stations and power supplies, and ONLY 1 really nice oscilloscope that everyone has to share. All the engineers will have a laptop- they may often share licenses for the expensive software like MATLAB and SolidWorks. They work outside the lab whenever possible, because the lab has no windows. Sometimes they make work from home.

The main Engineering work of a robotics startup is to go from a prototype to product. Signs of a prototype that needs to be commercialized include pieces made from

Arduino boards

RC Hobbyist servos and batteries

cardboard

duct-tape

80/20 framework

Legos

3D printed parts

Hand machined metal parts

These parts, for reasons of cost and scaleability and reliability, must be replaced with custom molded plastic, metal, composites, cheaper PCBs, standardized fasteners, and consumer grade batteries and power supply electronics. This process is months to years long and uses at least 3 engineering disciplines. It's very expensive.

At the same time, the Sales and Marketing and Finance employees (and also Engineering employees if the company is any good) are working to move from an idea to a business. This selling and fundraising is where the money to do the Engineering work comes from.  You'll notice that Anki site you linked to is billing the product as a toy, not as a military transport robot. This seems obvious, but it has significant engineering implications for what your robot will be expected to do, how long it will last, and how much you can sell it for.

All these people are busily burning up money, sometimes to the tune of  millions of dollars. To fight some of this battle, most robotics companies outsource A LOT to consultants and contractors: a consultant might build your website, design your business cards, redesign your plastic shell to be injection molded instead of 3D printed,  test your power supplies for safety, and write your user manual. You should NOT outsource complaints handling and tech support initially, because if you do, you'll lose a lot of valuable information about your first products.

As a startup, once you are actually ready to produce a product (Double check- if there are still pieces of your robot made from the bullet list above, then you aren't ready), you will probably hire a Contract Manufacturer to make your first robots because you can't afford all the equipment or employees to make them yourself. You will pay them to follow your instructions to make your robot and test units before they are sold. You will discover, over the course of several months and dozens of angry user phone calls, that your written instructions weren't clear enough and robots have shipped broken. You will fix it.

Your coworkers and consultants and contractors are located all over the country and world, not in your lab. In the case of suppliers and contract manufacturers, someone at your company is paid to visit them and audit their work, and report the results back.

All this costs more time and money than the stereotypical software startup. It rarely includes extra money for Silicon-Valley-style perks such as gyms and gourmet smoothies[1].  The logistics of a robotics startup are close to insanity. The payoff margins are smaller than software, and the costs are higher. About the only good news is that no one can bit-torrent your robot for free, and because it is so hard to build a sustainable robot business, there are fewer people willing to fight the battle.

But, I get to say I design robots for a living, and that's worth a LOT.

-Crazy System Engineer apologizes for long answer.

Note 1:  The perk of free coffee IS included.  In my professional opinion, no one has EVER made engineers pay for coffee.

Title: How do robotics startups work?


问:
No ROS 'sourceing' anymore after installing rosdep2
My ROS-system was working pretty well.

Then, I installed rosdep by using sudo apt install python-rosdep2, which ended fine without showing any issues. Then I issued

```<code>sudo rosdep init
sudo rosdep update
</code>```

which also ended without showing issues.

But now, my ROS-installation seems to be broken because I can't source my ROS any more!

For example, typing ROS-commands, such as

roscore or rqt

results in:

Sourcing, as usual with source /opt/ros/meldoic/setub.bash makes no difference.

What has happened? How to fix this?

Additional Info:

Typing ros<tab><tab> only shows me the following options anymore:

Where is all the rest gone?

答:
rosdep update should be run without sudo. ROS wiki/rosdep.

sudo rosdep init
rosdep update ## without sudo
```
<p>Running <code>rosdep update</code> again might solve your problem, although I haven't encountered this specific problem myself. Further steps to investigate could be to search for the commands you are missing (rqt, rostopic). For example search for <code>roscore</code>:</p>
<pre class="lang-bash prettyprint-override"><code>find /opt/ros/$ROS_DISTRO/bin -iname roscore
</code>```

$ROS_DISTRO might need to be manually to your ROS distribution (for example noetic).

Edit:
The following rosdep command will attempt to fix the permission issue.

rosdep fix-permissions
```

According to the rosdep man page:

rosdep fix-permissions: "Recursively change the permissions of the user's ros home directory. May require sudo.  Can be useful to fix permissions after calling "rosdep update" with sudo accidentally."

Body:
rosdep update should be run without sudo. ROS wiki/rosdep.

sudo rosdep init
rosdep update ## without sudo

Running rosdep update again might solve your problem, although I haven't encountered this specific problem myself. Further steps to investigate could be to search for the commands you are missing (rqt, rostopic). For example search for roscore:

find /opt/ros/$ROS_DISTRO/bin -iname roscore

$ROS_DISTRO might need to be manually to your ROS distribution (for example noetic).

Edit:
The following rosdep command will attempt to fix the permission issue.

rosdep fix-permissions

According to the rosdep man page:

rosdep fix-permissions: "Recursively change the permissions of the user's ros home directory. May require sudo.  Can be useful to fix permissions after calling "rosdep update" with sudo accidentally."


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

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

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

答: Delete folder catkin_ws , And do it again.</p>

Title: Invoking "cmake" failed


答:
I can share my experience at a startup where we built what was essentially special purpose robots.  I'm sure there's a wide spectrum though.  A lot depends on the complexity of your robot or machine and the target market for it.  Is it something that will be manufactured in 10's of units and sold for millions a dollar a piece or something that will be manufactured in the millions and sold for hundreds of dollars.  There are many other factors as well.

We had mechanical engineers, electrical engineers, software engineers, physicists, system integrators.  When you're at the "garage" stage you may have 0-1 of each but the general ideas still apply.

Physically we had some lab spaces where the machines would be built/integrated/tested and around them was the team work area/offices.

You start from a concept/high level system design.

The system will typically be decomposed into separate parts/assemblies.

Typically the design is iterated on.  Some assemblies may be designed, built, tested and then changed.  The system design can evolve as well.

If you walked into our labs there'd always be some piece of the machine being run through cycle testing or some other functional tests.  Things clicking and humming all over the place ;-)

In our startup we didn't make any parts in house.  We had some close machine shop contractors manufacture all the parts we needed for development.  I know some startups will have a machine shop with a CNC mill/lathe for rapid turnaround of parts.

We did do all the assembly and integration in house.

Over time the design is finalized and various production drawings, procedures, and BOMs are made for the entire machine.  Those include all the manufactured parts, the off-the-shelf parts, things like printed circuit boards etc.

Throughout this software is being developed side by side with everything else and needs to change to match the changing system and requirements (that's my job :-) )

There are various other business activities ongoing as well.  Talking to customers, HR, finance...

It's not as easy to prototype as it is with pure software.  Arguably if you're building a small web site you can bootstrap your business with no investment.  If you're building a robotic company it's probably not possible.

I hope this gives some idea of my experience.  Feel free to ask more questions.

Title: How do robotics startups work?

Body:
In software engineering startups, you generally go to a room with a computer or bring your own laptop, and write code. I'm interested in how robotics startups work: Is there a separate location for designing the robots? Take for example, Anki. Do they have separate research labs for designing robots? How does a robot get from a single design to being manufactured?

I couldn't find a better place on SE to post this (the startups business section is defunct): Please link me to another SE site if there is a better place to ask this question.


问:
Is higher jerk always better for reducing cycle time?
I'm interested in decreasing the cycle time (time to execute a given task) of a robotic arm. As in the title, are there any downsides to maximising the joint jerks of the robot?

Naively, increasing the rate of acceleration should lead to shorter cycle times. Perhaps are there long term negative effects on the wear and tear of the robot?

答:
I haven't directly worked with robot arms, but I would think that too much jerk is a bad idea. I think it could increase the wear and tear of the joints and also affect final precision.

Anyways, this paper sheds some insights on this topic.

High jerk of the robot joint can heavily excite the resonance
frequencies of the body structure, creating vibrations, and slow down
the tracking speed, as well as affect the tracking precision


问:
Multidimensional obstacle avoidance
Artificial potential barriers are known that allow robots to avoid obstacles. They are constructed as follows. https://authors.library.caltech.edu/106548/1/2010.09819.pdf

Can you please tell me how this approach is generalized to the case of limiting several coordinates of the controlled robot?

答:
I am assuming that the desired application would be to control a quadrotor drone or similar platform.

The scalar representations of distance shown in the paper above can be represented in 2 ways (that I see). You could extend from the 2d plane to the 3d plane using the same vector norm function as before. This would mean that the mathematical operations would not change, just the low level data structure would be a 3 element vector instead of a 2 element vector.

You could also simply do all of those equations separately on the X, Y, and Z components of the pose vector at the same time. This could be implemented with 3 different threads running the same mathematical process. This is probably safer since you can then prioritize each axis exclusive of the others in case you have to navigate areas where one axis of motion is not going to require large position deltas.

Does that help?

Title: Multidimensional obstacle avoidance


问:
Omnidirectional Movement for 3 Wheeled Spherical Omni wheel robot
I was watching James Bruton's video on his spherical omniwheeled robot and he was explaining how to go directly sideways. He explains this from 6:09 to 7:06. I didn't understand how the velocity of the wheels not facing the direction of movement move exactly the cos(60). I kind of get how the yaw force from the directional wheel need to be counteracted by the other 2 wheels so each wheel spins at half the velocity of the directional wheel but how does this have to do with the cos(60)? Can someone please explain the math behind this?

答:
I think this is not really difficult trigonometry. Suppose we want the robot to move in a forward direction? We need to use the two front motors. (I tried to sketch this out in the pictures, I will now explain all this scribble). Due to the fact that the motors are not at right angles to the axis we need, therefore, we need to feed the motors a little higher speed so that it travels at the axial speed we need. To calculate how much you need to increase the speed for the motors so that the axial speed is necessary for us, we need trigonometry.

Imagine that we need to move forward at an axial speed of 10. What speed must be applied to the left and right motors so that the entire robot moves forward at a speed of 10? Let's find out. X is the required axial speed. The front wheels are off-axis by 30 degrees. The side is adjacent, so we take the cos of 30 degrees. We get 10 / cos(30) is approximately 11.54. But we have two motors, so we just halve the speed and feed the motors. (I do not take into account the direction of rotation here).

Now it's more interesting how to move to the sides? In this case, all motors must move in the same axial direction. Let's start with the back motor. It stands parallel to the axis we need, so we don't need to change its speed. Well, just split it in half, because the top and bottom parts of the robot must move at the same speed.

Now the front motors. They are located at an angle of 60 degrees to the desired axis. The side is again adjacent, we take the cosine. Next, we take half of the required speed, divide it by cosine 60, then divide it in half again, because there are two motors in front and that's it. Well, an example. If we want to move at a speed of 10 to the side, then we need to apply speed 5 to the back motor, and 2.5 to each of the front ones.

So that's why there is a cos(60).


问:
Jacobian of Euler's rotation equations
I propagate the attitude of a satellite in a free-floating, torque free environment from $t_k$ to $t_{k+1}$ by integrating Euler's equation of motion:

$$ \dot{\omega} = [J]^{-1}([\omega]_{\times}[J]\:\omega)$$

with $[J]\in\mathbb{R}^{3\times3}$ being the (full) inertia matrix and $\omega \in \mathbb{R}^3$ the angular velocity vector, and $[\cdot]_{\times}$ being the skew-symmetric operator.

If we consider an Euler integration step of $dt$, we can therefore write:

$$ \omega_{k+1} = \dot{\omega}_k\cdot dt = [J]^{-1}([\omega_k]_{\times}[J]\:\omega_k)\cdot dt$$

I would like to compute the analytical Jacobian $\textbf{F}_\omega = \frac{\partial\omega_{k+1}}{\partial \omega_k}$, or an approximation of it, in order to propagate the covariance from $t_k$ to $t_{k+1}$. Is there any known closed-form solution? With the cross-product, I really don't know how to tackle the problem.

Any help is welcome. Thank you.

答:
$$\frac{\partial\dot\omega}{\partial\omega} = [J]^{-1}\frac{\partial([\omega]_{\times}[J]\omega)}{\partial\omega}$$

$$= [J]^{-1} \frac{\partial(\omega\times[J]\omega)}{\partial\omega}$$

$$= [J]^{-1} \left (\frac{\partial\omega}{\partial\omega}\times[J]\omega + \omega \times [J]\frac{\partial\omega}{\partial \omega}\right)$$

$$ = [J]^{-1} \left (1\times[J]\omega + [\omega]_\times[J] \right) $$

Using the two definitions:

$a \times b = [a]_{\times}b = [b]^{\intercal}_{\times}a$

$[x]^{\intercal}_{\times} = -[x]_{\times}$

on the term $1\times[J]\omega$, we find the correct answer:
$$ \frac{\partial\dot\omega}{\partial\omega} = [J]^{-1} \left ( [\omega]_{\times}[J] - \left [[J]\omega \right]_{\times} \right )$$

Title: Jacobian of Euler's rotation equations


问:
How to reset odom positions of robots while setting initial positions of robots in gazebo simulation through launch file
I'm in the process of creating a coordination system for a multi robot system. For that i currently have created a ROS based simulation in gazebo using Rosbot2.0 (Robot physically available as well). Following are the launch files i used.

Template launch file for a single robot.

```<code><launch>
<arg name="tf_prefix" default=""/>
<arg name="init_pose" default="-x 0.5 -y 0.5 -z 0 -R 0 -P 0 -Y 0"/>

<!-- Load the joint space controller -->
<rosparam command="load" file="$(find joint_state_controller)/joint_state_controller.yaml" />
<node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner" output="screen" args="joint_state_controller" />

<!-- load the model of the robot" -->
<param name="robot_description" command="<span class="math-container">$(find xacro)/xacro '$</span>(find rosbot_description)/urdf/rosbot.xacro' robot_namespace:=$(arg tf_prefix)"/>

<!-- Spawn the robot_state_publisher with the desired tf_prefix -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen">
    <param name="tf_prefix" value="$(arg tf_prefix)"/>
</node>

<!-- Spawn the robot in the desired pose given by "init_pose" variable" -->
<node name="rosbot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="<span class="math-container">$(arg init_pose) -urdf -param robot_description -model $</span>(arg tf_prefix)"/>

<node pkg="tf" type="static_transform_publisher" name="map_publisher" args="0 0 0 0 0 0 map <span class="math-container">$(arg tf_prefix)/map 100"/>
<node pkg="tf" type="static_transform_publisher" name="imu_publisher" args="0 0 0.02 0 0 0 $</span>(arg tf_prefix)/base_link $(arg tf_prefix)/imu_link 100"/>
</code>```

Multi robot launch file

```<code><launch>
<!-- BEGIN ROBOT 1-->
<group ns="rosbot1">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 0.5 -y 0.5 -z 0 -R 0 -P 0 -Y 0" />
        <arg name="tf_prefix" value="rosbot1"/>
    </include>
</group>

<!-- BEGIN ROBOT 2-->
<group ns="rosbot2">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 4.5 -y 0.5 -z 0 -R 0 -P 0 -Y 1.57" />
        <arg name="tf_prefix" value="rosbot2"/>
    </include>
</group>

<!-- BEGIN ROBOT 2-->
<group ns="rosbot3">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 0.5 -y 4.5 -z 0 -R 0 -P 0 -Y 0" />
        <arg name="tf_prefix" value="rosbot3"/>
    </include>
</group>
</code>```

With these files i can load the robots into the simulation without an issue.

My target is to create a multi robot coordination system that can work with robots without knowing their initial position. So to follow that premise, when simulated, each robot's odometry and TF both needs to be zero. But with the above approach,

robot 1 starting position 0.5 0.5 0

robot 2 starting position 4.5 0.5 0

robot 3 starting position 0.5 4.5 0

are reflected as is in odom and TF.

Is there a way to keep the robots as mentioned above and still has the odom and TF to 0 0 0.

To add to that, what i need to do is simulate real world where robots start position is considered origin. In rosbot real world usage, they use rosbot_ekf to generate the odom so each robot start from 0 0 0 but actually in seperate position. I'm looking for a way to simulate that. Thanks

答:
Usually, robot's float a topic (eg /mobile_base/commands/reset_odometry for TurtleBot) to reset the odometry.

The URDF for the Rosbot2.0 uses Skid Steer plugin. This plugin does not expose a method for resetting the odometry of the robot. So you can't reset odometry by calling a topic or from launch file.

But nothing stops you from internally keeping track of the robot's initial offset/transform and correcting this initial transform manually. Or else, you can use a different robot model that supports resetting odometry (Turtlebot).


问:
What is the best SE3 library for python?
I am currently googling on this topic but I would like to hear your opinion.

What is the best self-contained SE3 library that offers interconversion between quaternion, rotation vector, transformation matrix?

Those are the functions that I often use for my projects and all implemented in Matlab. And I am looking for an alternative to avoid re-implementing them all in python.

Quaternion2RotVector and its inverse

Quaternion2RotMatrix and its inverse

RotMatrix2RotVector and its inverse

SE3 inverse, the inverse function of each rotation representation

答: I'm surpised nobody mentioned Scipy. Easy to use, mature, great docs, huge community.</p>


问:
Rack and Pinion Gear for CNC
I am trying to build a small 3D printed CNC machine but can't afford lead screws as of now. I need to 3D print a lead screw or use a rack and pinion gear system. I am a little skeptical able the rack and pinion because I don't know how big of a problem backlash will be. I need to know if I will get a +- 3mm accuracy. Is it possible to use 3D printed rack and pinion gears to make a CNC or should I 3D print a lead screw?</p>

答:
My experience-free book learning suggests that pre-loading the rack would eliminate backlash at the rack.

First, visualize where the backlash arises. When the pinion moves the rack in direction A, one side of the pinion teeth will engage one side of the rack teeth. Call these the A sides. But when the pinion goes to move the rack in direction B, first it has to rotate a little, until the B sides of the teeth engage, before the rack moves.

Now for the pre-loading: suppose you had a spring pulling the rack in direction B. When the pinion moves the rack in direction A, it has to stretch the spring, while again engaging the teeth on the A side. However, when the pinion goes to move the rack in direction B, the spring contracting actually does all the work, pulling the rack in direction B. The pinion's motion controls the rate of retraction, still fighting the spring. And all the while the A sides of the teeth remain engaged, eliminating the backlash.

This doesn't come for free, of course. Besides moving the rack and its load, the motor and geartrain driving the pinion will need to be strong enough to stretch the spring to its greatest extension. At its least extension, the spring will still need enough tension to pull the rack and whatever it is carrying. (One could fantasize the complication of replacing the spring with a separately controlled motor/geartrain whose job was solely to fight against the main one.)

Finally, backlash in the upstream geartrain won't be addressed by this scheme, unless the spring on the rack can somehow backdrive it all.

Title: Rack and Pinion Gear for CNC


问:
Wheel encoder Tick calculation
Sorry for being a newbie. Can somebody explain me how many ticks a wheel encoder would deliver (based on one complete wheel rotation), if I have a slice with 500 windows? Is the assumption correct, that 1 tick is counted per window?

Thanks

答:
That depends on what type of digital encoder you have.
A full quadrature encoder has 2 light (or magnetic) sensors detecting up and down pulses. A single light source encoder can only detect speed, but not velocity (speed and direction). A full quadrature encoder counts 2 up ticks per window and 2 down ticks for the same window. This is also how direction is calculated - which of the 2 sensors ticks up/down first determines which direction the encoder is rotating. This means there are 4 ticks for 1 window on a full-quadrature encoder.</p>

Title: Wheel encoder Tick calculation


问:
Do I need a camera along with LIDAR for SLAM?
Equipment:

Pi 3 B

Mega

2x Encoder Motor 12VDC 299RPM

MPU 6050

12V bat 2000mAh

LIDAR or Kinect ?

I want to implement EKF SLAM. I have referred bot NOX ROS wandering robot, Hussarian CORE and Robotics weekend. I have achieved localisation and sensor fusion of MPU and Encoder on Mega.

For the Mapping part, I am confused as to which sensor should be used either LIDAR or KINECT? What is the advantage of using both of them?

答:
This is a great question, as it speaks to a key design choice in robotics. For EKF, once we have odometry, another direct input is where features (landmarks) are.

For a hobbyist project, I'd say Lidar is easier to begin with. For EKF, one simple (and beginner-friendly) way is to assume everything has the same shape (cones), then use "circular regression" to recognize cones from the 2D lidar detections. The locations of the cones are ported to EKF as observations.

For more complex environment, consider particle filters. I started off with an $100 2D Lidar off of amazon, and I used ROS's navigation package (gmapping, particle filters,etc.) to get a small mobile platform running.

Depth Cameras (E.g, Intel Realsense, Microsoft Kinect) are more expensive, and 3D reconstruction can be tricky with regular cameras. I'd say for the proof of concept, Lidar is more beginner friendly and cheaper.


答:
This depends on your hardware and the software stack you are using.  A digital pulse will have two edges; rising and falling.  A simple slotted optical interrupter sensor has a single LED emitter/detector pair that can generates the signal (and so the rising/falling edges).  It does this as a disk passes by it that has slots in it.  So each slot will generate a rising and falling edge.  So the number of edges is 2 * number of slots.

A quadrature encoder has two sensors.  The sensors my be optical, like the example above, in which case there is a disk with slots.  The sensors my be hall effect sensors, in which case the 'disk' has magnets that cause the hall effect sensors to generate rising and falling edges.  So if we think of those magnets as the same as optical disk 'slots' then we can say that for a quadrature encoder that the number of edges is 4 * number of slots per rotation.

So the number of signal edges is determined by the number of sensors in the encoder and the number of 'slots' in the 'disk'.  However, if you are using a software stack to read the encoder, it may impose it's own semantics on 'ticks'; for instance, it may only count rising edges, or it may count a complete transition between rising/falling for all sensors as a single 'tick'.  So you should consult the documentation to determine what it is reporting. Also look at your encoder specification of PPR, pulses per rotation.

See DroneBot Workshop for a good explanation of encoders.

Title: Wheel encoder Tick calculation

Body:
Sorry for being a newbie. Can somebody explain me how many ticks a wheel encoder would deliver (based on one complete wheel rotation), if I have a slice with 500 windows? Is the assumption correct, that 1 tick is counted per window?

Thanks


问:
what method should I use for putting rubber bands on wheels?
I have a BOE bot PBasic2 stamp based robot that came with rubberband "tires" for the wheel. however, they are very tight and I can't figure out how to get them onto the plastic hubs.
the furthest I've gotton was mostly covering the outside, but when trying to make it less crooked it came off again.
is there some trick to getting those pesky tires to stay on?</p>

答:
A BOE wheel is shown below.

To get the tire (the outer rubber ring) onto the wheel, pulling a thin string around between the wheel and tire might work.  However, you might also try slightly heating the ring (eg, with a hair dryer), which is likely to make the ring slightly more flexible and stretchy.  Be careful not to overheat the ring.  Uncontrolled hot air from a heat gun probably is too warm and would risk melting the ring.


问:
Calculate transform from different poses
My robot is at a starting pose $s_0 = (x_0, y_0, \theta_0)$ and, while moving, I receive a sequence of motion measurements $[\mu_1, \mu_2, \: ... \: \mu_n]$, where $\mu_i = (\Delta x_i, \Delta y_i, \Delta \theta_i)$, generating the path $[s_0, s_1, s_2, \: ... \: s_n]$.

At the first pose $s_0$ a landmark $l$ is measured with measurement $z_0 = (l_x, l_y)$, where $l_x$ and $l_y$ are the $x$ and $y$ coordinates of the landmark in the reference frame of $s_0$.

Here is an explanatory schema:

What I need is to find the landmark measurement $z_0$ in the reference frame of the last pose, $s_n$. In the image above, it would mean computing $z_3$, i.e. the measurement $z_0$ in the reference frame of $s_3$.

My idea is to use homogeneous coordinates to get the matrix transformations between poses, i.e.

\begin{equation}
s_n = M_{n-1}^n  M_{n-2}^{n-1}\: ... \: M_0^1 s_0
\end{equation}

and do the backward chaining of inverses to find $z_3$. But I don't really know how these matrices should be, and how to do the second step using the inverses.

答:
I am just going to explain from the basics. So feel free to skip through the first part and scroll to the bottom if you want the answer.

Basics:

The 3 parameters of your pose are $x,y,\theta$.

These can be stored as homogeneous matrix which is the combination of the translation($x,y$) and the rotation($\theta$).

It looks like so

$$\begin{bmatrix}
cos(\theta) & -sin(\theta) & x\\
sin(\theta) & cos(\theta) & y \\
0 & 0 & 1
\end{bmatrix} $$.

The advantage of this homogeneous representation is that it allows us to chain together poses using matrix multiplication, and that the inverse pose/transform is equal to the matrix inverse.

Note when working with homogeneous points you may notice that the sizes of your landmarks(2x1 vector) and the transform(3x3) matrix don't match. So you also have to convert your landmarks to the homogeneous form by appending a 1 to the end.
$[x,y] -> [x,y,1.0]$.

So each of your poses($M$). Can be represented by one of these 3x3 matrices.

So you will have $M_{s_1}^{w},...M_{sn}^{w}$

Your landmark position I'll represent as $l_{s0}$ or $l_{w}$ where the subscript is in which coordinate frame it is observed.

Your delta transforms can also be represented as a matrix.
$$u_1 =
\begin{bmatrix}
cos(\delta\theta) & -sin(\delta\theta) & \delta x\\
sin(\delta\theta) & cos(\delta\theta) & \delta y \\
0 & 0 & 1
\end{bmatrix} = M_{s_1}^{s_0} $$.

So now you can transform one pose into another by just multiplying it by your delta transform.

$$ M_{s_0}^{w} * u_1 = M_{s_0}^{w} * M_{s_1}^{s_0} = M_{s_1}^{w}$$

In this case I use $w$ to represent some arbitrary global frame in which all your poses and landmarks exist. For our purposes we can just say it is the origin $x=0,y=0,\theta=0$, and we can sometimes ignore writing it down($M_{s_1}^{w}=M_{s_1}$). I ,however, think it is good practice to always write it as it makes sure you chain your poses together correctly.

Multiplying transforms and landmarks

When you are multiplying landmarks and transforms your are essentially changing the coordinate frames.

$$ M_{s0}^{w} * l_{s0} = l_{w}$$

Here we are transforming a landmark in the $s0$ frame to the world frame$w$.

$$ M_{s0}^{w} * M_{s1}^{s0} = M_{s1}^{w}$$

Here we are computing the pose of the $s1$ frame in world.
Note that we can also remove the intermediate coordinate frames because they essentially cancel each other out. Here $s0$ is cancelled.

You can also rearrange the equation (they are just matrices) if you want to compute something else.

$$ M_{s0}^{w} = M_{s1}^{w}* {M_{s1}^{s0}}^{-1}$$

The two key things to remember are that it is matrix multiplication(so order matters), and that coordinate frames should always match.

So for landmarks the subscripts must match.

OK
$$ M_{s0}^{w} * l_{s0} = l_{w}$$

NOT OK
$$ M_{s1}^{w} * l_{s0} = l_{w}$$

And for poses the subscript of the preceding term and the superscript of the after term must match.

OK
$$ M_{s0}^{w} * M_{s1}^{s0} $$

NOT OK
$$ M_{s0}^{w} * M_{s0}^{s1} $$

This rule even works with inverse because the inverse operation flips the subscript and superscript.

$${M_{s1}^{s0}}^{-1} = M_{s0}^{s1}$$

Solution:

Given:

Landmark($l_{s0}$) in $s0$

 Pose $s0$ which is $M_{s_0}^{w}$  (I noticed afterwards you don't even need this information, since everything is relative for you.)

delta transforms $u1,...,u3 = M_{s_1}^{s_0},...,M_{s_3}^{s_2}$

Want:

Landmark in $s3$. ($l_s3$)

From the subscripts we know we want an equation that looks like the following.

$$l_{s3}=M_{s0}^{s3} * l_{s0} $$

So we want to find $M_{s0}^{s3}$.

So just chain together the transforms making sure that our coordinate frames match.

$$M_{s0}^{s3}=M_{s_2}^{s_3}M_{s_1}^{s_2}M_{s_0}^{s_1}$$

Remember that our inverse flips the subscript and superscript. So to get $M_{s_2}^{s_3}$ we just invert our delta transform ${M_{s_3}^{s_2}}^{-1}$.

Answer 1:
$$l_{s3}=M_{s_2}^{s_3}M_{s_1}^{s_2}M_{s_0}^{s_1} * l_{s0} $$

Now this is actually kind of ugly because we have to invert all of our delta transforms. Another better option is to only invert the final transform.

$$M_{s0}^{s3}={M_{s3}^{s0}}^{-1}={(M_{s_1}^{s_0}M_{s_2}^{s_1}M_{s_3}^{s_2})}^{-1}$$

Answer 2:
$$l_{s3}={(M_{s_1}^{s_0}M_{s_2}^{s_1}M_{s_3}^{s_2})}^{-1} * l_{s0} $$


问:
How can I control an Irobot Create using Jetson Nano?
I have an irobot create 4400 model and I'm trying to use a jetson nano to send commands to it. I want to try this example that turns on the play led. I connected the tx and rx and gnd ports from J41 header on the jetson nano to rx and tx and gnd ports on create's db25. Here's my code.

However, the create just won't move at all. I don't know if I'm missing some setup steps or just simply my codes are wrong. I wonder if anyone could be kind enough to check and see if there's anything wrong with my code? How would u write it if u want to send this command? Sorry if my problem is a bit foolish, but I'm really new to this and everything seems so complicated.

答:
Try this API note this is a python API.
https://pypi.org/project/pycreate2/</p>


问:
Calculating wheel linear velocity from body velocity
A frame {b} is attached to the centre of a robot chassis. The planar configuration is given by $(x,y,\phi)$ where $\phi$ is the angle between the x axis in {b} and the x axis of a fixed reference frame {s}.

The robot has 4 wheels; the centre of each is given by $(x_i,y_i)$ in {b} where i=1 to 4. The distance of the centre of the robot from the centre of each wheel is given by $l$ along the x-axis and $w$ along the y-axis.

The linear velocity of the centre of the $i$th wheel is given by the following equation. How do I derive/understand the middle mapping matrix?
$$\begin{bmatrix}v_{x_i}\\v_{y_i}\end{bmatrix} =
\begin{bmatrix}-y_i&1&0\\x_i&0&1\end{bmatrix}
\begin{bmatrix}\dot\phi\\\dot x\\\dot y\end{bmatrix}$$

I've seen the same equation in 2 places, both in a 4 mecanum wheeled mobile robot context:

Equation 7 in this paper. It says it has something to do with the motion being planar.

Equation 13.5 in the book Modern Robotics by Kevin Lynch . There are other matrices in the equation but I'm mainly focused on this particular mapping matrix.

答:
The matrix you have termed the "mapping matrix" is meant to translate between the twist (linear and angular velocity) of the robot and the linear velocity of the centre of each individual wheel, as you have said.

The easiest way to understand what is going on is to note that if the robot is rotating, then the linear velocity of each wheel will be a combination of both the linear velocity of the robot's central frame {b} and its angular velocity about that frame. The purpose of the matrix is to account for both of these contributions based on the relative position of each wheel relative to the central frame.

If we separate out the equations based on the matrix, we end up with the following:
$$\begin{matrix}v_{x_i} = \dot x - \dot \phi y_i\\v_{y_i} = \dot y + \dot \phi x_i\end{matrix}$$

The first term on the right side of each equation is the linear velocity of the robot in the given direction, while the second term is the contribution to the wheel's linear velocity due to the rotation: an offset in the $\hat y$ direction contributes inversely
to the velocity in the $\hat x$ direction and an offset in the $\hat x$ direction contributes proportionally to the velocity in the $\hat y$ direction.

To visualize where these come from, you can imagine that the robot is a disc spinning about its centre (the frame {b}) with an angular velocity of $\dot \phi$ (which by convention is positive in the counter-clockwise direction). The contribution of the angular velocity of the robot to each wheel centre's linear velocity will be the same as the linear velocity of the point on the disc at that wheel's centre.


问:
Why use timing belt drives in Stepper Driven Robotic Arm
This may be a noob question. I am sorry if it is but I am new to this field. I am working on a design of SCARA Robot and I am using Stepper Motors to drive it. In many youtube videos, I have seen that they increase the torque using timing belts. Now I understand that in most cases timing belts are used for keeping motors away from the joints to reduce inertia. But I don't understand why they use ratio in belt drive. As far as I know, Stepper motors provide high torque at low speeds and vice versa. Then Stepper Motor should provide that much torque at reduced speed by default, right? Or I am missing something?</p>

答:
Even at zero speed, stepper motors have a max torque, called the holding torque. If your design needs even higher torque than that, you could use a bigger (heavier, more expensive) motor. Alternatively, use a ratio in the belt drive.

To be concrete: a 1:2 ratio will double the available torque, but at the expense of making things 2x slower. It will also double the resolution by making each stepper step half-size.

A design with a very high ratio would start looking like a gearbox, which would suggest revisiting the approach.


问:
unable to publish values of costmap_2d occupancy grid
Here's how my code looks -

```<code>costmap_2d::Costmap2DROS *global_costmap = new costmap_2d::Costmap2DROS("global_costmap", buffer);
</code>```

I have specified the following params in my configuration file -

```<code>global_frame: odom
rolling_window: true
track_unknown_space: true

plugins:
  - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
  - {name: inflation,                 type: "costmap_2d::InflationLayer"}
</code>```

I am able to publish the occupancy grid using the terminal by running rostopic echo -n1 /global_costmap/costmap.

However, when I add the following line to my code -

```<code>unsigned char* global_og = global_costmap->getCostmap()->getCharMap() ;

cout << global_og[10] << endl;
</code>```

I see some strange characters being published.

答:
I could resolve the issue by using cout << (int)global_og[10] << endl;

I needed to cast the unsigned char to int.


问:
I am an entrepreneur and I want to start building robots for businesses, where do I start?
Over the last couple of years I've had good success with my technology startups and now looking to enter into robotics. I was interested in robotics and automation ever since I was a kid (yes, that sounds nerdy). So my question is: Where to get started, what to build? and how to sell? And lastly, how difficult it is to sell in this industry?</p>

答:
To answer your questions:

Where to get started?

Start with an idea, talk to some experts about feasibility, hire someone to build a prototype, then get funding and produce your final product.

What to build?

Build something that is useful, if you want it to be marketable.

How to sell?

The same way you sell anything else... market it to the right demographic.

How difficult it is to sell in this industry?

Can't answer this, because it largely depends on what you're selling and how good you are at selling things.


问:
Localization of a mobile robot with odometry using quadrature encoders . Is it feasible?
My goal is to localize a mobile differential drive platform using just quadrature encoders using dead reckoning. The robot will operate indoors and is to execute goal to goal trips through hallways and corners.

Is it feasible to know the exact location through odometry using encoders.
A sample paper that discusses this - Kinematics, Localization and Control of Differential Drive
Mobile Robot

Please share any papers/projects/blogs that have tackled localization in autonomous robots. Thank you

答:
Looking over the linked paper, the abstract includes "Both  experimental  and  simulation  results  confirm   the   effectiveness  of  the  achieved  control  algorithms...", however, I don't actually see any experimental results in the paper, just simulation.  So they don't ever estimate the accuracy of the technique in real-world conditions that I can see.

There are ways to both calibrate odometry parameters and measure accuracy over time.  I would do a google search for 'UMBmark method'.  Here is an article explaining the UMBMark method.  Using that method, you can make your wheel-encoder based dead-reckoning as accurate as possible.

You can improve dead-reckoning accuracy by combining inertial navigation with wheel encoders; inertial navigation is a good complement to wheel encoders because it can detect wheel slippage.  But inertial navigation also accumulates unbounded errors, so while adding it can be an improvement, dead reckoning will still accrue unbounded errors overtime.  You need some other means of localization to fix these errors periodically.

This paper compares various methods for visual (camera based) odometry and localization.  Typically wheel-encoder based odometry is used for high frequency state propagation and camera-based localization can be used for lower frequency updates.


问:
Why does ROS2 claim to be "real time"?
ROS2 uses DDS, in the wiki it says that DDS is "The Data Distribution Service (DDS) for real-time systems is an Object Management Group (OMG) machine-to-machine (sometimes called middleware or connectivity framework)"

The question is, how can a real-time system run within a general-purpose operating system (like ubuntu, windows, etc)? a real-time system is supposed to be predictable and to ensure that it should communicate directly with the hardware (i.e. hardware timers) instead of being handled, for example, with ubuntu

答:
"Realtime" is a fairly vague term. What ROS is referring to is often termed "soft realtime" because it is able to calculate control actions as fast enough to keep up with the robot's physical motion. More often than not, this is actually good enough and certainly easier to achieve. Especially if watchdog timers are used appropriately, soft realtime systems can be very reliable.

What you are referring to, requiring strict guarantees on latency, would then be termed "hard realtime". At first it might seem this is necessary for robotic control but it really isn't. If the control is a little bit late the system doesn't suffer catastrophic failure; the performance is just a bit worse. For safety systems, though, hard realtime is often required.

Title: Why does ROS2 claim to be "real time"?


问:
time varying gain LQR vs fixed gain LQR, in finite horizon and infinite Horizon
Consider the dynamic system
$\dot{x}=Ax+Bu$ and the optimal control formulation of
$J = x^TQx + u^TRu$, with optimal linear feedback $u=Kx$ where $K$ is the gain matrix, and I use $k$ to denote time step from 0 to N.

From one book, I read the Riccati iteration derived from dynamic programming going backward from N to 0 (I use prime to denote matrix transpose below) as

$K(k)=-(B'\Pi(k+1)B+R)^{-1}B'\Pi(k+1)A$ with $k=N-1,N-2, ..., 0$
where
$\Pi(k-1)=Q+A'\Pi(k)A-A'\Pi(k)B(B'\Pi(k)B+R)^{-1}B'\Pi(k)A$ with $k=N-1, N-2, ..., 0$
This is a time varying optimal gain, I guess $K(0)\neq K(k)$?

However, from another book, I read the algebraic Riccati equation using variational method, a matrix P has to be found satisfying
$PA+AP^{'}-PBR^{-1}B^{'}P+Q=0$, then the optimal gain is
$K=-R^{-1}B^{'}P$.

My question is, does this mean for discrete time, the optimal LQR gain should be time varying and for continuous time the optimal LQR gain should be a constant matrix? If so, what is the key insight causing such a difference ?

答:
The algebraic Riccati equation is for the infinite horizon LQR. For finite horizon one can use the Riccati differential equation

$$
-\dot{P}(t) = P(t)\,A + A^\top P(t) - P(t)\,B\,R^{-1}B^\top P(t) + Q. \tag{1}
$$

The reason why $(1)$ gives an expression for $-\dot{P}(t)$ is because one has to start the differential equation at the time horizon $T$ with $x(t)^\top P(T)\,x(T)$ the terminal state cost and $(1)$ is solved backwards in time until $t=0$.

Similarly, for discrete time one also has the infinite horizon LQR with an associated algebraic Riccati equation, and the finite horizon LQR with an associated Riccati difference equation.


问:
Choosing path planning and obstacle avoidance algorithm for 2D space
I am working on a 2D space where my robot needs to follow a trajectory while avoiding some obstacles.

I've read recently about methods for path planning as "Vector Field Histogram" and the "Dynamic window approach".

Is it worth to use these kind of algorithms for a 2D space or should I go with something as Potential Fields or Rapidly-Exploring Random Trees?

答:
As you can reduce the path planning and collision avoidance of aircraft down to 2D if you do not include separation by height, I will use aerospace as the example. One school of thought is that collision avoidance is different from path planning, because in high level path planning you can assume that you have complete knowledge of the other aircraft or obstacles that
you are avoiding. In collision avoidance you
are limited by the sensors available. The levels of mission planning are shown in the Figure:- Planning Hierarchy with Spatial Decomposition, collision avoidance is most
applicable to the safety or low level trajectory planning. Also shown in this figure
are the time requirements for data from each
of the systems. Collision avoidance is the
point at which, if you do not alter course
you will crash. The two places where this
can be observed are in controlled airspace
within the terminal region (airports) and where
the airways intersect. Rules of the Air dictate a set of rules, which if followed prevent this happening. Pilots are not very
good at see-and avoid as they are required
to perform stability and control, communications and high level mission planning. This
means that collisions are not detected as early
as they should be and then become a critical last second maneuver.

In large aircraft, Traffic Collision Avoidance System (TCAS) is used to make the pilots aware of
where approaching aircraft are. TCAS is a co-operative system, which works on the assumption
that both aircraft will have TCAS. If only one aircraft has TCAS, for example a large aircraft
flying
towards a micro-light, a collision will occur. The large aircraft may turn in one direction, and the
micro-light (who has had no communication with the aircraft) may turn in the same direction. As
mentioned above the issue is with small aircraft, which are unable to carry the large, power hungry
TCAS systems. Larger gliders carry a FLARM system (The name is inspired from Flight Alarm),
which broadcasts its own position and speed vector; but this does not communicate with TCAS, it
just senses the approaching aircraft (only it has FLARM also, leaving the same problem mentioned
with the micro-light).

These systems, which will be on most aircraft in the next ten to fifteen years, have in
influenced many experts in this field, to assume that the position of all aircraft within the operating area will be known. Though it should be noted that, whilst this would be a logical conclusion to draw in controlled airspace, in uncontrolled airspace this cannot be definitively said, because it does not account for the aforementioned small aircraft that are unable to carry such systems.

In order to deal with the situations described above in uncontrolled airspace there are three types
of collision detection sensors:

Cooperative : That tell you where they are (e.g. ADS-B)

Passive : Take data in (e.g. Camera's)

Active : Send out signals to receive
information back (e.g. Radar/Sonar or Lasers)

After the sensor data is acquired, in order to work out where to go, the sensor data is analysed
using Collision Avoidance Algorithms:

Potential Fields : Real time obstacle avoidance method. `Robot
motion can be considered as a particle that moves in a gradient
vector field generated by positive and negative electric particles'
The advantage is that it is simple. The disadvantage is the local
minima condition where the robot can get stuck between two walls or
obstacles.

Vortex Potential Field : In order to reduce the problem of the local minima, a vortex can be added to the potential field, the disadvantage of this is that it forces the vehicle one way round the obstacle and this can lead to a sub-optimal path.

Bug Algorithms : Simple to find optimal leave points, the 'simplicity    of these algorithms leads to a number of shortcomings. None of these    algorithms take into account robot kinematics which is a severe    limitation.'

Roadmap : Captures the connectivity of the robots free space into one
dimensional curves 'If more than one continuous paths can be found,
the shortest patch might be selected according to Dijstra's algorithm
or the A* algorithm' Drawbacks are `time and storage complexities
when the environment is complex'

3D Geometric : 'does not require the solution of any programming
problem, thus resulting suitable for real time applications'

Azimuth Approach : Using passive camera video feeds and image
processing techniques to spot the aircraft and detects a collision
based on change in azimuth angle. This method can be very processor
intensive.

Collision Cone : Transforms the velocities of both aircraft into
relative velocities. A safety region is drawn around the obstacle
aircraft and a cone is used to connect the region to the avoiding
aircraft. A potential collision is detected when the relative
velocities are within the cone.

A number of path planning algorithms have been discussed in the other answers so I will not repeat them here.

In conclusion you need to fully understand the problem you are dealing with before you can design a collision avoidance algorithm or path planning algorithm to suit the purpose. Many collision avoidance algorithms and path planning algorithms are compared using a simple bicycle model which may or may not be representative of your final application. If the model is not representative then its like tuning a controller for one system then implementing it on another.


答:
As r-bryan answered they do increase the effective torque. However that also increases the effective resolution giving you better repeatability. As an example a direct drive motor that provided a 0.1 degree repeatability using a 4 to 1 ratio belt drive would give you a 0.025 degree resolution. The trade off is a lower speed.

As secondary effect is that in case of a collision, the belt will absorb a certain amount of the impact possibly preventing damage to the motor.

Title: Why use timing belt drives in Stepper Driven Robotic Arm

Body: This may be a noob question. I am sorry if it is but I am new to this field. I am working on a design of SCARA Robot and I am using Stepper Motors to drive it. In many youtube videos, I have seen that they increase the torque using timing belts. Now I understand that in most cases timing belts are used for keeping motors away from the joints to reduce inertia. But I don't understand why they use ratio in belt drive. As far as I know, Stepper motors provide high torque at low speeds and vice versa. Then Stepper Motor should provide that much torque at reduced speed by default, right? Or I am missing something?</p>


问:
IMU gravity sensing
How are IMUs used to sense the direction of gravity? I have read a number of articles that talk about using IMU for orientation of flying robotics but I do not understand how. Could someone explain how?

To be more concrete, how can we differentiate between acceleration of the vehicle and gravity?

答:
That is partly possible if you fuse linear acceleration and angular velocity.

Estimate the gravity direction from IMU when the robot is stationary. Now you know the gravity direction.

Once your robot starts to move around, your IMU will give you the estimation of acceleration where gravity and real acceleration are mixed. How to extract the real acceleration?

Estimate your robot orientation by accumulating angular velocity from a gyrometer. Now you know where is the gravity direction with respect to your flying robot body frame.

Rotate a gravity vector [0 0 -9.81] into your current robot body frame.

Substrat your rotated gravity vector from the acceleration.

Now you have a pure real acceleration without gravity.

This works only for a few seconds or minutes due to the accumulated errors of the gyrometer. You need extra sensors such as a camera to continuously compensate the IMU bias and get the correct acceleration.

Title: IMU gravity sensing


问:
How to actually fuse sensor using Extended Kalman Filter
Background

I'm working on 4-omniwheel mobile robot. It have encoder on each wheel and MPU 6050 IMU. The robot positioning suffer a great error because slip, so i try to increase the accuracy of positioning by fusing sensor value from encoder and IMU.

Question

I have look a lot of paper regarding sensor fusion using EKF [1][2][3].

With algorithm of EKF

$$\hat\beta^-_k=f(\hat\beta^+_{k-1},u_k)$$
$$P^-_k=F_kP_{k-1}F^T_k+Q_k$$
$$K_k=P^-_kH^T_k(H_kP^-_kH^T_k+R_k)^{-1}$$
$$\hat\beta^+_{k-1}=\hat\beta^-_k+K_k(z_k-h(\hat\beta^-_k))$$
$$P^+_k=P^-_k-K_kH_kP^-_k$$

state to predict

$$
    \left[\begin{matrix}
    x \\
    y \\
    \theta \\
    \dot x\\
    \dot y\\
    \omega\\
    \end{matrix}\right]
$$

and measurement model of each sensor

Encoder[4]
$$h_{encoder} = \left[\begin{matrix}v_1\\v_2\\v_3\\v_4\\\end{matrix}\right]$$
$$H_{encoder} = \frac{r}{4}
\left[\begin{matrix}
0 & 0 & 0 & 1 & 1 & \frac{1}{a+b}\\
0 & 0 & 0 & 1 & -1 & \frac{-1}{a+b}\\
0 & 0 & 0 & 1 & 1 & \frac{-1}{a+b}\\
0 & 0 & 0 & 1 & -1 & \frac{1}{a+b}\\
\end{matrix}\right]$$
$$z_k = H_{encoder}\beta_k+v_k$$

IMU
$$h_{imu} = \left[\begin{matrix}\theta\\\omega\end{matrix}\right]$$
$$H_{imu} = \left[\begin{matrix} 0 & 0 & 1 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 1\end{matrix}\right]$$
$$z_k = H_{imu}\beta_k+v_k$$

I'm not quite sure where to put both sensor equation. I mean in EKF algorithm, I can literally place $h, H$ and $z_k$ of sensor on Step 3, 4 and 5 one at a time. But how to put both of IMU and Encoder equation? Or maybe I have misunderstanding about EKF sensor fusion?

Reference

E. I. Al Khatib, M. A. Jaradat, M. Abdel-Hafez and M. Roigari, "Multiple sensor fusion for mobile robot localization and navigation using the Extended Kalman Filter," 2015 10th International Symposium on Mechatronics and its Applications (ISMA), 2015, pp. 1-5, doi: 10.1109/ISMA.2015.7373480.

V. Sangale and A. Shendre, "Localization of a Mobile Autonomous Robot Using Extended Kalman Filter," 2013 Third International Conference on Advances in Computing and Communications, 2013, pp. 274-277, doi: 10.1109/ICACC.2013.59.

Jingang Yi, Junjie Zhang, Dezhen Song and Suhada Jayasuriya, "IMU-based localization and slip estimation for skid-steered mobile robots," 2007 IEEE/RSJ International Conference on Intelligent Robots and Systems, 2007, pp. 2845-2850, doi: 10.1109/IROS.2007.4399477.

C. Röhrig, D. Heß and F. Künemund, "Motion controller design for a mecanum wheeled mobile manipulator," 2017 IEEE Conference on Control Technology and Applications (CCTA), 2017, pp. 444-449, doi: 10.1109/CCTA.2017.8062502.

答:
I've never worked on Mecanum wheels before so I researched a bit. One of the first things I look for is there has to be a way to combine all of the encoder velocity measurements. Apparently, Jacobian equation can be used for that (I believe it is H_encoder in your question).

You can calculate system's velocity by

\begin{equation}
\left[\begin{array}{c}
V_{X} \\
V_{Y} \\
\omega_{Z}
\end{array}\right]=J^{+}\left[\begin{array}{c}
V_{1 W} \\
V_{2 W} \\
V_{3 W} \\
V_{4 W}
\end{array}\right]
\end{equation}

where J+ is pseudoinverse matrix. Using the fact that lineer velocity is just a product of angular velocity and wheel radius,

$$
\left[\begin{array}{c}
V_{X} \\
V_{Y} \\
\omega_{Z}
\end{array}\right]=\frac{R}{4}\left[\begin{array}{cccc}
-1 & 1 & 1 & -1 \\
1 & 1 & 1 & 1 \\
-\frac{1}{a} & \frac{1}{a} & -\frac{1}{a} & \frac{1}{a}
\end{array}\right]\left[\begin{array}{c}
\dot{\theta}_{1} \\
\dot{\theta}_{2} \\
\dot{\theta}_{3} \\
\dot{\theta}_{4}
\end{array}\right]
$$

From here, you can easily calculate position by integrating this equation. Using limit definition of derivatives you have,

$$\frac{\left[\begin{array}{c}
X_{X} \\
Y_{Y} \\
\theta_{Z}
\end{array}\right]_{k} - \left[\begin{array}{c}
X_{X} \\
Y_{Y} \\
\theta_{Z}
\end{array}\right]_{k-1}}{ \delta T}=\frac{R}{4}\left[\begin{array}{cccc}
-1 & 1 & 1 & -1 \\
1 & 1 & 1 & 1 \\
-\frac{1}{a} & \frac{1}{a} & -\frac{1}{a} & \frac{1}{a}
\end{array}\right]\left[\begin{array}{c}
\dot{\theta}_{1} \\
\dot{\theta}_{2} \\
\dot{\theta}_{3} \\
\dot{\theta}_{4}
\end{array}\right]_{k}$$

Rewriting,

$$\left[\begin{array}{c}
X_{X} \\
Y_{Y} \\
\theta_{Z}
\end{array}\right]_{k}=\left[\begin{array}{c}
X_{X} \\
Y_{Y} \\
\theta_{Z}
\end{array}\right]_{k-1}+\frac{R}{4}\left[\begin{array}{cccc}
-1 & 1 & 1 & -1 \\
1 & 1 & 1 & 1 \\
-\frac{1}{a} & \frac{1}{a} & -\frac{1}{a} & \frac{1}{a}
\end{array}\right]\left[\begin{array}{c}
\dot{\theta}_{1} \\
\dot{\theta}_{2} \\
\dot{\theta}_{3} \\
\dot{\theta}_{4}
\end{array}\right]_{k} \delta T$$

So with these equations, you have propagation equations of the system (just add Gaussian white noise for measurement equations). This brings us to a competitive sensor fusion on theta value, since both IMUs and encoders are "sensing" it. You can check on some competitive sensor fusion algorithms. Most of the time people just average them. After that, you will have simple H matrix for kalman filter.

$$ H = \begin{bmatrix}
1 & 0 & 0 &0  & 0 &0 \\
0 & 1 & 0 & 0 & 0 &0 \\
0 &0  &1  & 0 & 0 &0 \\
 0& 0 & 0 & 0 & 0 & 1
\end{bmatrix} $$

Edit: Forgot to give reference: Kalman Filter Sensor Fusion for Mecanum Wheeled Automated Guided Vehicle Localization


问:
May I get this robot arm to be controlled via drawing, not programming?
I got an Omron Viper 850 robot arm with a spindle mounted with a cutter. It is controlled via EV+ programming (EV+ is a programming language used in the ACE Adept Omron software to move the robot).

The idea, initially, was to use it to cut some plastic car plates that goes inside of the car. But I have a bunch of different models of car plastic plates and now I am having a bad time doing a program for every plastic plate model that I have to cut. Each program takes 1~2 days to be ready and the curves are not perfect.

The question is if theres some drawing software that enables me to take a photo from the plastic plate, delimit the borders and gets the robot to cut it. Or at least, a software for this robot that permits make some drawings and get the robot to follow the path, alike a CNC machine being controlled by MACH3 software.

Thanks in advanced.

答:
I doubt you will find an out of the box solution, but you can piece together a solution if you have some programming knowledge.

There are many image to G-Code converters out there. You can use one of these to convert your image to G-Code. The most interesting part of this are the coordinates. Your robot is also controlled by coordinates, but instead of a G01 command (in G-Code) it has a Move command. All you need to do is write a small script that replaces the G-code syntax in the G-Code with your eV+ syntax. It does not need to be a full blown interpreter and pretty printer. These programming languages have a very simple syntax, you can just do string manipulation (replace  substrings, add or remove , or ;) and it should work.


问:
What is the best way to simulate Staubli robots inside a C++/C# app
A little bit of context : I want to create an app using C++ (or C#) to handle 3D objects (obj), I will perform some operations on those 3D models to create some robotic trajectories. Then I want to simulate those trajectories showing the Staubli robot (a tx2-90) to the user.

I am totally new in the 3D coding world and so far I've only been using manufacturers softwares (for staubli it's SRS which integrates a powerful simulator) but now I want to create my own app to simulate the behavior of the robot when given different trajectories.

What librairies or 3D engines (considering I have some 3D objects to handle as well)  should I use for that? Gazebo (same thing for RoboDk apparently) seemed pretty promising but it seems that you can't modify the interface and I need something I can have the hand on as it's going to be a proprietary interface.

I am struggling to find my starting point for this so if you could guide to some ressources or anything that would be lovely!

Thank you in advance!

答: First I do work for Staubli robotics. Having made that clear, Staubli does have a robot emulator and 3D viewing environment as part of the Staubli Robotics Suite software. The unlicensed version is available for free. It does not allow you to actually create applications, but you can run existing applications on the emulator and see a 3D model of the arm move. Purchasing a developers license allows to create applications using the VAL 3 language and to add objects to 3D environment for a more realistic looking simulation. We do offer academic discounts for educators and students. a e-mail address with a .edu extension is accepted to obtain the academic discount.</p>


问:
Is there a way to send commands to the Staubli CS9 from remote system via TCP/IP??(like ur_rtde, urx libraries for UR robots)
I am new to ROS development and Staubli robots. Though i have some prior knowledge on UR5e, I am finding it hard to understand the architecture of Staubli and its other programming interfaces (like staubli robotics suite) and more importantly, is there a way to send commands to the robot from remote system via TCP/IP??(like ur_rtde, urx libraries for UR robots).

So can anyone suggest a beginners tutorial or a guide where i can get a good understanding on the staubli's architecture(VAL3, SRS) and its ROS interfacing. I am not able to find much information or troubleshooting tutorials in the internet (no idea why). It looked like a very closed loop for a beginner like me. Any help from your side would be very helpful.

Thanks in advance. As i can't find any good forums (like UR forums) for Staubli (please suggest one,if anyone knows) , I thought this would be helpful for me.

答:
First I want to say that I do work for Staubli. While Staubli does not directly support ROS, others have done some development work using ROS with our robots. most of them were with the older CS8C controller.

There is a github depository with a driver that should work with the both the CS8C and the CS9 controller. I have not actually used this driver.

https://github.com/ros-industrial/staubli_val3_driver