问:
VR: is it possible to calculate hand position relative to head based off these known orientations and lengths?
If we have 3, 9DoF IMUs for absolute orientation data on the:

wrist

upper arm

forehead

and we know the length of the:

wrist

upper arm

shoulder to base of neck

neck

and we also know the global position of the forehead on some external coordinate system

Is it possible to estimate the position of the user's hand just off these known orientations, body lengths, and head position?

答:
You might be interested in this paper:

M. Quigley, R. Brewer, S. P. Soudararaj, V. Pradeep, Q. Le, and A. Y. Ng, "Low-cost Accelerometers for Robotic Manipulator Perception," in Proc. Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2010.

Where the authors instrumented a 6 and 7 DoF robotic arm with "low cost" accelerometers and used those instead of encoders to measure joint positions.

To answer your question, "is it possible?", yes of course it is possible.  But how usable it will be entirely depends on how accurate you need it to be.  Here are some considerations you should consider:

You tagged the question as "VR".  So if this will be mounted on a human, realize that humans are squishy compared to robots, and getting accurate measurements of "link lengths" will be difficult.  Also repeated placement of sensors will be a challenge.  Be prepared for lengthy calibration times each time the sensors are mounted.

Don't underestimate the flexibility of the human shoulder.  There are more joints there than you probably realize.  Modeling as a simple ball and socket is likely insufficient.  The kinematic chain between a human's head and hand is very complex.

If you measured just accelerations w.r.t. gravity, there are ambiguities that you can't measure.  For example these two arm configurations will look the same:

So you will have to integrate accelerations and velocities over time.  Since you said you will be using an IMU I assume you know this already.

The IMU should have a gyro which is better to integrate to get position.  But will have drift over time.  So it will need to zeroed from time to time.  But humans are not still, so this may be a challenge.

Humans can move very fast.  This may saturate the sensors.


问:
Will using a 1:50 cycloidal drive on a 10,000 RPM brushless motor actually spin the output shaft at 200 RPM with 50x the torque of the motor?
In short, I'm trying to build a high-torque and high-RPM robotic arm, and I think brushless motors are the best compromise. The motors I'm considering are 400KV, and are supposed to run on 6S. Are there any glaring errors with my idea?</p>

答:
You need to consider both the max rated input speed of the drive (as another answer suggests) as well as the rated torque of the cycloidal drive.

The rated torque is the torque at which the drive can operate for some number of input cycles - typically 1 billion.  Reducers (aka gearboxes or drives or transmissions) also have peak and max input torque ratings as well.

The speed may be the killer here, though.  If you check out the specs of the Nabtesco RV-N series, for example, the allowable output speed is only 100 rpm or so (i.e. 5000 rpm input).

10000 rpm is really high, I think.  Speeds of 1000 rpm or less are more typical I believe.

ContentLicense: CC BY-SA 4.0


问:
Find a mistake in transformation between different coordinate frames in the WIP-calibration pipeline
I design the extrinsics calibration pipeline for the robotic agents, carrying onboard two sensors of different modalities.  I aim to calibrate one of them (S) without a calibration device.

Some characteristics of the system follow:

In writing transforms here, I use monogram notation.

I have two (almost) identical agents, "train" and "test". The first one has i-subscripts in poses, while the second has j-subscripts. The second agent has an overscript "$\text{`}$" in its calibration transforms.

Any agent has two sensors. The first sensor is aligned with an agent's body coordinate frame, (B on the figure). The coordinate frame of the second sensor is denoted S on the figure. For the sake of example, let's say, that sensor B is a lidar, sensor S is a camera.

Both sensors are capable of full navigation, producing SE3 transformations.

I want to find calibration ($X^B_{S'}$) by observing the constant term in the discrepancies of localizations, provided by two sensors.

Prior to writing this text, I've verified several invariants, let's suppose the following:

There is the one agent ("train"), which is already fully calibrated up to desired precision. We will use this agent to create localization maps.

Using sensor B, we are able to create consistent localization map (in a coordinate frame "world", W, and localize agents in this map without a bias.

Using sensor S, we are also able to create consistent localization map. It's in an another world coordinate system, V. These coordinate systems have a known relation. If we know the position of an agent in one "world", we can know its position in another:
$X^V_S = (X^B_S)^{-1} \cdot X^W_B \cdot X^B_S$.

The different sensors work at a different frequences, yet not radacally different. We have a reliable way to interpolate to the target timestamp in one sensor, from the temporally local transform trajectory in another sensor.

When I say "fully calibrated", I mean the features of two sensors are aligned using the extrinsics $X^B_S$, and the features overlap to subpixel precision.

Below, I outline the proposed pipeline:

A fully calibrated train agent goes to observe location, and builds two localization maps, in coordinate frames W and V respectively.

The test agent also has is't first sensor B calibrated, but the second sensor S has only rough approximation of real calibration. Or, that approximation is rather good, and we want to verify this by our method. So, the test agent observes the same location, and then builds two localization trajectories, using respective maps provided by train agent.

I associate [and interpolate] transforms from the localization trajectories to build list of pairs, then compute the discrepancies by inverse-compose operation on each pair.

Across the 6 axes of minimal transform representation, I construct an outlier-filtered, empirical distribution. In a case of a fully calibrated test agent, I expect this distribution to have a zero mean.

Why I believe this should work? The second localization system (blue below) is oblivious of $X^B_S$ transform. The position of the camera in body gets "baked" into position of body in world. So, it could be factored out statistically, provided that we have an independent source of body positions in world from the first localization system (red below).

Problem:

The distribution, introduced above, has a non-zero mean, for a pair of fully calibrated agents.

Watch out now, there is a suspicious formula below:

Details:

The test agent, at the timestamp j, gets two localizations:
$X^W_{B_j}$ from the first sensor, $X^V_{S'_j}$ the second sensor. The first sensor is aligned with agents body, so nothing needs to be done here.

Let's bring second transform to the same axis:
$X^W_{B^\text{by second localization}_j} =  X^B_S \cdot X^V_{S'_j} \cdot X^{S'}_B$.
What should be suspecious here is that we multiply by the train agent extrinsics on the left (because the "train" has sourced the map), but multiply by the test agent extrinsics on the right.

It's suspicious, but I have sat long enough on it, and do not see the error.
I also have spent a massive amount of time checking, re-cheking, debugging, and accumulating experimental data.
When we use train agent both in train and in test, everything checks out. When the test agent differs from train - we cannot align these two trajectories.

What I ask here: is to reason with me, point towards a red herring I fail to see in this problem.

答:
The question was about the constant error in the calibration pipeline.
The question proposed, that the left multiplication of localization transforms by the $X^B_S$ (other agents extrinsics) is erroneous:

$X^B_S \cdot X^V_{S'_j} \cdot X^{S'}_B$.

What was found out: it is correct in fact, we must left-premultiply all agents localization transforms by the same transform ($X^B_S$), to have the final trajectories in the same coordinate system.

Or, what's better, do not premultiply at all (which I've ended up doing). So, the calibration pipeline only has the $W$ world coordinate frame, and does without $V$.

The constant error, mentioned in the question was due to intricacies of the second localization system, and is further discussed here.


问:
Q: Motor sizing for reeling application
I would like to ask for some help.

My application is regulation of vertical speed of the camera, which is mounted on winding/unwinding reel. The camera follows the object (which moves vertically).

The load (weight) is constant, however due to the change in radius while winding, the torque changes. To maintain desired vertical (linear) speed constant, the rotational velocity decreases while the torque increases and other way around when unwinding.

The rotational speed of the motor would have to be calculated since its a function of the current radius and desired linear(verical speed). The feedback for closed loop control of the linear velocity comes from the camera image.

The required torques (only load, without considering losses, frictions,..) are: (for maximum desired linear vertical velocity of 2m/s)

0.165 Nm @ 2315 rpm

1.065 Nm @ 358 rpm

How do I choose the right motor size for this application? Would I need a gear? I'm searching for a BLDC motor.
Do I need to select a motor with the rated torque/speed of maximum speed and torque of my application (2315 rpm, 1.065Nm) ? ... that would be a huge motor :(

Thank you for your help.

答: I don't think the torques/speeds you specify are unreasonable for a BLDC motor.  Here, for example, is the performance curve for a motor from Electrocraft:

Title: Q: Motor sizing for reeling application


问:
Choosing correct power supply for Stepper Motors
I am building a machine and need 2 Stepper Motor for that.
The motors are driven using by a 3.3v arm device.

I have made the following selections regarding the stepper motor, stepper motor driver and the power supply.

Power Supply 12 Volt Power Supply - 3.5 Amp Single Output

Stepper Motors Stepper Motor: Unipolar/Bipolar, 200 Steps/Rev, 42×48mm, 4V, 1.2 A/Phase

Stepper Motor Driver DRV8825 Stepper Motor Driver Carrier, High Current

I tried my best to research the compatibility and came up with these.

Is this a good selection considering the fact that the Power Supply will be driving 2 of these motors.

I will be running the motors at 1/16 step for high resolution.As far as the speed is concerned,it's going to be pretty slow but they will be running continuously for hours in end.Basically what I am trying to do here is make a V-Plotter.As far I can tell, there will be loads of start stop motion in the motors though.

答:
using a correct power supply for stepper motors, or servos, is difficult.  You just cannot select based on voltage and amperage alone.  biggest criteria is the so-called over-voltage protection circuitry in most power supplies.  over-voltage protection circuitry is marketing/sales hype, and misleading.  over-voltage protection circuitry does not sense over-voltage, it senses fast current change, which generates an internal voltage, that turns off the power supply.  turning off the power supply does protect the power supply, but causes any motor to stop/stall/miss steps.  This turnoff lasts 2-3 seconds, devastating for any machine operations.

Best power supply is one without over-voltage protection circuitry.  Remember, it's not over-voltage protection circuitry.  This is actually the greatest cause of poor motor performance than any other criteria.

Example:  connect a 24v 10A power supply to a nema34 stepper motor.  if you set the torque high, thus high amperage, say power supply 3 amps total (2 windings on at same time), and start the motor, the power supply voltage will drop in 200 msec to around 4V, then rise again after 3 seconds.  LED blinks.  You will never see over-voltage, voltage never is over 24.5V. Yet the power supply shuts off. At Excitron, we have analyzed this situation for over 18 years.  One solution is set the brake for about 20% of load, then the power supply is slightly loaded at about .5A.  Most power supplies cannot handle a 0 to 3A load without shutting off, but will not shutoff if loaded say, from .5A to 3A.  Note that 3A is much less than 1/3 of the supply output of 10A, which has a surge capacity of about 13A.  Depends on the power supply, but you get the idea.

CUI makes a robust enclosed 24V 72 watt supply that has no over-voltage protection circuitry.  This supply is amazing, never shuts down due to rapid amperage change.

Therefore, almost all power supplies do not work well with high amperage motors.

ContentLicense: CC BY-SA 3.0


问:
Can an Xbee transceiver module be used for controlling a stable Quadcopter?
I would like to use an Arduino Nano IOT as a flight controller and connect this to a Xbee transceiver module for control. If the Xbee module was set up so that for each packet transmission it included [throttle, yaw, pitch and roll], would the Xbee module be fast enough for responsive control?

I would eventually like to add a Raspberry Pi Zero W for higher level control e.g controlling using PID loops for GPS coordinates and also to follow preprogrammed routes that could be uploaded using the Xbee module.

答:
As Tully's comment suggests, its very broad and we cannot say for your exact situation if it would work. But...

In the past at my university we had a drone control lab course we were required to take and we did exactly what you're proposing over very short indoor distances. We had an Xbee that communicated the control systems' minimal commands at several kilohertz and sent back its actual information for plotting / logging.

Higher level commands like GPS viapoints should work fine if the low-level control is later put onto the drone itself. That would require little if any difference in requirements than just a wifi or cellular connection. That isn't very time sensitive or high rate.


问:
Camera selection for long range stereo vision system (up to 100 meters)
I want to implement a real-time stereo vision system for long range (up to 100m) depth estimation. I know that there are some general considerations as described in this SOV post. I have seen some typical cameras such as zed stereo cameras which has limited range (max. 20m).

Maximum allowable baseline distance between cameras is 0.5m and about field of view, i think that a camera with 8mm (or 12 or 16) focal length can provide reasonable FOV. I need depth resolustions at 100m to be 1% or maybe lower.

Are ip cameras proper for such applications? If no, Can anyone please suggest proper cameras for application in long range stereo vision system?

I will be grateful for any information you can provide.

答: old thread but the RPI hq camera with the 16mm lens would give you 1.875m at 100m with a 0.5m baseline. I think something that wasn't talked about much that I'm looking into is field of view and zoom and the affect on disparity.</p>


问:
Selecting a gear reduction: torque vs speed
I have just sized the DC motors I want to use (corresponding to my robot and its intended applications - my figures include a 50% uncertainty factor to account for friction in reducers and other losses). Now I need to actually choose the exact motors I want to buy from the manufacturer (I am targeting maxon motors as I am not an expert and want no problem). I have a few down to earth questions about linking the mechanical needs to the electrical characteristics, among them:

Question #4:

The motor I chose (maxon brushed DC: 310005 found here) has nominal speed = 7630rpm - nominal torque = 51.6mNm. My needs are max speed = 50.42rpm / max torque = 10620 mNm. This means a reduction factor of 151 for speed and 206 for torque. Should I choose a gear closer to 151 or 206?

答:
I think the better practice might be to start with what you need to the transmission to do and work backwards to make your motor selection.

Start with your max torque requirement (10.6 Nm).   What kind of "max" is this?  Is it a momentary maximum that the system will routinely reach or is it an absolute maximum that may occur accidentally.  Let's assume that it is the former and not the latter.

Design starting with the transmission (aka reducer, gearbox) rather than the motor.  How "sloppy" can your gearing be?  If you need very low backlash and/or low weight, then you will need something like a harmonic drive.  If not, you might be able to use a lower precision solution like planetary gearing.

Given your output torque requirements, look through a guide like this.  I've linked to a guide from Harmonic Drive, but there are lots of other manufacturers.  If you look through the specs starting on p. 19 you will see a spec for "Limit for Repeated Peak Torque".  Let's take this as your max torque spec. (If you meant a momentary peak torque that is not routinely hit, then look at "Limit for Momentary Torque").

You are looking for a transmission that can support 10.6 Nm repeated peak torque.  The tables indicate that a size 14 gear (planetary or harmonic) could handle this with margin.

Next you need to decide on your speed requirement.  Do you care how fast your element can slew?  If you are not sure, then make a table of implied max output speeds for each gear model/available ratio given the max input speed listed in the specs.  For example, looking at the CSF models, you could support output speeds of 85, 106.25, and 170 rpm with the CSF-14-100, -80, and -50, respectively.  Step back and look at these and decide which of the candidates are acceptable and which are not.

At this point you might have a mix of harmonic drive and planetary drive candidates.  If you are not particularly concerned with backlash and weight, then you probably will want to use a planetary drive for cost.  Otherwise you will select a harmonic drive.  (You could also make this choice up front, but maybe it is best to enumerate all the candidates up front).

You will also want to add a column for "nominal" output torque in each case.  Here you could pull in the "Average Torque" specs.  You could estimate average speed by multiplying the max speed by the ratio of average torque rating to momentary peak torque rating.

Divide the speeds, average torques, and momentary peak torques in your table by the gear ratio. At this point you will have a table listing the average and maximum speeds that your motor needs to support.  You can go to your favorite motor suppliers catalog and select accordingly.

I've just illustrated this with a set of planetary and harmonic drives, but of course you could throw other types of transmissions into the mix.  These two are the most common for robot arms.


问:
How to calculate operating torque and holding torque of a slew drive for a manipulator arm?
Hope you are doing good and enjoying your weekend.
I have a question regarding calculation of torque and tilting moment for a slew drive. Slew drive (motorised) will be used at the base of a manipulator arm to facilitate the arm rotation in 360°.
image here.

For tilting moment : (the mass of each part of manipulator arm) * (perpendicular distance between CG of each part and axis of rotation) (as shown in image)

For operating torque : I am not quite sure how to calculate that because torque is also mass of each part * perpendicular distance between CG and axis of rotation. Then I thought that acceleration torque itself is the operating torque in my case (please correct me if I am wrong).

There is no existing slew drive on the manipulator so I have no reference point.

Could someone please guide me with the formula for calculating operating torque and holding torque for a slew drive based on the image shown?

Thank you for your valuable time and info.
Have a great sunday :)

答:
It really isn't an easy problem, since the answer depends on not only the masses and locations of each element, but also the velocities and accelerations you want to support.

When I looked into this problem myself I found precious few resources to learn from.  Robotics texts tend to abstract the problem away and aren't always of much practical value.

The best starting point for me was a really ancient paper from 1975 by B.K.P. Horn who as then (and still is!) with the MIT AI Lab.  I ended up writing my own primer based on Prof. Horn's to walk myself through solving gradually more difficult problems.  There is a really good text book out there by Rivin on The Mechanical Design of Robots, but it is out of print.

Sorry - Not a very concise answer to your question, but maybe a starting point.


问:
Why applied joint torque will affect another joint?
I want to ask a very simple question.

For the robot dynamics Newton-Euler algorithm, suppose there is a two-link planar robot, we can write the simple dynamic equation form as $M(\theta)\ddot{\theta} =  \tau - h(\theta,\dot{\theta})$.

From the equation, we can see if we applied only one joint torque(suppose applied at joint one and ignore all links gravity), it will affect another joint accelerate(change the second joint angles).

It's not intuitive, in my imagination, if we run the joint one motor and ignore the gravity of links, so just change the joint one angle.

who can explain it?

Thank you!

Best,

Ben.

答:
I would amplify on the previous answer by also pointing out that as a practical matter the maximum torque available from a given joint will depend on the joint actuator's weight, which will in turn influence the overall dynamics of the arm.  This is an insipid effect that can really confuse arm design.

This paper, presented at the 2020 ICCRE conference in Japan, steps through a couple of examples with different types of actuators to explore the effects on robot arm dynamic performance (and reliability).


问:
Finding torque equation for my robotic arm
I am designing a 5 dof robotic arm, and for that I would like to find a torque equation. However, I am a little confused here:
According to me the torque equation for M1 should be l2m2+l3m3+l4m4+l5m5 (m is mass of motors)(plus mass of link on their COG) but as these things will rotate so am I suppose to take their inertia or their mass?

答:
It's actually quite a bit more complicated than that.  You need to take into account not only the lengths and masses of each arm (and joint), but also what velocities and accelerations you want to support.

This paper provides a graded approach to understanding robot arm dynamics, starting with a simple dual-link arm.


问:
What can be the rating and specifications of dc motor used for making a quadcopter?
I want to make a quadcopter for my final year project and I am willing to use DC motors as the four rotors of the quadcopter. Can any one guide me about the ratings for proper motor selection for my job.</p>

答:
You'll need to use brushless (as opposed to brushed) motors for a quadcopter:

see Why do quadcopters use brushless motors

The motor goes hand in hand with the propellers, so you have to make sure they are compatible for your application, as you'll need to generate enough thrust to get it to fly (so it will depend on the weight):

see How to choose the right propeller/motor combination for a quadcopter?


问:
Help with 2D forward kinematics
I have been trying to find the HTM of a 2-DOF arm in 2D by finding the rotation matrices and displacement vectors by hand rather than use DH parameters to better understand them. I have followed the steps in this video to find the rotation matrices by finding the rotation when the joint angle is 0, and multiplying with the 2x2 rotation matrix around the z-axis.

However, when I solve for the HTM with theta1 = 90 degrees in python, I get a displacement vector of 0,0. I am wondering if the method I'm using to find the R0-1 is correct, especially since frame 1 is offset from frame 0. My steps are listed below:

a1 and a2 are the link lengths, and theta1 and theta2 are the joint positions, shown starting at 0.

Any help is very appreciated.

答:
I think you are on the right track.

Prof. B.K.P. Horn at the MIT AI lab wrote this paper to analyze this problem almost 50 years ago - at a time when there weren't any robotics texts available.  He goes through the problem slowly and step-by-step in a "classical" fashion.

The location of the first actuator is given by:

$x_1 = a_1\cos\theta_1$

$y_1 = a_1\sin\theta_1$

The location of the arm tip is:

$x_2 = a_1\cos\theta_1 + a_2\cos(\theta_1+\theta_2)$

$y_2 = a_1\sin\theta_1 + a_2\sin(\theta_1+\theta_2)$

I don't know if this is exactly what you are looking for, but if not I think you will find some guidance in Prof. Horn's paper.  He also solves the torque problem using Lagrangians and goes through that step-by-step.  If you have any other questions, you might email him.  After 50 years, he is still at MIT and writes back!

Title: Help with 2D forward kinematics


问:
Is using a robotic operating system still considered bare-metal C?
I want to get experience with low-level, bare-metal programming and am not sure if a project that uses an ROS counts as that.</p>

答:
Bare metal programming is defined by not using any abstractions that might be provided by an OS and working directly with the hardware. Wikipedia Technopedia.

ROS provides an even higher level framework which builds on top of your computer OS, such as Linux, or Windows.

You can learn a lot about low level concepts while using frameworks such as ROS. And you likely will find that you may want to select a specific part of a larger system to implement at the lowest level. A good learning project could be to reimplement an existing piece of functionality in bare metal instead of trying to recreate the entire system at the lowest level.


问:
Sending Universal Robots UR5e to specific place Using Camera
I have a UR5e installed with a simple camera on its end effector. The robot is at a known position (Cartesian pose/angles and joint angles)

Using the camera I took a picture of a QR code and got the object's real life coordinates to the camera using OpenCV's SolvePNP. This gives me a 3x1 translation vector and a 3x1 rotation vector.

I'd like to tell the robot to move to that position in translation and angles.

I guess first step would be to inverse that result so I have the QR code's position from the camera's axes point of view.

How do I "add" this movement to the robot's arm?

(Using Python and ut_rtde)

Thank you

答:
Just run some inverse kinematics and get the 6 joint angles that move the camera to the wanted position.

And find the example Python code that controls each motor angle of the robot and give your 6 values above.


答: If you don't want DH, then why bother at all with rotation matrices. For this simple case, you can do it by hand much simpler than dealing with the rotation matrices.

Title: Help with 2D forward kinematics

Body:
I have been trying to find the HTM of a 2-DOF arm in 2D by finding the rotation matrices and displacement vectors by hand rather than use DH parameters to better understand them. I have followed the steps in this video to find the rotation matrices by finding the rotation when the joint angle is 0, and multiplying with the 2x2 rotation matrix around the z-axis.

However, when I solve for the HTM with theta1 = 90 degrees in python, I get a displacement vector of 0,0. I am wondering if the method I'm using to find the R0-1 is correct, especially since frame 1 is offset from frame 0. My steps are listed below:

a1 and a2 are the link lengths, and theta1 and theta2 are the joint positions, shown starting at 0.

Any help is very appreciated.


问:
Why does the HG4930 IMU have better specifications than the HG1700, even though it's almost certainly worse?
I was browsing and looking at different IMUs and came upon the following Honeywell page:

https://aerospace.honeywell.com/us/en/learn/products/sensors/inertial-measurement-units

There they have a table comparing a bunch of IMUs. I was looking at their RLG-based HG1700 and their MEMS-based HG4930. I am fairly certain that there is no way that the HG4930 is a better sensor than the HG1700, yet it beats or equals the HG1700 in all areas except for the turn-on bias specifications, which to my understanding aren't the most important if you have access to a GNSS aid for some amount of time. It's even lighter, smaller, and uses less power.

HG4930:

In-run gyro bias: 0.25deg/hr

In-run accel bias: 0.025mg

Turn-on gyro bias: 7deg/hr

Turn-on accel bias: 1.7mg

ARW: $0.04^\circ/\sqrt{hr}$

HG1700:

In-run gyro bias: 0.25deg/hr

In-run accel bias: 0.05mg

Turn-on gyro bias: 1deg/hr

Turn-on accel bias: 1mg

ARW: $0.125^\circ/\sqrt{hr}$

I don't really believe that the HG4930 is a better sensor than the HG1700 for, say, estimating position and attitude. So, what's the catch?

答:
These numbers are important but there are many other metrics to evaluate sensors on. No sensor is best in all applications. You've already called out size, weight, and power consumption. There are other characteristics such as reliability, physical robustness, max acceleration and rates measurable before saturation, sensing quality in the presence of noise factors. Many of these properties are implied in the datasheet by the differentiation of the technologies inside MEMs vs RLG. I'd suggest that you read up more on the different technologies.

MEMs devices are newer and are improving more. Here's an article asking if they are better already but it still comes down to what your application requires rather than a generic statement of "better" and what do you value most in the various cost benefit tradeoffs.


问:
How to avoid gimbal with Quaternions
I'am working with an LSM6DSO32, so I'am starting with Kalman filter, everything works but with Euler angle I got gimbal lock I think... But if my pitch angle approach to 90° my roll angle jump and I get a bad value and my pitch is like blocked around 90°.

So I searched and I foud this phenomenon "Gimbal lock" after some other researches I have read I should use Quaternions to avoid this Gimbal lock. I found this code that implement MadgwickAHRS algo who use Quaternions here

But if I use computeAngles, this function return Euler angles I have again Gimbal problem. So my question is, how can I only use Quaternions without Euler transformation to compute my roll and pitch angles? My objective is to know if my roll or my pitch angles has move to 90 or -90° aboyt my start position. For example, if my start position is roll 20° and pitch 10°, I would like to detect if my roll is 110° or -70° and if my pitch is 100° or -80°

How can I solve my problem with only q0, q1, q2, q3 values ?

I found this article here I've tried the solution for gimbal lock, but when I set my roll to 0 and compute yaw with 2atan2(q1, q0) for pitch equals PI/2 the value I got isn't good, yaw move a lot...

答:
If you define your tested conditions in terms of euler angles, you're going to have to use euler angles. I would suggest finding a way to reframe your question not in terms of euler angles but by the quantities of change.

It's not clear what you mean by q0 - q4 are those the individual values of one quaternion, or 4 different quaternions?

It seems like you should have an initial quaternion and a final quaternion. You can then compute the difference, and likely provide logic that thresholds on properties of that resultant quaternion. Such as the resultant angle is 90 degrees from the original. Or maybe the angle around a specific axis like asked here

Title: How to avoid gimbal with Quaternions


问:
ros2 interface name is not multicastable
I am new to ros2. When I try to run a launch file, I get this message.

selected interface "interfaceName" is not multicast-capable: disabling multicast

I get this message when I use galactic, but when I use dashing I'm not getting this error.

Is there a possibility to disable this message?

Environment

Docker image: Ubuntu20

Ros2 Distro: galactic

Thanks a lot!

答:
I'm not sure, but I suspect the message is coming from the RMW implementation. The default RWM implementation for Galactic (rmw_cyclonedds) is different from the default in Dashing (rmw_fastrtps_cpp). You could try setting the environment variable RMW_IMPLEMENTATION to try a different RMW before launching, e.g.:

```<code>export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
</code>```

Note, this changes the underlying communication library; you should set this variable in all terminals that are starting ROS nodes, otherwise you may run into issues with nodes communicating with each other. For more details about changing the RMW, see Working with multiple ROS 2 middleware implementations.

Body:
I'm not sure, but I suspect the message is coming from the RMW implementation. The default RWM implementation for Galactic (rmw_cyclonedds) is different from the default in Dashing (rmw_fastrtps_cpp). You could try setting the environment variable RMW_IMPLEMENTATION to try a different RMW before launching, e.g.:

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

Note, this changes the underlying communication library; you should set this variable in all terminals that are starting ROS nodes, otherwise you may run into issues with nodes communicating with each other. For more details about changing the RMW, see Working with multiple ROS 2 middleware implementations.


问:
How to connect cmd_vel to motor_command in ROS
I have a motor driver for a BLDC wheel. I have successfully made the motor driver and ROS connections and when I send motor_command as in the "user manual" of the motor drivers, my wheels are working.

I found a package to make Differential Drive. Differential Driver Package link

I can use the "twist_to_motors.py" file to be able to drive in this package. But how can I provide a bridge between my motor driver and this file?

my motor command : rostopic pub -r 10 /bldc_driver_node/Command chip_bldc_driver/Command "motor_command: 100"

if i run this command my wheel is spin. But cmd_vel and i want use teleop, how to bridge?

this my motor driver package link : motor-driver-package

答:
Based on the twist_to_motors.py documentation, it sounds like you have to map the following two published topics to your motor command subscribers:

lwheel_vtarget - (std_msgs/Float32)

The target velocity for the left wheel (in M/s)

rwheel_vtarget - (std_msgs/Float32)

The target velocity for the right wheel (in M/s)

One way I can think of to do this is to implement a bridge node. The bridge node would subscribe to the lwheel_vtarget and rwheel_vtarget topics, and in the callback functions you would add the logic to convert from m/s to your motor command and publish the motor command.

Here's a sketch implementation in Python (I haven't tested it):

import rospy
from chip_bldc_driver.msg import Command
from std_msgs.msg import Float64

def main():
    rospy.init_node('bridge_motor_command')

    left_pub = rospy.Publisher('left/motor_command', Command, queue_size=10)
    right_pub = rospy.Publisher('right/motor_command', Command, queue_size=10)

    def convert(msg):
        command = Command()
        # TODO: change this line to properly convert from m/s to motor command
        command.motor_command = msg.data * 1000

    def left_callback(msg):
        nonlocal left_pub
        left_pub.publish(convert(msg))

    def right_callback(msg):
        nonlocal right_pub
        right_pub.publish(convert(msg))

    left_sub = rospy.Subscriber("lwheel_vtarget", Float64, left_callback)
    right_sub = rospy.Subscriber("rwheel_vtarget", Float64, right_callback)

    rospy.spin()

```

The publisher topic names and queue sizes can be changed to fit your needs. Similar code could be implemented in C++, if that is your preferred language to use.

Body:
Based on the twist_to_motors.py documentation, it sounds like you have to map the following two published topics to your motor command subscribers:

lwheel_vtarget - (std_msgs/Float32)

The target velocity for the left wheel (in M/s)

rwheel_vtarget - (std_msgs/Float32)

The target velocity for the right wheel (in M/s)

One way I can think of to do this is to implement a bridge node. The bridge node would subscribe to the lwheel_vtarget and rwheel_vtarget topics, and in the callback functions you would add the logic to convert from m/s to your motor command and publish the motor command.

Here's a sketch implementation in Python (I haven't tested it):

import rospy
from chip_bldc_driver.msg import Command
from std_msgs.msg import Float64

def main():
    rospy.init_node('bridge_motor_command')

    left_pub = rospy.Publisher('left/motor_command', Command, queue_size=10)
    right_pub = rospy.Publisher('right/motor_command', Command, queue_size=10)

    def convert(msg):
        command = Command()
        # TODO: change this line to properly convert from m/s to motor command
        command.motor_command = msg.data * 1000

    def left_callback(msg):
        nonlocal left_pub
        left_pub.publish(convert(msg))

    def right_callback(msg):
        nonlocal right_pub
        right_pub.publish(convert(msg))

    left_sub = rospy.Subscriber("lwheel_vtarget", Float64, left_callback)
    right_sub = rospy.Subscriber("rwheel_vtarget", Float64, right_callback)

    rospy.spin()

The publisher topic names and queue sizes can be changed to fit your needs. Similar code could be implemented in C++, if that is your preferred language to use.


问:
Tracking 2D positioning with IMU Sensor
I am using a miniature car and I want to estimate the position. We can not use GPS modules and most of the tracking systems that I saw, are using IMU senson with the GPS module. In our car we are able to find our exact correct location with image processing but for some parts that dont have enough markings we can not do this. So we want to use the IMU as backup for our positioning. so as long as the positioning is close is good for us.

And we are only interested in our 2D position since the car is on a flat ground.

I am using a IMU 9DOF sensor and I want to calculate my movement. I have seen some amazing works with IMU for tracking body movements but no code or simple explanation is anywhere about it. So basically I have the reading from accelerometer, gyro and magnetometer. I also have orientation in quarternions. From the device I am getting also the linear acceleration but even when I am not moving it in any direction the values are not 0 which is really confusing.

Can you please help me how to approach this?

Thanks in advance

答:
An IMU as any sensor is not perfect and it is affected by errors.

In IMUs case there are some accelerometers and gyros. They should be orthogonal each other but for construction constraints they can't really be.

Expensive IMUs come with a calibration matrix which is "personal" for each device, and here is why of the extra costs. So someone should calibrate it before use it.

IMUs are affected by many others things like magnetic fields as example.
This is another reason for why you won't never read a zero value if the IMU is not moving.

All these error affect the pose estimation since they read accelerations you have to perform a double integration of the value to reach a pose. Double integration of an error make it error^2 (for a simple constant error due to bad calibration).

I can suggest you to search the web for "pose estimation algorithm" as keywords or go to ROS that maybe have something ready for your IMU.

Title: Tracking 2D positioning with IMU Sensor


问:
Sensor fusion with extended Kalman filter for roll and pitch
I'm trying to implement an extended Kalman filter to fuse accelerometer and gyroscope data to estimate roll ($\phi$) and pitch ($\theta$). I've found a lot of kalman filter questions but couldn't find one that helped for my specific situation. I've implemented the filter with the below equations and matrices, gotten from the "small unmanned aircraft" book by Beard and McLain.

state predict with new gyroscope data:
$$
x_{n + 1} = x_n + T_s  f(x, u) \\
P_{n+1} = P_n + T_s (AP_n + P_nA^T + Q)
$$

measurement update with new accelerometer data ($y$):

$$
K = PC^T(CPC^T + R)^{-1} \\
x = x + K(y - h(x, u)) \\
P = (I - KC)P
$$

f(x, u) =

$$\begin{matrix}
\dot \phi + \dot \theta  sin(\phi)tan(\theta) + \dot \psi cos(\phi)tan(\theta)\\
\dot \theta  cos(\phi) - \dot \psi  sin(\phi)
\end{matrix}$$

where $\dot \phi, \dot \theta, \dot \psi$ are the roll, pitch, and yaw angular velocity from the gyroscope

A =
$$\begin{matrix}
(\dot \theta  cos(\phi) - \dot \psi sin(\phi))tan(\theta) &  (\dot \theta  sin(\phi) - \dot \psi cos(\phi))sec^2(\theta)\\
-\dot \theta  sin(\phi) - \dot \psi  cos(\phi) & 0
\end{matrix}$$

h(x, u) =
$$\begin{matrix}
gsin(\theta)\\
-gcos(\theta)sin(\phi)\\
-gcos(\theta)cos(\phi)
\end{matrix}$$

C =

$$\begin{matrix}
0 & gcos(\theta)\\
-gcos(\phi)cos(\theta) & gsin(\phi)sin(\theta)\\
-gsin(\phi)cos(\theta) & gsin(\theta)cos(\phi)
\end{matrix}$$

my state vector is:

x =
$$\begin{matrix}
\phi\\
\theta
\end{matrix}$$
and they're both initially set to 0.

$T_s$ is the time step, and is set to 0.1 since that's how often i call the predict and update functions. The Q matrix is a diagonal of 1.5 and the R matrix is a diagonal of 0.025.

When I actually implement this, i get the following output, which is pretty stable until i move the IMU:

I'm not sure why it would settle with a bias of 2, are there any common pitfalls that cause something like this?

When i actually try to rotate it about x or y, the output goes crazy:

It gets bit better and changes less rapidly when i make Ts smaller, but that doesn't seem like the right solution. Is there another problem I'm not seeing in my math?

If not then I'll go back and look over my actual code. I thought if i include that here too, then the post will get too long, if not I'll edit to add my code as well.

Thanks for the help.

答:
I wanted to comment but it did not allow me, so I am writing an answer!

If matrix $A$ is Jacobian of $f(x,u)$, then the upper right element of $A$, i.e., A(1,2), should be $(\dot{\theta}\sin(\phi)+\dot{\psi}\cos(\phi))\sec^2(\theta)$.

The sign of cosine is positive.


问:
What common device uses 7 pin mini DIN plugs, that could be used for the Roomba serial port?
I have a Roomba that I'm planning to hack on the cheap, using junk cables and other parts. The excellent book Hacking Roomba suggests using Macintosh serial cables as a cheap surrogate.

However, as a hopeless Macintosh aficionado, I am somewhat loath to start chopping up my precious Mac cables. Plus the 8 pin Mac cables aren't an exact match anyway

So, I was wondering what other, hopefully commonly available, devices use a 7 pin mini DIN plug, that could be used instead?

答:
Core Electronics sell the cables...

https://core-electronics.com.au/mini-din-connector-cable-for-irobot-create-2-7-pins-6-feet.html?utm_source=google_shopping&gclid=CjwKCAiAx8KQBhAGEiwAD3EiP3lPsVEOb1lMni_NlwosKJn3eBxhbsDlLSWiARWlqn-ZYJkN7FcUTBoCHPcQAvD_BwE

you can also find the plugs on ebay, just google "ebay roomba din plug"


问:
Particle filter on more dimensions?
I decided to write and implement a very small radar tracking program in order to understand the basics of the particle filter.
So I wrote a class (class Aircraft) for a ideal moving plane which moves with constant speed and constant altitude . The model can be mathematically written as:

$$
\underline{x}_{k + 1} = \underline{x}_{k} + \underline{v} \Delta t
$$

where $\underline{x} = [x, y]^T$
Since speed and altitude are constant:

$$
x_{k+1} = x_{k} + v_{0} \Delta t \\
y_{k+1} = h_{0}
$$

Then I wrote anothe class (class Radar) to simulate a radar for tracking the aircraft. Basically it takes the x and y coordinates of the aircraft and calculate the range and the slope of the radar beam tracking the airplane. Since a radar is not perfect I added some gaussian noise $\mathcal{N}(0, \sigma)$ to the range and to the slope, thus:

$$
\rho = \sqrt{x_{k}^{2} + y_{k}^{2}}  + \mathcal{N}(0, \sigma)\\
\theta = arctan2(y_{k}, x_{k}) + \mathcal{N}(0, \sigma)
$$

Here a screenshot of the program and below the whole code for all the people, who can profit from it:

Now...my problem is simply that in my program, at the prediction step, I predict the particles using a model, where speed and altitude are constant all the time -> starting conditions: $(v_{0}, h_{0})$

Question: since the model above is not close to the reality (a real aircraft can change speed and altitude at any given time), how can I realize a particle filter, which take account of the position (done), speed and altitude at the same time?
Should I implement a particle filter for the speed and for the altitude and then feed the outputs to the particle filter for the position?
Or there are other better and more efficient ways to track more then a state with a particle filter?

Here the entire code for playing (many thanks to Robert Labbe and his staff: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python)

```<code>#!/usr/bin/env python3

__version__ = "0.1"

# Importing relevant libraries
from filterpy.monte_carlo import systematic_resample, residual_resample, stratified_resample, multinomial_resample

import matplotlib.animation as animation
import matplotlib.pyplot    as plt
import matplotlib

import pandas as pd
import numpy  as np
import scipy.stats

###################################################
#
#  Defining a class for the aircraft
#
###################################################
class Aircraft(object):

    def __init__(self, x0, v0, h0):

        self.x0 = x0  # horizontal position
        self.v0 = v0  # horizontal velocity
        self.h0 = h0  # height

    def getRealPosition(self, t):
        """ Calculate the real position of the aircraft
            Remember: it flies at constant speed and height
        """
        x = self.x0 + (self.v0 * t)

        return np.array([x, self.h0])

###################################################
#
#  Defining a class for the radar
#
###################################################
class Radar(object):

    def __init__(self, sigma):

        self.range = 0.0    # direct way to the target
        self.theta = 0.0    # angle to the target
        self.sigma = sigma  # radar noise

    def getRange(self, position):
        """ Calculate the range and the angle to the target, and add some noise
            to the calculation to make the radar reading noisy
        """
        range      = np.sqrt(np.square(position[0]) + np.square(position[1]))
        self.range = range + (np.random.randn() * self.sigma)

        theta      = np.arctan2(position[1], position[0])
        self.theta = theta + (np.random.randn() * self.sigma / 30.0)

        return np.array([self.range, self.theta])

    def getPlotRadar(self, data):
        """ Utility to display the target seen by the radar on the plot """
        x = data[0] * np.cos(data[1])
        y = data[0] * np.sin(data[1])

        return np.array([x, y])

###################################################
#
#  Defining a class for the particle filter
#
###################################################
class particleFilter(object):

    def __init__(self, N, x0, y0):

        self.__num_particles = N
        self.__particles     = np.empty((N, 2))
        self.__x0            = x0
        self.__y0            = y0
        self.__weights       = np.ones(N) / N

    def create_gaussian_particles(self, mean, std):

        self.__particles[:, 0] = self.__x0 + (np.random.randn(self.__num_particles) * std)
        self.__particles[:, 1] = self.__y0 + (np.random.randn(self.__num_particles) * std)

    def predict(self, v0, std):

        self.__particles[:, 0] += (v0 * 1.0) + (np.random.randn(self.__num_particles) * std)
        self.__particles[:, 1] += (np.random.randn(self.__num_particles) * std)

    def update(self, z, R, radar_position):

        for i, pos in enumerate(radar_position):

            distance = np.linalg.norm((self.__particles - pos), axis = 1)
            self.__weights *= scipy.stats.norm(distance, R).pdf(z)

        # Normalize weights
        self.__weights += 1.e-300
        self.__weights /= sum(self.__weights)

    def neff(self):
        """ Compute the effective N, which is the number of particle, which contribute to the probability of distribution """
        return (1. / np.sum(np.square(self.__weights)))

    def resample_from_index(self, indexes):

        self.__particles[:] = self.__particles[indexes]

        self.__weights.resize(len(self.__particles))
        self.__weights.fill(1.0 / len(self.__weights))

    def resample(self):

        if self.neff() < (self.__num_particles / 2):

            indexes = systematic_resample(self.__weights)
            self.resample_from_index(indexes)

            assert np.allclose(self.__weights, (1. / self.__num_particles))

    def estimate(self):
        """ Mean and variance of the weighted particles """
        pos = self.__particles[::1]

        mean = np.average(pos, weights = self.__weights, axis = 0)
        var  = np.average((pos - mean) ** 2, weights = self.__weights, axis = 0)

        return mean, var

    def getParticles(self):

        return self.__particles

###################################################
#
#  Here begins the main code
#
###################################################

N_MAX       = 200
N_PARTICLES = 1000
x_map_dim   = N_MAX
y_map_dim   = 80

radar_noise    = 0.8   # noise of the measure
radar_position = [0.0, 0.0]

x0 =  0.0  # Starting position
v0 =  1.0  # Aircraft speed
h0 = 56.0  # Aircraft height

aircraft  = Aircraft(x0, v0, h0)
radar     = Radar(radar_noise)
pf_filter = particleFilter(N_PARTICLES, x0, h0)

pf_filter.create_gaussian_particles([x0, h0], radar_noise)

fig, ax = plt.subplots()

plt.xlim(0.0, x_map_dim)
plt.ylim(0.0, y_map_dim)

pt1, = ax.plot([], [], 'g>', ms = 12)   # Draw the aircraft on the plot
pt2, = ax.plot([], [], 'r.', ms = 4)    # Draw the target seen by the radar on the plot
pt3, = ax.plot([], [], 'c.', ms = 0.2)  # Draw the particles on the plot
pt4, = ax.plot([], [], 'b+', ms = 4)    # Draw the estimated position of the aircraft on the plot

ax.legend([pt1, pt2, pt3, pt4], ['Aircraft', 'Radar', 'Particles', 'Estimated position'], loc = 'lower right')

def animate(i):

    real_pos      = aircraft.getRealPosition(i)
    radar_measure = radar.getRange(real_pos)
    plot_radar    = radar.getPlotRadar(radar_measure)  # Not needed, if the radar should not be plotted

    pf_filter.predict(v0, radar_noise)  # Prediction made on the basis that speed and height are constant

    pf = pf_filter.getParticles()  # Not needed. It is only for showing the particles on the plot

    pf_filter.update(radar_measure[0], radar_noise, radar_position)
    pf_filter.resample()

    mu, _ = pf_filter.estimate()

    pt1.set_data(real_pos[0], real_pos[1])
    pt2.set_data(plot_radar[0], plot_radar[1])
    pt3.set_data(pf[:, 0], pf[:, 1])
    pt4.set_data(mu[0], mu[1])

animation = matplotlib.animation.FuncAnimation(fig = fig, func = animate, frames = N_MAX, interval = 100, repeat = False)

plt.show()
</code>```

答:
Each particle should represent a point in the state space that you care about. So your particles will have information about position (altitude included) and speed.

You should then predict the particles forward using the more accurate model you have. If you don't have any information about how the speed or altitude change, that's okay, just make sure that your measurement noise covariance parameter is enough to capture some of the deviation from the prediction. Of course since you are simulating the sensors, you can just reduce the noise, but in reality, you can't do that.

For the prediction step, each particle will use whatever velocity it has to predict its position. In this way, particles can represent different velocities and hopefully their mean represents the true velocity of the aircraft.

Title: Particle filter on more dimensions?


问:
Rotary Stage (high resolution controller for BLDC motor)
I am building a 3phase BLDC motor controller based on an STM32 MCU, a high resolution 26 bit optical encoder and a DRV8301 motor driver from TI.

This is a for a high precision rotary stage for an optical project.

My question is about the strategy to control the motor. I have tried multiple different techniques but at the end of the day I am not able to tune the system for the various operating modes I will need when using the rotary stage.

The modes I will be needing are: position hold, very slow speed control (from 100 to 1000 counts per second) to moderate speeds (a few degrees per seconds), up to high speed (relative to my application) or about 60 degrees per second.

In other words we are talking a wide range of speeds from 100 or counts per second to about 10 million counts per second.

Position data is polled at 8KHz and the noise is roughly 2 counts RMS which is pretty good.

I initially tried a P-PI cascade controller (a position controller feeding a velocity controller). it worked, but this technique didn't yield the best tracking accuracy mainly because the velocity measurements are derived from the position and the delta position between two periods is roughly equivalent to noise. Boosting the filtering helped but not enough.

I tried variations of this cascade controller, by adding I and D terms. Which didn't really help.

I then tried to do a simple position controller (PI, and PID) which gave me the best results in terms of tracking accuracy. The biggest challenge with this one is that there is realistically no way of tuning for one specific speed without significantly damaging the other speeds I am interested in.

Of course I could retune or create various presets, or even try to correlate PID gains to the velocity I want to track at.

My question is this: what is the best approach to this problem? Is there a better strategy than any of the ones I mentioned?

Cheers
SM

答:
gain scheduling

It sounds like a simple PI controller works well for this motor at any particular narrow range of speeds, but tuning it for one speed ruins the performance for other speeds.
This is common when the process you are trying to control is strongly nonlinear.

This motor sounds like a good candidate for "gain scheduling". (a) (b) (c) (d)

One approach to gain scheduling:
A single PI or PID controller, where the PID values are come from a lookup table, with 2 or more values for "P gain" or "D gain" or "I gain" or some combination, switching from one entry to another depending on the current speed.
This is equivalent to the other approach to gain scheduling:
2 or more PI controllers or PID controllers, each one with PID values tuned for a different range of speeds, switching from one to another depending on the current speed.
(I've seen one system that at high speeds counted "pulses per millisecond"; but at low speeds anywhere close to "1 pulse per millisecond" it switched to different hardware that measured "time between pulses").

This leads to the question of how exactly to switch from one range to another range. The various strategies for doing that are known as "bumpless transfer". (d) (e)
(Usually "bumpless transfer" applies to switching from manual control to PID control, but the same techniques apply to switching from a main line to a bypass line (f) and gain scheduling.).

non-linear PID

With standard linear PID, there is inevitably a tradeoff:
when the current speed is far away from the desired speed, it would be nice to have a fast response (fast slew rate), i.e., high P gain, but that generally leads to large overshoots.
When the current speed is close to the desired speed, it would be nice to have little or no overshoot, i.e., low P gain, but that generally leads to slow response.

A variety of approaches modify the error value with some non-linear function before feeding the modified error value into the P term (or all 3 of the P,I,and D terms) of a standard PID controller.

Many people do this in hopes of getting both fast response (high gain) when the error is large, and little or no overshoot (low gain) when the error is small.

Other people add nonlinear functions to the raw sensor values (or the error value or both) to try to "cancel out" non-linearities of a strongly nonlinear system, hoping that that the result is close enough to linear that a standard PID will work great.
( See "How to control a nonlinear system with a PID controller" ).

Either way, non-linear PID requires tuning the parameters of a non-linear function.
(g) (j) (h) (i) (k) (l) (m)


问:
Self-Motion Manifolds
In this paper by J. W. Burdick, the main result basically says that

for a redundant manipulator, infinity solutions corresponding to one end-effector pose can be grouped into a finite set of smooth manifolds.

But later in the paper, the author said only revolute jointed manipulators would be considered in the paper.

Does this result (grouping of solutions into a finite set of manifolds) hold for redundant robots with prismatic joint(s) as well? Is there any significant difference in analysis and result when prismatic joints are included? So far I couldn't find anyone explicitly address the case of robots with prismatic joints yet.

(I am not sure if this site or math.stackexchange.com would be the more appropriate place to post this question, though.)

答:
Saw this question and figured I would throw my two cents in 5 years later.

Gilhad's reasoning about the mathematical process of simple to complex theorems/proofs makes sense as to why the analysis is done only with revolute joint manipulators. However, going from spherical to prismatic is going from complex to simple. A solely prismatic serial manipulator is painfully easy to analyze:

Consider the fact that a prismatic joint has no rotational axis. Thus, a solely prismatic serial manipulator has no rotational degrees of freedom. This is why there is no real discussion about such manipulators - they are a trivial case (constrained to only 1D, 2D, or 3D translations). The aforementioned transformation from revolute joints to prismatic joint would suffer from the same issues - as it has been specifically designed to be "translate-only".

The analysis of serial manipulators becomes much more difficult when revolute joints are introduced - bringing with them lots of sine's and cosine's, as well as (up to) 3 additional orientation degrees of freedom.

As for what the analysis of a prismatic joint serial manipulator looks like, let's consider our end-effector Jacobian at a given joint configuration $q$, $J(q)$ - the crystal ball of manipulator properties. Given a robotic manipulator with $n$ joints (with some trivial design constraints being satisfied) and $m$ degrees-of-freedom in the workspace, Burdwick's analysis is restricted to the cases where $n \ge m$. Thus, $J \in \mathbb{R}^{m\times n}$ is either a square matrix or a matrix such that there is at least one linearly dependent column (this latter idea being useful for the derivation of the aforementioned smooth manifolds).

To gain some intuition on a general prismatic manipulator Jacobian, let's look at a 3-joint prismatic serial manipulator where joint one translates the end-effector solely along the X-axis, joint 2 along the Y-axis, and joint 3 along the Z-axis. We will assume this analysis is being done in the future where problems do not exist, such that the manipulator has no discernible joint limits. Without getting into the derivation of this manipulator's Jacobian, we will wave our hands and find that:
$$J(q) =
  \left[ {\begin{array}{cc}
    1 & 0 & 0\\
    0 & 1 & 0 \\
    0 & 0 & 1 \\
  \end{array} } \right]$$
We see that $J(q)$ is invertible, a necessary condition for a prismatic manipulator to have 3 workspace degrees-of-freedom, for all possible joint configurations. Thus, any movement in our workspace, defined as $\dot{x} = J(q)\dot{q}$, can be directly mapped back to a movement in the joint space as $\dot{q} = J(q)^{-1}\dot{x}$. Intuitively, we can see that following a desired joint trajectory will cause a unique end-effector motion - and likewise a unique end-effector trajectory will be caused by a unique joint trajectory (not at all the case with revolute joint manipulators). With a few additional steps we could prove that the forward kinematics map of this manipulator, and in fact all prismatic manipulators where $n = m \le 3$ and $J(q)$ is invertible, is a bijection.

This is a distinct difference from one of the major propositions Burdick makes about revolute manipulators - which is the forward kinematics map for a 3-joint revolute spatial (having all 3 translational degrees-of-freedom) manipulator may have up to 4 unique solutions.

Finally, when considering redundant manipulators - one interesting addition to the original problem of inverse kinematics is that each solution will lie on a smooth $n-m$ dimensional manifold (as opposed to a single point). To traverse this manifold, we begin by taking the singular value decomposition of $J(q)$. This yields the following relationship: $J(q) = U\Sigma V^{T}$, where $U \in \mathbb{R}^{m\times m}$, $\Sigma \in \mathbb{R}^{m\times n}$, $V \in \mathbb{R}^{n\times n}$, $U$ and $V$ are orthonormal matrices, and $\Sigma$ has non-zero entries only along its diagonal. As the last $n-m$ columns of $\Sigma$ contain only zeroes, the last $n-m$ rows in $V^{T}$ will serve as a basis for "null" motion (joint motion that does not affect the end-effector). If we let $v = \dot{q}$ be equal to one of these vectors (or a linear combination of them), then $V^{T}v \in \mathbb{R}^{n\times 1}$ will have non-zero entries only in the last $n-m$ rows (perhaps an interesting exercise for the curious). These non-zero entries will be "zeroed" by the $n-m$ all-zero columns of $\Sigma$. This should be enough to show that we satisfied the following:
$$ \dot{x} = J(q)\dot{q} = U\Sigma V^{T}\dot{q} = 0, \dot{q} = v$$

Given that a prismatic joint manipulator has a constant Jacobian, its singular value decomposition will also be constant and thus linear. The manifolds for these prismatic manipulators then are $n-m$ dimensional linear subspaces of the $n$ dimensional joint space.

There, I wasted my time explaining the analysis of prismatic joint manipulators to show why you will never see anyone else wasting their time on the analysis of prismatic joint manipulators ;)

Title: Self-Motion Manifolds


问:
Inferring joint orientation on multi-joint arm
Not a robotics question in the strictest sense, I guess, but related closely enough, I hope:

I have an arm-like articulated two(-plus-one)-joint appliance that I want to use as a 3D input device. It uses an angle measurement device and two IMUs, which are placed as depicted schematically below:

The blue boxes depict the positioning and orientation of the IMUs (the arrows point to the IMU's relative "forward" direction). The blue dot/highlighted angle represent the angle being measured. The base can rotate around its centre, counting as the third joint, technically, but shouldn't be of too much relevance here. The arm joint rooted at the base has two rotational degrees of freedom, indicated by the red-ish arrows (it can't rotate around the base's up-direction). The unfilled rectangle represents the data I'd like to infer from the other measurements.

edit: I cannot post more accurate schematics here, but if you want to visualise this apparatus a bit better, think of a Geomagic Phantom, except that the lower arm joint is not rotational, but is built more like a classic analog joystick.

Note: The positioning of the sensors, especially of the IMUs at the base and on the second arm joint are fixed, so please do not suggest changing these (I can't).

I'm now wondering how to compute the orientation of the middle link from the data I have: both IMUs return quaternions $q_0$ and $q_2$, respectively (relative to the magnetic north, measured from their relative forward-direction). My representation for the relative rotation between the two arm links is a quaternion ($q_a$) as well (even though it could just as well be directly represented as an angle, but since I'm performing quaternion math anyways, I might as well have it in this form, too). I'm pretty sure that there must be some way to basically compute what an IMU on the middle link (let's call it $q_1$) would measure from the data I have, but I'm not quite sure about my maths here...

My intuition was to compute $q_1 = q_0^{-1} * q_2 * q_a^{-1}$, following from the assumed identity $q_2 = q_0 * q_1 * q_a$, but that doesn't seem to hold. As I feared that the rotation of $q_2$ relative to the joint it resides on influences the computation result, I also computed $q_1 = q_0^{-1} * q_2 * q_{z\pi} * q_a^{-1}$, where $q_{z\pi}$ represents a 90° rotation around the up(=z)-axis.

However, my measurements still seem off when I visualise the movements (the $q_1$ movement seems exaggerated compared to the actually induced movement). What else might I miss here? Is my math faulty, or is it possibly only an implementation mistake I made?

EDIT2: I found that one major flaw of my maths was the lack of calibration. Adding a calibration pose, I was able to compute the relative orientation between the two IMUs in both the visual model and the actual device and go from there. However, to compute the lower link's orientation, I still rely on an equation like $q_1 = q^*_2 * q_a^{-1}$, with $q^*_2$ being the quaternion that rotates from the relative orientation between $q_0$ and $q_2$ in the calibration pose towards their current relative orientation. I'm still not quite sure if that equation is fully appropriate, but it appears to work okay so far.

答:
I might be missing something here, but if you are looking for the position of the tip of the arm, it should just be:

$x = l_1\cos(\beta) + (l_1+l_2)\cos(\alpha + \beta)$

$y = l_1\sin(\beta) + (l_1+l_2)\sin(\alpha + \beta)$

where $l_1$ is the length of the first link, $l_2$ of the second, $\alpha$ the relative angle of rotation that you indicate in your diagram, and $\beta$ the angle of rotation of the base arm (not indicated with any symbol in your diagram).


问:
The math behind minimum controller sample rate compared to actual error frequency spectrum
It seems intuitive to me that, in a digital system, a system sampling the error rate "too slowly" will fail to stabilize the system.

Is there a theory/set of metrics/equation I can use to represent this in the frequency or time domain?

i.e.

$$
e(t) : \text{Actual error (not sampled error) with respect to time}
\\
e(s) : \text{Laplace or frequency domain representation of error signal}
\\
F_s : \text{Rate at which error is sampled}
$$

If $e(t)$ has frequency components much higher than $F_s$ (or maybe if $F_s < 2\text{max}[e(s)]$ ), is it possible to properly control the system?

答:
If you do not filter out (or filter down) the high frequency components of $e(t)$, they will be "folded back" into the desired spectrum through the process of "aliasing".

Practically speaking, no low-pass filter is ideal, so there will always be high frequency components that get under-sampled and aliased back.  You can view these undesired components as a noise contribution at the output of your sampler.  Depending on the nature of the high-frequency components, they might just introduce white noise that produces small random errors, or they may introduce a bias that you need to account for.

This paper by Texas Instruments gives a pretty comprehensive treatment of the subject.


问:
Get the arm joint angles with kinect 1
I am Carlos Barreiro and I am studying a Robotics Master. Now I am working with my Thesis. The project consists in the teleoperation of the a robot with Kinect (model 1). More specifically, I am working with the humanoid robot Pepper which is developed by Aldebaran (Softbank).

For the skeleton tracking in real time I am using the Kinect for Windows SDK (v1.8).  Because with the kinect 1 I can’t obtain the Skeleton tracking in Linux :-(. It is not a problem, I think that I can continue with Windows for a few time.

For this project I use Python because I have more experience with this language and it is easier communicate with Naoqi (the robot middleware). For the communication with Kinect I am using the library PyKinect, it is a wrapper from the C++ Windows SDK.

My problem is calculating the rotation angle for the arm actuators. The robot needs translate the positions of the points of the skeleton to an angle for each motor (Pitch Roll or Yaw) like the bellow picture.  So I need to get the shoulder pitch, should roll, elbow roll and elbow Yaw.

The skeleton that I got from Kinet gives me the 3d point and the quaternions of each joint  (shoulder, elbow, …)

I am trying different ways but the result could be improved a lot of.

CASE A:

I am using the joint 3D position for calculate the angle between two points.

For example :

The shoulder robotics has two actuators: the shoulder Roll and the Shoulder Pitch.

In this function takes I pass two arguments, in this case the 3D position point of the shoulder and the elbow and then I calculate the angle between each axis.
Code:

```<code>def angulosXplano (puntoA, puntoB):

def calcularAngulo(uno, dos):
    # Compute the angle
    rads = math.atan2(-dos,uno)
    rads %= 2*math.pi
    degs = math.degrees(rads)
    return degs

dx = puntoB.x - puntoA.x
dy = puntoB.y - puntoA.y
dz = puntoB.z - puntoA.z

yaw  = calcularAngulo(dx, dy)
roll = calcularAngulo(dy, dz)
pitch = calcularAngulo(dx, dz)
</code>```

For calculating the shoulderPitch angle of the robot  I use the roll angle (that I got from the fuction angulosXplano) and for the shoulderRoll I use the  pitch angle.

The reason of calculating the angles in this way is because I get better results than the results obtained if I calculate the shoulderPitch with the pitch angle and the shoulderRoll with the roll angle.

The angular movement for the shoulder roll is good, but the should pitch is moderate and the roll elbow movement is the worst because the shoulder movement affects to the elbow movement.

CASE B:

Also I try to get the shoulder pitch and roll and the elbow yaw and roll with the quaternions of the SDK of the Microsoft.

In this case I tried the quaternions for the elbow, I obtain the quaternion like:

```<code>data.calculate_bone_orientations()[JointId.WristRight].hierarchical_rotation.rotation_quaternion
</code>```

For the elbow I use the Wrist-Right because I read that the position of the joint depends on the previous joint.

After obtain this quaternion, I convert it to Euler angles, the next code it’s a method of a class that I had developed. The class has got the qw, qx, qy and qz quaternions params.

```<code>def quaternion2euler(self):
    q = self
    qx2 = q.x * q.x
    qy2 = q.y * q.y
    qz2 = q.z * q.z

    test = q.x*q.y + q.z*q.w

    if (test > 0.499):
        roll    = math.radians(360/math.pi*math.atan2(q.x,q.w))
        pitch = math.pi/2
        yaw     = 0
    elif (test < -0.499):
        roll    = math.radians(-360/math.pi*math.atan2(q.x,q.w))
        pitch = -math.pi/2
        yaw     = 0

    else:
        roll = math.atan2(2 * q.y * q.w - 2 * q.x * q.z, 1 - 2 * qy2 - 2 * qz2)
        pitch = math.asin(2*q.x*q.y+2*q.z*q.w)
        yaw = math.atan2(2*q.x*q.w-2*q.y*q.z,1-2*qx2-2*qz2)

    return [roll, pitch, yaw]
</code>```

If use the yaw for the robot elbow roll, the results for the elbow roll improve a lot compared to the previous method. But I can’t find the angle for the robot elbow yaw.

FUTURE CASE C:

My next step would be try the case A but with vectors instead of 3D points. For example the vector A (middle-Shoulder and right-Shoulder) and the vector B (right-Shoulder and elbow). But I have not developed anything yet.

Any help that can help me to improve the code,  some bibliography or any better idea would be welcome.

答: Probably too late to help, but I think the problem is that there are not unique solutions to achieve some position.  There are probably better practices, but you might try to search for a solution to a given position problem using a genetic algorithm and picking a candidate solution that gets close enough to the positional error you are willing to tolerate.</p>

Title: Get the arm joint angles with kinect 1


答:
I second @Tully's statement that Bare Metal is defined as "without the OS in ROS".

Should you use an OS depends on the size of the processor. An 8 bit μC? Bare metal C. The ROM space is so little that you don't need the abstractions of C++ let alone that of an OS.

An ARM? Linux takes up only 3MB RAM to run.

An even more capable platform? An OS won't suffice, a plethora of third-party user-space utilities will also be needed as to utilize the platform's capacity.

Title: Is using a robotic operating system still considered bare-metal C?

Body: I want to get experience with low-level, bare-metal programming and am not sure if a project that uses an ROS counts as that.</p>


问:
Transforming position to torque
first question in this forum :D

so i started creating a 2 link robotic arm in SIMULINK and made a function that builds its trajectory (cubic spline) and used it as an input for my joint.
so my input was position and output was the torque etc.

Now i would like my input to be torque,how do i go about it?
should i create a transfer function out of the dynamic equation OR can i use the trajectory in someway OR is there a simple way?
If you have an answer i would appreciate if you can send a detailed explanation on  how you can do that in SIMULINK

答:
As it is, I think your problem is under-specified.  You will need to specify $x$, $y$, $v_x$ and $v_y$, where $(x,y)$ is the tooltip position and $v_x$ and $v_y$ are the velocities in the two directions of the tooltip.

You will need the mass of each arm, say $m_1$ and $m_2$ as well as the mass of the actuator at the joint (let's call it $m_a$).

You will need the lengths of each link, $l_1$ and $l_2$.

Once you have all this, you can set up the torque equation for the arm and solve it using Lagrangians.  You can find some guidance on how to do this here.

I don't know if this is exactly what you are looking for, but maybe its a start.  It's also been 4 years since you posted the question, but since no one ever answered I thought I would take a shot.

Title: Transforming position to torque


问:
Angle Random Walk vs. Rate Noise Density (MPU6050)
I’ve made a datalog from a MPU6050 (IMU: gyroscope and accelerometer) at 500Hz sample rate. Now I want to calculate the characteristics from the gyro to evaluate the sensor.

For the gyro I’ve found following values in the datasheet:

Total RMS Noise = 0.05 °/s

Low-frequency RMS noise = 0.033 °/s

Rate Noise Spectral Density = 0.005 °/s/sqrt(Hz)

Now I want to ask how I can calculate these values from my dataset?

At the moment I’ve the following values from the dataset:

Standard deviation = 0.0331 °/s

Variance = 0.0011

Angular Random Walk (ARW) = 0.003 °/sqrt(s) (From Allan deviation plot)

Bias Instability = 0.0012 °/s

Is the ARW equal to the Rate Noise Spectral Density mentioned in the datasheet? And also is the RMS Noise from the datasheet equal to the standard deviation?

edit:
I found following website: http://www.sensorsmag.com/sensors/acceleration-vibration/noise-measurement-8166
There is the statement:  "...Because the noise is approximately Gaussian, the standard deviation of the histogram is the RMS noise" So I guess the standard deviation is the RMS noise from the datasheet. But how about the ARW?

答:
Total RMS Noise

Yes, this should be approximately equal to your standard deviation as long as there is no bias.

Rate Noise Spectral Density

You cannot obtain this from the statistics you list.  You will need to take a Fast Fourier Transform (FFT) of your raw data and look at the results in the frequency domain.  Look in the data sheet to see at what frequency or frequency band the spectral noise density is specified at and then compare what your FFT says.

Low-frequency RMS noise

Again, you will need to know (or guess) what frequency cutoff your data sheet is assuming and use the same cutoff.  You may need to run your data through a low-pass digital filter then look at the results in the time domain.

You can do the above analysis with a tool like MATLAB.  If you don't have MATLAB (It's kind of expensive) check out R Studio or Scilab.  They are both available for free.  Personally I prefer R - It has great statistical analysis tools and there is a lot of open source floating around for data visualization.


问:
problem with simulated sensor in Matlab?
I'm simulating a sensor in 3D. The sensor should determine ($p, \theta, \phi$) from the origin  where $\theta$ is the rotation about z-axis and $\phi$ is the rotation about x-axis. The sensor is given position of a point($x, y, z$). This is what I did

```<code>    p = sqrt(x^2 + y^2 + z^2);
theta = acos(z/p);   <---- I'm guessing the problem here
  phi = atan2(y,x);
</code>```

Now I need to get the Cartesian coordinates ($x',y',z'$). This is what I did

```<code>    [p theta phi] = getmeasurement(x, y, z);
    x' = p*cos(theta)*sin(phi);
    y' = p*sin(theta)*sin(phi);
    z' = p*cos(phi);
</code>```

The sensor is working fine at the beginning but at a particular point it behaves strangely. I have the state vector to compare it with the measurement. I'm guessing that $\theta$ might be the problem.

Edit:

I'm sorry for this mistake. The aforementioned calculations based on the following picture

So, the point will rotate first about z-axis ($\theta$) and then rotate about x-axis ($\phi$)

答:
Your first set of formulas are calculating the spherical coordinates for the sensor which are different from the angles of rotation around the x-axis (which you have called $\phi$) and the y-axis (which you have called $\theta$)

When using the formulas for converting cartesian coordinates to spherical coordinates you  end up with $\phi$ as the rotation about the x-axis and $\theta$ as the angle between the vector to the x,y,z location and the z-axis (the polar angle)

So the calculation with $\theta$ is correct it just isn't calculating what you thought.

The problem you have isn't with any of that though, it is with the calculation of z', the formula should be

```<code>z' = p*cos(theta);
</code>```

Body:
Your first set of formulas are calculating the spherical coordinates for the sensor which are different from the angles of rotation around the x-axis (which you have called $\phi$) and the y-axis (which you have called $\theta$)

When using the formulas for converting cartesian coordinates to spherical coordinates you  end up with $\phi$ as the rotation about the x-axis and $\theta$ as the angle between the vector to the x,y,z location and the z-axis (the polar angle)

So the calculation with $\theta$ is correct it just isn't calculating what you thought.

The problem you have isn't with any of that though, it is with the calculation of z', the formula should be

z' = p*cos(theta);


问:
Alternatives to Mount the Motors on Quadcopter
We are doing a quadcopter project and we are at the stage of building the vehicle. However due to lack of attention, the screw holes of the Brushless Motors (Emax CF2822) we bought do not align with the holes which are placed on the Quadcopter Frame (F450). Only one of the holes align and it is not enough to stabilize them.

This is one of the arms of the quadcopter frame:

I pointed out to one of the screw holes.

Here below you can see the motor I use and one of the screw holes:

Below is what I experience with my setup:

As it is obvious from the picture, the screw holes of the motor do not align with the ones on the frame, therefore I can only mount one screw whereas I need to mount four of them.

Other than buying a new frame, I wanted to find alternative methods to mount these motors. I thought about using Silicone and then mounting the motors on top of the silicone. How can I solve this problem?

答:
As people suggested in comments, you have limited options.

Replace the motors to fit the frame

Replace the frame to fit the motors

Design an adaptor plate

Modify the existing frame

Replacing the frame or motors

The first two options just require shopping, so don't  need addressing here.

Pros

You get exactly what you need for your project
Cons

Cost

Design an adaptor plate

Designing an adaptor plate should not be difficult, if you have engineering drawings for the motor and frame..

Cons

Short run bespoke manufacturing can be expensive

Adds weight, of the plate, and of the extra bolts

Changes the position of the motor and thus the centre of gravity of the craft.

Modify the existing frame

This can be further subdivided into DIY and professional modifications.

Pros

If done correctly, would not change the position of the motor
Cons

It changes the design of the frame, it removes weight, but may alter the stiffness of the frame, and many more dynamic parameters, such as torsional strength, which would require Finite element analysis to fully assess

If these arems are not as solid as they appear, modification may not be an option, and this may not be apparent until making the first hole

DIY

If you are skilled with precision machining, and have equipment like a pillar drill or CNC machine, you could modify the arms yourself.

Cons

Mistakes at this stage may turn your frame into scrap, or even worse, could store up hidden problems for the future

Professional modification

This will require similar design work to designing an adaptor plate

Cons

Short run bespoke manufacturing can be expensive

If at first...

Finally, if one of these techniques doesn't work, you can always move on to another. For instance, if you have the budget to buy another frame if you botch a modification, then that is a less risky option. Do not underestimate the potential cost of taking the cheaper option though.


问:
How is named a controller that sets a position to reach with a constant velocity?
I looked everywhere I could but didn't find a useful answer, so let me explain here:

My controller is giving a position goal, and while this position is not achieved, the linear actuator is controlled to move at a constant speed through a PID. When the position is reached, the speed is 0.

More precisely:

```<code>Inputs: position_desired, velocity_desired

basic_PWM = velocity_desired/max_actuator_velocity * 255 #Compute proportionally some feedforward basic PWM to reach approximately the desired speed
While position_desired not reached:
    Compute PID output based on velocity error (velocity_desired - velocity_measured) => PID_output
    Command = basic_pwm + PID_output
    Send PWM command to motor
Command = 0 #when position is reached, stop motor
Send PWM command to motor
</code>```

The closest name I could find is "velocity controller with position condition", but that doesn't sound very clean to me, is there a conventional name for this type of controller?

Thank you!

答:
I would use a simple PIDF controller. The PIDF controller is just like a PID controller, but with a feed-forward term. The feed-forward term consumes the desired velocity, multiplies with a scalar constant, and then adds that to the output of the PID controller. This allows for an immediate velocity that then gets adjusted by the PID part to take into account fluctuations in battery power or changes in friction. Then, once the error is within a certain range, you could turn off the feed-forward term and the integral term in the PID to allow for proportional control with damping.

This will require some tuning, but it should be simple enough to implement.
Does this make sense?


问:
Safety standards for autopilots
Does anyone know if where i could learn more about the software safety standards for real time applications, such as for car and plane autopilots?

Both EU and US suggestions are very much wanted.

答:
The question is rather broad, only vaguely on-topic, and not a Q&A type of question...

However, I'll give it ago... and fortunately, the US and EU are reasonably well aligned.

Automotive

The primary functional safety standard for the automotive world is ISO 26262... a massive standard of 13 parts, addressing the whole software and systems engineering lifecycle.

Associated with this, you have ISO/SAE 21434 which addresses the Cybersecurity side of things, and supersedes the longer standing SAE J3061.

As autonomy becomes a bigger issue, a number of parallel projects are ongoing, including UL4600 and several ISO-led works

Aerospace

In the aerospace domain, it's a little more complex and non-integrated... airborne software falls within DO-178C, while programmable electronics comes under DO-254

Work is ongoing to revise these for UAVs

Software-level

At the software level, testing has been internationally standardised with ISO/IEC/IEEE 29119 (a multi part standard) which brought together a number of existing US and UK led standards in harmonised form... and has been further developed by an multi-national working group ISO/IEC JTC1/SC7/WG26.

Associated with this is the ISO/IEC 250xx SQuaRE family of standards which define quality measures.

Availability

Unfortunately, international standards are covered by copyright and are not freely available - hence no links in this answer.  They can be sourced thorough the appropriate national body (eg BSI in the UK)

My day job revolves around a lot of these... I'm happy to discuss further (probably better offline... see profile)

Title: Safety standards for autopilots


问:
sensor breaks tf tree in ROS
I am currently trying to add sensor(lidar) into my robot. I made base for a sensor, link to which sensor is attached through gazebo reference.

The problem is that adding a  tag for some reason creates another one tf tree, with 2 nodes, where my lidar is attached. Whereas there still exists another tf tree with my robot and sensor base.

If i remove  (in fact removing this tag removes sensor, but still keeps the link to which this sensor is attached) the tree becomes well defined.

I want to know how to fix this and to get the single tf tree.

What i add is the following(taken from livox github):

```<code><gazebo reference="<span class="math-container">${name}">
      <sensor type="ray" name="$</span>{name}">
          <pose>0 0 0 0 0 0</pose>
          <visualize><span class="math-container">${visualize}</visualize>
          <update_rate>$</span>{update_rate}</update_rate>
          <!-- This ray plgin is only for visualization. -->
          <plugin name="gazebo_ros_laser_controller" filename="liblivox_laser_simulation.so">
        <ray>
          <scan>
          <horizontal>
          <samples>100</samples>
          <resolution>1</resolution>
          <min_angle><span class="math-container">${-horizontal_fov/360*M_PI}</min_angle>
          <max_angle>$</span>{horizontal_fov/360*M_PI}</max_angle>
          </horizontal>
          <vertical>
          <samples>50</samples>
          <resolution>1</resolution>
          <min_angle><span class="math-container">${-vertical_fov/360*M_PI}</min_angle>
          <max_angle>$</span>{vertical_fov/360*M_PI}</max_angle>
          </vertical>
          </scan>
          <range>
          <min><span class="math-container">${laser_min_range}</min>
          <max>$</span>{laser_max_range}</max>
          <resolution><span class="math-container">${resolution}</resolution>
          </range>
          <noise>
          <type>gaussian</type>
          <mean>$</span>{noise_mean}</mean>
          <stddev><span class="math-container">${noise_stddev}</stddev>
          </noise>
        </ray>
            <visualize>$</span>{visualize}</visualize>
        <samples><span class="math-container">${samples}</samples>
        <downsample>$</span>{downsample}</downsample>
        <csv_file_name>package://livox_laser_simulation/scan_mode/avia.csv</csv_file_name>
        <ros_topic>${ros_topic}</ros_topic>
          </plugin>
      </sensor>
    </gazebo>
</code>```

Here is the part of the urdf which connects lidar to trunk link:

```<code>  <joint name="scan_joint" type="fixed">
    <parent link="trunk"/>
    <child link="livox_base"/>
    <origin rpy="0 0 0" xyz="0.2 0.0 0.1"/>
  </joint>
  <material name="blue_custom">
    <color rgba="0 0 0.8 1"/>
  </material>
  <!-- <xacro:Livox_AVIA name="livox"/>
  <xacro:include filename="/home/ramil/catkin_ws/src/livox_laser_simulation/urdf/standardrobots_oasis300.xacro"/>
  <xacro:link_oasis name="oasis"/> -->
  <gazebo reference="livox">
    <sensor name="livox" type="ray">
      <pose>0 0 0 0 0 0</pose>
      <visualize>True</visualize>
      <update_rate>10</update_rate>
      <!-- This ray plgin is only for visualization. -->
      <plugin filename="liblivox_laser_simulation.so" name="gazebo_ros_laser_controller">
        <ray>
          <scan>
            <horizontal>
              <samples>100</samples>
              <resolution>1</resolution>
              <min_angle>-0.614355377778</min_angle>
              <max_angle>0.614355377778</max_angle>
            </horizontal>
            <vertical>
              <samples>50</samples>
              <resolution>1</resolution>
              <min_angle>-0.673696522222</min_angle>
              <max_angle>0.673696522222</max_angle>
            </vertical>
          </scan>
          <range>
            <min>0.1</min>
            <max>200.0</max>
            <resolution>0.002</resolution>
          </range>
          <noise>
            <type>gaussian</type>
            <mean>0.0</mean>
            <stddev>0.01</stddev>
          </noise>
        </ray>
        <visualize>True</visualize>
        <samples>24000</samples>
        <downsample>1</downsample>
        <csv_file_name>package://livox_laser_simulation/scan_mode/avia.csv</csv_file_name>
        <ros_topic>scan</ros_topic>
      </plugin>
    </sensor>
  </gazebo>
  <link name="livox_base">
    <inertial>
      <mass value="0.1"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0.00 0 0.00"/>
      <geometry>
        <mesh filename="package://livox_laser_simulation/meshes/livox_mid40.dae">
          </mesh>
      </geometry>
      <material name="blue_custom"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://livox_laser_simulation/meshes/livox_mid40.dae">
          </mesh>
      </geometry>
    </collision>
  </link>
  <!-- <xacro:Livox_Mid_gazebo_sensor name="livox" visualize="True"/> -->
  <link name="livox">
    <inertial>
      <mass value="0.1"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
    </inertial>
  </link>
  <joint name="base_to_livox_joint" type="fixed">
    <parent link="livox_base"/>
    <child link="livox"/>
    <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
  </joint>
</code>```

答:
You haven't posted the sensor config that generates the incorrect tf tree, but your bad tf graphic shows livox as a child of a1_gazebo::base and not just base.

What happens if you change the config from a1_gazebo::base to base?

:EDIT:

Okay, so you posted a partial URDF file, but I didn't see a joint in there, so I was confused as to how your sensor was linked to anything, so I went to the GitHub account you mentioned and found this livox_mid70.xacro file that has the following joint defined at the bottom:

```<code><joint name="<span class="math-container">${name}_to_$</span>{name}_base_joint" type="fixed">
  <parent link="<span class="math-container">${name}_base"/>
  <child link="$</span>{name}"/>
  <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
</joint>
</code>```

The weird thing here is that this parent link is defined as ${name}_base, but the base frame you're getting in your tf tree is a1_gazebo::base.

I would suspect your joint's parent link is incorrectly named, but your URDF snippet doesn't give any joint details, so I can't really comment/troubleshoot beyond this.

Title: sensor breaks tf tree in ROS

Body:
You haven't posted the sensor config that generates the incorrect tf tree, but your bad tf graphic shows livox as a child of a1_gazebo::base and not just base.

What happens if you change the config from a1_gazebo::base to base?

:EDIT:

Okay, so you posted a partial URDF file, but I didn't see a joint in there, so I was confused as to how your sensor was linked to anything, so I went to the GitHub account you mentioned and found this livox_mid70.xacro file that has the following joint defined at the bottom:

<joint name="${name}_to_${name}_base_joint" type="fixed">
  <parent link="${name}_base"/>
  <child link="${name}"/>
  <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
</joint>

The weird thing here is that this parent link is defined as ${name}_base, but the base frame you're getting in your tf tree is a1_gazebo::base.

I would suspect your joint's parent link is incorrectly named, but your URDF snippet doesn't give any joint details, so I can't really comment/troubleshoot beyond this.


问:
What is the difference between RC motors for cars and helicopters?
I am working on a robot with focus on speed. At the moment I am looking for a suitable motor but it would help if I understood the difference between the various options.

To provide some background, I have not worked with RC model components before, but I think this is the only place for me to find the components needed for my robot, such as the motor.

I have already figured out how much power the motor needs to accelerate my robot as desired, taking energy conversion efficiency and tractional resistance into account. It's about 170 watts, depending on the final weight.

To limit my search further, I need to decide on either using a RC car motor or a RC helicopter motor now, but I don't understand the difference between these options.

Focussing on brushless motors (if that matters), what are the differences between RC car and RC helicopter motors? What needs to be taken into account when choosing between them?

答: There is no difference in between them. Motors are categorized by type (brushed or brushless), size, kv rating and the number of poles. The size and kv rating are usually what determine what application it can be used in.</p>