问:
How Do You Program the SR04 Ultrasonic Sensor?
Dear Robotics Community,

I am participating in a Robotics tourney that will start in a few weeks. The challenge I signed up for is to deliver and dump ping pong balls to a box. I already have my robot and the ball container built, but I need some help with coding it.

I just need help coding an SR04 ultrasonic sensor for my Arduino robot. I want it so that when it senses the box in front of it, the robot turns on a motor and stops when the box is a certain distance away from the robot. I also want it to back up and go back to its starting position when it is done delivering the payload. I was told by my coach that a "boolean variable" would do the job, but I also do not know how to program this.

Thank you!

(Here is the robot platform I am using: https://www.elegoo.com/product/elegoo-uno-project-smart-robot-car-kit-v1-0/)

答: Did you try the newPing library ?</p>

Body: Did you try the newPing library ?


问:
Will the irobot create library work with other roomba models?
I have a roomba 595. I connected it to my Pi via serial but I'm having a tough time finding commands or documentation for it. I was wondering if the same commands used for the create model roombas would work for non-create models.</p>

答: Yes, the same commands for the Create2 will work with a Roomba 595.</p>

ContentLicense: CC BY-SA 3.0


问:
Can I use another GPIO pin on the Pi 3 as a RX UART?
I accidently plugged 5v in to the RX UART pin 15 on my Pi, now I'm unable to receive communication on this pin from my connected device. I was wondering if it's possible to use a different GPIO pin as an RX pin to receive serial ?</p>

答:
This question may sound simple.  However it is likely dependent on if the processor's hardware UART resource is mappable to different (functional) pins as well as if the Linux UART driver is flexible enough to be configurable for this alteration to the UART feature of the Raspberry Pi.  Even if both of these features are available, such a change likely involves recompiling the driver if not the kernel.  This usually involves having an installed compiler and installed kernel source code (you need the kernel source code even if you are only compiling the driver).  Not a light subject.

On the other hand, people do write code to simulate a UART on other Raspberry Pi pins.  This is usually done when the actual hardware UART is committed to another activity.  In such a case, this Raspberry Pi stackexchange answer provides a good example.

If you have further Raspberry Pi questions, you may have better luck if you ask them on the Raspberry Pi stackexchange web site.


问:
Is this a good quadcopter build?
3D CAD:

After some editing:

I'm building the frame myself from aluminum and polycarbonate.

EDIT: all frame is polycarbonate except of the arms (and all screws & nuts & washers)), they are form aluminum covered in polycarbonate. the total length (from one motor to another) is exactly 60cm

Approximate Mass: 1.736 kg

What I thought to put in:

Battery: ZIPPY Flightmax 4000mAh 3S1P 20C (changed from this 1500mAh battery)

Motors: Turnigy Aerodrive SK3 - 2822-1090kv

PDB: Hobby King Quadcopter Power Distribution Board

ESC: Hobbyking SS Series 18-20A ESC

Core: Arduino Nano

IMU: Invensense MPU-6050

Propellers: 10x4.5 SF Props 2pc Standa## Heading ##rd Rotation/2 pc RH Rotation (changed from 8x4.5 ones)

I'm gonna program it myself (or atleast try to).

I WANT TO USE IT AS A UAV (self controlled)

Questions:

Is this a good setup?

It costs to much for me, any way to keep the frame and change the
parts to be cheaper and yet a good quadcopter?

Does the propeller fit the motor?

Any place to buy these for cheaper?

Is it a good frame?

Am I missing some parts?

Thanks alot,
Dan

EDIT:

I checked it using this site and it gave no errors (guess its a good sign).

The camera on the image is just for the picture (no camera is intended there).

答:
First of all, don't take it personally.

I am not a quad copter builder of some sort myself, but your setup is flawed:

Battery can deliver 30A constant, maxed out. Your motors take, at full power, 8×4 = 32A. You might get away with this battery, but it won't last long because you are pushing it too hard.

Big, heavy battery, low power engines/esc/battery. I don't even think your copter is going to lift of with this setup. Engines of
only 80W on a quad that, taking a look at your picture, is going to
be relatively heavy, is asking for trouble.

PDB is okay with this, and future, more power-hungry (I think), motors. They probably have a safety margin, but don't push it too
hard, which for now, you are not.

Arduino: you are going to try and program it. Programming a quad isn't an easy task, and unless you are quite a skilled programmer, I
recommend you to buy a programmed board, something like this: Hobby
king link.

I don't know a whole lot about copters, I'm more in the plane business, but unless you change motors, these props seem too big.
Moral of the story: get bigger engines, bigger battery, bigger ESC.

I can try to recommend better motors, ESC, etc., but I won't. I don't know enough about quads to be certain it is going to work, and
I won't recommend you something I don't know for sure, sorry.

It costs to much for me, any way to keep the frame and change the parts to be cheaper and yet a good quadcopter?

First make sure that your setup is right, then start asking where you can get it cheaper, that's my advice.

Does the propeller fit the motor?

You are going to need an adaptor, but that is normal, I'd bet there are adaptors that suit your needs.

Any place to buy these for cheaper?

Yes, but you are missing a few (important) parts, the setup you present here isn't a very expensive one, if you can't afford it, I recommend you to save money until you can buy a proper setup, you won't regret having some patience.

Is it a good frame?

I can't judge if a frame is correct by one picture, there are way too many variables (like thickness of the material, where you are using aluminum, and where you are using the plastic, how are your motor mounts, what material, so on...).

Am I missing some parts?

Yes, since I think you want to control it, you are going to need a controller, add 25$. Materials for the frame, camera, transmitter for the camera, ground station to receive, monitor for the video feed, so on.

I think you are taking this too lightly. You don't just build a quad for the first time, it's going to take a lot, and I mean a lot, of trial and error, and quite a bit of money.

Take your time to find the right parts.

Title: Is this a good quadcopter build?


问:
why atleast three points are needed to control 6 dof?
I am reading tutorials on visual servoing using Hand book of robotics and there it is mentioned that in order to control camera's six dof we need atleast 3 points. I didnt quite get the idea behind it? can anyone please explain. Thanks</p>

答:
We need  to be able to track 3 points, (sometimes called features), on a solid body to estimate its 6dof pose relative to the camera.

Each has an estimated position in the 2D camera image.

If you imagine having only two points visible on the object, you can rotate the object around the line (axis) joining the two points and the 2D position in the image will not change.

Since there is no change in the position of the points in the image for this rotation, we need one more point, that is not on the line, to estimate the pose.

You can also just count the Degrees of Freedom if you understand what is independent in your problem domain. In this case, each point has 2DoF, so you need 3 of them to get 6DoF.

Note that in practice we use more than 3 points to both average errors and to handle the fact that it is not always easy to identify which point is which.


问:
Can i use DC Brushed motors for building a drone?
I want to make a drone. But my budget is very low. Brushless motors are very expensive. I want use the Brushed CHEAP ones. can i us them ?</p>

答: I would definitely look at a brushed motor when the budget is low. They have a reputation of being less powerful, but the main problem is they have a very high RPM. This means you either have to use very small inefficient propellers or a geared system. Brushed geared mini-drones have pretty good performance when it comes to battery life because the propeller is big compared to the weight. Small, coreless brushed motors are pretty efficient but wear out after some time.</p>

ContentLicense: CC BY-SA 4.0


问:
Depth sensing for a pick-and-place robot
I am supposed to design a pick-and-place robot. I have a prismatic joint to go down to a particular depth to pick an object which is located in 2D using computer vision. What is the recommended way to detect the height at which the object is placed? The object can be at a maximum vertical distance of 15 inches (around 38 cm).

What do you think is easier to implement  for sensing this height? Any suitable cheap sensors for this arrangement? Or a stereo camera system?

答:
Based on your actuator and their sensor you can try force based control, relying on admittance filter. You command the arm to go down and when an external force is applied it means you pushed the object top.

Alternatively, if you don't need millimeter accuracy you can use cheap ultra-sound sensors to detect the depth. Or if you need more precision a 1 point laser range finder. Those two option should be cheap and with simple information to handle. Place the sensor between the claws of you gripper if you can.

In general, if you are not confident with vision I would recommend to avoid stereo camera system, as the calibration and exploitation is not that straight forward.
In the vision department  you can also look for sensor like kinect or intel euclide. They provide depth info readily usable and based on infrared, which might be an issue in sunny places.


问:
Urdf as a way to model dynamics?
Since urdf format serves the purpose of kinematic model but also extends for dynamical properties such as mass,moment of inertia and centre of masses, can it be considered a viable dynamical model of a robot, comparable to standard methods such as Euler-Lagrange and Newton-Euler?</p>

答: No. URDF is a convenient way to format information about the model; it is not a model itself. </p>

Title: Urdf as a way to model dynamics?


问:
D(q) Inertia Matrix and the Jacobian Matrix
There is something I need to verify.

Say we have the following RPR robot manipulator.

The DH table

yields 3 rotational matrices:

\begin{equation}
R^0_1, R^0_2,  R^0_3
\end{equation}

Using these rotational matrices, the linear velocity Jacobian matrices \begin{equation} Jv_1, Jv_2, Jv_3 \end{equation}
and angular velocity Jacobian matrices \begin{equation} Jw_1, Jw_2, Jw_3 \end{equation} are derived.

Where each of these matrices are 3 by 1. So that combining the linear and angular velocity Jacobians yields the 6 by 3 Jacobian matrix of the manipulator:

\begin{equation}
J =
\begin{bmatrix}
Jv_1 & Jv_2 & Jv_3 \\  Jw_1 & Jw_2 & Jw_3
\end{bmatrix}
\end{equation}

The Euler Lagrange dynamics equation for a 3-DOF robot manipulator is

where the 3 by 3 inertia matrix is given by

where n is the number of DOF of the manipulator.

For the D(q) matrix to be 3 by 3, the linear and angular velocity Jacobian matrices must be 3 by 3 instead or 3 by 1.

Can you explain the mismatch of dimensions?

Am I supposed to augment the 3 by 1 matrices and obtain 3 by 3 matrices?

答:
I think this is a matter of notations.

In the given formula for $D(q)$, the matrices $J_{vi}$ and $J_{\omega i}$ are not simply the direct extraction of columns of the Jacobian of the system.

$J_i$ is the matrix that relates $\dot{q}$ to the velocity (of the center of mass) of the link $i$. That is, if we write $v_1$ to denote the linear velocity of the center of mass of the first link, then $J_1$ will be such that

$$v_1 = J_1\dot{q}.$$

Since $\dot{q} \in \mathbf{R}^3$ and $v_1 \in \mathbf{R}^3$, the matrix $J_1$ is a $3 \times 3$ matrix.

Note also that since the velocity of link i is not affected by any joint $j > i$, the columns $j > i$ of the matrix $J_i$ will be zero.


问:
PID Conundrums for Legged Robots
I am currently working on a legged hexapod which moves around using a tripod gait. I have two sets of code to control the tripod.

Set 1: Time based control

In this code set, I set the tripod motor set to move at their rated rpm for a required amount of time before shifting to the other tripod motor set.

PID control would be based on counting the number of transitions using an optical speed encoder, Calculating the error based on difference between actual speed and required speed and then adjusting the error with fixed Kd and Ki values.

Set 2: Transitions based control

In this code set I count to the number of transitions required to complete one rotation of the leg(tripod motor set) before starting the other leg(tripod motor set).

PID control would be time based. Calculation of error would be the difference in time taken for individual motors of the motor set.

Query:
The set 2 shows promising results even without PID control, but the first set does not.Why so? The motors are basically set to move 1 rotation before the other set moves.

Would the speed differences between the motors cause it to destabilize?

How often do I update the PID loop?

My robot seems to drag a little bit. How do I solve this?

答:
It sounds like you have 6 legs with some number of PID-controlled joints on each leg.  You would like to move 3 legs at a time, while the other 3 legs stand in a stable tripod configuration.

Instead of figuring out how to move each set of 3 legs as one unit, you should be treating them as individual legs.  You will send a leg a set of desired joint positions, and the PID control on each joint motor will effect that change.  By sending a steady stream of desired joint positions, you will be describing a trajectory for the leg to follow.

Coordinating the actions of all 6 legs simply involves a series of checkpoints to make sure that no leg gets too far behind the others.  You need not keep all 6 legs on the same checkpoint; for example, you might keep each set of tripods tightly in sync but only sync the 2 sets at the point in the gait where the weight is shifted.

Another way to imagine the checkpoints is to consider the gait to be a series of repeated movements of each leg, where each leg is slightly phase-shifted.  In that case, the checkpoints would be the "constraints" on the allowed phase differences (e.g. this CMU paper).

Title: PID Conundrums for Legged Robots


问:
Quadrotor Dynamics: Calculating angular velocity of quadrotor
I am trying to simulate and implement the controller of the paper Geometric Tracking Control of a Quadrotor UAV on SE(3). To do this I need to first implement the dynamics of the quadrotor. According to the paper, the whole control structure looks as follows:

And the equations of motion are:

Now according to the setup given f and M as input I need to calculate the equations numbered 2 to  5. I see how we can calculate equation 2 and 3 and that is by calculating the acceleration and integrating over dt to get velocity and integrating again to  get the position. But I don't understand how to calculate equations 4 and 5. In 5 I can calculate the angular acceleration from 5 by manipulating it but I don't know the angular velocity omega. Similarly in 4 I don't know the angular velocity omega to calculate R_dot. How do I calculate omega given just f and M? Is there a flaw in my understanding? Am I missing some piece of information? The link to the paper is here. Thanks in advance

答:
If you want to compute the quadrotor dynamics you just need to plug M and f in (5) and (3) to get the accelerations, then you integrate the accelerations to get the velocities and you integrate the velocities to get the position/attitude.
You will need to initialize the velocities and position/attitude to their initial values (typically zero velocity and initial position/attitude).

Note that $\hat{.}$ is a skew symmetric operator, and retrieving the roll pitch yaw angle from $\mathbf{R}$ an be done easily based on the expression of some of its components. The tricky part is integrating the $\dot{\mathbf{R}}$


答: I think what you're missing is initial conditions; you need to define $\Omega$ at $t=0$. Give that angular velocity, you can then easily solve (4) for $\dot{R}$ and (5) for $\dot{\Omega}$. From that point forward you always know what $\Omega$ is at the start of the timestep so can continue to solve in the same manner.</p>

Title: Quadrotor Dynamics: Calculating angular velocity of quadrotor

Body:
I am trying to simulate and implement the controller of the paper Geometric Tracking Control of a Quadrotor UAV on SE(3). To do this I need to first implement the dynamics of the quadrotor. According to the paper, the whole control structure looks as follows:

And the equations of motion are:

Now according to the setup given f and M as input I need to calculate the equations numbered 2 to  5. I see how we can calculate equation 2 and 3 and that is by calculating the acceleration and integrating over dt to get velocity and integrating again to  get the position. But I don't understand how to calculate equations 4 and 5. In 5 I can calculate the angular acceleration from 5 by manipulating it but I don't know the angular velocity omega. Similarly in 4 I don't know the angular velocity omega to calculate R_dot. How do I calculate omega given just f and M? Is there a flaw in my understanding? Am I missing some piece of information? The link to the paper is here. Thanks in advance


答:
This issue might be caused by a voltage drop accross the system. Either your batteries aren’t charged up, your batteries are rated for a lower voltage or, the way the power is being distributed is incorrect.

Steps to fix it:

Check each motor separately: connect the three wire lead coming from the ESC and plug it into the receiver (motor must be connected to the three phase cables, and ESC must be connected to the battery). If any motor starts to stutter or stall, swap the ESC and check if the ESCs are defective.

If the motors and ESCs are working correctly, check if your power distribution board is working correctly. If you’re using a power distribution board, then check each solder pad and see if there’s enough contact, also check each of the 4 ESC terminals are being supplied around 12 volts. If they aren’t being supplied 12 volts, then your pdb is at fault.

If there are no faults with the motors, ESCs and PDB, check all your wiring and see if there’s any loose connections and also check the settings on the KK flight controller.

For the KK flight controller, first, calibrate the ESCs, REMEMBER TO TAKE ALL PROPELLERS OFF. After calibration, go through the different settings to see if there’s anything to be changed.

During this test ALL PROPELLERS MUST BE REMOVED. After removing, you can take a small cut of electrical tape and stick it onto the motor shafts so you can feel the motor directions.

I personally don’t really like the KK flight controller because when calibrating the ESCs, a lot of things can go wrong, press the buttons for too long or too short, the motors will start spinning at full throttle. I’ve had personal experience when I left the props on and held the buttons for too long. I ended up with a shaved finger and two deep gashes near my right hand wrist.

If you’ve tried all of this and it still fails, please reply with a list of all of the components used.

Best of luck,

Sid.

Title: Quadcopter motor fails beyond 50% throttle

Body:
I have recently build a quadcopter with the following specs:-

KK mini board

4 x A2212-1000kV / 13T motors

4 x 30A ESC

2200mAh 25C 12.5V battery

The issue i am facing is that once the throttle crosses close to 50% either:-

One or more motors would stop spinning.

Motor fail video 1

Motor fail video 2

All motors would slow down to min speed.

I have checked the battery voltage before running and its at 12.2 V.

It would be really helpful if you could suggest a fix.

Thanks

Additional data

Voltage across ESC with motors (All 4 connected at same time w/o propeller)
STOP => Speed at which motor stopped working.

```<code>          +---------+---------+---------+---------+
+---------+ Motor 1 | Motor 2 | Motor 3 | Motor 4 |
|Throttle | (Volts) | (Volts) | (Volts) | (Volts) |
+---------+---------+---------+---------+---------+
|   Min   |  10.3   |  10.3   |  10.3   |  10.3   |
+---------+---------+---------+---------+---------+
|   7%    |  9.75   |         |         |         |
+---------+---------+---------+---------+---------+
|   50%   |  9.48   |         |  STOP   |         |
+---------+---------+---------+---------+---------+
|   72%   |  9.26   |         |         |         |
+---------+---------+---------+---------+---------+
|   Max   | STOP /  |  9.28   |  9.28   |  9.28   |
+---------+  9.28   +---------+---------+---------+
          +---------+
</code>```

Voltage across individual ESC with motors without propellers

```<code>          +---------+---------+---------+---------+
+---------+ Motor 1 | Motor 2 | Motor 3 | Motor 4 |
|Throttle | (Volts) | (Volts) | (Volts) | (Volts) |
+---------+---------+---------+---------+---------+
| Battery |  12.04  |  11.60  |  11.60  |  11.50  |
+---------+---------+---------+---------+---------+
|   Min   |  11.89  |  11.60  |  11.54  |  11.35  |
+---------+---------+---------+---------+---------+
|   7%    |  11.86  |  11.60  |  11.51  |  11.31  |
+---------+---------+---------+---------+---------+
|   20%   |  11.83  |  11.61  |  11.49  |  11.29  |
+---------+---------+---------+---------+---------+
|   50%   |  10.77  |  11.56  |  11.41  |  11.24  |
+---------+---------+---------+---------+---------+
|   72%   |  11.63  |  11.47  |  11.25  |  11.06  |
+---------+---------+---------+---------+---------+
|   Max   |  11.57  |  11.50  |  11.17  |  10.98  |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
|Change in|  0.32   |  0.10   |  0.37   |  0.37   |
| voltage +---------+         +---------+---------+
| between |         |  Maybe  |
| 1st and |         |  error  |
|  last   |         |  while  |
| reading |         | taking  |
+---------+         | reading |
                    +---------+
</code>```

NOTE: That after re-soldering, the motors run fine to full throttle without propellers. But once I attach the propellers the motor 3 stops spinning beyond 50% throttle.


问:
Line following robot path planning
I have built a mobile robot with several ultrasonic sensors to detect obstacles and an infrared sensor to track a line as a path. I have written a simple algorithm to follow the line which works fine, but avoiding obstacles are a problem because the robot doesn't know the layout of the path, so even if it does move around the obstacle, it is not guaranteed that it will find the path line again(unless the line is perfectly straight). Therefore, I think I may need to use a path/motion planning algorithm or find a way to store the layout of the path so that robot could predict where to move and get back to the path line and keep on following after overcoming an obstacle. I would like to hear suggestions or types of algorithms I should focus on for this specific problem.

Picture might help specifying the problem I'm facing.

Thank you.

答:
My suggestion is to start very slowly but comfortable. At first step, don't try to control the robot automatically, instead use manual control and see the robot as a RC-car. Drive a little bit around with the toy and have fun with the obstacles. The second step is to program the domain knowledge into the robot. This is done via a surveillance parser. The software tracks the manual actions of the human operator and prints conclusions on the screen. Like “robot drives straight ahead” “obstacle in front of robot” “robot is on the waypointline”, “robot is off road”. The third and last step is to add a recommendation function to the surveillance system. The software gives an advice what the human operator has to do next. In all steps, the human operator must stay in the loop, it should be a semiautomatic system:

quote: “In this game, the robots are semi-autonomous: Although the
  robots have intelligence (machine low level) that allows them to
  follow colored lines, users interact with them and provide high level
  commands“ Semi-autonomous Color Line-Following Educational Robots:
  Design and Implementation,
  2011

Title: Line following robot path planning


问:
Does more "Power" (W) means better motor?
If a motor has more Power (W) from another it means that it is better?</p>

答:
The short answer is no.  The longer answer requires more information from you, regarding how the motor is to be used.

Since you have tagged your question with "quadcopter", I'm going to assume that you plan to put the motor on a UAV, in which case more power definitely does not mean "better".

More power (W) will draw more current (A) from the battery (meaning a larger battery and higher all-up-weight (AUW) of the craft).

You need to choose the correct motor and prop for your particular quadcopter frame.  There is no one-size-fits-all motor for quadcopters.  In general, you should be looking for a brushless outrunner motor with low kv, and pairing it with a slow-fly prop.


问:
Why are joint velocities very high near a singularity?
I am reading about singularities and I know that those are configurations which result in the same end-effector position and orientation.
I also read that joint velocities get very high near that singularity but I don't understand why.

I get it that they have to be very high when going through that singularity because the arm has to be in multiple poses at once, but I don't know why the speed is so high if it is just near a singularity.

Please help me understand.

答:
First of all, singularities are not configurations that have the same end-effector position and orientation. Those configurations are inverse kinematic (IK) solutions to that end-effector pose (position and orientation).

The formal definition of singularities is the configurations that the Jacobian loses its rank. At such configurations, the manipulator may lose its degrees-of-freedom (DOF), i.e., it may not be able to move its end-effector in some certain direction.

Let's consider the relation
$$\dot{x} = J(q)\dot{q},$$
where $x \in \mathbf{R}^6$ is a vector representing an end-effector pose, $q \in \mathbf{R}^n$ is a robot configuration, $J(q)$ is the Jacobian at the given configuration, and $n$ is the number of DOFs.

For the sake of argument, consider when $n=6$, i.e., $J(q)$ is a square matrix. At a singular configuration $q^\ast$, the Jacobian loses its rank and therefore $\det(J) = 0$. Looking back to the previous relation, you may see that no matter how large the joint velocity is, it does not contribute anything to the end-effector velocity.

Let's consider this from a mathematical point of view. From the singular-value decomposition of $J(q)$, one has
$$\dot{x} = (U\Sigma V^{-1})\dot{q},$$
where $U$ and $V$ are some orthogonal matrices and $\Sigma$ is a diagonal matrix whose entries are singular values (well, not the same singular as what we are discussing). With some algebraic manipulation, one has
$$\dot{x}' = \Sigma \dot{q}',$$
where $\dot{x}' = U^{-1}\dot{x}$ and $\dot{q}' = V^{-1}\dot{q}$. Those mapping by $U^{-1}$ and $V^{-1}$ can be seen as coordinate transformations.

At the vicinity of a singular configuration, the Jacobian nearly loses its rank. The singular values (i.e., the entries of $\Sigma$) are very small. Therefore, to attain a certain $\dot{x}'$ (that is, to be able to move in some direction), you would require a very large $\dot{q}'$.

Note, however, that after all, the high joint velocity behavior near a singular configuration is a result of using the relation $\dot{x} = J\dot{q}$ to calculate $\dot{q}$ from a given $\dot{x}$. As @Ugo pointed out in his comment, there exists methods to get around this behavior.


问:
How can I protect my props from being damaged?
I have a quad copter and I'm developing my own flight controller to run the code and testing it on the quad.
As you all must be knowing, this means a lot of broken propellers.
I thought of making a frame with prop protection but fabrication seemed difficult because 3d printing is proving expensive and cutting aluminum isn't that practical. Can you suggest a better way to fabricate? </p>

答:
It seems odd to me that cutting aluminum is cheaper than 3d printing plastic protections.
As pointed out by @st2000, propeller protectors are available on the market, provided that you have a standard structure and propeller size.

Otherwise I would suggest that you look into polystyrene block to do your own propeller guard. This is a lightweight and cheap option.

Be aware that if you make your protection too big you will impact the aerodynamic of the airflow. This can be used as in ducted fan setups.


问:
OpenRAVE output torques and simulation timestep
I'm using OpenRAVE to simulate a quadruped, in order to get an idea of torque requirements.

To get started I made a single DOF, single link pendulum to test controllers etc out on.
I've whipped up an inverse dynamics based PD controller using ComputeInverseDynamics(), which I set the outputs using SetDOFTorques(). I then set a desired position, with the desired velocity being zero. This all appears to work well and I can start the simulation, with the pendulum driving up to the desired position and settling.
My concern is the value of the output torques. My pendulum is modeled as a simple box of length 1, mass manually set to 1, with a COM of 0.5.
When I run my simulation, I output the gravity component from ComputeInverseDynamics(). This gives 4.9NM, which matches up with hand calculated torques I expect from the pendulum (eg the static case) when it is driven to the desired position (from down to horizontal).
But the output torques to SetDOFTorques() are much higher and vary depending what I set the simulation timestep to.
If I maintain a controller update rate of 0.001 seconds, then for a simulation update of 0.0001 seconds, my output torque is approximately 87NM. If I alter the simulation timestep to 0.0005 seconds, keeping the controller rate the same the output torques drop down to about 18NM.

As an experiment I removed the inverse dynamics controller and replaced it with a plain PD controller, but I still see large output torques.

Can anyone shed some light on this? It's very possible I'm missing something here!

Thanks very much

Edits:
I'm adding the main section of my code. There is no trajectory generation, really. I'm just trying to get to a fixed static position.
In the code, if I keep dt fixed, and alter env.StartSimulation(timestep=0.0001), I get the issues popping up.

```<code>with env:
    robot = env.GetRobots()[0]
    robot.GetLinks()[0].SetStatic(True)
    env.StopSimulation()
    env.StartSimulation(timestep=0.0001)

dt = 0.001
w = 100
eta = 5
Kp = [w*w]
Kv = [2*eta*w]
# Desired pos, vel and acc
cmd_p = [3.14/2]
cmd_v = [0]
cmd_a = [0]

while True:
    with env:
        torqueconfiguration, torquecoriolis, torquegravity = robot.ComputeInverseDynamics([1],None,returncomponents=True)
        err_p = cmd_p - robot.GetDOFValues()
        err_v = cmd_v - robot.GetDOFVelocities()

        # ID Controller
        M = compute_inertia_matrix(robot, robot.GetDOFValues())
        a_cmd = (Kp*err_p + Kv*err_v + cmd_a)
        taus = torquegravity + torquecoriolis +  M.dot(a_cmd.transpose()).transpose()

        # Just PD(ish) controller
        #taus = Kp*err_p - Kv*robot.GetDOFVelocities()

        with robot:
            robot.SetDOFTorques(taus,False)     # True = use limits
            print (taus, torquegravity+torquecoriolis, a_cmd, M.dot(a_cmd.transpose()).transpose())
    time.sleep(dt)

# https://scaron.info/teaching/equations-of-motion.html
def compute_inertia_matrix(robot, q, external_torque=None):
    n = len(q)
    M = np.zeros((n, n))
    with robot:
        robot.SetDOFValues(q)
        for (i, e_i) in enumerate(np.eye(n)):
            m, c, g = robot.ComputeInverseDynamics(e_i, external_torque, returncomponents=True)
            M[:, i] = m
    return M

<?xml version="1.0" encoding="utf-8"?>
<Robot name="Pendulum">
    <RotationAxis>0 1 0 90</RotationAxis> <!-- makes the pendulum vertical -->
    <KinBody>
        <!-- <Mass type="mimicgeom"><density>100000</density></Mass> -->
        <Body name="Base" type="dynamic">
            <Translation>0.0  0.0  0.0</Translation>
            <Geom type="cylinder">
                <rotationaxis>1 0 0 90</rotationaxis>
                <radius>0.3</radius>
                <height>0.02</height>
                <ambientColor>1. 0. 0.</ambientColor>
                <diffuseColor>1. 0. 0.</diffuseColor>
            </Geom>
            <mass type="custom">
                <!-- specify the total mass-->
                <total>5.0</total>
                  <!-- specify the 3x3 inertia matrix-->
                  <!--<inertia>2 0 0 0 3 0 0 0 5</inertia> -->
                  <!-- specify the center of mass (if using ODE physics engine, should be 0)-->
                <com>0.1 0.0 0.0</com>
                </mass>
        </Body>
        <Body name="Arm0" type="dynamic">
            <offsetfrom>Base</offsetfrom>
            <!-- translation and rotation  will be relative to Base -->
            <Translation>0 0 0</Translation>
            <Geom type="box">
                <Translation>1 0 0</Translation>
                <Extents>1 0.1 0.1</Extents>
                <ambientColor>1. 0. 0.</ambientColor>
                <diffuseColor>1. 0. 0.</diffuseColor>
            </Geom>
            <mass type="custom">
                <!-- specify the total mass-->
                <total>1.0</total>
                  <!-- specify the 3x3 inertia matrix-->
                  <!--<inertia>2 0 0 0 3 0 0 0 5</inertia> -->
                  <!-- specify the center of mass (if using ODE physics engine, should be 0)-->
                <com>0.5 0.0 0.0</com>
                </mass>
        </Body>
        <Joint circular="true" name="Joint0" type="hinge">
            <Body>Base</Body>
            <Body>Arm0</Body>
            <offsetfrom>Arm0</offsetfrom>
            <weight>0</weight>
            <axis>0 0 1</axis>
            <maxvel>100</maxvel>
            <resolution>1</resolution>
        </Joint>
    </KinBody>
</Robot>
</code>```

Here is some data for dt = 0.001 and env.StartSimulation(timestep=0.0001)

In this data,

taus is the torque command to the simulation,

torquegravity+torquecoriolis is returned from the inverse dynamics

a_cmd is the controller command and

M*a_cmd is the command after being multiplied by the mass matrix

The gravity and coriolis parts appear to be correct for steady state, where it should be about 4.9NM

```<code>taus, torquegravity+torquecoriolis, a_cmd, M*a_cmd
 3464.88331508,  0.48809828,  5329.83879509,  3464.39521681
 330.67177959,  1.47549936,  506.45581573,  329.19628023
-785.91806527,  2.45531014, -1212.88211601, -788.37337541
-1065.4689484,  3.23603844, -1644.16151823, -1068.70498685
-1027.47479809,  3.80261774, -1586.58063974, -1031.27741583
-877.83110127,  4.18635604, -1356.94993433, -882.01745731
-707.25108627,  4.4371714, -1094.9050118, -711.68825767
-554.34483533,  4.6006198, -859.91608481, -558.94545512
-432.22314217,  4.70818921, -672.20204828, -436.93133138
-327.797496,  4.7768792, -511.65288492, -332.5743752
-240.77203429,  4.82021019, -377.83422228, -245.59224448
-172.18942128,  4.84807059, -272.3653721, -177.03749186
-117.58895761,  4.86591166, -188.39210657, -122.45486927
-74.51920719,  4.87743369, -122.14867828, -79.39664088
-39.91183436,  4.88473444, -68.91779816, -44.7965688
-12.82321495,  4.88971433, -27.25066043, -17.71292928
 8.45349476,  4.89281357,  5.47797105,  3.56068118
 25.35468725,  4.89489884,  31.47659755,  20.45978841
 38.84080509,  4.896309,  52.22230167,  33.94449609
 48.72668147,  4.89724689,  67.42989936,  43.82943458
 56.78552877,  4.89790152,  79.82711885,  51.88762725
 65.515892,  4.89836756,  93.25772991,  60.61752444
 68.81359264,  4.89867903,  98.33063633,  63.91491362
 73.86961896,  4.89891052,  106.10878221,  68.97070844
 76.67416578,  4.89907489,  110.42321674,  71.77509088
 79.62549808,  4.89919702,  114.96354008,  74.72630105
 85.17343708,  4.89928669,  123.49869291,  80.27415039
 85.13686188,  4.89934963,  123.44232654,  80.23751225
 85.75675034,  4.89939931,  124.39592466,  80.85735103
 86.55192592,  4.89943807,  125.61921208,  81.65248785
 86.39672231,  4.89946802,  125.38039121,  81.49725429
 87.4299925,  4.89949202,  126.97000073,  82.53050048
 87.42776523,  4.8995098,  126.96654682,  82.52825543
 87.15472709,  4.8995251,  126.54646461,  82.255202
 86.97240783,  4.89953825,  126.26595319,  82.07286958
 86.98023044,  4.89954905,  126.27797137,  82.08068139
 86.75364661,  4.89955809,  125.92936696,  81.85408852
 86.9853716,  4.89956526,  126.28585591,  82.08580634
 88.01679721,  4.89957062,  127.8726563,  83.1172266
 89.2610231,  4.89957348,  129.78684557,  84.36144962
 88.47969399,  4.89957495,  128.58479851,  83.58011903
 88.77623594,  4.89957711,  129.04101359,  83.87665884
 90.87280518,  4.89957739,  132.2665043,  85.9732278
 88.9513552,  4.89957707,  129.3104279,  84.05177813
 89.14100099,  4.89957773,  129.60218964,  84.24142327
</code>```

And here is some data for dt = 0.001 and env.StartSimulation(timestep=0.0005)

```<code>taus, torquegravity+torquecoriolis, a_cmd, M*a_cmd
-313.62240349,  0.98927261, -484.01796324, -314.61167611
-242.03525463,  2.00886997, -375.45249938, -244.0441246
-199.82226305,  2.79259699, -311.71516928, -202.61486003
-190.02605484,  3.39367572, -297.56881625, -193.41973056
-162.08293067,  3.8525617, -255.28537288, -165.93549237
-125.84847045,  4.17559368, -200.03702174, -130.02406413
-103.89936813,  4.40068949, -166.61547326, -108.30005762
-82.32305905,  4.5566127, -133.66103347, -86.87967175
-64.56801352,  4.66415211, -106.51102404, -69.23216563
-49.68124446,  4.73812107, -83.72210081, -54.41936553
-37.91265825,  4.78890663, -65.6947152, -42.70156488
-27.99189838,  4.82374208, -50.48560071, -32.81564046
-19.81225948,  4.84762415, -37.9382825, -24.65988362
-12.55978349,  4.8636252, -26.80524414, -17.42340869
-6.89165107,  4.87470983, -18.10209369, -11.7663609
-3.13313345,  4.88256746, -12.33184754, -8.0157009
 0.69831646,  4.88796162, -6.44560793, -4.18964516
 3.86277859,  4.89166745, -1.58290594, -1.02888886
 6.12163439,  4.8941598,  1.88842245,  1.22747459
 8.58189707,  4.89593332,  5.67071346,  3.68596375
 9.1580546,  4.89712981,  6.55526891,  4.26092479
 11.81854706,  4.89798468,  10.64701905,  6.92056238
 12.40540565,  4.89856409,  11.54898701,  7.50684156
 14.04109075,  4.89897979,  14.06478609,  9.14211096
 14.39924399,  4.89926951,  14.61534535,  9.49997448
 14.98060951,  4.89947252,  15.50944153,  10.08113699
 16.08890875,  4.89961544,  17.2142974,  11.18929331
 16.01955973,  4.89971637,  17.10745133,  11.11984337
 17.06493791,  4.89978831,  18.71561478,  12.16514961
 17.35364328,  4.89983976,  19.15969772,  12.45380352
 17.62239334,  4.89987688,  19.57310225,  12.72251646
 17.84455913,  4.89990387,  19.91485424,  12.94465525
 17.43825648,  4.89992362,  19.28974286,  12.53833286
 17.58436934,  4.89993826,  19.51450935,  12.68443108
 17.70571012,  4.8999492,  19.70117065,  12.80576093
 18.40852272,  4.89995746,  20.78240808,  13.50856525
 18.49492461,  4.89996372,  20.91532445,  13.59496089
 18.56575802,  4.89996852,  21.02429154,  13.6657895
 18.62430693,  4.89997223,  21.11436108,  13.7243347
 16.54216482,  4.89997511,  17.91106109,  11.64218971
 18.71146936,  4.89997747,  21.24844907,  13.81149189
 18.13316504,  4.89997923,  20.35874741,  13.23318581
 18.77330006,  4.89998067,  21.34356829,  13.87331939
</code>```

Despite the differences in torque command (a_cmd) I still get similar performance, in that the arm drives to the right position fairly quickly.
As another experiment I set the initial position to pi/2 and just fed back the gravity term to the torque output. My understanding of this is that the arm should float, ala a gravity compensation sort of thing. But it just drops as if a small torque is applied.
Thanks again!

答:
I came back to this problem and just stumbled over an answer.
At the end of the simulation update step I was using:

```<code>time.sleep(dt)
</code>```

It should have been:

```<code>env.StepSimulation(dt)
</code>```

This fixed that particular problem.

Body:
I came back to this problem and just stumbled over an answer.
At the end of the simulation update step I was using:

time.sleep(dt)

It should have been:

env.StepSimulation(dt)

This fixed that particular problem.


答:
The wattage rating is usually (read the manufacturer's specs very carefully) the measure of how much power the motor can draw.  It doesn't tell you anything more than that.

Wattage does not tell you whether the motor is efficient at converting the input electrical energy into output mechanical energy.

Wattage does not tell you whether the motor's power-to-weight ratio is reasonable.

Wattage does not tell you whether the motor's size is reasonable for your application.

Wattage does not tell you whether the stall torque or maximum speed is correct for the load you wish to drive.

Wattage does not tell you whether the motor's duty cycle can support the needs of your application.

If you are comparing 2 motors that differ only by their input power rating, and more power is important to you, then yes: the motor with more power will be better for you.

Title: Does more "Power" (W) means better motor?

Body: If a motor has more Power (W) from another it means that it is better?</p>


问:
Sex Robotics for everyone male and female
How much would a sex robot cost, and is it ethically correct?</p>

答: Cost wise, the robots would only constantly decrease in price as the technology is currently infantile and very expensive but soon itll be relatively cheap and widely understood. Ethic wise, fleshlights are allowed so why wouldn't sex robots be right? ^^</p>


问:
How do you arrange the dof in a robotic arm?
I'm designing an arm that can manipulate objects on a table.

My question is about the arrangement of the degrees of freedom.

Different robots seem do have different arrangements of the degrees of freedom,.

e.g. the open-source thor robot uses [yaw-roll-roll-yaw-roll-yaw], while Google's in-house arm uses [yaw-roll-yaw-roll-yaw-roll-roll].

Is there any reason you would choose one specific arrangement over another?

答:
Good Question.  The number, arrangement, and orientation of DoFs in the robot should not be taken lightly.  It should reflect the robot's desired purpose.  Care must be taken to place the "sweet spot" of the arm's workspace in a good place relative to the rest of the robot.  And if there will be 2 arms, you probably also want to overlap their workspaces significantly (or not).

N. Staub already mentioned number of DoFs and placement of the (heavy) motors.  Physical constraints like this are obviously very important.

The orientation of joints can also drastically affect the robot's workspace.  Take a look at these examples:

UMass Amherst's UBot-7 has arms that come straight out the sides of the robot's torso.

The DARPA ARM-S Robot has arms that come out of the torso at 45 degree angles.

The original Boston Dynamics Atlas had arms that came out at upward angles.

The ABB YuMi Robot has arms that come out of the torso both angled in and up.

Lastly, the arrangement of the DoFs can also change the usable workspace of the arm.  There are many metrics that can be used to determine the arm's "sweet spot".  Manipulability measure is one such metric.  Here i some analysis I did on a 5 DoF humanoid arm, (3 DoF shoulder, 1 DoF elbow, 1 DoF wrist).  I analyzed 2 different shoulder configurations: Roll-Pitch-Roll, and Yaw-Pitch-Roll.  Link lengths are identical, and I think the joint limits are analogous.  Color codes denote the scale of the manipulability measure.  Red is large, Green is low.  Larger (redder) is better.  There is an isometric view in the upper left, and 3 orthogonal views.  Front view is in the lower right.  For the orthogonal views, what is shown is a slice through workspace close to the elbow joint.  The robot's torso is gray, upper arm is red, lower arm is green, and wrist is blue.  This is the robot's right arm.  As shown, the arm is sticking straight out of the torso.

You can see that the shape of the sweet spot is different between the two arms.  For Roll-Pitch-Roll it is more up and down.  And for Yaw-Pitch-Roll it is more left to right.  If the X axis points forward, Y points to the left of the robot, and Z points up, then the best manipulability space for the RPR configuration is like a doughnut around Y axis, and around the Z axis for the YPR configuration.

Lastly, if you are interested in designing robot arms, I highly recommend the book:
"Robot Evolution: The Development of Anthrobotics" by Mark E. Rosheim.


问:
Line follower PID tuning for high speed
I have a line following differential drive robot with a PID control. I successfully tuned (try and error) the P,I,D constants for a good stability in low speeds, but when I increase the speed, everything goes sideways.

Therefore I want to solve this with a bit of a mathematical approach.

I started logging the error (setpoint-present sensor value;input for PID) and output (from the PID; motors get values: left = speed-output, right = speed+output).

My question is, whether it is possible to use this data in order to further improve the PID?

答:
Yes, it is possible. Though remember, what you are measuring is error between measured value (which for your robot is direction that it is heading in 2D) and desired value (which is direction it should be heading). To use more mathematical and complicated methods, you have to know absolute heading of robot and be able to measure its step response. For robot like that it would be response to i.e. 45 degree angle drawn on track. Also, check this question for good PID tuning strategies.

With trial-error method You can do well, but remember - winning robots have:

wheels speed measurement (i.e. encoders) - best way to compensate loss of voltage on battery during run,

clean and well made tires - clean before every run to get best results,

proper line sensors alignment - far forward and close to each other (distance smaller than 19mm sensor to sensor).

Title: Line follower PID tuning for high speed


问:
Quadrotor SE3 Controller: Calculating Rd_dot
I am trying to simulate and implement the controller in the paper Geometric Tracking Control of a Quadrotor UAV on SE(3). I have the dynamics implemented, however I am stuck at one part in the controller which is the calculation of the following equation:

$$e_\Omega=\Omega-R^TR_d\Omega_{d\cdot}$$

I have all the variables in equation (11) calculated except for $\Omega_d$ which is the desired angular velocity.

From equation (4) of the paper we know the relation:

$$\dot{R}_d=R_d\hat{\Omega}_d$$

However, I don't know how to calculate $\dot{R}_d$. Can someone give the exact equation for getting $\dot{R}_d$ so I can calculate $\Omega_d$ to get the error $e_\Omega$?

My code is available on github.

答:
In this paper rotation matrices are used to describe the orientation of the quadrotor. This is chosen because each orientation as a single representation (contrary to quaternions) and gimbal lock is not possible (contrary to any Euler angle convention).

In the proposed controller, ones want to know how close the actual rotational velocities from the desired one, hence the equation (11) which provides this information as a vector from the matrix representation.

That being said, $\Omega_d$ is your desired angular velocity and should come from your planner  as for the desired rotation transcribed in $R_d$. As you have the time evolution of $R_d$ you should be able to get its derivative $\dot{R}$.


问:
Flight controller drift issue
(This is a little long)

So I am working on a drone recently, and aim to control it using an Android device. I've read that it can be done using a Raspberry Pi and Multi Wii, but I couldn't find any crius multiwii boards for sale anywhere. So I decided to build one using a few guides.
I used an Arduino nano and an MPU 6050 to get my work done, and have made all proper connections.

5V - VCC

GND - GND

A5 - SCL

A4 - SDA

I dumped the Multiwiii firmware on to the board, by making the proper adjustments in the code. And then I test the device using the Multiwiii calib tool provided.
Everything is fine, the picture of the quad rotates as I move the assembly, but the issue is that the compass tilts in its own. I thought it maybe due to some lose contact, even after thoroughly soldering it remained the same.
Essentially, the yaw and roll, and the compass indicator slowly drift even if the assembly is perfectly still. I'm unable to find a proper solution to this, as the drift should not happen in real flight. The drift is very small, +1° to the left or right for every 2-3 seconds. But over a period of time, it builds up to noticeable drift. I'm looking for a possible explanation of this, or a solution/suggestion, I'd really appreciate it.

Thanks

答:
You are using cheap MEMS components, they are typically prone to noise and drift.

I don't know how you retrieve your angles but the sensors are giving you angular velocities and linear accelerations. Start by assessing the quality of these signals, and then see of this maps to your orientation.

Typically there are two ways of computing orientation, either projection the gravity $\vec{g}$ measured by the IUM (if acceleration from motion is negligible) or integrating the gyros (if noise on the gyros is small).

Title: Flight controller drift issue


问:
How to build big robots(Material/Method)?
I am interested to know, if I want to build middle/big size robots(50*50*150 cm^3), which material and which method is better to use?

I mean, when I want to build a robot with this size(20*20*20) I do designing with solidworks and printing by 3d-printer very happy and simple! But what if I like to bigger my robot?

I think this photo may help to clarify what do I mean:

If someone wants to build robots in this scale, what should he learn?(except going to university and getting a master in mechanical engineering:) ). I mean is it possible to learn or not?

Edit: I wanted to write this for Mike but it was to big for a comment and I thought maybe it's better to add it here:

It was a great answer, thank you! But maybe it was better to mention I
  really don't want to build a robot lonely by myself. My goal was about
  learning how can I make a big prototype of my robot? I have made a
  robot in 20*15*20 cm^3 size by 3d printer. it's an educational robot.
  I designed it by Solidworks and made it by my Prusa i3 printer. Also I
  programmed it myself. And I thought if I can build this robot in
  50*50*150 cm^3 size I can sell it to schools! or even build other
  types of robots like servants. So I was looking toward a way to build
  a prototype of that and show it to some investors and make a team to
  build it functional as you said it in your answer.

答:
I am interested to know, if I want to build middle/big size robots(50*50*150 cm^3), which material and which method is better to use?

I am assuming you don't want to go the way of designing a robot using a CAD software followed by tons of machining to bring all the custom parts to life. If you are looking to build a robot using off-the-shelf materials, I would say aluminum extrusion is the way to go. It is the machine builder's lego. Using aluminum extrusion and aluminum plates, you can rapidly build a large, rigid base onto which you can mount all your electronics, motors, sensors, computers, etc.... I prefer Bosch aluminum extrusion (which officially is called 'aluminum structural framing'). Have a look here: https://www.boschrexroth.com/en/us/products/product-groups/assembly-technology/aluminum-structural-framing/index. For plates, round shaft, angle, etc... you can go to metal supermarkets (if you are in US or Canada. If not you should have something local). An example of an ongoing robotic project that was built with extrusion and plates can be seen here: https://answers.ros.org/question/271819/please-suggest-all-packages-to-achieve-slam-for-robot/

I think this photo may help to clarify what do I mean:
Aluminum extrusion will allow you to build the two robots that have a rolling base. As for the middle biped robot, you will need to get more fancy... WAY more fancy. Building biped robots is very challenging, and you will most likely will need to machine your own components around off-the-shelf parts that you are utilizing. Rolling bases with robots on top are much easier to build than biped robots. I guess I am trying to say that the images you included are robots that are not all in the same league. So far I have focused on a moving base. If you are trying to build arms with end effectors, you will need to start machining custom parts (whether your own design or open source).

If someone wants to build robots in this scale, what should he learn?(except going to university and getting a master in mechanical engineering:) ). I mean is it possible to learn or not?

Usually advanced robots (like the 3 you have in the image) are built by teams. Teams allow members to specialize in different disciplines (mechanical, electrical, electronics, programming, etc...) which produces the best solutions in each discipline. However, a single person can also build an advanced robot, it just takes longer, and it will be very challenging to come up with the perfect solution in every discipline every time. My question is why do you want to build a robot? if you are trying to learn, then join a robotics club, or start building miniature robots. If you are looking to build functional robots (entirely on your own), to achieve actual tasks, then I suggest you learn the following:

CAD software - drawing your robot out will save you time as you discover issues before you start building. I recommend solid works, so you can later do 3D printing.

Machining - you will need to build some pieces that link off-the-shelf parts in your mechanical design.

Electrical - You can always pick up a textbook and run through basic AC/DC theory and do some experimentation. You will need to have some basic understanding to use off the shelf parts and how to integrate them together. you will need to understand how to step down/up voltage, limit amperage, etc...

Mechanics - Before you start building you will need to double check your design (catch items such as robot will not flip as it's too top heavy, or motor is underpowered to move limb, etc...)

Programming - May I suggest C and C++? You will need to program the robot to control all your hardware to perform the task you want. I am relying on the ROS framework.

Robotics is an amalgamation of mechanical, electrical and programming. All robots rely on these disciplines to various extents.

My advice is first figure out why you need a robot. this will guide what you will build. Then start building each system out independently of each other; once you are done amalgamate all your parts into a single unit.


问:
Kollmorgen S300 drive oscillation
Robotics! We've got a rotation device controlled with Kollmorgen S300 servodrive. The official support is silent as Jesus, so I've decided to ask here instead.

When it is given a task to set into a direct position, it comes to that position and then oscillates around it with a radius of 4-5 degrees. As we are simply C++ programmers and our job is NOT related with any mechanical devices (we don't know physics), we are stuck. So, the question comes to that:

What are the general reasons for drive oscillation?

How do we fix that?

Thank you very much in advance!

答:
I just looked up the model number and it's a servo drive. If you did not tune your servo axis then you will have very bad performance, and what is happening is to be expected. You need to tune your PID loop.

Servo systems are closed loop. This means that the encoder (or resolver) in the servo motor is sending feedback to the drive. The drive using the PID values you provided will use an algorithm which modifies the voltage output to the motor to eliminate the error (actual position vs. the position the motor is supposed to be in). If your PID is not properly set up, a mild oscillation means you are lucky... Your servo could run away and start shaking violently until the drive faults.

To solve your problem you need a tuning guide. I prefer Applied Motion Products, and as a sample of what needs to be done have a look at this document: https://www.applied-motion.com/sites/default/files/QuickTuner_920-0022C_0.pdf. You need the same document for Kollmorgen (who I have worked with, and at the time I was not a fan.. but it was over 10 years ago, maybe they are better now).

Title: Kollmorgen S300 drive oscillation


答:
From what I understand, your question is purely about how to manufacture a robot that looks like it when you have the know-how for programming it and stuff.

Manufacturing such robots as in your picture uses mostly polymers(fancy name for plastics). They are created using injection moulding machines and other similar processes. For the aluminium/metal parts, metal additive manufacturing or aluminium extrusion is used. All g

Now, when you are scaling your robot up, you have will have different mass for every link and joint. Therefore you will have to scale up your power supply and actuators torques, and then work around with other requirements from there.

Now for determining the torques required at the joints, you will need to know the mass and the moment of inertia of every joint and link, which depends upon the material and design, of course.

For understanding everything, you will need to study forward and inverse kinematics and then learn about robot dynamics. Ideally, its best if you study everything from the basics and make sure you understand everything about it so that you will built a very reliable robot that does exactly the way you expect it to. I am afraid I will have to leave the part about whether it is achievable on your own or not upto your discretion. Most people who studied this subject at university with me found it quite difficult.

However, I know people who just winged it with simple robot designs of similar dimensions and they worked. However, If you plan on building a bi-ped robot of that scale, Gob bless you! It will involve tremendous amounts of trial and error which maybe very expensive.

Since you are planning on building a team to help you out, I suggest you get someone from mechatronic/mechanical, electronic and computer engineering background.

I hope I have answered all your queries correctly. Cheers!

Title: How to build big robots(Material/Method)?

Body:
I am interested to know, if I want to build middle/big size robots(50*50*150 cm^3), which material and which method is better to use?

I mean, when I want to build a robot with this size(20*20*20) I do designing with solidworks and printing by 3d-printer very happy and simple! But what if I like to bigger my robot?

I think this photo may help to clarify what do I mean:

If someone wants to build robots in this scale, what should he learn?(except going to university and getting a master in mechanical engineering:) ). I mean is it possible to learn or not?

Edit: I wanted to write this for Mike but it was to big for a comment and I thought maybe it's better to add it here:

It was a great answer, thank you! But maybe it was better to mention I
  really don't want to build a robot lonely by myself. My goal was about
  learning how can I make a big prototype of my robot? I have made a
  robot in 20*15*20 cm^3 size by 3d printer. it's an educational robot.
  I designed it by Solidworks and made it by my Prusa i3 printer. Also I
  programmed it myself. And I thought if I can build this robot in
  50*50*150 cm^3 size I can sell it to schools! or even build other
  types of robots like servants. So I was looking toward a way to build
  a prototype of that and show it to some investors and make a team to
  build it functional as you said it in your answer.


问:
Controlling more than 12 Servos with the Arduino Servo library
I'm using Teensy hardware specifically.  I have a Teensy 2.0 and a Teensy 3.0, and from the documentation it seems like there are two 16 bit timers available, and each should be able to control 12 servos.  However, I've attached a logic analyzer and have confirmed that only the first 12 servos attached ever function.

Is there anything special I have to do with my sketch in order to convince the Servo library to allocate the second timer for servos attached beyond number 12?

This works:

```<code>#define NUM_SERVOS 12

Servo servos[NUM_SERVOS];

// teensy 2.0 pins
int pin_assignments[NUM_SERVOS] = {0, 1, 2, 3, 4, 5, 20, 19, 18, 17, 16, 15};

void setup() {
  for(int i = 0; i < NUM_SERVOS; i++) {
    servos[i].attach(pin_assignments[i]) ;
  }
}
</code>```

But this, below, only ever shows activity on the first twelve pins attached:

```<code>#define NUM_SERVOS 24

Servo servos[NUM_SERVOS];

// teensy 3.0 pins
int pin_assignments[NUM_SERVOS] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};

void setup() {
  for(int i = 0; i < NUM_SERVOS; i++) {
    servos[i].attach(pin_assignments[i]) ;
  }
}
</code>```

答:
The problem lies in the Servo.h file in Arduino\libraries\Servo.  The Teensy 3.0 parameters are not defined in this file and therefore it is assumed to have only one timer.  Changing the default action to copy the second last action was sufficient for my purposes, I changed it the file as follows:

From:

```<code>#else  // everything else
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
#endif
</code>```

To:

```<code>#else  // everything else
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
#endif
</code>```

This only managed to get me 16 servos though.  I also tried adding other timers with no success in increasing the number of available servos.  Hopefully this proves useful to someone.

Body:
The problem lies in the Servo.h file in Arduino\libraries\Servo.  The Teensy 3.0 parameters are not defined in this file and therefore it is assumed to have only one timer.  Changing the default action to copy the second last action was sufficient for my purposes, I changed it the file as follows:

From:

#else  // everything else
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
#endif

To:

#else  // everything else
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
#endif

This only managed to get me 16 servos though.  I also tried adding other timers with no success in increasing the number of available servos.  Hopefully this proves useful to someone.


问:
Can ROS run on a Raspberry Pi?
Can ROS run on a Raspberry Pi?

ROS is resigned to run on a network of machines, with different machines, even different cores on the same machine doing different jobs. Can one of those machines be a Raspberry Pi?

I am considering using an R-Pi as the EtherCAT master on a mobile robot, communicating with the main PC over WiFi, using a dongle.

Can an R-Pi even run ROS at all?

Would an R-Pi have enough processing power to do some 1kHz servoing?

Would it be possible to run some servoing on the host through the WiFi connecion?

答:
You can try this tutorial for ROS run on a Raspberry Pi, it works
http://www.instructables.com/id/Raspberry-Pi-and-ROS-Robotic-Operating-System/</p>

Title: Can ROS run on a Raspberry Pi?


问:
are these two logic level shifters are doing the same job
I am just in need of a level shifter and I want to ask if these two are doing the same job without any difference, if there is a difference I need to know

1 : https://www.sparkfun.com/products/12009

2 : https://www.pololu.com/product/2595

答:
Yep, they are pretty much the same thing.
The schematics are the same.
Specs listed in for the Pololu seems broader; but, that may be just specsmanshio</p>


问:
DC geared Motor 20 NM 25 RPM small dimensions.
My application requires a DC geared motor with torque of 10 NM - 20 NM and low speed (25 RPM at most) and a small dimensions (120 mm length at most).
I failed to find my specs at eBay, and Alibaba targets only mass production.
Can you recommend me certain models of Gear, Stepper or even Servo motors that met the above specs from any online store?</p>

答:
If you want the motor to be short but don't care about the diameter, consider a pancake gear motor.

Ex: The AST 9AFG is less than 50mm long and has a version can deliver over 10NM at 21RPM.  They have larger ones too


答:
You can easily 3D print prop protectors on a cheap 3D printer, but there is a way to prevent breaking most of the props
Not flying indoors and flying in a large area will prevent you from breaking most of your props</p>

Title: How can I protect my props from being damaged?

Body:
I have a quad copter and I'm developing my own flight controller to run the code and testing it on the quad.
As you all must be knowing, this means a lot of broken propellers.
I thought of making a frame with prop protection but fabrication seemed difficult because 3d printing is proving expensive and cutting aluminum isn't that practical. Can you suggest a better way to fabricate? </p>


问:
Quadcopter application underwater
Just out of curiosity, can the concept of a Quadcopter be applied to an ROV? Would it work the same way underwater as it would be in Air? If not what kind of modifications it would take to implement that idea, underwater?</p>

答:
First of all, my intuition says it'll work, same logic - props push the water/air makes the quadcopter move.

My guess is that the water resistance to the motors is much higher than the air and therefor the motors should be much stronger.

Another thing might be that there is almost no way to fix it if it brakes in the water (it'll probably just drown) so you should probably "extra" protect your props and electronics and actually everything..

The other thing is quite obvious, you need to protect your electronics from water so that makes the price go up a bit more.

Title: Quadcopter application underwater


问:
Robotic arm select servo motors
Hi i´m designing a robotic arm based on this idea of the NOVABOT I only want to change its structural parts by aluminum tubes. In this design 3D model it use the servo hs-311 wish have a max torque of 3.7 kg/cm, and its made of some plastic material.

I made my calculations following this url and made a excel that I append here... the mass of my design have been taken from iProperties of Autodesk Inventor, so they are in mass units not in weight. And I´m dismissing the mass of the joints (m5,m6) to have a first idea of the values, because I dont have the selected motors.

And my problems is that I think I´m missing something here because the it results in a very high torque motors, for this simple design.

here is my excel

答:
There are two general categories of servos, hobbyist and industrial. Hobbyist ones generally go up to about 50kg/cm, and some will do more than that but costs multiply (sometimes these are called giant scale). Industrial servos start at around $250 minimum (400+ is more common), not including all the additional hardware to control them. And they are considerably more complicated to use, as you would expect from industrial-grade motors.

If you need more power, geared stepper motors are a much cheaper option, but they don't have the same position-sensing functionality. You can buy rotary encoders separately (either incremental or absolute; absolute are more expensive but more useful) and those would solve that problem, but that is an extra component and thus increases complexity. Be advised that geared stepper motors are heavy, so you would only want to use them for the lowest DOF's. Some arm makers use steppers for the base rotation and both T1 and T2, but both joint motors are mounted to the base and one of them transmits power along a belt or driveshaft to T2. This allows the extra power without massively increasing the moving weight, and the belt or driveshaft gears can be used for additional gear reduction.

If you take this approach, consider that these geared steppers are also long, so if you mount them on opposite sides of the arm, that base will be very wide - probably wider than L1 is long.

And now you see why industrial robot arms are so expensive; it's hard to pack all the components into the right places and find pieces that are the exact right size. But you are definitely in the right direction by using only metric units!

Title: Robotic arm select servo motors


答:
You can find DC gearmotors on Amazon with roughly those specs.

This one, set with 30rpm and 24v, is fairly close: https://www.amazon.com/uxcell-Torque-Electric-Reduce-Turbine/dp/B072DTMPBC/ref=sr_1_5?s=hi&ie=UTF8&qid=1511799633&sr=1-5&keywords=dc%2Bgear%2Bmotor%2B25rpm&th=1

This one has higher RPM, but more power, and you can add an extra 2:1 gear reduction: https://www.amazon.com/dp/B01N8YDOC9/ref=sspa_dk_detail_2?psc=1

That's the smallest you'll find in fairly cheap motors. Otherwise, you'd need to custom order one, or talk with a manufacturer/supplier, which will probably be more expensive.

Title: DC geared Motor 20 NM 25 RPM small dimensions.

Body:
My application requires a DC geared motor with torque of 10 NM - 20 NM and low speed (25 RPM at most) and a small dimensions (120 mm length at most).
I failed to find my specs at eBay, and Alibaba targets only mass production.
Can you recommend me certain models of Gear, Stepper or even Servo motors that met the above specs from any online store?</p>


问:
GPS/ 1GYRO - 2D + ACCEL+GPSEKF
I am trying to integrate GPS and IMU but as a first step I am trying to use just 1d gyro and 2d accelerometer to work. Below is my model -

State model and propagation

So, my question is .. after implementing this EKF, if I sigma_u for accelerometer is reduced to like 0.1 or less or in fact any lesser value, the error in comparison to GPS solution grows. It becomes around 50 m!! If I put in a higher value the error decreases. What am I missing in the model? Can anyone help me, please?

答: Low cost accelerometers have a bias that varies with temperature and from startup to startup.  Your model does not appear to have a state to simulate these accelerometer bias offsets.  Note that in order to compare the results of accelerometers with position sensors like GPS, the accelerometer data must be double-integrated.  If there is any un-modeled bias offset, this double integration causes position errors to grow quadratically over time.  If you give accelerometers a high noise value in your model, then the filter can "explain away" some of this error as the result of random noise.  When you tell the filter that accelerometers are very low noise, however, this forces the filter to believe the accelerometers are telling the truth, so your filter will follow the erroneous output in preference to the GPS position.</p>

Title: GPS/ 1GYRO - 2D + ACCEL+GPSEKF


问:
State of the art trajectory for fine precision robots
Which kind of trajectory would one use for a fine precision robot?

I know trapezoidal and cubic trajectories, but errors get very high when stopping at every configuration and when speeding up to the highest possible velocity.

How is this done in practise especially when not much deviation from a straight path is wanted?

In my case I try to get the end-effector to go a straight line with a three joint rotational robot.

答:
For very high-precision applications such as finishing, milling by CNC machines, jerk-bounded trajectories (that is, trajectories comprising polynomials of degree 3 of higher) are often used. If you search on Google Scholar using the term "jerk bounded", you can find loads of methods to plan such trajectories.

High-order polynomial trajectories (or splines) are not always necessary, however. For stiff articulated manipulators (such as position-controlled robots), they are usually stiff enough that using second-order (parabolic) polynomial trajectories is perfectly fine. The effect of (theoretically) unbounded-jerk is often negligible.

In your case, you mentioned that the errors got high when stopping and speeding up. I suspect that this might not come from the trajectory generation method you used.

If the robot you are using is custom-built, you might want to

Do kinematics calibration to make sure that the locations of joints and the tool are actually where you think they are; and

Check how well the motors can track your input commands.

Otherwise, you may check if this issue is related in any way to singularities.


答: There is another Servo library that can drive as many servo's as you want :Link to Arduino Software Servo. Good luck</p>

Title: Controlling more than 12 Servos with the Arduino Servo library

Body:
I'm using Teensy hardware specifically.  I have a Teensy 2.0 and a Teensy 3.0, and from the documentation it seems like there are two 16 bit timers available, and each should be able to control 12 servos.  However, I've attached a logic analyzer and have confirmed that only the first 12 servos attached ever function.

Is there anything special I have to do with my sketch in order to convince the Servo library to allocate the second timer for servos attached beyond number 12?

This works:

```<code>#define NUM_SERVOS 12

Servo servos[NUM_SERVOS];

// teensy 2.0 pins
int pin_assignments[NUM_SERVOS] = {0, 1, 2, 3, 4, 5, 20, 19, 18, 17, 16, 15};

void setup() {
  for(int i = 0; i < NUM_SERVOS; i++) {
    servos[i].attach(pin_assignments[i]) ;
  }
}
</code>```

But this, below, only ever shows activity on the first twelve pins attached:

```<code>#define NUM_SERVOS 24

Servo servos[NUM_SERVOS];

// teensy 3.0 pins
int pin_assignments[NUM_SERVOS] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};

void setup() {
  for(int i = 0; i < NUM_SERVOS; i++) {
    servos[i].attach(pin_assignments[i]) ;
  }
}
</code>```


问:
How to build a working r/c crane capable of lifting 2 lbs/1Kg
Building an r/c crane capable of lifting and rotating 2.2 lbs. Have constructed the crane with a base on a ball bearing lazy-susan for rotation of 90 degrees. The question is: how to attach the crane base (2.38"OD plastic pipe) to a servo for rotation control.
Any ideas would be appreciated. Thanks. </p>

答: I suggest the lazy-susan rotating base be a gear, and then you can have a smaller gear coupled with it and the servo run the gear in a vertical orientation. The following figure should give you an idea of what I mean.


问:
Encoder for odometry (Wheel vs motor)
Hey i am building a ROS enabled robot which relies on Odometry data from encoders for the purpose of SLAM .

I am confused between what would be more accurate in estimating the pose and robot position either using encoders mounter directly to the back of the motor shaft vs quadrature encoders attached to the wheel .

PS:- I have a Ebike motor running my bot , so as you can guess it uses chain drive to turn the wheels . Please suggest me some mechanical designs by which i can attach encoders to a chain drive .

答: Since it's the wheels which change the robot's pose in the environment, I'd suggest putting the encoders to the wheels. Especially if the motor and the wheel are only connected by a chain, introducing possible slack between motor and wheel angular positions. Would the wheel sit directly on the motor axis, it would not matter.</p>

Title: Encoder for odometry (Wheel vs motor)


答:
Ln_r1 ideas is very good, but I prefer the gear is on lazy susan side. So the motor is in vertical shaft position.

Because getting gear at lazy susan periphery is not easy, alternatively you can install a large gear below lazy susan (common shaft with lazy susan).

More easy, use pulley. Either lazy susan rim as pulley or install large pulley below lazy susan (common shaft with lazy susan).

Title: How to build a working r/c crane capable of lifting 2 lbs/1Kg

Body:
Building an r/c crane capable of lifting and rotating 2.2 lbs. Have constructed the crane with a base on a ball bearing lazy-susan for rotation of 90 degrees. The question is: how to attach the crane base (2.38"OD plastic pipe) to a servo for rotation control.
Any ideas would be appreciated. Thanks. </p>


问:
What rail material is best used for linear bearings?
For the 3d printer RepRap Prusa there are several rails (smooth rods) that guide the printer head on the different axises. The printer head uses several linear bearings to glide along the rails.

There isn't any specification on what kind of material would be best suited for this purpose with the linear bearings. My first assumption would be for stainless steel because it won't corrode (rust) on the surface, but I'm not sure if this is true for all printers (whether they are 3D printers or not) as a different material may allow the linear bearings to glide more easily. Aluminum would have been my second choice but I have the same reservations of which grade would be least resistant.

This resource has some limited information but does not help with which would be best suited for this particular application.

What material is best suited for this purpose?

答:
Well, I got proper industrial linear bearings recently, along with stainless steel rails.

The properties of interest is that the material is smooth and hard to minimise friction. In fact, the stainless steel rails I obtained was both hardened and polished.

Aluminium could be dented by stainless steel bearings affecting performance.

Having said this, for a printer, which has very little weight/force, materials of differing hardness is probably fine. If you just want to reduce friction, just get polished material, or else polish it yourself (although stainless steel would probably maintain smoothness better since it is harder).


答:
I'm guessing that your question is based on whether the mathematical model of a quadrotor would work in a water environment, and not the hardware. Quite obviously the electronics and mechanical systems would need changing to work in the water: the electronics would short and the rotors would spin too fast.

The rest of my answer is based on the work Design and implementation of a structured flight controller for a 6DoF quadrotor using quaternions by Stingu and Lewis. The free version of that paper can be found at Quaternion-Based Quadrotor Control. Most quadrotor models that I have studied use minor variations on the same equations for the basic flight control.

From that paper we have the following system diagram:

Operating a quadrotor model in a liquid would require one change to the model: if the physical vehicle was neutrally or positively buoyant (ie, it doesn't sink) then the model would be invalidated. In that case the model would have to adjust for flipping the quadrotor upside down to increase the depth.

The rest of the model could be used as is: it's medium independent. In fact, the only portion of the model that touches on the medium is the equations for torque and thrust of the propellers:

$$
K_T = \frac{T}{\rho n^2 D^4}
$$

$$
K_Q = \frac{Q}{\rho n^2 D^5}
$$

In these equations, $K_T$ is a thrust constant, $K_Q$ is a torque constant, $T$ is thrust, $\rho$ is free stream density (air or water), $n$ is rotation speed, and $D$ is rotor diameter. To operate the model in water $\rho$ just has to be replaced with the density of water ($1000 kg/m^3$).

Title: Quadcopter application underwater

Body: Just out of curiosity, can the concept of a Quadcopter be applied to an ROV? Would it work the same way underwater as it would be in Air? If not what kind of modifications it would take to implement that idea, underwater?</p>


问:
Wall following robot oscillates heavily
I have a mapping robot , 3 ultra sound sensors HC SR04 , arduino uno board, two motors MG-6-120, power source 2 5v 4000 mAh power banks, driver L298N.

It uses a wall follower algorithm (here is the problem), if it finds a wall it should go parallel to it until it finishes the room, but as it follows the wall is oscillates heavily left and right so when it has to turn it is not parallel to the wall and sometimes misses the next wall after the turn.

I will post a picture of the problem.

P.S. the robot only has to make 90 deg turns.

Wall following function in a few words:

if (dist < minDist) turnSoftLeft();

if (dist > maxDist) turnSoftRight();

but this causes it to oscillate a lot and never go smooth parallel to the wall.

I read that I could use a PID proportional–integral–derivative, but I have no idea how to do that.

答:
In a broad understanding of control systems, we use a sensor reading as input. we set a target for that reading and try to minimize the difference between target and input reading by performing some action and taking the input again. IN PID control,we use additional parameters(constants) to reduce the difference between input and target faster.

You can follow the following algorithm without PID control and
yet achieve a proper wall following
For your problem :

Input : Distance from Ultrasound sensors.

Output : Motor

Assuming your placement of sensors on front(1),

right(2) and left(3) face of robot.

The simple algorithm can be modelled as follows:

set constants i.e min dist to move forward,min dist to make right turn,min dist to make left turn.(min dist = minimum distance)

Loop 1

2. read from sensors 1,2,3.

3. if(distance from 1 > min dist to move forward) : actuate both motors.

4. if(distance from 2 < min dist to make right turn) : actuate left motor.

5. if(distance from 3 < min dist to make left turn) : actuate right motor.

end loop1

There is a 2nd loop in actuate function where

1. Set target distance from sensor as min distance + some constant.

loop 2

2. compute error = target - read from the interested sensor.

3. output:using PWM technique control motor ON-OFF actuation

until error is zero.

end loop2

If you are interested in PID control you can follow the link

https://github.com/jdelacroix/simiam

It is a tutorial on matlab for PID control of robot.

you can change few scripts in the SIMIAM controller to suit your needs
It even has a implementation of ultrasound sensor.

hope this helps

I personally fell implementing a simple PID controller on arduino is tough

as it needs a lot of fine tuning to make the robot move parallel to wall.
I suggest you use additional sensors like odometry or IMU to get exact parallel following

Title: Wall following robot oscillates heavily


问:
Position Sensor
During my design of a simple robotic arm, where I 3D printed most of the parts, then used these HS-422 servos, it turned out that for a better control precision and to be able to apply Inverse Kinematic Modeling on my arm, I need feedback positions from these servo, which HS-422 do not provide.

I want to keep using these Servos because the parts are designed to fit them, what options do I have to include feedback position sensors without changing the servos and re-designing the arm's parts? Or is there any servo with feedback position and close dimensions to HS-422 that I can replace with?

答: A slightly difficult but interesting way to solve this would be to stick markers on your joints, and then you can use a camera to find the relative position of the marker wrt to the base point.</p>

Title: Position Sensor


问:
How can I draw with a 3 DOF RRR arm ,I have done the Forward and Inverse KInematics
Heres the Matlab code, I start with x and y and when I pass it through IK and Fk I get back the correct x and y thus I am confident that IK and Fk are correct.

```<code>x = 10; y = 10; z = 0;
a2 = 7.5; a3 = 9;
r = sqrt(z^2 + y^2);

th1 = atan2(y,x);
th3 = acos((r^2 + x^2 - (a2^2 + a3^2))/(2*a2*a3));
th2 = atan2(x,z) - atan2(a3*sin(th3), (a2 + a3*cos(th3)));
T0 = compute_dh_matrix(0,0,0,0);
T01 = T0*compute_dh_matrix(0, -pi/2, 0, th1);
T02 = T01 *compute_dh_matrix(7.5, 0, 0, th2-pi/2);
T03 = T02 *compute_dh_matrix(9, 0,0 , th3);
T03(1:3,4)

%ans =
%
%    10.0
%    10.0
%       0
</code>```

I have tower pro micro servos SG90 for base, shoulder and elbow joints.I am giving power using a mobile charger which outputs 5V and 2A.Now I want to try drawing some simple shapes with this robot I tried giving it the sequence of x and y locations with z=0, but the results seem not good.Do I need another DOF on the end effector?Is there any way to map x-y to the theat_start - theta_end for every angle?This is the diagram of the robot,
 I have a small change as my zero position is upright not with a bend like below but the rotation and angles are the same..

Now I am trying to draw in X, Y plane as Z is zero all the time.a2 and a3 are the link lengths.I don't know how to control the speed of the servos I just hacked the sweep code from Arduino.I just want to draw some basic shapes or a line, I tried giving (9,9), (10,10) and (11,11) thinking it will draw a line.

These images show my setup in detail.I haven't taken all the offsets yet.I was getting close but not exact x and y that I entered into the IK->FK functions so I thought I could just work with less accuracy to get results quick.If you can help with IKfor offsets it would be great too.

I really hope this is a problem that you guys consider as per the rules and as I have done work on FK and IK I hope this question makes sense.Thank you.

答:
To explain the reason why you are getting a bad output you need to understand trajectory planning.

So you have now done the FK and IK for the robot, however now to be able to do the tasks that you have mentioned, the biggest problem is that your end effector needs to traverse a smooth continuous path.

So feeding the robot with the end points it not enough, you need to be able to generate a trajectory using these end points. The equation for a cubic polynomial is as follows.

You can fit the three points on this curve by analytically finding the coefficients by feeding boundary conditions for velocity, acceleration and position. This can be done using MATLAB.

Now the program will feed your inverse kinematics calculating program with the points on the trajectory. The gap between two points will depend upon the step that you have to determine.

Now take the case of the straight line motions that you want. Feed the robot with intermediate points in steady increments, that should do the trick. If it does not work, then you may consider all my other suggestions in this answer.

Also your joints need to complete the task at a speed such that the motion of all the joints start and end at the same time, this enables smoother movement of your joints, again it involves trajectory planning concepts and a whole lot of theory. But you can consider this as low priority since you have individual actuators for every joint and no feedback loops.

Btw make sure the points you are feeding are not on the edge of your work space, in that case you will have a singularity and the robot would not achieve the position correctly.

For best results replace those cardboard stuff with something more solid like some plastics using 3D printing. And then calculate mass and moments of inertia of the links and everything to calculate how much torque is required to be able to push the pen down on to the paper hard enough for the pen to create a mark.
For this you need to learn robot dynamics which involves use of manipulator jacobian and so on..

Hope this helps.


问:
How do i figure out how much thrust an 150cc Size Brushless Outrunner Motor will output with propellers?
I need to know this as i'm trying to figure out if two of these could lift approximately 170 pounds of wheight. And that's includig batterys and the motors.</p>

答:
The way to know that is mostly to test, usually with a regulated power (not a battery) and with a scale. Those measurements are available for a variety of motor/propeller pairs on-line, they are usually provided by re-sellers.

If you use those be careful about the propeller pitch do not focus only on its diameter, as the pitch  as important aerodynamics effects.
Also watch out the voltage at which the test are conducted, typically in flight with battery you have a varying voltage and you might need to take some safety margin to compensate that.


问:
Line-following robot with a 5th wheel
Both of these 4 wheel drive line following robots have a fifth wheel in the rear.
My first thought is, that it is used as a braking mechanism. Would that be the case? If so, could someone explain - how does that mechanism work on the first robot?

答:
I m not familiar with those robots, but I will guess it's more used for odometry, in order to know the speed and the traveled distance.

The design are packed so it is hard to see for sure, but it seems to me that there are only 2 wires per motor, so not enough for position/velocity feedback. So the best to get instantaneous speed would be a free wheel for odometr, but this is a guess as I am not familiar with these competitions.

Also it seems that the last model has an IMU, so it might use some kind of sensor fusion to get even better estimate.

Title: Line-following robot with a 5th wheel


答:
The fifth wheel is a odometric sensor as suggested by N staub. It is not for braking. Mobile robots do not use brakes as they cause the slipping on terrain  often induce errors in odometirc position estimation using technique of dead reckoning which is most primitive and well applied.

It has IR sensor attached to it which counts  ticks i.e No of times
the IR sensor is interrupted due to turning of wheel.(Wheel has small holes along its rim).

Then distance traveled is estimated as follows:

distance travelled = no of ticks * ((2*pi*radius of the wheel)/angle between 2 holes )

for the estimation of speed count no of ticks in a unit time.
But not higly useful info as fifth wheel does not slip.

It uses Ackermann steering mechanism.
back motors drive the robot as in a car.front motors achieve turning by rotating steering motor in middle and giving more speed to motor in opposite direction of turn  i.e to turn left right motor will be powered more than left motor.

Follow this link to know more:https://en.wikipedia.org/wiki/Ackermann_steering_geometry

hope this helps

Title: Line-following robot with a 5th wheel

Body:
Both of these 4 wheel drive line following robots have a fifth wheel in the rear.
My first thought is, that it is used as a braking mechanism. Would that be the case? If so, could someone explain - how does that mechanism work on the first robot?


问:
Maze Solving Algorithm For Mazes With Loops
I am trying to implement a line following robot that can solve mazes similar to the Pololu robots you can watch on youtube. My problem is the maze that I am trying to solve is looped and therefore simple Left/Right hand rule can not solve the maze. I have done some research and think either Flood-Fill or Breadth-First-Search algorithm will be able to solve these looped mazes. Solving the maze is reaching a large black area where all the sensors will read black. When the robot is following the line some of the sensors will read white and the central ones black.

Is there any other algorithms that can solve looped mazes? I understand how the Flood-Fill algorithm works but am unsure how it could be implemented in this situation.

My robot has 3 sensors on the bottom. The one in the centre is expected to always read black (the black line it follows) and the sensors on the right and left are expected to read white (while following a straight line) and then black once a junction or turn is reached. My robot has no problem following the line, turning etc. I need to find an algorithm that can solve looped mazes (that is, find a path from an entrance to an exit).

答:
If both entrance and exit of the maze is at the edges of the maze, the left/right hand (wall following) algorithm should work. If you start following a wall that is connected to the exit, you could never get into a loop.

If you want the robot to be able to start in the middle of a maze with loops then simple wall following is not enough. I would recommend the Pledge algorithm in that case. The basic idea is that you pick an arbritary direction and follow it until you encounter a wall. Then you follow the wall until you have made as many righ turns as left turns, then continue forward (along the direction you originally picked).

The Pledge algorithm is proven to work in the ideal case with perfect sensors or some kind of error correction. If there could be errors when turning and not all angles are 90° some further measures may be needed (for example a compass). See this article for more details (direct link to the pdf). In your case the errors should be small enough.


问:
What are myopic and non-myopic policies?
I am reading this paper: A survey on Policy Search for Robotics and I came across these terms. Can someone give an answer, please?</p>

答:
A myopic policy is one that simply maximises the average immediate reward. It is "myopic" in the sense that it only considers the single criterion. It has the advantage of being relatively easy to implement. A fairly well-known example is the hill-climbing algorithm.

However, a myopic search is particularly vulnerable to becoming trapped at a local optima, and so failing to identify a globally optimal solution.

A non-myopic policy is one which has wider focus, considering other factors. This can greatly improve the success of the algorithm, but is generally more complex to implement.


问:
Mobile robot speed synchronization for straight line moving
I would like to build a simple mobile robot with differential wheels, and I am currently design the wheel speed controller. After reading some papers, I noticed that to realize a straight line moving, the linear speed and angular speed of the mobile robot have to be controlled at the same time, which makes the system a Multi-input-multi-output (MIMO) system. I plotted two different controller structures I came across while reading materials. Both of them have angular speed feedback and control, but one with linear speed feedback and control, the other without. In the picture, Gl(s) and Gr(s) refer to the motor transfer function, and vl and vr are the measured wheel speed.

Would anyone please suggest which controller structure is more reasonable and can realize better straight line moving?

Updates
v* and w* are linear speed reference and angular speed reference respectively that could either be fixed values or come from trajectory generation; corrected a typo in the motor block in structure 2, as @Chuck pointed out, and changed G1(s) and G2(s) to Gl(s) and Gr(s) for better illustration.

答:
For achieving exact straight line motion on a differential drive robot.
It is best to use PWM techiques to control current supplied to the motors.
Using PWM  waves generated on the micro-controller/processor, output the current to pins to which you are connecting the driver circuit(like L293D) for motors.

You can follow this link for more  info:http://www.i6.in.tum.de/Main/Publications/5224223.pdf

Hope this helps.........


问:
Robot Calibration using DH parameters
I'm new in robotics. My problem is the next one: I have a 6DOF robot manipulator and because the implementation was for real-time application my calculation time had to be really fast so that I used Wrist Center position(Geometrical solution). After using some calibration machine(I don't know much about this machine) I got the real DH parameters of the robot and of course are not the same.
I can't use the real DH parameters in my IK cause is no longer valid for the new DH parameters and If I implement a numerical solution I don't know really how much time it will take. So, my questions are :

Do you know any IK method for this case with no more than 0.5ms for each IK calculation?

Is there any information about how can compensate the position without change the IK but knowing the real DH information?

Do you know any other solution to this problem?

Finally, I was reading kinematics calibration. I think I got the idea but in the end is the same problem, you got new DH parameters and How to use those new DH parameters or maybe I understood wrong this information, basically is using this equation:

Thanks for help!!!

答:
With a 6 DoF arm, you should be able to use a closed form for IK.  I would avoid a numerical solution if you need it to be fast.  You might want to try IKFast in OpenRave.  It can supposedly handle "robots with arbitrary joint complexity like non-intersecting axes".  However, after kinematic calibration my joint axes were no longer at right angles.  When I tried my new robot kinematics in IKFast it would crash and I was never able to get valid IK solutions.  I had a 7 DoF arm on a 1 DoF torso though.  You might have better luck with a 6 DoF robot.

I don't think there is a general way to use your nominal IK, then apply some transform to account for your modified kinematics.  The kinematics is just too non-linear.  But this does work in small sections of the workspace.  In fact, I wrote a paper on the subject:

B. Axelrod, W. Huang, "Improving Hand-Eye Calibration for Robotic Grasping and Manipulation" IEEE TePRA, 2012.

To better understand kinematic calibration, the best (clearest) source of information I could find on the subject is in the book "Robotics: Modelling, Planning and Control" by Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani, Giuseppe Oriolo, chapter 2.11.  Which requires a description of the arm in DH parameters, multiplying out the kinematics equation, partial differentiation w.r.t. each DH parameter, then a least-squares fit (with the left pseudo-inverse), then iterate.

But I was never able to get this technique to work for me.  What did work was using PoE (Product of Exponentials).  In PoE, the kinematic parameters of the model vary smoothly with changes in joint axes and can handle kinematic singularities naturally. I followed this paper and was successful in kinematically calibrating my 7 DoF arm:

I. Chen, G. Yang, C. Tan, and S. Yeo, “Local POE model for robot kinematic calibration,” Mech. Mach. Theory, vol. 36, no. 11/12, pp. 1215– 1239, 2001.

Title: Robot Calibration using DH parameters