问:
What makes Kuka robots better?
KUKA seems to be everywhere, why are they better?
Or, what makes one robot(robotic arm) better than
another anyway?

How much does the raw material of a robot cost
compared to its price? Is most of the cost
of the robot in Intellectual property?

Thanks!

答:
Kuka is not generally better. Better at some aspects, worst at others. Kuka does not seem to have the largest market share by revenue (according to thisarticle from 2017) (Admittedly direct revenue from industrial robot sales is hard to measure and the article is old)

If a robot arm is better or worst then the other one is heavily application and context dependent. A different manufacturer might fit the application better, but if a company already has a number of Kuka robots, they will probably keep buying Kuka robots, as mixing different brand will increase maintenance and training costs.

Kuka robots offer some advanced software packages that go beyond just moving the robot. Software packages e.g for welding integrate with welding tools and ease the workload of robotic welding engineers by offering an integrated solution. Kuka is not the only manufacturer doing this, but it is recognized as one of the robot manufacturers, who offers more advanced software features, a large number of integrations with other equipment and advanced SW features which go beyond simple robot motion.

Generally the positioning precision, maximum velocity, reach and maximum payload is comparable between the top industrial robot manufacturers, with small exceptions, like Kuka and Fanuc offering extra high payload capacity. There are some differences in the mechanical capabilities, but the main difference between robots is software features and functions and technical support from the manufacturer.

It is hard to say what is the raw material cost of a robot, since robot manufacturers have (presumably) significant discounts on list prices from suppliers (raw metal suppliers,  motor suppliers, gearbox suppliers, drive amplifier suppliers, connector suppliers, cable suppliers, cabinet suppliers, to name only the big ticket items). Building a prototype robot (incl. mech and elec design) without software, at list prices would be probably more expensive then buying a robot. One could speculate, that the  materials and equipment used in an industrial robot should be less then half of the cost of the robot, for a robot manufacturer, since the robot sales should be able to keep the company profitable. (And there are many auxiliary activities which need to be carried out at these companies, besides the actual production)

IP can be a big issue and robot manufacturer patent their designs and inventions at a significant cost, but patents for the most basic functions of a robot have expired a long time ago.

Title: What makes Kuka robots better?


问:
How to design a robot chassis so as to avoid bending issues?
I'm good on the programming, control systems and electronics aspect of robotics, but need help with a problem with mechanical design.

How do I avoid bending of my chassis due to weight?
It is a 2 wheeled differential drive robot with a castor wheel in front. Since these are the only three contact points, the chassis is bent along Xand Y axis. What changes can I make to the design to avoid this effect by the bending stress?

答:
It is difficult to provide a specific answer due to not knowing details of your design, but consider these factors for the deflection of a beam.  They should give you ideas.

For a beam supported at the endpoints, with a load in the center, the deflection increases if:

The load increases.

The distance between endpoints increases.

The deflection decreases if the material supporting the load:

Has a higher Young’s modulus.

Is thicker.

Interestingly, the distance between endpoints very much affects the deflection - all of the other parameters are linear for increasing or decreasing deflection except for the distance.  For that parameter, the deflection increases relative to the cube of the distance between endpoints.

So what can you do?

lighten the load

move the attachment points closer together

use a stronger base to hold the load

use a thicker base to hold the load

Now it gets interesting.  You don’t need to increase the strength or thickness of the whole platform, just that of the material between the connection points.   Consider if you added a thin, flat bar of metal to brace the platform.  This bar is much more easily deflected if it lies flat relative to the floor than it is if it is mounted with the longer dimension vertical (like a wall instead of a floor).  But that is harder to mount.  So here is my favorite idea besides moving the mount points closer together:  use angle braces under the platform between your attachment points.   The 90 degree angle allows you to have a horizontal surface for mounting to the platform, and the vertical section provides the strength and thickness to counter the deflection force.

ContentLicense: CC BY-SA 4.0


问:
How to calculate displacement of the end effector by the yaw, pitch, and roll in the spherical joint?
For planar robots, we can calculate how small changes in the angle of each joint corresponds to the displacement of the end effector, by constructing a jacobian consisting of cross products between the axis of rotation of each joint and difference between the position of each joint and the end joint. I tried to use the same logic for a spherical joint with 3dof by calculating three angles for each global axis of rotation, from the displacement of the end effector at each global axis. I then tried to construct a rotational matrix to correctly orient the joint from these three Euler angles. However, since rotations of each angle stack on top of each other in rotation matrices, this didn't work. Is there a practical way to construct a rotation matrix from these angles or is there a different solution to this problem?</p>

答:
Write the rotation matrix from the first coordinate system to the coordinate system moved by the first motor.  Four of the elements should include a cosine or sine of the first motor angle.  Then write the rotation matrix from that coordinate system to the coordinate system moved by the second motor.  Do this again for the third motor.

Multiply these three rotation matrixes together and you will get the rotation matrix for the 3 dof spherical joint.

Incidentally, you can easily write the individual 3x3 rotation matrices as follows:

The first column is composed of the direction cosines of the moving x axis relative to the fixed coordinate system; the second column is composed of the direction cosines of the moving y axis with respect to the fixed coordinate system; the third column is composed of the direction cosines of the moving z axis with respect to the fixed coordinate system.


问:
Compiling Code for EY-80
I recently purchased at EY-80 from electrodragon: EY-80 All in one 9-Axis Motion Sensor (Gyro + Acceler + Magneto + Baro)

I am having a hard time compiling the example code on my arduino:

This is what is happening.  So far, I am only copy and pasting the code.  Any help? (I am somewhat new to programming, so don't fully understand all of the code)

答:
After talking to a friend, I found out what I did wrong.

I needed to include all of the #include libraries.

I downloaded one of the libraries in html, instead of raw .h format which was messing up the program, so I downloaded the correct version.

The program is now working, and collecting data well!

If you find your readings to be off, change the update delay from 500ms to 20ms and the readings will drastically improve.

ContentLicense: CC BY-SA 3.0

Title: Compiling Code for EY-80


问:
Moment of Inertia of a Dumbbell
hope you are all doing well.

I am taking a course at Coursera about Robotics and in one of the quizes, I had some problem with a particular question. I passed the quiz (4/5 correct answers), however I would like to know what was wrong with my approach. The discussion forums of the course are pretty useless. I had tried them for some questions in the past and I did not get even a single response from anybody. This is the reason I am posting the question here. Here is the question:

What I did was; I first divided the dumbbell into three parts: two spheres and one cylinder. Then I calculated the mass of the cyliner (1.4074) and then the mass of one of the spheres (23.52). Then I calculated the moment of inertia for each axis of the cylinder (Ix = 0.000281, Iy = 0.0048, Iz = 0.0048). After that, I did the same thing for one of the spheres (Ix = 0.0941, Iy = 0.0941, Iz = 0.0941) and multiplied each axis by 2. Then I added this result to first cylinder and I got the matrix;

[0.1885 0 0; 0 0.1930 0; 0 0 0.1930]. However, my result was incorrect. Can you tell me what was wrong with my approach?

答:
You have correctly identified, that you have to segment the body into 3 geometrical shapes, and calculate the inertia for all of these separately. If I understand your explanation correctly, you did not compound the inertias of the segments correctly.

Here is the Wikipedia article on how to compound the inertia of N masses. It is not just a simple summation because the inertia is dependent on geometrical coordinates. Summing up two matrices disregards this geometrical dependency.

Title: Moment of Inertia of a Dumbbell


问:
Constrained Inverse Kinematics velocity calculation via Jacobian
I am trying to implement inverse kinematics for a robot arm with 5DOF within Unity. The robot arm is supposed to depict the mechanical, hydraulic driven cylinder arm of a heavy machine such as excavators have. As of now, the forward kinematics control of the arm is done with two joysticks (4DOF) in two modes due to the missing DOF. I would like to control the arm with inverse kinematics by controlling the target/end effector with rate control with the same controller setup i.e. the two joysticks.

System description:
In my right handed Cartesian coordinate system, the first joint is supposed to rotate around the vertical y-axis, while the rest of the joints are hinge joints around the z-axis. All joints have their individual work/angle range constraint.

My system requires the following:

IK within the constrained ranges of my joints.

Real-time mapping of input from controller to motion.

Integration of velocities of the joints or the integration of an end effector velocity.

Even distribution of the angles.

I'm trying to use known computer graphic algorithms such as FABRIK and CCD, but have also tried to approach the problem with simple (gradient descent) and more complex (cobyla) optimization methods.

My problems:
The last two requirements of the list are my biggest problem.

As far as I understand, joint velocities or the end effector velocity is usually done in the field of robotics by calculating the relationship between the joint velocities and end effector via the Jacobian. The angular and linear velocities are then combined to show the full manipulator velocity. What I do not understand is: if I use the Jacobian with joint angle constraints with upper and lower bound angle limits and also velocity limits, my problem has to be formulated with these inequality constraints. How can make sure, that my end effector is following the trajectory given through the user in the given? I cannot find any explaination of where this is considered.

The distribution of the angles is suppposed to help the arm always hold a more or less curved form downwards much like a banana would. By this I mean I do not want my arm to have any sharp buckling in the middle as such, as it tends to find solutions for some positions, but rather stay similiar to the image below. Is it possible to extend these computer graphic algorithms to achieve this type of angle distribution without interupting the main calculation?

Thank you to anyone, who can help me with these questions!

答:
As you correctly identified and mentioned, the Jacobian matrix links the joint velocities to the end effector velocities.

$$\dot X  = J \cdot \dot Q $$
or
$$\dot Q  = J^{-1} \cdot \dot X $$

What these expressions of the Jacobi Matrix do not explicitly show is their dependency of the current pose of the robot. Depending on how the Jacobi matrix has been obtained, this might be dependent of $Q$ or $X$. If the inverse kinematics equations have been derived there the inverse kinematics is defined as $f^{-1} (X)$ then the Jacobi matrix will be dependent on the TCP position $J^{-1}(X)$. If the forward kinematics equations have been used to derive the Jacobi matrix then $J(Q)$. Please note that this notation does not refer to actually inverting $J$, but it is meant to express that the inverse Jacobi is usually derived from the inverse kinematics equations and are dependent on the TCP position $X$.

Every time the robot changes its position, the velocities have to be recalculated in order to stay on path. The lower the cycle time, the higher the frequency at which the velocity is recalculated the better the robot will stay on path.

For Unity this will be the Update() function of a game object, called every frame, for 60fps this would mean every 16ms. For a robot controller this is in the 1ms range (maybe up to 4ms). (There are also some advanced features, like path lookahead for robot controller which come into play here, but let's remain at the question in hand)

The question explicitly mentioned velocities. There is a way to follow a given curve without considering the velocities. This would be simpler, but it is not considered here.

So given a curve in Cartesian (or Task space) a velocity profile has to be attached to this curve (if it is not already done when defining the curve). A simple velocity profile can be planned using co called "S-Curves". Here is an example on how to do this.

Now, assuming that the current position of the robot matches the starting point of the curve, the  first thing to do is to get the next step of the curve, where the robot should be in the next frame (or next control loop cycle). This can be calculated in terms of position, or if the target velocity profile is available, it can be calculated what velocity should the robot currently have instead of where is should be in the next timestep.

Here comes the tricky part for your manipulator. Since your manipulator is redundant, you (most probably) cannot define $J^{-1}(X)$. However, by adding additional constraints you can solve the inverse kinematics problem. Here is where you would want to add the additional constraints to make sure that the banana shape is kept. Effectively you are solving $Q = f^{-1}(X)$ with additional constraints. Also here, since you have all joint angles, you can compare to joint angle limits. In Unity this will be solved in an Update() function of a MonoBehaviour script. Now you have the desired, banana shaped joint angles and now, you can calculate $J(Q_i)$. This matrix will have actual values and not an expression, hence it can be inverted (or pseudoinverted). If inverted (or pseudoinverted) you get ${(J(Q_i))}^{-1}$, which maps cartesian velocities to joint space velocities, while also taking account your desired banana shape. Now that you have the velocities in joint space, you can actuate your joint using these velocities

So, to summarize, your robot seams redundant, so you cannot solve the IK without additional constraints. This is why an expression for $J^{-1}(X)$ which takes into account the "banana shape preference is not easy to do". You can solve your IK with any additional contraint you like (e.g. a constraint for banana shape) and calculate the Jacobi matrix which links joint space velocities to cartesian velocities, $J(Q)$. This is pose dependent and is not an expression or a function but a matrix filled with values. You can invert (or pseudoinver) this and use it to map TCP velocity to joint space velocity but for this exact pose only. When the robot changes position, the same calculation has to be made again for that pose.

Again, there are simpler ways to achieve the same effect in Unity, since Unity does not need a smooth velocity profile for smooth-looking motions (as opposed to real robots). Furthermore, there is a somewhat more complicated approach needed for a real robot, where you have a position-velocity-torque cascaded control loop. The described solution is somewhat in-between, because it answers the points explicitly raised in the question.


答:
First, I don't get the same mass for the spheres. Volume of a sphere is $\frac{4}{3}\pi r^3$, right? When I do $5600\left(\frac{4}{3}\right)\left(\pi\right)\left(0.1^3\right)$ I get a different answer.

Second, if you're going to offset the centers of mass then you need to use the parallel axis theorem:

$$
I = I_{cm} + md^2 \\
$$

That is, the shifted moment of inertia is the base moment of inertia (about the center of mass) and then you offset by mass times the offset distance squared.

You submitted the answer as though all objects were centered on the same spot, but they're not.

:edit:

I edited the calculation to use the radius instead of what I had originally put (the diameter). Used the right value in the actual calculation I did, but wrote the wrong numbers down here (like I've done on SO many tests)

Title: Moment of Inertia of a Dumbbell

Body:
hope you are all doing well.

I am taking a course at Coursera about Robotics and in one of the quizes, I had some problem with a particular question. I passed the quiz (4/5 correct answers), however I would like to know what was wrong with my approach. The discussion forums of the course are pretty useless. I had tried them for some questions in the past and I did not get even a single response from anybody. This is the reason I am posting the question here. Here is the question:

What I did was; I first divided the dumbbell into three parts: two spheres and one cylinder. Then I calculated the mass of the cyliner (1.4074) and then the mass of one of the spheres (23.52). Then I calculated the moment of inertia for each axis of the cylinder (Ix = 0.000281, Iy = 0.0048, Iz = 0.0048). After that, I did the same thing for one of the spheres (Ix = 0.0941, Iy = 0.0941, Iz = 0.0941) and multiplied each axis by 2. Then I added this result to first cylinder and I got the matrix;

[0.1885 0 0; 0 0.1930 0; 0 0 0.1930]. However, my result was incorrect. Can you tell me what was wrong with my approach?


问:
Directly tapping Create2 battery through vacuum brush
Problem Overview: our project consists of an iRobot Create2, a RaspberryPi 4 and a YDLIDAR X4. The RaspberryPi is powered from the Create2 serial port. We tried to power the lidar from the RaspberryPi, but reached the limits of the Create2 serial port power/current. We managed to directly tap from the Create2 battery, and also from the Main Brush. However, we are experiencing problems when tapping to the Vacuum's power, which would have been a more elegant and simpler solution.

Context: As per the suggested approach from the official documentation's, when the serial port of the Create 2 (rated at 20.5V-10V 0.2A) is not enough for powering your project, one can try to draw power from one of the motor brushes:

```<code>  Method         Voltage        Current        Power
 -------------- -------------- -------------- ------------
  Serial          20.5V–10V      0.2A           2W
  Main Brush      16V – 12V      1.45A          17W
  Side Brush      16V – 12V      0.54A          6.5W
  Vacuum Brush    16V – 12V      0.56A          6.7W
</code>```

The Vacuum Brush (rated at 0.56A 6.7W) should be more than enough for our YDLIDAR X4, whose datasheet specifies that it requires up to 480mA when starting, but then idles at 350mA:

```<code>
       Subject         Min.    Typical    Max.    Unit                                                               Remark
 -------------------- ------- ---------- ------- ------- ------------------------------------------------------------------------------------------------------------------------------
  Supply Voltage        4.8          5     5.2     V      If the voltage exceeds the max value, it may damage the core. Too low Voltage may affect performance and even stop ranging
  Voltage Ripple          0         50     100     mV     High ripple may cause working failure
  Start current         400        450     480    mA      Relatively higher current is required at startup of the device
  Sleep mode Current    280        300     340    mA      System dormancy with motor rotating
  Work mode Current     330        350     380    mA

</code>```

We have used the recommended 2.2mH 1.5A inductor (specifically, the Murata 1422514C inductor, as per the manual), and are also using an LTC3780 based DC/DC BUCK BOOST Converter (we know this is overkill, and are waiting for a bunch of LM2596 based Buck converters to be shipped).

Despite all our efforts, the YDLIDAR X4 is only powered for about 5 seconds, and then the Create 2 cuts all current to the Vacuum Brush. We have no idea why this happens.

We have verified that this happens both when we press the "Clean" button to turn on the robot's default program, and also when we set the robot to FULL mode and send the turn-motors-on command through the tethered serial connection using RealTerm.

We have checked all related questions, but none mention the power cut we are experiencing:

directly tapping Create2 battery

IRobot Create 2: Powering Up after Sleep

increase current draw from serial port of icreate 2

We have also contacted support at create@irobot.com but have not gotten any answer (yet).

EDIT:

When trying to tap to the Vacuum power, we had already disconnected the vacuum's motor. The same goes to the Main Brush' motor.

EDIT 2:

Taking Steve & Chuck's remarks into account, we have redesigned our initially intended setup.

Since we were indeed running the Raspberry Pi 4 dangerously close to the power limit of the Mini DIN serial port, we have decided to power it from the Main Brush motor drive (16V – 12V,  1.45A, 17W).

This, on the other hand, raises a bootsrapping problem (as noted by Steve). To overcome this, we have come up with the solution shown below:

In short, we have added a MOSFET that powers the Raspberry Pi from the Mini DIN serial port by default (when the Create 2 is Passive/Safe/Full modes). After the Raspberry Pi boots, a script will command the Create 2 through the Open Interface to power the Main Brush motor drive. The current coming from the main brush driver will automatically switch the MOSFET, and the Raspberry Pi will now be powered by the main brush driver. We have added a capacitor just in case the switching is not fast enough and cause a power outage on the Raspberry Pi.

Finally, the LIDAR is now powered through the Raspberry Pi's USB ports.

Hopefully, this design will be handy for anyone trying to tap directly from the Create 2 battery.

NOTE: this new setup has not yet been tested. We're still waiting for some remaining components to be shipped, but I will report back with our results once we have finished building and testing the new wiring setup.

答:
Welcome to Robotics, XabiGarde. I can't tell from the documentation whether the stated power is the total amount the driver can source or if it's the net amount available AFTER accounting for the motors themselves. You're looking at a startup power draw of 2.25 W on a port rated for 6.7 W. It would seem like that's capable, but you might also be browning out the bus if the 6.7 W is also driving the motor. The 5-second shutoff might be a short-circuit protection built into the Create2.

Troubleshooting steps I would try are:

Measure the voltage during the power-on sequence and see if your supply voltage is normal - manual states it should be 12-16 volts.

Disconnect the Create2's driven motor and see if the problem continues.

Try connecting to a higher-power source (main brush) and see if the problem continues.

If you try the above and the problem persists, please post the code section you're using to run the motors. It's been a while since I looked at the OP codes for the Create2.


答:
A few thoughts, here:

First thought: you are dangerously close to the power limit on the serial port with just the Raspberry Pi 4. Worst case trip power out of the serial port is 12 V @ 0.2 A = 2.4 W (assuming perfect DC to DC conversion), but the Pi 4 B draws 3.4 W at idle. I suspect you're getting away with this (for now) because your battery is (currently) fully charged; on the dock, you'll see 21 V, which will get you 4.2 W continuous. Once the battery droops, your Pi may reset.

Second thought: As @Chuck pointed out, you can't run both the LIDAR and the associated motor at once, so if you haven't disconnected the motor, please do that.

Third thought: The motor PWM is switching the low side, but if you're powering the Pi off the serial port still, the PTC is on the high side. There might be some weird current flowing that is tripping the current limit on the motor driver.

If this were my project, I would run everything off the main brush power port; clip the leads to the brush motor, add the Murata inductor you mentioned in series, and you'll have 17 W at your disposal, which should be more than enough for the Pi and the LRF. The only downside of that is that you end up with a bootstrapping problem when the robot is on the dock. I don't have a good answer for you on that one.

Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.

Title: Directly tapping Create2 battery through vacuum brush

Body:
Problem Overview: our project consists of an iRobot Create2, a RaspberryPi 4 and a YDLIDAR X4. The RaspberryPi is powered from the Create2 serial port. We tried to power the lidar from the RaspberryPi, but reached the limits of the Create2 serial port power/current. We managed to directly tap from the Create2 battery, and also from the Main Brush. However, we are experiencing problems when tapping to the Vacuum's power, which would have been a more elegant and simpler solution.

Context: As per the suggested approach from the official documentation's, when the serial port of the Create 2 (rated at 20.5V-10V 0.2A) is not enough for powering your project, one can try to draw power from one of the motor brushes:

```<code>  Method         Voltage        Current        Power
 -------------- -------------- -------------- ------------
  Serial          20.5V–10V      0.2A           2W
  Main Brush      16V – 12V      1.45A          17W
  Side Brush      16V – 12V      0.54A          6.5W
  Vacuum Brush    16V – 12V      0.56A          6.7W
</code>```

The Vacuum Brush (rated at 0.56A 6.7W) should be more than enough for our YDLIDAR X4, whose datasheet specifies that it requires up to 480mA when starting, but then idles at 350mA:

```<code>
       Subject         Min.    Typical    Max.    Unit                                                               Remark
 -------------------- ------- ---------- ------- ------- ------------------------------------------------------------------------------------------------------------------------------
  Supply Voltage        4.8          5     5.2     V      If the voltage exceeds the max value, it may damage the core. Too low Voltage may affect performance and even stop ranging
  Voltage Ripple          0         50     100     mV     High ripple may cause working failure
  Start current         400        450     480    mA      Relatively higher current is required at startup of the device
  Sleep mode Current    280        300     340    mA      System dormancy with motor rotating
  Work mode Current     330        350     380    mA

</code>```

We have used the recommended 2.2mH 1.5A inductor (specifically, the Murata 1422514C inductor, as per the manual), and are also using an LTC3780 based DC/DC BUCK BOOST Converter (we know this is overkill, and are waiting for a bunch of LM2596 based Buck converters to be shipped).

Despite all our efforts, the YDLIDAR X4 is only powered for about 5 seconds, and then the Create 2 cuts all current to the Vacuum Brush. We have no idea why this happens.

We have verified that this happens both when we press the "Clean" button to turn on the robot's default program, and also when we set the robot to FULL mode and send the turn-motors-on command through the tethered serial connection using RealTerm.

We have checked all related questions, but none mention the power cut we are experiencing:

directly tapping Create2 battery

IRobot Create 2: Powering Up after Sleep

increase current draw from serial port of icreate 2

We have also contacted support at create@irobot.com but have not gotten any answer (yet).

EDIT:

When trying to tap to the Vacuum power, we had already disconnected the vacuum's motor. The same goes to the Main Brush' motor.

EDIT 2:

Taking Steve & Chuck's remarks into account, we have redesigned our initially intended setup.

Since we were indeed running the Raspberry Pi 4 dangerously close to the power limit of the Mini DIN serial port, we have decided to power it from the Main Brush motor drive (16V – 12V,  1.45A, 17W).

This, on the other hand, raises a bootsrapping problem (as noted by Steve). To overcome this, we have come up with the solution shown below:

In short, we have added a MOSFET that powers the Raspberry Pi from the Mini DIN serial port by default (when the Create 2 is Passive/Safe/Full modes). After the Raspberry Pi boots, a script will command the Create 2 through the Open Interface to power the Main Brush motor drive. The current coming from the main brush driver will automatically switch the MOSFET, and the Raspberry Pi will now be powered by the main brush driver. We have added a capacitor just in case the switching is not fast enough and cause a power outage on the Raspberry Pi.

Finally, the LIDAR is now powered through the Raspberry Pi's USB ports.

Hopefully, this design will be handy for anyone trying to tap directly from the Create 2 battery.

NOTE: this new setup has not yet been tested. We're still waiting for some remaining components to be shipped, but I will report back with our results once we have finished building and testing the new wiring setup.


问:
Real Time Motion Control
How is real time control normally handled? Do you run a separate motor control unit which has its own RTOS or is there some other way?</p>

答:
The key elements to real-time motor control is the motor controller and the motion controller (which can be a CNC, a robot controller or other type of controller). The following description fits most modern industrial control systems in use today where precise motions down to the 10-50 micrometer range can be archived.

The motor controller usually is not x86/x64 based. It is usually some kind of DSP (or microcontroller or FPGA). It might use some very simple OS (with hard real-time constraints), but it can also just be bare metal. This device has a cascaded closed loop controls for controlling torque (current), velocity and position. It has an "amplifier" stage (e.g. H-bridge or a "triple H-bridge" for 3 phase motors) for supplying the motors and usually it also has encoder inputs. The control loop cycle time on this device is a key feature. the Torque controller has the highest frequency and the position controller (the outermost loop) has cycle time close o a millisecond (up to 4 ms is still practised).

The motor controller receives setpoints (or reference values) from the motion controller. Furthermore it can also receive feed forward offsets for the velocity and torque control loops. The motion controller has a RTOS (e.g. VxWorks) and its main role is to plan the trajectories based on some application program (e.g. G-Code for CNC machines) and cyclically send setpoints to the motor controller with a cycletime in the milliseconds range. The motion controller communicates with the drive amplifier via a real-time bus system (e.g. CanOpen, ProfiNet).

Title: Real Time Motion Control


问:
Are there any tutorials for OMPL in Python?
I want to learn and understand the Open Motion Planning Library (OMPL) through Python as I don't have much experience with C++. Almost all tutorials are written in C++ and there are some demos in Python. I installed and checked OMPL version 1.5. It worked well, and I want to know more about other applications. Are there any resources or suggestions on how I can learn OMPL through Python?

I use Ubuntu 18.04
Python 3.6
OMPL 1.5

答: OMPL does have Python bindings.  There is a section on the site documentation explaining the differences between the Python and C++ APIs and some samples.  That may provide you with a starting points, though I don't see any full tutorials using Python as of this writing (alternate long-lived link).</p>


问:
Does increasing robotic arm's speed cost replayability?
i've been researching robotic arms for a personal project. I'm a computer engineering student, made some projects with arduino but my knowledge about robotics is currently limited.

So i was wondering, what was the limitations of the robot arms in the market? I'm planning to build a 3 joint robotic arm, it will be used for light weight job (like dotting paper with pen). Would making this fast(Sorry, i don't really know how i could explain that further) and precise(0.01-0.001 mm) possible?

答: An alternate approach is to reduce the mass and stiffness to enable higher accelerations, in combination with better sensing and control.  For example, controlling the end-effector in relation to the target in sensor space instead of a global coordinate frame (which is likely arbitrary with respect to the task).  The control scheme will have to allow for dynamic changes in the shape of the mechanism as it accelerates.</p>


答:
Back in the 90's I worked on a robot for a pen manufacturer customer. They wanted to simulate nib wear by having a robot write cursive script continuously for hundreds of hours at a time, in a reproducible way.

If I remember correctly, the robot we developed was around 70cm tall, a tripod with the pen suspended on rods from near the apex. The motors were close to the top, one each for the x and y axis, using the long rod to amplify the speed and range of travel of the limited travel motors (voice coil, IIRC) we were using.

As others suggested, in order to be fast enough it had to be be incredibly lightweight. The low payload weight (just a pen) made this just about possible, but to get that speed sacrifices in positional accuracy had to be made with the technology available at the time.

These days we wouldn't have the control issues we did back then (integer PID parameters with the National instruments motor controller we were using, left our system at most marginally stable most of the time, forcing us to cut back the speed to retain stability) but the fundamental limitations of torque, speed, range of travel, precision and cost are always going to be difficult to balance, and unusual requirements in one of these aspects can push the component cost sky high.

There are lots more options available now though, from flexture stages, piezo walk or stack actuators, smaller, more precise lightweight linear motors, but all of these options are going to be expensive, far beyond most hobby budgets.

If you go for a Cartesian robot design, rather than a traditional 'arm', 50 micron accuracy is not too difficult/expensive if your range of movement is not too high. Even relatively cheap fused deposition 3d printers can get 10um step size (not accuracy). Much below 10 micron accuracy gets tough unless your range of movement is very restricted though.

Title: Does increasing robotic arm's speed cost replayability?

Body:
i've been researching robotic arms for a personal project. I'm a computer engineering student, made some projects with arduino but my knowledge about robotics is currently limited.

So i was wondering, what was the limitations of the robot arms in the market? I'm planning to build a 3 joint robotic arm, it will be used for light weight job (like dotting paper with pen). Would making this fast(Sorry, i don't really know how i could explain that further) and precise(0.01-0.001 mm) possible?


问:
KUKA Robotics API IDE
I've got Robotics API library, a demo program and a robot. I want to develop an app for it. The best solution is offline development on some kind of simulator. I'm completely new in such tasks - is there any IDE for this? Or a way do deliver byte-code to machine? Thanks in advance!</p>

答:
RoboDK offers a driver that sits on the KPC. You can write your code in most high-level languages like Python, for example. Point the local RoboDK application towards your IDE of choice, import RoboDK library into your project, and use RoboDK, well documented, API to run online debug from your python IDE.

https://robodk.com/doc/en/RoboDK-API.html#RoboDKAPI

Title: KUKA Robotics API IDE


问:
Why can't the Controller Spawner find the expected controller_manager ROS interface?
I have a quadruped robot with base link (BL), 4 child links called LFT, LFT, RFT, RFT, T for thigh and each having 4 children with name LFC, LBC, RFC, RBC, C for Calf. 8 joints - Base link to 4 thighs and 4 thighs to 4 calfs are used.

An excerpt from the URDF is posted below:

```<code> <link
    name="LFC">
    <inertial>
      <origin
        xyz="0 -0.085 0" rpy="0 0 0" />
      <mass value="0.038416" />
      <inertia ixx="0.00010326" ixy="0"  ixz="0" iyy="1.3494E-06" iyz="0" izz="0.00010451" />
    </inertial>
    <visual>
      <origin xyz="0 0 0"            rpy="0 0 0" />
      <geometry>
        <mesh filename="package://urdfgenesyssw/meshes/LFC.STL" />
      </geometry>
      <material name=""> <color rgba="0.89804 0.91765 0.92941 1" />
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://urdfgenesyssw/meshes/LFC.STL" />
      </geometry>
    </collision>
  </link>
</code>```

A Joint and Transmission sample is also shown:

```<code>  <joint    name="LFTLFC"    type="revolute">
<origin      xyz="0 -0.17 0.004"      rpy="0 0 1.5708" />
<parent      link="LFT" />
<child      link="LFC" />
<axis      xyz="0 0 1" />
<limit      lower="-0.7854"      upper="0.7854"      effort="0"      velocity="0" />
</code>```

```<code>  <transmission name="LFTLFC_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="LFTLFC">
  <hardwareInterface>EffortJointInterface</hardwareInterface>
</joint>
<actuator name="LFTLFC_motor">
  <hardwareInterface>EffortJointInterface</hardwareInterface>
  <mechanicalReduction>1</mechanicalReduction>
</actuator>
</code>```

Controllers are as shown below:

```<code>  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: "joint_state_controller/JointStateController"
    publish_rate: 50
  # Position Controllers ---------------------------------------
  LFTLFC_controller:
    type: effort_controllers/JointPositionController
    joint: LFTLFC
    pid: {p: 100.0, i: 0.01, d: 10.0}
  /gazebo_ros_control/pid_gains:
    LFTLFC: {p: 100.0, i: 1.0, d: 10.0}
</code>```

The launch part of the controllers is as follows:

```<code><rosparam command="load" file="$(find urdfgenesyssw)/config/joints.yaml" ns="/urdfgenesyssw" />
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="/urdfgenesyssw"
args="joint_state_controller
BLLFT_controller
LFTLFC_controller
BLLHT_controller
LHTLHC_controller
BLRFT_controller
RFTRFC_controller
BLRHT_controller
RHTRHC_controller
--timeout 30 " />
</code>```

Why does the error show:

```<code>[WARN] [1592642363.497903, 24.557000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
</code>```

答:
It is always recommended to mention your ROS distribution and OS. I believe the error is coming from missing ROS package controller_manager. You can download and install it from the following link

https://github.com/ros-controls/ros_control


问:
Wifi to pass through aluminium
I am about to make an rc car which uses a wifi connection. The body for the car would be made from aluminium and the wifi receiver will be placed inside this aluminium casing.

How do I make sure that this will work?

Would I be forced to change my material or can I just make an extension for the receiver and make sure it is out of the casing?

If so , would that really help me?

答: Your Wifi signals should be able to penetrate aluminum. Wifi uses radio waves which can go through some thick material. I know that Wifi signals pass through steel. The best way for you to know is to try. If it does not work, drill a hole in your casing and use an antennae.</p>

Title: Wifi to pass through aluminium


问:
Simulator for NEMA17 (stepper motor) and A4988 (stepper motor driver) along with Arduino
I want to simulate an Arduino MEGA (or UNO) controlling a NEMA17 (stepper motor) using A4988 (stepper motor driver). I couldn't find the stepper motor and driver on TinkerCAD. Can this be done in Proteus? Or is there any other workaround possible?</p>

答: You can do that in Proteus. You can simulate a stepper motor there, but only to see the motion, it is not possible to simulate the speed, inertia, and mechanical response.</p>


问:
digital servo won't seek to angle if delta between current position and target is more than ~15 degrees
My students and I are using a Hiwonder LD-220MG digital servo to position a "shoulder" on a robot.

We are seeing a behavior (on every one of these servos that we test) that it won't go between arbitrary angle values. If the angle we want to go to is too far from where the servo is currently positioned, then it either ignores the new target value, or very slowly creeps to it if it's not "too far". If the target angle is "close", say within 15 degrees, the servo will correctly and quickly move to the target angle.

So far, we've looked at voltage (right at the top of the spec for the servo), signal quality (nice solid 50Hz square wave coming from a PCA9685 16-Channel 12-Bit PWM Servo Driver), and software (used a hobby R/C tester).

Any and all suggestions appreciated.

答: Gever, do you have any clue on what type of feedback control you are using? This is usually a PID kind of controller (at least as far as I know). It could be that the once you give a large target position, the controller values get too high, causing an error to your servo. Adjusting the values of the PID (or any kind of) controller parameters would maybe help.</p>


问:
Signed difference between two directions
I want to get the difference between the orientation of my robot and a target point. The orientation is expressed as an angle as shown in the pictue below. The point is expressed as (x, z) in a cartesian space that has origin in the robot position. The x and z axis are always fixed.

This image explains how the angle and the axis are intended.

I need the angle between the orientation and the target, and I need it to be positive/negative when the target is left/right.

答:
Assuming you know the heading of your own vehicle, you then need to find the absolute bearing of your target so you can find the relative bearing between your vehicle and the target.

The best way to do this, if you have the x/z position of the target, is with the atan2 function, where:

atan2(y, x) returns a single value θ such that −π < θ ≤ π

If you just use atan then you wind up with an ambiguous result and you need to check/offset the answer by checking the signs of y and x. The atan2 function does this automatically.


问:
Is it possible to control a 5 DOF manipulator in the 6 DOF Task Space?
I am referring to pre-computed torque control techniques that are based on the Task Space dynamic model.

Maybe by using pseudo-inverse for the Jacobian and the task space inertia matrix ?

Cheers,
Titouan

答:
This is a somewhat awkwardly worded question, hopefully I'm getting at the essence of what you're trying to ask here.

In short, no, you can't because with 5 DOF, you won't be able to apply force/move the end effector of the robot in any arbitrary combination of directions.

However, it might be okay that you only have 5 DOF if the motions that you need to do also only have 5 DOF. (eg. only motions in x, y, z and rotation in the x and z dimensions)


问:
Chebychev–Grübler–Kutzbach Formula of Degree of Freedom
I always have had a problem understanding Chebychev–Grübler–Kutzbach Formula of Degree of Freedom:

$$d = 6\,n - \sum_{i= 1}^{m}\left( 6 - f_i\right)$$

where $n$ is the number of moving links, $m$ is the number of joints and $f_i$ is the degree of freedom of each $i$-th joint.

I read about it in the Wikipedia and there its said that the formula should work for any non-over constrained system. Hence I assume that it should work for parallel manipulators. But when I try to compute it for some parallel manipulators I don't get the degree of freedom that I expect. Maybe I don't understand what parts to consider as the "moving links". I would appreciate if someone explains this through computing it for the cases of "3-RPR" and "Gough-Stewart" parallel platforms.

答:
You can check here how to apply the formula to a parallel robot.

For a 6DOF Stewart platform

$$d = 6\,n - \sum_{i= 1}^{m}\left( 6 - f_i\right)$$

$n = 13$ links, $m = 18$ joints, six of which with mobility 1 (the prismatic joints), 3 of which with mobility 3 (the spherical joints) and three of which with mobility 2 (the universal joints). There is a different variant, where you have 6 spherical joints. That is a bit more complicated since there is a "lost" (or redundant) degree of freedom between the two spherical joints so you have to subtract this. (The pragmatic explanation is, that if the prismatic joint is between two spherical joints it can freely rotate around its axis, but this rotation does not contribute to the motion of the mechanism)

So $d = 6 \cdot 13 - 6 \cdot (6-1) - 6 \cdot (6-2) - 6 \cdot (6-3) = 78 - 30 - 24 - 18 = 6$ dof

For the 3-RPR, since it is planar mechanism the formula is:

$$d = 3\,n - \sum_{i= 1}^{m}\left( 3 - f_i\right)$$

$n = 7$ links, $m = 9$ joints, all with mobility 1.
So $d = 3 \cdot 7 - 9 \cdot (3-1) = 21 - 18 = 3$ dof

However, as far as I know, it is not exactly correct to say, that this formula applies to all non-overconstrained types of mechanisms. There is a special, very rarely used case of parallel robots, called the Isoglide robot to which this formula cannot be applied correctly.


问:
How can I leverage my experience with the JVM and Android to do some hobby-level building and controlling robots at home?
I'm looking for a product for home hobby-level robotics. Something that has modular robot hardware allowing me to design the robot itself, but lets me write the logic in a JVM or Android language. I have searched several times so I'm not expecting a big list, but it could be designed any of three ways that I can think of:

connects to a configurable API endpoint, OR conversely,

publishes an HTTP or RPC API for a controlling client to connect to, or

supports running a jar or apk on the robot itself, or

plugs into and carries around an Android device or small computer with some standard language-agnostic way of communicating with control APIs locally.

I'd like to dabble in robotics. The thing I know best is the JVM. For better or worse, I've worked almost exclusively with the JVM for over 10 years and know several JVM-based languages. Call me specialized, but I'm not investing full work days in developing a new skill, and if I can't lean on my familiarity with known tech, I would anticipate dipping a toe into robotics to be more frustrating than fun. I know the JVM is heavy for the low-cost, bare-metal architecture choices that are typically made in the field of robotics; let's not talk about that here.

Extra points if a kit comes with a Kotlin library.

答: Have you taken a look at LeJOS? It's a port of the Java VM and SDK to the various Lego MINDSTORMS robot kits. The Lego kits themselves are quite capable as hobbyist robotics kits go, I bought the NXT version years ago and had a lot of fun with it. The newest EV3 kit has a powerful ARM CPU and an SD card reader for loading software, it looks like a good option if you don't want to spend much time fiddling around with firmware installation.</p>


问:
What is a cost and cost function in path planning?
Surfing through websites and videos, I interpreted that cost refers to parameters such as time taken to go from start position to the goal position or distance traveled in every possible path and cost functions refers to the functions of these parameters with some condition such as shortest time taken or shortest distance traveled.
So is this interpretation, right?</p>

答:
The term cost function in path planning is borrowed from optimization. Rightfully so, since path planning in most cases is, in fact, an optimization problem.

The cost function in optimization expresses the function which should be minimized (as optimization is a synonym for minimization). Optimizing a cost function translates to finding its minimum. So if your function is $$f(x,y) = \sqrt{x^2+y^2}$$ by minimizing this function as:
$$ \begin{align}
\underset{x,y}{\min}&\quad f(x,y)\end{align} $$
you will get $f=0$. If we attribute meaning to this you could say that we are looking to minimize a distance and here cost becomes the distance. In this trivial example, the minimum cost is 0, i.e. you cannot be closer than distance 0.

If we look at path planning the cost function gets more complicated. If we look to minimize the travelled distance the cost function is the travelled distance, which is dependent on all the waypoints which you travel through. Let‘s denote the list (or vector) of waypoints with

$$\Theta =[\theta_1 \dots \theta_n ] $$

So the distance you travel can be calculated from these waypoints as $$f(\Theta)=\sum{\theta_i} $$

(If all $\theta$ are adjacent points on a uniform grid.) Minimizing this alone as
$$ \begin{align}
\underset{\Theta}{\min}&\quad f(\Theta)
\end{align} $$
does not bring much since we can already know, that the minimum amount of travel we can do is 0. What makes this interesting are additional constraints, in other words, the function is subject to (s.t.) constraints. Setting the first point $\theta_1$ to be the starting point, forcing the last one $\theta_n$ to be the last one and forcing the all neighbouring $\theta_i$ to be adjacent. Loosly describing these as contraints gives:

\begin{align}
\underset{\Theta}{\min}&\quad f(\Theta)\\
\text{s.t.}&\quad \theta_1 = \theta_{start}\\
&\quad \theta_n = \theta_{end}\\
&\quad \text{adjacent}(\theta_i, \theta_{i+1}) = 1\end{align}

This way, by minimizing the function, the minimum length of the path which connects the starting point with the target point can be found. However, finding the length is in many cases not what we are looking for. Finding the waypoints themself is in many cases of interest. This is also minimization (or optimization) of the same function, but we are not interested in the output of the function, but in the argument of the function, $\Theta$.

$$ \begin{align}
\underset{\Theta}{\text{argmin}} &\quad f(\Theta) \end{align} $$

Distance is just one example of cost. It can also be the fastest route (minimum time), minimum energy, a combination of more factors (e.g time and distance) expressed as a weighted sum.


答: Another alternative are robots based on the Raspberry Pi or Arduino microcontrollers. The Pi4J library implements convenient API's for accessing Raspberry Pi I/O's, while the JArduino distribution enables controlling Arduino boards from Java over a serial or Bluetooth connection. You can search for "arduino robot kit" or "raspberry pi robot kit" to find hobbyist kits based on those platforms.</p>

Title: How can I leverage my experience with the JVM and Android to do some hobby-level building and controlling robots at home?

Body:
I'm looking for a product for home hobby-level robotics. Something that has modular robot hardware allowing me to design the robot itself, but lets me write the logic in a JVM or Android language. I have searched several times so I'm not expecting a big list, but it could be designed any of three ways that I can think of:

connects to a configurable API endpoint, OR conversely,

publishes an HTTP or RPC API for a controlling client to connect to, or

supports running a jar or apk on the robot itself, or

plugs into and carries around an Android device or small computer with some standard language-agnostic way of communicating with control APIs locally.

I'd like to dabble in robotics. The thing I know best is the JVM. For better or worse, I've worked almost exclusively with the JVM for over 10 years and know several JVM-based languages. Call me specialized, but I'm not investing full work days in developing a new skill, and if I can't lean on my familiarity with known tech, I would anticipate dipping a toe into robotics to be more frustrating than fun. I know the JVM is heavy for the low-cost, bare-metal architecture choices that are typically made in the field of robotics; let's not talk about that here.

Extra points if a kit comes with a Kotlin library.


问:
Is odometry necessary for Vector Field Histogram?
I've read the VFH paper and now reading the VFH+. Odometry does not seem to be necessary, but I'm kind of confused about the grid and how to track how much distance the robot has traveled between samples.

Should I read sensor readings and calculate distances to obstacles without taking into account the distance traveled?

答:
No. VFH is a method to identify the next heading direction, which, from the current information available seem to be the best choice.

It is independent of how the current position is determined and how the information about the surroundings of the robot is required. As far as I know, both VFH and VFH+ are independent of distance travelled. The only depend on the current surroundings and target position, so, to answer your question regarding sensor readings: yes, the Histogram for VHF is build up using obstacle distances relative to the current position of the robot, so there is no need to calculate the distance travelled.


问:
Good Microcontrollers/SOCs for a Robotics Project
I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?

Observation: I'd like to start with a simple line-following vehicle and build up afterwards.

答:
If you want a line-following robot, then something similar to an m3pi would be achievable. Photo-transistors seem to be very effective with a black-on-white track.

As for a microcontroller, Mario Markarian is probably right, it is down to personal preference and the project you are working on. The m3pi uses an mbed and has a lot of IO's to play with. For more advanced robots a raspberry pi or beagleboard work, interfaced with slave microcontroller(s) to provide sensor data and offloading any repetitive computations that could otherwise slow down the pi.


问:
Are there any GPS sensors that provide data at 1Hz or faster?
I searched for GPS devices that provide 1 sec updates to server, but I have not found any.

I found this

T=30s.Module has sent a monitoring data packet. After 12 seconds the
  server sends an acknowledgement. In 18 seconds later (T = 30s) module
  sends the next monitoring data packet

Are there any products that take less than this time?

Why do gps devices take this much time to send data?

答: Many GPS receivers will output data more often than 1Hz. For example, the Venus GPS, which can produce readings at 10Hz.


问:
How to control the speed of servo?
I am using FPGA board and servo, I read that with PWM I can control where the servo will rotate. If the duty cycle in PWM is 1.5 ms it goes to the center, if it is 2 ms it goes to clockwise and if it is 1 ms it rotates to counter-clockwise. But, I couldn’t find any clue on how to control the speed of the servo. Can you help me please?</p>

答: The main application of servos is to move to a position, not at a constant speed, but in order to change the speed while maintaining the torque, you can simply slowly change the pwm duty cycle from one value to another (eg 1500 to 2000) and the servo will slowly move. If you would like to control the velocity precisely, then a motor with an encoder output would be better.</p>

Title: How to control the speed of servo?


问:
How to access Raspberry Pi over wifi?
I have to use Raspberry Pi with Arduino on a mobile robot and access Raspberry Pi on a PC through WiFi. Is it possible? Please explain how to do it?</p>

答:
If you haven't yet connected your pi to wifi, follow this guide first.

If you are on Windows, then you will need to install an ssh client such as PuTTY.
If you are on MacOS or Linux, simply open a terminal and use the ssh command. (ssh pi@raspberrypi).

By default, raspberry pis flashed with raspbian have the hostname raspberrypi, user pi, and password raspberry.

Title: How to access Raspberry Pi over wifi?


问:
PID control brushed motors via PWM using Encoder Clicks at SetPoints/Measurements
I've read numerous posts (1 , 2, 3 ) about using PID to control motors. All examples I've seen deal with the control signal being in the same units as the measurement signal. For example, use PID to set PWM values and measure PWM values as feedback or read stepper motor values in encoder clicks and then set new motor values also in clicks.

What I'm not understanding is how does one use PWM as the control when the measurements are in Encoder Clicks as would be common on a DC brush motor with encoder. How does the output of the PID taking Clicks as input, outputs and setpoint get translated to an appropriate 0 to 255 PWM signal (Assuming 8-bit PWM)?

It seems like there's a fundamental disconnect between the encoder clicks which can be though of as velocity (change of distance over time) vs PWM control signal which is an amount of power provided to the motor.

My naive guess would be to:

Determine the MAX encoder clicks per second at a given PWM value of 255 emperically.

Determine the MIN encoder value for the PWM value right before the motor stops moving under load. (For example my Pololu motors need at least 60 PWM on my motor controller to actually turn, below that value they just 'whine'.)

Linearly map the encoder readings from the MIN and MAX to an appropriate MIN and MAX PWM reading?

```<code>// Using the Arduino PID library
encoderLow = 60;   // determined empirically
encoderHigh = 8400;// determined empirically
PWMLow = 60; // determined empirically
PWMHigh = 255;  // PWM as which we reach encoderHigh

Input = reading_from_encoder();  // clicks per second
Setpoint = 1000; // also in clicks
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
translated_pwm = map(Output, encoderLow, encoderHigh, PWMLow, PWMHigh)
drive_motor(translated_pwm); // control signal to motor as PWM value.
</code>```

Where Input (the feedback from the encoders), Setpoint, and Output are in clicks. Output is the control signal from the Arduino PID library

Questions:

Is this the normal approach?

My map() function assumes a linear relationship between encoder values and PWM values. I doubt that's true. Is the PID going to compensate for the nonlinearities?

What is the correct way to do this?

答:
You are correct that for PID your output and input should be in the same unit, generally position or velocity. You will need a way to convert your encoder input to that unit, which should be the same unit as your setpoint.

The arduino PID library appears to abstract this for you.


问:
Why to seal a motor shaft, or the whole motor, for underwater ROV?
I just finished a competition for underwater robots. The water is about 40-50cm in depth and 90% of the designs just exposed the thrust motors completely in the water similar to the picture below and nothing happened during the competition. BTW, the water is tap water, not salt water.

I saw many questions and how-to articles about sealing the motor shaft for underwater ROV. I am not sure I understand the reason, especially after I found this reply to Preventing leaks in motor shafts for underwater bots. Is it because of the concern of short circuit or wear and tear if water goes into the bearings? Or will things be very different when the robot has to go deeper?

答:
The only major reason for doing this is the outcome of the interaction of water & current!!!

Besides, as the depth increases, the pressure increases & the probability of the contact(water & current) as well increases.


问:
Are Rospy subscriber callbacks executed sequentially for a single topic?
Suppose a ROS node receives new batch of data on a topic while the previous batch is still being processed by callback. Will ROS wait for its completion or will it spin a new thread and run both at the same time?

I'm asking because if they are sequential there is no need for a lock, but if they're not I'd need to use locking inside the callbacks.

I looked up the documentation for the rospy.Subcriber class, but it has no mention of this.

答: Apparently the ROS topics have an ambiguous behavior. I have also tested publishing through the rostopic pub and it showed a parallel behavior. But when the publication came from another node it apeears to wait for the execution of the last callback on a sequential approach.</p>


问:
For a quadcopter do i need to place the gyroscope sensor at the center of mass?
I am trying to build a quadcopter and think it is essential to have its center of mass in the middle. Therefore, I am planning on putting the battery in the center. However, this will cause me to place my gyroscope/accelerometer sensor not in the center. Will the sensor data be not useful if the sensor is placed away from the center of mass of the quadcopter? Should I put the sensor in the center of the drone and place the battery with a slight offset from center? Also if the sensor data can be used no matter where it is placed, would it require a lot of math to transform the data to something useful for control?</p>

答:
Most quadcopters position the flight controller/sensors at the center with the battery slightly above or below but still on the center.

If you are planning on building a race quad that will not use auto level, then you can place your gyro anywhere as the roll rate will be measured the same (just ensure that you set the orientation parameter properly in its settings).

If you are planning on using auto level, then you should put the sensors in the center, as auto level requires accelerometers which need to be at the center of mass for the highest accuracy.


问:
Approach for covering entire floor plan using Arduino-UNO and HC-SR04
I am working on a bot controlled by Arduino-UNO using HC-SR04. I want my bot to go around the floor, avoiding all obstacles, covering the entire floor. I tried measuring wall distance on all sides and gradually navigating the bot so as to increase two distances(h2 and l1 in my case) and decrease the other two. But this approach works only in an rectangular room without obstacles.

It appears my approach is not right. What should be my approach to navigate if the walls are not at right angles or has obstacle but navigable path behind?

答:
When it comes to mechanisms to avoid obstacles, you have several algorithms. Each one of them has good and bad things. In general, they are grouped in two main categories:

You have no previous knowledge about the environment.

You have some knowledge about the environment.

I only know about the first type. Vector Field Histogram and its revisions VFH+ and VFH* seem to be good solutions. Simpler solutions can be Virtual Force Field and Bug Algorithms.

Most of them relay on ultrasound sensors to sweep the surrounding and calculate what the best local path is.

Papers:

THE VECTOR FIELD HISTOGRAM - FAST OBSTACLE AVOIDANCE FOR MOBILE
ROBOTS by J. Borenstein and  Y. Koren

After this first paper, you can read its revisions VFH+ and VFH*.

When it comes to the second category, I find the best ones require image processing and high computational requirements, however others add ultrasound beacons in the room. The robot would use the pulses send by the beacons to triangulate its position in the room.

Papers:

POSITIONING SYSTEM FOR INDOOR MOBILE ROBOT USING ACTIVE ULTRASONIC
BEACONS by Hiroaki SEKI,  Yasuo TANAKA, Masaharu TAKANO and Ken
SASAKI


答:
You can operate your RPI via your computer’s  Remote Desktop Connection app. You will need some access to your RPIs HDMI cable for a short time however, or access to it via SSH while setting up. And will obviously need to have network connection or WiFi connection.

Step 1 - Get IP address of RPI

Open Terminal and execute the following command:
hostname -I
(Note that this is with a capital I)

Step 2 – Install xRDP

Enter these commands into the terminal:
sudo apt-get install xrdp

(If it says the package does not exist, then enter this command): sudo apt-get update

Step 3 - connect via Remote Desktop

Start your operating systems Remote Desktop Client (if you are using Windows, open RDP Client)

Enter IP address of your RPI.

Click OK

You will be taken to the XRDP login screen, unless you have already entered it into your Remote Desktop client before connecting (if that is the case, skip step 5).

Enter the RPIs username and password and click “OK”
You can now access your RPI via Remote Desktop!

Title: How to access Raspberry Pi over wifi?

Body: I have to use Raspberry Pi with Arduino on a mobile robot and access Raspberry Pi on a PC through WiFi. Is it possible? Please explain how to do it?</p>


问:
Finding the right PD values for a quadcopter simulator
I am working on this short assignment where I have to find the right PD values for a simulated quadcopter.  I have to reach 0.9 meters under 1 second with an overshoot of less than 5%.  This is my code:

```<code>function [ u ] = pd_controller(~, s, s_des, params)
%PD_CONTROLLER  PD controller for the height
%
%   s: 2x1 vector containing the current state [z; v_z]
%   s_des: 2x1 vector containing desired state [z; v_z]
%   params: robot parameters

% u = 0;

error = s_des - s;
z_des = 0.9;

Kp = 0.5;
Kv = 1.0;

u = params.mass*(z_des + Kp*error(1) + Kv*error(2) + params.gravity);

end
</code>```

So far this is my output:

I've tried many different value combinations and so far this is the closest that I could get.

答:
You are controlling a second order system. Set both kp and kv to 4.

If the system does not reach your desired altitude then there are additional problems with the code.


问:
How to convert 2D AutoCad drawing into CODE for CNC machine (laser cutter)?
I am a student of mechanical engineering, currently working on my 3rd-year project. I am designing a sheet-metal enclosure for a belt drive. We have a common laser cutter that could be used for my engineering Design & Fabrication project (3rd Year Project), to cut the said sheet metal. The problem is that I don't know how to write the G/N code program for the laser machine or any CNC per se.

My question is, how can I use the data in an AutoCAD design or any DWG file and produce a CNC program for 2D profiling?

答:
Your question can be generalized as how to "convert: a CAD model to G-Code (or NC Code).
Generally CAD is used to design parts and CAM (Computer Aided Manufacturing) software is used to design the manufacturing process for the part designed in the CAD tool.

In some cases this is highly complex (e.g. for 5 axis milling) and in some cases this can be simple (e.g. your case of following a contour). If you have a 2D image there are a number of free tools you can use to export contours these as G-Code, like:

All to G-Code converter

DXFG2GCode

These are similar in nature to a CAM software, but they lack certain functions and so, they are not ready for series production, but are OK for prototyping and experimenting.

There is a collection of free tools listed here, but I am not sure about the quality.

After you have generated the G-Code you can visualize it in NCViewer. This also might help to improve your G-Code skills.

Please note that I am not including plasma or laser cutting generally in the above description, as these might require some other advanced features for series production, like nesting.


答:
The 1-second processing time is based on the fact that GPS technology uses CDMA to allow the receiver to pick up all satellite signals simultaneously.

For GPS to work, your receiver must perform several steps:

(Step 0) Locate which satellites are overhead (this can be assisted by something called an almanac).  This step only happens when the unit is first powered on.

The signals from all visible satellites are received one the same frequencies simultaneously, and amplified.

The spread-spectrum digital signal is extracted by mixing the received signal with a local carrier (more info, PDF).

For each satellite (of at least 4), a pseudo-random code is generated to match the code of that given satellite.

The remote (sender) and local (receiver) codes are synchronized.

The incoming signal is decoded using the now-synchronized code.

The decoded signal contains a known pseudorandom sequence, which is matched against a local sequence to determine the distance from the satellite that transmitted the signal (this is based on the time offset between the sequences).

When all signals have been decoded, any clock inaccuracies are corrected and the position can be calculated.

Repeat.

Notice that each satellite's signal has its own code, which helps it stand out from all the other satellite signals.  Simpler GPS units will process these decoding steps sequentially, while more sophisticated units use multiple receivers to process the signals in parallel.

You can further speed up the reporting rate of a GPS by combining the updates with an estimation based on odometry, an accelerometer, etc.

Title: Are there any GPS sensors that provide data at 1Hz or faster?

Body:
I searched for GPS devices that provide 1 sec updates to server, but I have not found any.

I found this

T=30s.Module has sent a monitoring data packet. After 12 seconds the
  server sends an acknowledgement. In 18 seconds later (T = 30s) module
  sends the next monitoring data packet

Are there any products that take less than this time?

Why do gps devices take this much time to send data?


问:
What can a Point-to-Point Robot do?
What are point-to-point controlled robots actually good for? Only pick and place tasks?
Since continuous path controlled manipulators can do anything a p2p robot can do, plus tasks that require a "steady hand" (painting, welding, etc.), what is the point of p2p controlled robots? Are there any other applications you can trust it with?</p>

答:
Any task, where the task itself is not dependent on a specific trajectory or motion profile uses (and should use) point to point motions. Furthermore, tasks where only a portion of the task is reliant on a specific path should use point to point motions to connect these. Furthermore, all major industrial robot vendors do not exclusively offer point to point controllers, but these point to point motion commands are part of the programming language, alongside linear motions, circular motions or spline motions.

Tasks where p2p is used are pick and place, spot welding where only the last few millimetres of the path should have a defined profile (final positioning the electrodes  before clamping them), machine tending tasks, even for spray painting, the motions which are not actually needed for painting are most likely ptp.

A straight line, a LIN path is the shortest in Cartesian space between two points. However, the robot, from a motion amplitude and energy consumption perspective does not move in Cartesian space, but in joint space. We can simplify a bit, and call the p2p motion the equivalent of the straight line in joint space. It is not quite that, but almost. So if you want to travel minimum distance between two points your best option is p2p motion.

Title: What can a Point-to-Point Robot do?


答: You could also look at Fusion 360. Fusion 360 is a CAD application that has a number of post processors to generate G code for a variety of machining, 3D printing, and laser cutting devices. Both AutoCAD and Fusion 360 are owned by Autodesk. Fusion 360 is subscription based, but I believe there is a free version for students and also for hobbyists.</p>

Title: How to convert 2D AutoCad drawing into CODE for CNC machine (laser cutter)?

Body:
I am a student of mechanical engineering, currently working on my 3rd-year project. I am designing a sheet-metal enclosure for a belt drive. We have a common laser cutter that could be used for my engineering Design & Fabrication project (3rd Year Project), to cut the said sheet metal. The problem is that I don't know how to write the G/N code program for the laser machine or any CNC per se.

My question is, how can I use the data in an AutoCAD design or any DWG file and produce a CNC program for 2D profiling?


问:
Compute orientation velocities 6-DOF robot
I am trying to compute the joint velocities a 6-DOF manipulator(a typical industrial robot).

I have an initial position [xi, yi, zi, T1i, T2i, T3i] and goal position [xf, yf, zf, T1f, T2f, T3f] in the Cartesian task space and a given cartesian velocity in mm/s. T1, T2 and T3 are ZYZ Euler orientation angles.

My approach to computing the joint velocities is to use the inverse Jacobian. I multiply the 6x1 velocities vector, [Vx, Vy, Vz, w1, w2, w3], with the 6x6 inverse Jacobian matrix. Vx, Vy, Vz are in mm/s and w1, w2, w3 in rad/s. The result is the 6x1 joint velocities vector.

Vx, Vy, Vz are easy to compute. At every scan, I compute:

Px=(Goal_positionX - Current_positionX)

Py=(Goal_positionY - Current_positionY)

Pz=(Goal_positionZ - Current_positionY)

Then I compute the magnitude:

MAG_P=SQRT(Px^2 + Py^2 + Pz^2)

The velocity is set by the user in mm/s, e.g. Vo=5mm/s. It is interpolated by a t factor [0-->1](a function of time), which I compute using the first derivative of a 5th order polynomial, to provide smooth acceleration, deceleration and zero final velocity.

Then:

Vx= (Vo*Px/MAG_P)*t

Vy= (Vo*Py/MAG_P)*t

Vz= (Vo*Pz/MAG_P)*t

I use the velocities above to multiply with the 6x6 inverse jacobian the result are the joint velocities, with no orientation change of the robot end-effector. Everything works fine. The robot reaches its goal position as expected following an expected linear path.

Now I going to the main topic of my question. I want to interpolate the orientation velocities as well [w1, w2, w3].

I have done a lot of research and reading and still could not figure out. I learned that I can't just subtract the orientation angles e.g. [T1f - T1i] and divide by total time to get velocities.

I found that a common approach is to use SLERP interpolation, with quaternions and a t [0-->1] interpolation factor as input parameters. I convert my [T1i, T2i, T3i] and [T1f, T2f, T3f] to quaternions, qI and qF, and use the 5th order t interpolation factor computed above. The result is a quaternion representing the orientation at a given time, not velocities.

Every scan my system computes new t value factor(that progresses over time) which I use with SLERP to give me the next computed orientation:

qN=SLERP(qI,qF,t), which is the next interpolated orientation.

I compute the current end-effector orientation in quaternion: qC, and subtract qN - qC to give me the displacement to use as orientation velocities.

qV = qN - qC (doing proper quaternion subtraction = (qc)-1*qN)

Then I convert qV to ZYZ angles in radians:

[w1,w2,w3] = TO_ZYZ_FROM_QUATERNION(qV).

And use the above orientation velocities together with the cartesian velocities to multiple with the (J)-1.

Unfortunately, this approach does not work. The robot does not interpolate correctly to the final goal position.

I have read a lot of literature and posts approaching this same topic:

Controlling the pose of a manipulator using inverse kinematics

Jacobian-based trajectory following

Inverse kinematic orientation problem

Inverse Kinematics with Orientations

I would appreciate it if someone could point me in the right direction. I would like to stick with this approach using the inverse Jacobian and not use IK.

Note: My system is a PLC(industrial programmable controller)and there are no built-in complex math libraries. So approaches using simpler math functions would be better. All of the main math functions had to be implemented by me, e.g matrix dot product, matrix inverse, transpose, quaternion conversion, SLERP algorithm, ZYZ conversion, Jacobian inverse, etc. I have tested my functions comparing the results with online tools and I'm confident my implementations are working correctly.

Below I illustrate my problem:

答:
I was able to figure out after digging further through several other posts and google searches.

This post pointed me in the right direction:

https://physics.stackexchange.com/questions/293037/how-to-compute-the-angular-velocity-from-the-angles-of-a-rotation-matrix

Then Wikipedia:

https://en.wikipedia.org/wiki/Angular_displacement#Infinitesimal_rotation_matrices

Then this document:

https://arxiv.org/ftp/arxiv/papers/1311/1311.6010.pdf

Basically the solution is to use an infinitesimal rotation matrix. My mistake was computing from the quaternion displacement to ZYZ angles.The correct procedure should be converting from the displacement quaternion to a rotation matrix, which would be the infinitesimal rotation matrix:

V_ROT_M= TO_ROTATION_FROM_QUATERNION(qV)

Then the result is:

Then dividing each component by the scan-time(compute time between current rotation and next rotation) results in the orientation velocities:

w1=V_ROT_M[3,2]/deltaT

w2=V_ROT_M[1,3]/deltaT

w3=V_ROT_M[2,1]/deltaT

After testing with several goal poses the results seems to be satisfatory, the robot interpolates correctly following the expected linear path and end-effector orientation change.


问:
Detection of linear acceleration vs rotational velocity/acceleration
I am wondering, how do you differentiate between linear acceleration and rotational velocity and acceleration for IMU? A rotational velocity or acceleration will still appear to the accelerometer as a time varying acceleration.</p>

答: When you buy an IMU from a manufacturer, it provides the guidelines on how to read this sensor (IMU). For clarification, IMUs only provide linear accelerations, not the rotational ones. Rotational velocities are obtained from the gyroscope embedded inside an IMU. These velocities are then integrated to obtain the orientation. Some IMUs come with a magnetometer that are able to provide absolute orientation.</p>


问:
Estimate noise covariance matrix of measurements using a ros-bag
I am facing the following issue, and some hint or orientation would be great. I am working on a project in which I was given a ROS bag, and I have to implement a localization node using SLAM. To do so, I have developed the prediction and correction part of the algorithm, and I am now working on adding new landmarks to the map (there are 2 kind of landmarks). My current problem is that, for one of the landmark types, I don't have the noise covariance matrix for the correction step (sometimes referred as Q, sometimes referred as R). The observations for this kind of landmarks is of type geometry_msgs/Pose.

I want to know if from the ROS bag data, I can estimate the covariance matrix for the observations of that kind of landmark. I've tried the following things:

importing the data to Matlab, and calculate the covariance matrix using the cov function. The result is a 6x6 covariance matrix, with values that go from -0.1 to 8.XX. With this, the result in the robot's position is very noisy.

importing the data to Matlab and calculate the correlation matrix using the corr function. The result using this values is a bit better than the previous attempt but still noisy.

I tried an Identity matrix filled with some values in the order of 1e-3 in the variance fields. I did this assuming that the position of the landmark has no correlation with its orientation, as well as the x position has no correlation with its y position (something that I now think it's not true). The result in this case is something a bit less noisy than the first point, but more than the second point.

So, here is my question: is there a way I can estimate the measurement's noise covariance matrix from the ROS bag?

Edit:

To clarify a bit what I need:
The EKF is composed by a prediction step and a correction step. The prediction step is:

$\hat\mu = g(\mu_{t})$

$\hat\Sigma = G_t \hat\Sigma G_t^T + Q_t$

The correction step is

$K_t = \hat\Sigma H_t^T ( H_t \hat\Sigma H_t^T + R_t )^{-1}$

$\mu_{t+1} = \hat\mu + K_t ( z_t - h ( \hat\mu ) )$

$\Sigma_{t+1} = ( I - K_t H_t ) \hat\Sigma$

I am trying to estimate $R_t$

Hope you can help me!
Thanks in advance!

答: You can estimate the noise in the kf by adding a covariance state to your state vector. I don't know how practice this is but it can be done.</p>


问:
I want to actuate a motor based on a wav file, but it has too many samples per second
I am trying to actuate a simple DC motor based on a wav file. At the moment I am using the "cat vs dogs sounds" from Kaggle.

One of the wav files in this DB looks like this:

These audio files are just a few seconds. The sample rate is 16KHz.

My first idea was to just actuate the motor based on the amplitude, but at 16KHz this doesn't make any sense. Also, the signal goes constantly from + to - (this is sort of ok because the motor can move in both directions), but from a human POV, what the motor does doesnt make any sense, because the movements are too rapid. I then tried to "decimate" the signal into a few points per second, but the signals seem to be badly destroyed.

DC motors are actuated using an Adafruit board, using Arduino, and then I have a Python script that interfaces with the Arduino through serial. I have this working fine, and I can make for example a loop from python that increases the speed every few seconds. My idea was to go forward or backwards based on the amplitude of the signal (if it is negative or positive), I am no expert on audio, so this might make no sense. I won't react to other sounds, only to the input wav files.

I don't really know what is the best way of transforming an audio signal of 16KHz into something that can be use to actuate a motor. At the moment I am using a DC motor, but the idea in the near future is to use leds instead, and change their intensity based on the audio signals

答: You need to low-pass filter the input data.</p>


问:
Software Architectures for Robots
When designing a robot (manipulator, house robot, drone, autonomous driving system), what options does one have regarding the general software architecture? Is there even such a thing, as a very high level view on different software architectures?

I have very little clue about software architectures, so hopefully the answers can give an entry point into the topic.

答: ROS the Robot Operating System provides a framework and functions for robots - ROS is modular and operates different functions in separate nodes - each their own process. Each node can publish or subscribe to topics(messages) managed through a central core process - nodes can be distributed across machines. ROS has known data structures for messages or you can create your own. The way it all fits together gives you an architecture that you can expand as necessary. I would recommend this to anyone learning robotics, just the amount of available open source nodes/code is worth the time learning ROS. (just a fanboy)</p>

Title: Software Architectures for Robots


问:
Jetson TX2 vs small form factor PC for autonomous robots
What are the advantages and disadvantages for each?

I can build a small form factor PC with a GTX 1050 which will easily out perform a jetson for the same price.

When and where are each more appropriate to use? What are the advantages of each?

答:
A Jetson TX2 is about 15 Watts at full load and can run from 9v-15v.

The PC with GTX 1050 will be above 300 Watts and likely require both 5v and 12v supplies with little wiggle room in those numbers.

A mobile robot would need to be quite big to carry the batteries for the PC+GPU This would also be larger in physical size.

The Jetson TX2 is smaller, lighter and with the lower power requirements can have a smaller battery.


问:
Running ROS, Gazebo and RViz on Macbook
I have recently started learning robotics. Being at uni, I had access to Linux PCs where I could easily run ROS and Gazebo. However, due to the current pandemic and closure of universities, I now have to rely on my MacBook.

Following are the specs of my machine:

Core i7 2.7GHz Quad-Core

16GB RAM

Intel Iris Graphics 655 1536 MB

Is it possible to run ROS and Gazebo simulations on a machine with these specs?

Although it is mentioned on the gazebo website that a dedicated Nvidia graphics card is required, but I have found threads on this forum where ROS and Gazebo run fine on intel graphics. For example:

https://robotics.stackexchange.com/a/16824/26934

I also tried running a gazebo simulation using Ubuntu with VirtualBox but got a Segmentation Core Dumped error. I did some research and found a thread where it was mentioned that it may be caused by using a non-Nvidia graphics card:

https://answers.ros.org/question/281376/gazebo-is-crashingsegmentation-fault/

Need some guidance on how to run gazebo simulations on MacBook.

Thanks.

答:
I have run Gazebo in machines that don't have Nvidia cards for years now, never had any problems with it.

The problem is more likely related to the virtual machine environment, see here and here for relevant threads.

In any case, you should consider installing Ubuntu in dual-boot mode. It will help avoid this sort of compatibility issue, and you will make better use of your hardware resources.

Title: Running ROS, Gazebo and RViz on Macbook


问:
What is the difference between Markov localization and hidden Markov localization?
I just started studying localization for robotics. I started with Markov localization.
There was a cool lecture on Udacity. I also came across another localization called hidden Markov localization, but couldn't find many blogs on it. Can anyone explain to me briefly what's the difference between both?</p>

答:
From some basic googling.

https://dtransposed.github.io/blog/Robot-Localization.html

https://www.cs.ubc.ca/~carenini/TEACHING/CPSC322-10/SLIDES/lecture32-2010.pdf

http://web.mit.edu/16.412j/www/html/lectures/L4_Introduction%20to%20SLAM%20II.pdf

http://www.columbia.edu/~mh2078/MachineLearningORFE/HMMs_MasterSlides.pdf

Also the wikipedia article on Hidden Markov models is pretty clear.

A hidden markov model is just a case where the state/variables you are interested are not directly observable. This is the more common situation as generally you don't have a nice sensor that directly measures the variable you want. Instead you have to infer the hidden state through measuring other visible variables.

For a localization example, you are interested in the robots global position and heading. These are your hidden variables ,because in many cases you don't have a sensor that can directly measure this. Instead you might have something like range measurements to 2D landmarks, and a motion model which predicts how your robot moves. Now neither of them directly measure the hidden state(position,heading), but you can use a series of them to infer the hidden states.


问:
Multi-Link Robot Degrees of Freedom

I want to compute the DOF of this system if it composed of (n) such links grasping this common object using Grubler's formula obtaining the solution as a function of (n), considering this to be a spatial system then we have: m = 6, The number of rigid bodies or links including the ground N = 4, The number of joints J = 3, The added DOFs from those joints f = 7, so if we used the formula:
DOF = m(N - 1 - J) + f we get: 7, and considering the (n) links then the total degrees of freedom of such a system is 7n. I want to make sure that I didn't make any mistake and I am getting it right. Thanks in advance.

答:
The formula is

$$d = 6\,n - \sum_{i= 1}^{J}\left( 6 - f_i\right)$$
or

$$d = 6N - 1 - \sum_{i=1}^j\ (6 - f_i) =  6(N-1 - J) + \sum_{i=1}^J\ f_i $$

In the book Modern Robotics, there is an additional (-1) in the formula, as shown in the second version of the formula, as they recommend counting the ground as linkage. I do not count ground as linkage, I do not use the -1. For me it is just more logical this way, since ground is not a linkage and then I do not need to subtract 1 form the number of linkages. Furthermore the constant 6 in this version of the formula is denoted by m in the book Modern Robotics.

let's denote the number of chains grasping the object with $c$ in order to avoid confusion with the already used $n$ notation.

$N$ is the number of links including the ground link,

$n$ is the number of links not including the ground link,

$J$ is the number of joints and

$fi$ is the number of degrees of freedom of joint $i$.

so fort of all we have 1 linkage, the object being held commonly (assuming the grasp is rigid) counts as a linkage.
Per kinematic chain we have 3 linkages, we have to subtract 1 since the last one is grasping, therefore is part of the first linkage. In other words adding another kinematik chain increases the number of linkages  by 2 and not by three, since the last linkage will be part of the rigid body, there is no motion between them, therefore it does not count as a new linkage.

$n = 1 + 2 \cdot c$ for the case in the picture, for $c = 4$ linkages $n = 9$

There are 3 joints per kinematic chain. one of the joints with 3 dof, one of the joints with 1 dof and the last joint ... is tricky, it seems to have 3 dof, but in only counts as 2, since the two spherical joints produce a local rotation motion around the axis between their middle points. This a degree of freedom, which does not effect the motion of the whole chain, therefor it needs to be subtracted (if the number of kinematic chains is greater then 1, $c > 1$). So:

$$\sum_{i= 1}^{J}\left( 6 - f_i\right) = c \cdot ((6 - 3) + (6 - 1) + (6 - 2)) = c \cdot (3 + 5 + 4) = c \cdot 12 = 4 \cdot 12 = 48$$

Therfore, for the mechanism in the picture:
$d = 6 \cdot 9 - 48 = 54 - 48 = 6$

For the generalized version, for $c > 1$ number of kinematic chains added:

$d = 6 \cdot (1 + 2 \cdot c) - (c \cdot 12) = 6 + 12 \cdot c - 12 \cdot c$

$d = 6$, independent of the number of chains used.

It makes scene, since one chain has 6 degrees of freedom, if you couple the same chain parallel, is should not loose of gain any degrees of freedom.

If we would add 6 linkages, then we would obtain a structure very similar to the Stewart platform. It is commonly known that the Stewart platform has 6 DOF.

Title: Multi-Link Robot Degrees of Freedom