答:
The mistake is in the second matrix $T_B$ in the last column

this column means that you want to transfer the Frame by -2 in it's X direction and by -2 in it's Y direction which in your case is like this:

The X vector of the second Frame (A-Frame) is the Y Vector of the world Frame (O-Frame)

The Y vector of the second Frame (A-Frame) is the opposite of X Vector of the world Frame (O-Frame)

so if you want to transfer the new Frame by (-2, -2, 0) according to the world Frame you need to transfer it by (-2, 2, 0) according to the new Frame.. so the last column in the second matrix needs to be (-2, 2, 0, 1)

in this case the last column of the total matrix will be as you expected (-1, -1, 1, 1)

in general you need to write the transferring vector always in the last frame coordinates, so you need to apply all the previous transformations on it before you use it in the new transfer matrix

you need to multiply the (-2, -2, 0) vector by the inverse of first rotating matrix $T_A$ which is ($T_A^T$)  and you will get the new transferring vector (-2, 2, 0)


问:
What is a good approach for outlier rejection during real time data filtering?
I'm trying to finish up a localization pipeline, and the last module I need is a filtering framework for my pose estimates. While a Kalman filter is probably the most popular option, I'm using cameras for my sensing and I wouldn't be able to ensure the kinds of noise profiles KF is good for, I doubt it would work as well with suddenly appearing outliers in my poses: so I am looking for other options which can work with real time data and be immune to outliers.

One thing I came across is a Kalman filter with a threshold based update rejection, something like Mahalanobis distance: but I don't know if this is completely applicable because the localization would be performed in real time, and it's not like I have a large set of 'good poses' to start with. The end result I'm expecting is something like smoothing, but without access to a full set of values. Another option I found is from a paper that proposes a 'robust Bayesian weighted Kalman filter' that's good for real time outlier rejection, but I still need to read through it: and I don't have much experience with filtering/smoothing, so any suggestions would be very helpful, perhaps about a decent go-to mechanism for this?

答:
I really like the answer of Gouda.
One question though, you state "Pixel space observations are usually randomly Caushy distributed" how does this come about? Could you point me to some references or give an intuitive explanation? Thanks!

Regarding outlier robust Kalman filtering there are two similar approaches to the paper High-Voltage included.
One is based on L1-regularization, see Doubly Robust Smoothing of Dynamical Processes via Outlier Sparsity Constraints, and the other is based on sparse Bayesian learning, see Outlier-insensitive Kalman Smoothing and Marginal Message Passing.

ContentLicense: CC BY-SA 3.0


问:
Adding a floating joint to a sphere in urdf
I am trying to create a sphere that I can control through pybullet. I have a basic urdf specification that looks like this:

```<code><?xml version="0.0" ?>
<robot name="urdf_robot">
<link name="base_link">
  <contact>
    <rolling_friction value="0.005"/>
    <spinning_friction value="0.005"/>
  </contact>
  <inertial>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <mass value="0.17"/>
    <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
  </inertial>
  <visual>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <mesh filename="textured_sphere_smooth.obj" scale="0.5 0.5 0.5"/>
    </geometry>
    <material name="white">
      <color rgba="1 1 1 1"/>
    </material>
  </visual>
  <collision>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <sphere radius="0.5"/>
    </geometry>
  </collision>
</link>
</robot>
</code>```

But to control velocity instead of only external force I need add a joint. I tried adding a floating joint:

```<code><joint name="control" type="fixed">
  <parent link="base_link"/>
  <child link="internal_link"/>
  <origin xyz="0.0 0.0 0.5"/>
</joint>
<link name="internal_link">
  <inertial>
    <mass value="0.1"/>
    <origin xyz="0 0 0"/>
    <inertia ixx="1" ixy="0.0" ixz="0.0" iyy="1" iyz="0.0" izz="0.01"/>
  </inertial>
</link>
</code>```

but pybullet crashes when trying to load that without a helpful message. I don't know urdf well. Any ideas? Thanks!

答:
The joint type you've added to the URDF is fixed rather than the desired floating. Fortunately, floating is indeed a type of joint listed in the URDF Joint spec. I am not familiar with pybullet so I can't speak to whether this is the underlying issue with it crashing. It could also be an issue with the XML version being 0.0; it needs to be at least 1.0. As for your updated URDF:

```<code><?xml version="1.0" ?>
<robot name="urdf_robot">
<joint name="control" type="floating">
  <parent link="base_link"/>
  <child link="internal_link"/>
  <origin xyz="0.0 0.0 0.5"/>
</joint>
<link name="internal_link">
  <inertial>
    <mass value="0.1"/>
    <origin xyz="0 0 0"/>
    <inertia ixx="1" ixy="0.0" ixz="0.0" iyy="1" iyz="0.0" izz="0.01"/>
  </inertial>
</link>
<link name="base_link">
  <contact>
    <rolling_friction value="0.005"/>
    <spinning_friction value="0.005"/>
  </contact>
  <inertial>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <mass value="0.17"/>
    <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
  </inertial>
  <visual>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <mesh filename="textured_sphere_smooth.obj" scale="0.5 0.5 0.5"/>
    </geometry>
    <material name="white">
      <color rgba="1 1 1 1"/>
    </material>
  </visual>
  <collision>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <sphere radius="0.5"/>
    </geometry>
  </collision>
</link>
</robot>
</code>```

Body:
The joint type you've added to the URDF is fixed rather than the desired floating. Fortunately, floating is indeed a type of joint listed in the URDF Joint spec. I am not familiar with pybullet so I can't speak to whether this is the underlying issue with it crashing. It could also be an issue with the XML version being 0.0; it needs to be at least 1.0. As for your updated URDF:

<?xml version="1.0" ?>
<robot name="urdf_robot">
<joint name="control" type="floating">
  <parent link="base_link"/>
  <child link="internal_link"/>
  <origin xyz="0.0 0.0 0.5"/>
</joint>
<link name="internal_link">
  <inertial>
    <mass value="0.1"/>
    <origin xyz="0 0 0"/>
    <inertia ixx="1" ixy="0.0" ixz="0.0" iyy="1" iyz="0.0" izz="0.01"/>
  </inertial>
</link>
<link name="base_link">
  <contact>
    <rolling_friction value="0.005"/>
    <spinning_friction value="0.005"/>
  </contact>
  <inertial>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <mass value="0.17"/>
    <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
  </inertial>
  <visual>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <mesh filename="textured_sphere_smooth.obj" scale="0.5 0.5 0.5"/>
    </geometry>
    <material name="white">
      <color rgba="1 1 1 1"/>
    </material>
  </visual>
  <collision>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <geometry>
      <sphere radius="0.5"/>
    </geometry>
  </collision>
</link>
</robot>


问:
How to update the cartesian target when the robotic arm has a communication delay?
My robot system uses a 3D mouse to teleoperate the robotic arm's TCP. The robot returns its TCP's position every 10-20 milliseconds to the remote PC. The remote PC returns the new destination based on the current position and an input from the 3D mouse (new destination = current position + delta input from the mouse).

The problem is that the communication between the robot and the remote PC has delay around 100 milliseconds. Because of this condition, the robot can't generate a smooth trajectory, but it goes back and forth (jittered motion), or it repeats stop and start to move. I understand that this is because the current position is not updated in real-time and that leads to generating a wrong destination (even backward when the robot moves forward).

One thing I already tried was to filter out the target if the length between it and the current position was smaller than the one between the previous destination and the current position. However, I couldn't succeed because the robot requires the target update every 10-20 msec, and if not sending (or if sending the previous destination again), the robot stopped to move. So, this solution didn't work.

Does anyone know how to calculate/update the new destination every cycle in this condition? Do I need to forecast the new destination based on the past trajectory?

答:
You should update the robot references (and current position) independently if there is an update from the mouse or not. If there is an update (i.e. after 100 ms) you should update the value sent each 20ms to the robot. This way the robot shoudl never move backwards. I assume the backwards motion comeing from sending a new target position, and then sending the old (not updated) current position with a 0 delta.

Furhter improvmnet can be made by sending velocity references not postion references. Instead of positon targets, get directions and amplitude from the 3D mouse and use it as a velocities reference. Instead of

new destination = current position + delta input

use

new velocity = mouse direction + amplitude

This way you can control he velocity of the robot from the mouse which is helpful in many scenarios. A more advanced approach which is used by many is a hybrid approach. If the motion amplitude on the mouse is low, then it is a position control if the amplitude is high then it is a velocity reference. This alows both comfortable input of large amplitude motions and precise fine positioning.


问:
How do I adjust objects on a conveyor belt into the proper orientation?
This is part two of my larger robot, it follows up what happens with the small rocks here: What kind of sensor do i need for knowing that something is placed at a position?

Now i am taking the rocks down a tube for placement. In the case they need to be altered so they always will stand up before they enter the tube. Obvioulsy a rectangular rock wont fit if it comes in sideways. The dimensions here are pretty small. The rocks are about 15 mm x 10 mm. The tube i use is actually a plastic drinking straw. And the material i use for the rest of the robot is Lego powered by step motors which draw the conveyor belts to move the rocks. The control is Arduino.

(sorry for the lousy illustration, if you know a good paint program for mac like the one used to draw the picture in my other post, please tell me :-))

The rocks will always enter one at a time and have as much time they need to be adjusted to fit and enter the tube so the fall down. The question is, how to ensure all rocks are turned the right way when they get to the straw. Im not sure if using Lego when building the robot is off topic here, but a solution involving lego is preferable. And it has to be controlled by an Arduino.

General tips in how to split a complex task into subtasks robots can do is also good, is there any theory behind the most common sub tasks a job requires when designing multiple robots to do it?

答:
One way to do this is complicated, involving computer vision and a robot arm or other manipulator that can directly affect the orientation of each rock.

The low-tech way to do it would be to use a separate conveyor that gave you one rock at a time, and use walls to funnel it into a gate that matches the internal dimensions of the straw.  You would then just detect when the rock begins to push on the funnel walls (instead of travelling through) and knock it backwards to try again.  After a few tries, it should end up in the proper orientation (or you can give up and reject it at that point).  An even simpler way would be to skip the detection and just oscillate the funnel continuously, which would be safe if you're assured that each rock is guaranteed to have a working orientation.

It's similar to this patent which suggests a single wall, with the other side being open for improperly-aligned objects to fall off the belt.


问:
Computing Yaw angle from position and velocities
I have an object to whom I know the x,y,z position, length, width, height, and x,y velocities. Is there a possibility to compute the yaw angle from this information?  </p>

答:
if you mean by the "x,y,z positions and x,y velocities" just for one point of the object for example: The Mass Center or The Geometrical Center so the answer is No it is not possible, because it's possible for any point of the object to have any value for this parameters "x,y,z positions and x,y velocities" for different Yaw angles

but if you have another constrain or information about the object it may become possible to compute the yaw angle from this information


问:
using Li-Ion batteries in parallel
Looking at the Li-Ion battery packs from Servocity, part #605056, 12V, 6000maH battery pack. Any reason I shouldn't put these in parallel with each other? Any idea on what these might weigh? I've got a robot project going, currently running on a very heavy 12V lead acid RV battery, essentially a small car battery.</p>

答: Thanks Bakna! I got a response back from Servo City that this would be OK, I ordered a couple of these battery packs. I've got a project going where I took my daughter's old kiddy car and turned it into our own mars-rover type vehicle. I control it via wi-fi to a raspberry pi mounted on the vehicle and a Python GUI I run from a pc in the house. The raspberry pi controls an h bridge I built out of relays, with a big FET on the bottom that is driven by the PWM output on the raspberry pi for speed control. The real problem with the weight of the SLA battery is that I have a steep driveway, and with any speed at all, the momentum with the weight of the heavy SLA battery means that there is just no stopping the thing going downhill. This ought to solve that problem as well as help with overall load on the motors. Take care, thanks again! </p>

Title: using Li-Ion batteries in parallel


问:
Electronic Spring Vibrating Spheres
For a science project, I'm looking for a way to actuate a spring, connecting two ~ 1 cm Styrofoam spheres to each other, at frequencies around 1-60 Hz.

In other words, I want to be able vibrate 2 connected spheres around their center of mass.

What is this spring I'm looking for?

答:
The term for the electrical component that actuated (vibrates) at a selectable frequency is "Piezoelectric actuator". You can also examine vibration motors, like in the mobile phones or in the toothbrushes, which vibrate at predefined frequencies.

However if you are allowed to pick your own spring, and/or if you can change the masses attached, you can use even a sound card or a direct impulse on the spring, or a vibration motor to generate a vibration of need.

For the piezoelectric actuator, you supply voltage and it resonates accordingly.

For the mass (or spring) changing method, you will solve some good and simple physics problems. I would recommend professor Walter Levin's lectures, which are  funny and seriously great classes, available on the Internet.

Title: Electronic Spring Vibrating Spheres


问:
Running my 3 DOF Inverse Kinematics Code: Works in MATLAB, not in Python
I asked a question similar to this earlier, but I believe I have a new problem. I've been working on figuring out the inverse kinematics given an x,y,z coordinate. I've adopted the Jacobian method, taking the derivative of the forward kinematics equations with respect to their angles and input it into the Jacobian. I then take the inverse of it and multiply it by a step towards the goal distance. For more details, look at http://www.seas.upenn.edu/~meam520/notes02/IntroRobotKinematics5.pdf page 21 onwards.

For a better picture, below is something:

Below is the code for my MATLAB script, which runs flawlessly and gives a solution in under 2 seconds:

```<code>ycurrent = 0; %Not using this
xcurrent = 0; %Starting position (x)
zcurrent = 0; %Starting position (y)
xGoal = .5; %Goal x/z values of (1, 1)
zGoal = .5;
theta1 = 0.1; %Angle of first DOF
theta2 = 0.1; %Angle of second DOF
theta3 = 0.1; %Angle of third DOF
xchange = xcurrent - xGoal %Current distance from goal
zchange = zcurrent - zGoal
%Length of segment 1: 0.37, segment 2:0.374, segment 3:0.2295
while ((xchange > .02 || xchange < -.02) || (zchange < -.02 || zchange > .02))
        in1 = 0.370*cos(theta1); %These equations are stated in the link provided
        in2 = 0.374*cos(theta1+theta2);
        in3 = 0.2295*cos(theta1+theta2+theta3);
        in4 = -0.370*sin(theta1);
        in5 = -0.374*sin(theta1+theta2);
        in6 = -0.2295*sin(theta1+theta2+theta3);
        jacob = [in1+in2+in3, in2+in3, in3; in4+in5+in6, in5+in6, in6; 1,1,1];
        invJacob = inv(jacob);
        xcurrent = .3708 * sin(theta1) + .374 * sin(theta1+theta2) + .229 * sin(theta1+theta2+theta3)
        zcurrent = .3708 * cos(theta1) + .374 * cos(theta1+theta2) + .229 * cos(theta1+theta2+theta3)
        xIncrement = (xGoal - xcurrent)/100;
        zIncrement = (zGoal - zcurrent)/100;
        increMatrix = [xcurrent; zcurrent; 1]; %dx/dz/phi
        change = invJacob * increMatrix; %dtheta1/dtheta2/dtheta3
        theta1 = theta1 + change(1)
        theta2 = theta2 + change(2)
        theta3 = theta3 + change(3)
        xcurrent = .3708 * sin(theta1) + .374 * sin(theta1+theta2) + .229 * sin(theta1+theta2+theta3)
        zcurrent = .3708 * cos(theta1) + .374 * cos(theta1+theta2) + .229 * cos(theta1+theta2+theta3)
        xchange = xcurrent - xGoal
        zchange = zcurrent - zGoal
end
</code>```

Below is my Python code, which goes into an infinite loop and gives no results. I've looked over the differences between it and the MATLAB code, and they look the exact same to me. I have no clue what is wrong. I would be forever grateful if somebody could take a look and point it out.

```<code>def sendArm(xGoal, yGoal, zGoal, right, lj):
    ycurrent = xcurrent = zcurrent = 0
    theta1 = 0.1
    theta2 = 0.1
    theta3 = 0.1
    xcurrent, zcurrent = forwardKinematics(theta1, theta2, theta3)
    xchange = xcurrent - xGoal
    zchange = zcurrent - zGoal
    while ((xchange > 0.05 or xchange < -0.05) or (zchange < -0.05 or zchange > 0.05)):
        in1 = 0.370*math.cos(theta1) #Equations in1-6 are in the pdf I linked to you (inv kinematics section)
        in2 = 0.374*math.cos(theta1+theta2)
        in3 = 0.2295*math.cos(theta1+theta2+theta3)
        in4 = -0.370*math.sin(theta1)
        in5 = -0.374*math.sin(theta1+theta2)
        in6 = -0.2295*math.sin(theta1+theta2+theta3)
        jacob = matrix([[in1+in2+in3,in2+in3,in3],[in4+in5+in6,in5+in6,in6], [1,1,1]]) #Jacobian
        invJacob = inv(jacob) #inverse of jacobian
        xcurrent, zcurrent = forwardKinematics(theta1, theta2, theta3)
        xIncrement = (xGoal - xcurrent)/100 #dx increment
        zIncrement = (zGoal - zcurrent)/100 #dz increment
        increMatrix = matrix([[xIncrement], [zIncrement], [1]])
        change = invJacob*increMatrix #multiplying both matrixes
        theta1 = theta1 + change.item(0)
        theta2 = theta2 + change.item(1)
        theta3 = theta3 + change.item(2)
        xcurrent, zcurrent = forwardKinematics(theta1, theta2, theta3)
        xchange = xcurrent - xGoal
        zchange = zcurrent - zGoal
        print "Xchange: %f ZChange: %f" % (xchange, zchange)
    print "Goals %f %f %f" % (theta1, theta2, theta3)
    right.set_joint_positions(theta1) #First pitch joint
    right.set_joint_positions(theta2) #Second pitch
    right.set_joint_positions(theta3) #Third Pitch joint

def forwardKinematics(theta1, theta2, theta3):
    xcurrent = .3708 * math.sin(theta1) + .374 * math.sin(theta1+theta2) + .229 * math.sin(theta1+theta2+theta3)
    zcurrent = .3708 * math.cos(theta1) + .374 * math.cos(theta1+theta2) + .229 * math.cos(theta1+theta2+theta3)
    return xcurrent, zcurrent
</code>```

答: The problem is not with the code, but with the point you want to send the arm in the simulation. Whats going is the goal's points constitute a cartesian distance larger than the manipulator can catch. It occurs cause in python may have some numerical errors when the simulation is running.</p>


问:
Do Arduino Boards contain enough processing power for 4 DOF Robotic Arm
I am starting to work with 4 DOF Robotic Arm project.it has the following specs:

1- the speed of the tip of the end-effector is constant and adjustable.

2- the robot is controlled via joysticks which determine the direction of movement of the end-effector.

3- also the orientation of the end-effector is controlled.

to implement these specs I need a processor that can handle forward kinematics, inverse kinematics, trajectory related calculations in addition to reading from sensors and camera.

can Arduino Handle all that?

what are alternatives available?

答:
I dont think that a single arduino board will be able to handle all that.

Maybe start out with implementing controllers on your arduino? And let your computer handle the kinematics, camera and so on? Then you will also learn about communication between your computer and a Arduino board.

Another alternative may be a Raspberry PI, but I don't know about the computational power in that one. I think your biggest limitation is the camera, but I may be wrong.


问:
Using an Xbox controller to fly a Quadrocopter
So I have a quadrocopter, it does come with a remote but I intend to run certain modifications to the copter, like installing a camera, a mechanical manipulator, and other random modifications. The remote that comes with the copter isn't flexible enough to help with such functions and plus it lacks any more buttons.

I was wondering if I could somehow program the quadrocopter to respond to my Xbox controller. I was planning on using my laptop's Bluetooth connection to talk to copter. The Xbox controller which is connected to the computer would be then used to control the quadrocopter. So my question is, how exactly do I program the controller? How do I go about making all of this possible?

I understand this question is really vague and that there are too many options out there, but I do need help figuring this out.

答: Yes, in general this idea is perfectly plausible. However the method is going to be specific to your setup. I.e. the operating system you are using on your control computer and the onboard controller that you are employing. In our lab we use an Ardupilot Mega as our onboard controller for some of our quadrotors. To solve this problem I used the Linux joystick API to acquire the data from the Xbox controller (or a PS3 controller for that matter). I can then send this data to an Arduino that I have used to replace the RC receiver or I can send it directly to the Ardupilot via Xbee using the Mavlink protocol. If you can provide more detail about your setup then I may be able to provide a more detailed response.</p>


问:
Brushless DC motor problems at high velocities
For a project we use a brushless DC (BLDC) motor. Everything works fine until we tried to reach high velocities. I will first explain my setup, and than explain our problems using some graphs.

1.0 Setup

The following hardware is used in the setup:

BLDC motor: Tiger motor U8 (135kV)

Motion controller: SOMANET DC 1K

Encoder: RM08 12 bit absolute encoder

An overview of the setup is shown below:

1.1 Requirements and Parameters

We need about 4800 [RPM] from the motor. The Tiger motor has a kv value of 135 [RPM/V], connecting it to a 48 [V] supply means it theoretically should be able to go up to 6500 [RPM]. The specsheat includes a scenario where it reaches 5000 [RPM] while a propeller is connected to it, so 4800 [RPM] with no load should not be a problem.

2.0 Problem

We are not even getting close to the 4800RPM, a plot of the motor velocity vs phase current is shown below. We can identify 2 problems from this plot.

2.1 Inefficient commutation

The first thing which was remarkable from the test is that about 10 [A] was already required to turn at 3200 [RPM] without any load connected. This seems to be caused by inefficient commutation, we figured there are two main possible causes for this.

2.1.1 Phase offset error

Their might be an error in the phase offset used, this will cause an linear increase in required current with velocity. This can be best solved by finetuning the offset at a high velocity. However our curve does not seem linear, thus this does not seem to be the case.

2.1.2 Delay error

There is a certain amount of delay in between requesting the position from the RM08 and applying the new voltage. This delay can cause the current to exponential increase with motor velocity, which is true in our case.

By adding up al delays we found a total delay of ~0.1 ms in the system (see above). Spinning at 3000RPM = 50Hz and using 21 pole pairs means that the electrical turning frequency is 1050Hz, than a delay of 0.1 ms would cause a 37.8 electrical degree error, This likely causes the inefficiency!

2.2 Control going crazy

if we try to go above ~3200 RPM, the motor starts pulling a lot of current and makes a lot of noise. This means the motor is not operational above 3000RPM, this seems to be the most urgent problem at the moment.

Voltage dependency

Normally the motor velocity is limited by back-EMF, if the back EMF would be causing this issue the problem would be voltage dependent. Therefore some measurements where done at different voltage levels, see the two images below:

The moment where the motor stops following the velocity sweep seems to increase linearly with voltage. Another interesting outcome is that at 30V the motor just stops following the velocity sweep, while at the higher voltages (40V and 43V) the motor suddenly dropped to a lower velocity. Note that the 46V test stopped before this moment because to high current peaks were flowing trough the SOMANET (35A).
However it seems unlikely the back-EMF is the problem since Tiger has been able to reach 5000RPM themselves.

Solutions

For the first problem we thought we could use something like:

Pcorr = Penc + t_delay * Vel.

With:

Vel: angular velocity

t_delay: the delay compensation gain

Penc: the encoder position for the rotor

Pcor: the delay compensated position

However this didn't save the problem at all. Do you have any other suggestions?

For the second problem we can't think of any cause, can you think of any?

答:
Nice detail in your question.

The somanet site makes a big deal about their firmware being open source, so you should be able to check the timing in the code (or otherwise get the help of the somanet engineers).

A 15kHz PWM is the slowest I've seen in a long time and could indicate that that they had trouble fitting the commutation algorithm to their architecture. Or maybe they are optimizing switching losses which is all good.

Either way the PWM frequency is not part of the commutation calculation or estimated latency.

The commutation should use velocity and encoder latency in it's calculation. If not, and the math indicates it can't keep up, use a separate lower res encoder for commutation.

Verify that the noise on the motor bus is not affecting the encoder signal.


问:
Estimating yaw angle and yaw rate for a frontal vehicle
I would like to know if it is possible (and if it is possible how can it be done) to estimate the yaw angle and yaw rate of a vehicle in front of me knowing the following information:

-my speed (x,y,z),my position(x,y,z),my yaw angle and my yaw rate

-the relative speed to me(on x and y) of the vehicle/robot to which I want to find the yaw and yaw rate

-the position(x,y,z) of a point on the vehicle( corner of a vehicle) the length, width and height of the vehicle

答:
You need to state some other piece of information, which might be obvious in your mind:

Are the two vehicles exactly the same?

Do you know the motion equations of them?

Any angular acceleration is a torque divided by the inertia moment, and by numeric integration or any other method, you usually can calculate the angular rate and instantaneous value. This is the correct method as far as I know.

I only can guess of sort of rather not series methods to try to guess the yaw of that vehicle, which would imply the usage of rule of three. But I insist on that, more data is needed, and that calculus is no reliable at all.


问:
Correct calibration parameters of stereo system due to vibrations
In stereo vision, the camera is calibrated using the popular chessboard before use. During the course of use, the camera maybe be subject to environmental factors such as vibrations.This may cause calibration parameters to drift. I hope to correct calibration parameters online without using the chessboard.

Currently I assume:

focal length and principal points of two camera are constant,

the distance between them is constant

only  orientations of two camera changes.

The initial calibration parameters are available. Left/right images are undistorted using each individual camera calibration parameters.
Corresponding points can be established by detecting feature points and matching them from undistorted left/right images
Fundamental matrix can be calculated. I will call it calculated  fundamental matrix.

Fundamental matrix can be derived from calibration parameters of stereo system, and I will call it derived fundamental matrix.
The two fundamental matrix should be same if calibration parameters of stereo system doesn't change.
Otherwise I can get rotation matrix between the equation relating fundamental matrix to ration matrix and translation between two cameras
and each camera intrinsic matrix.

I am new to multiple view geometry. Is this a viable method? Is there any other method for that?
Any link to websites and papers are appreciated.

答: You could use g2o library for this. With it you can make a graph whose nodes are estimates of some states (point positions in 3d, point positions on images, extrinsic calibration parameters) and edges are cost functions. The library then alters the estimates to minimize the overall cost. You can assign confidence to estimates so that it changes less the estimates that you are very sure about.</p>


问:
Motor for DIY Electric skateboard
I've been planning to make an electric skateboard for a while now. All the tutorials that I have seen use brushless motors. However, where I live, its not possible to get the exact ones as shown in those tutorials.

The ones I can buy are somewhat like this.

The one shown in the tutorials is this.

I am new to brushless motors. The one in the tutorial in 270kv and the one I can buy is 1000kv (and above) but they both differ greatly in size. Plus there's this "outrunner" thing. The ones I can buy seem to be made for quadcopters and similar stuff.

So am I okay using the ones I can buy? The little 1000 kv ones, considering the fact that they need to run a 14T to 36T pulley system with approx 70kgs of weight on the board.

Or maybe I could just use the 12v 10Amp 1000RPM DC Motor that I have lying around?

答:
The 1000kv motor will probably not have enough torque, and the 10A motor will drain your battery (I am assuming you will be running on a battery) way too fast.
The motors you want are a lower kv that might not spin as fast, but will have enough starting torque to get you moving from a standstill.</p>

<p> Here is some good information on the types of motors you are talking about that might help you out. It applies to quadcopters but will help you understand the basics about motors and what their values and capabilities are.  </p>

Title: Motor for DIY Electric skateboard

Body:
The 1000kv motor will probably not have enough torque, and the 10A motor will drain your battery (I am assuming you will be running on a battery) way too fast.
The motors you want are a lower kv that might not spin as fast, but will have enough starting torque to get you moving from a standstill.

 Here is some good information on the types of motors you are talking about that might help you out. It applies to quadcopters but will help you understand the basics about motors and what their values and capabilities are.


问:
I am making a Ping pong-playing robot using two cameras to trace the ball (3D vision),what is the minimum Frame rate of the cameras?
I am making a Ping pong-playing robot, like the one in this video, and i am intending to use two cameras to trace the ball in 3D space. Supposing that the robot is playing against a beginner player, the ball takes about 0.7 second to travel from one side of the table to the other. but during this time the robot should process number of frames and predict the rest of the ball track, and the robotic arm should  move to the required position.

I read some papers talking about the same project, but I found a big difference from one to another(some paper used 30 FPS, while other one used 120 FPS). I didn't order the cameras yet, and I can't try more than once because it is a graduating project, so the time and the budget are limited.

So is there any way to predict the minimum Frame rate of the cameras?

I also heard that some projects are using Kinect instead of using two cameras or 3D vision,

Is the Kinect fast and precise enough for my project?

答:
First you need to calculate the maximum processing period time you can accept, preferably use (motor response time)/5 or less to be sure that the motors move smoothly ..

also you need to calculate the time you need to process the image because the processor that you use has a processing limit that you need to consider..

so the frame rate you need should be fast enough to achieve the first condition, but it would be waste to make faster than what your processor can handle.

but in general for graduating project 30 FPS is probably enough.. it will provide a good information to predict the trajectory of the ball.


答:
This is easy actually!

(ROS + Joy package) -- http://www.ros.org

XBee (as mentioned by @DaemonMaker)

A simple program that takes the joy_node publications and sends them out over XBee. This could be as simple as rostopic echo /joy >> /dev/ttyS0 or such, depending on how much control you have over the receiving end.

Note: We use playstation controllers on all our robots. Highly recommended.

Title: Using an Xbox controller to fly a Quadrocopter

Body:
So I have a quadrocopter, it does come with a remote but I intend to run certain modifications to the copter, like installing a camera, a mechanical manipulator, and other random modifications. The remote that comes with the copter isn't flexible enough to help with such functions and plus it lacks any more buttons.

I was wondering if I could somehow program the quadrocopter to respond to my Xbox controller. I was planning on using my laptop's Bluetooth connection to talk to copter. The Xbox controller which is connected to the computer would be then used to control the quadrocopter. So my question is, how exactly do I program the controller? How do I go about making all of this possible?

I understand this question is really vague and that there are too many options out there, but I do need help figuring this out.


问:
Algorithm for Determining Mobile Base Positioning Given End Effector Pose
I have a 6 DOF arm robot with a mobile base, and a given x/y/z/quaternion vector that the end effector must match. I am to determine the most optimal position of the mobile base such that an IK solution for the arm can be constructed from the end effector vector. I already have an IK method for the arm alone, but not one that includes the mobile base.

Not to mention, there is a collision aspect to this too. There is collision that the arm must avoid around the vector, which can easily be filtered with my simulator, but is just something that must be considered. Could anybody point out any algorithms that could possibly help? Thank you for your time.

答: If you have acces to academic sources (google scholar), relevant publications are from Vahrenkamp, Stulp and Zacharias.</p>


问:
Quadcopter flight controller - black smoke?
I bought a qx95 and after a few flights, maybe 3, there was black smoke that fizzled out of the what looks like the flight controller. And since then, anytime I give throttle - the fpv video feed cuts signal.

I'm assuming what I fizzled was some sort of limiter / power converter for the video?

My question is - what do I need to replace? Was that the flight controller or camera? Any thoughts on what I need to replace or repair?

答:
Double check whether it was the flight controller that burnt out, if it was the flight controller, then you should clearly see a difference in flight.

Also, throttle input and the fpv video aren't related unless you are using a power distribution board of some sort that can't take the high voltages or amperage. Check if all the wires and PCBs are ok.


答:
Check the legal requirements of the motors for your area.

The little 1000kV motors wouldn't have sufficient torque...

Look for anything below 600kV and the motor should be equal to or under the legal limit of the motor wattage.

Just to let you know...

kV means RPM per volt

The 'k' is the constant
The 'V' is the volts

So...

1000 kV means 1000 RPM per volt

Normally, higher kV motors have less torque and they are mainly used for small multicopters

Higher kV would have a lower top speed and much higher torque and they can be used for larger multicopter or projects like electric long board or e-bikes.

Title: Motor for DIY Electric skateboard

Body:
I've been planning to make an electric skateboard for a while now. All the tutorials that I have seen use brushless motors. However, where I live, its not possible to get the exact ones as shown in those tutorials.

The ones I can buy are somewhat like this.

The one shown in the tutorials is this.

I am new to brushless motors. The one in the tutorial in 270kv and the one I can buy is 1000kv (and above) but they both differ greatly in size. Plus there's this "outrunner" thing. The ones I can buy seem to be made for quadcopters and similar stuff.

So am I okay using the ones I can buy? The little 1000 kv ones, considering the fact that they need to run a 14T to 36T pulley system with approx 70kgs of weight on the board.

Or maybe I could just use the 12v 10Amp 1000RPM DC Motor that I have lying around?


问:
Why do the motors of my quadcopter not deliver sufficient power?
I am building a quadcopter using the tutorial The Ultimate PVC Quadcopter.

When ever I go to lift off, at full throttle, the motors spin but the quadcopter doesn't go anywhere. I have checked again and again and the motors are spinning in the right direction, and have the right propellers. Does anybody know why my quad won't fly?

I am using a KK2.1.5 flight controller, propellers marked with 1045r on the counter clockwise motors and the propellers just marked with 1045 on the clockwise motors.

If I switch the propellers, 1045r clockwise and 1045 counter clockwise, then my quadcopter flips over.

The layout of the motors is:

```<code>1. CW     2. CCW
4. CCW    3. CW
</code>```

I am a beginner and this is the first drone I have built/owned.

P.S. My quadcopter weighs 3.2 pounds, is using 980 kv motors, 10" propellers, 20 A ESCs, and a 3S 50C 2200 mAh Li-Po battery.

答:
Either the battery levels are low or the flight controller hasn't been set up yet.

First, calibrate the flight controller sensors.

After, Calibrate the ESCs. (Do this without props!)
Then set up the flight controller, so set the motor max values and min values.

ContentLicense: CC BY-SA 4.0


问:
Why EKF-SLAM uses EKF instead of linear Kalman Filter?
I am writing a bachelor's diploma on vSLAM. I learned and programmed EKF-SLAM like it's written in MonoSLAM paper, and I was going to write, that I can't use KF and have to use EKF because of non-linearity of observation function, but wait, how is it possible, if everything is linear?!

I understand, that if I store direction of a camera in form of axis-angle vector or quaternion then there will be something non-linear, but what if I will store it directly as values of rotation matrix? Then my observation function is just going to be a multiplication of matrices, which is a linear operator, and therefore linear. Am I wrong?

答:
Well in EKF SLAM, the underlying assumption is that all states are gaussian in nature and we can linearize the motion and observation models around the mean at each instant. This is done to write the equations in a form similar to what you see in the Kalman Filter.

Note: This linearization is just an approximation that we have made. It leads to error due to which nowadays we use other methods like Graph SLAM or particle filters.

Even if you represent the angles in form of a rotation matrix, the cosine and sine functions are non- linear in nature which we can't get rid of easily. The states contain angles and model is a function of states which is non- linear in nature.

You can store them in your state space however that just increases the dimension of your state space since instead of three euler angles, you now have 6 terms (cosine and sine value of each angle). This is really undesirable in nature as it unnecessarily increases the computation time of the over all algorithm (which is of the order $O(n^{2.4})$ in EKF SLAM.


问:
What is the difference between conventional and unconventional path planning methods?
Is there an exact definition for conventional and unconventional path planning methods? What are the features that help distinguish conventional and unconventional path planning methods? What is an example of conventional and unconventional path planning methods? </p>

答: Conventional methods relate to Djikstra algorithm, A-star algorithm or any other direct methods to find the path. Non conventional ones usually refer to genetic algorithms, particular swarm optimization, neural networks... Which are not thought for this geometrical issue, but for other kind of problems.</p>


答:
The movement of the ping pong ball is going to be ballistic, so you really only need to know its 3d position in 3 different locations in order to fully constrain its motion. In reality, you will probably want more. This excellent paper An Application of human-robot interaction: Development of a ping-pong playing robotic arm uses around 8-10 locations in order to fully constrain the ballistic motion, including the bounce off the table. It also has a review of past systems and approaches.

You really need to think not about the frame rate of the camera but the processing rate of the system.If you say you need 6 3d locations between both sides of the table then having more than:

$$ \frac{6 frames}{.7 sec} = 8.5 fps $$
 does not really help you, but it imposes another limitation, you need to be able to capture, transfer and process images in less than:
$$ \frac{1 sec}{8.5} = 117ms $$

This usually ends up being the limitation for these kinds of systems.

Additional food for thought, syncing the camera's shutter is usually pretty important or at least sampling the images close to one another. For example with two 30FPS cameras the maximum time between two frames acquired by the computer at the "same" time is 33ms but in the time the ball will have traveled
$$ \left(\frac{2.7m}{0.7 sec} * 33ms \right) = 12.8 cm $$

Depending on how your analyzing the data this might be significant (hint it probably is) This is why some people might be using 120fps cameras reducing the max error to around 3.2cm or you might use cameras that have a global shutter clock/sync to make sure that every image captured by all your cameras are taken at the same instant. The Firefly MV camera series is an inexpensive example of cameras that can have their shutters synchronized.

TL;DR

The Kinect is probably fast enough for your purpose, it's certainly cheaper than using Point Grey cameras, so I would give it a shot, I think moving a robot arm fast and accurate enough will be a bigger challenge.

Title: I am making a Ping pong-playing robot using two cameras to trace the ball (3D vision),what is the minimum Frame rate of the cameras?

Body:
I am making a Ping pong-playing robot, like the one in this video, and i am intending to use two cameras to trace the ball in 3D space. Supposing that the robot is playing against a beginner player, the ball takes about 0.7 second to travel from one side of the table to the other. but during this time the robot should process number of frames and predict the rest of the ball track, and the robotic arm should  move to the required position.

I read some papers talking about the same project, but I found a big difference from one to another(some paper used 30 FPS, while other one used 120 FPS). I didn't order the cameras yet, and I can't try more than once because it is a graduating project, so the time and the budget are limited.

So is there any way to predict the minimum Frame rate of the cameras?

I also heard that some projects are using Kinect instead of using two cameras or 3D vision,

Is the Kinect fast and precise enough for my project?


问:
Motion planning and robot controlling
I am stuck with understanding how can I make my robot move along planned path. For instance, if we have a grid map of an environment and applied, for example, A* to plan a path then after that we have to make our robot move through each cell in our path. Assuming that we know center coordinates of cells, the task is to generate control commands which will lead robot along the trajectory.

I have two differential wheeled robot so equations of motion are going to be like these, where b is a distance between wheels:

$v = \frac{1}{2}(v_{1}+v_{2})\\
\dot\theta=\frac{1}{b}(v_{2}-v_{1})\\
\theta = \frac{\delta t}{b}(v_{2}-v_{1}) + \theta_{0}\\
\dot x = v\cos(\theta)\\
\dot y = v\sin(\theta)\\
x = x_{0} + \frac{b(v_{1}+v_{2})}{2(v_{2}-v_{1})}(\sin(\theta)-\sin(\theta_{0}))\\
y = y_{0} - \frac{b(v_{1}+v_{2})}{2(v_{2}-v_{1})}(\cos(\theta)-\cos(\theta_{0}))
$

Suppose that we can control speeds of both wheels therefore we are able to set any possible angular and linear velocities. So what actually I have to do with these equations to make robot move through each cell?

Moreover there may be different constraints like moving with constant linear speed etc. I understand that I have to solve these equations somehow.
Will appreciate practical advises, certain names of algorithms and etc. Thanks!

答:
The model you have given is called the unicycle model and is widely used n robotics. In general the model is given by
\begin{eqnarray}
\dot{x} &= v\cos \theta \\
\dot{y} &= v\sin \theta \\
\dot{\theta} &= \omega
\end{eqnarray}
where $v = 1/2(v_1+v_2)$ and $\omega = 1/b(v_2-v_1)$ are the controls of the robot.

The method that you have mentioned is a waypoint following method, where the destination would be updated as you reach a point along a path. The problem is, due to the Lyapunov design, the destination is approached exponentially, i.e, as $t\rightarrow \infty$. Thus, the robot would slow down exponentially as it approaches the target.

One way to overcome this is to use design process that uses feedback linearization. But first you need to parameterize the path you get from A* with time to get a desired trajectory $\mathbf{x_d}(t)$. This is easy to do by selecting a speed for the robot to traverse the path.

Next select a point $p$ that is a distance $d$ away from the point of rotation of the robot, along the central axis of the robot. Assume that this point $p$ has a fully actuated kinematic model given by,
$$ \mathbf{\dot{x}_p} = \mathbf{v_p}$$ where $\mathbf{v_p}$ is the control for this point. If we set,
$$ \mathbf{v_p} = k_v(\mathbf{x_d}(t) - \mathbf{x_p}(t) ) + \mathbf{\dot{x}_d}(t), $$ then $\mathbf{x_p} \rightarrow \mathbf{x_d}$ exponentially, i.e., the point $p$ will follow the path. Note that its the point $p$ that follows the path and not the rotation center of the robot.

Control Design,

Next you should set the controls $v$ and $\omega$ of the robot so that point $p$ has this desired control $\mathbf{v_p}$. The position of the point $p$ can be written as,
$$ \mathbf{x_p} = \mathbf{x_0} + d[\cos \theta, \sin \theta ]^T.$$ Thus the velocity of the point $p$ is,
$$ \mathbf{\dot{x}_p} = \mathbf{\dot{x}_0} + d\dot{\theta}[-\sin \theta, \cos \theta ]^T.$$
Using the kinematic model of the robot to substitute for $\mathbf{x_0}$ and $\dot{\theta}$, this can be written as,
\begin{equation}
\mathbf{\dot{x}_p} =
\left[
  \begin{array}[c c]
     g\cos\theta & -d\sin \theta\\
    \sin\theta & d\cos \theta
  \end{array}
\right]
\left[
  \begin{array}[c]
     sv\\ \omega
  \end{array}
\right].
\end{equation}

In order to get $p$ to follow the trajectory, we need $\mathbf{\dot{x}_p} = \mathbf{v_p} = k_v(\mathbf{x_d}(t) - \mathbf{x_p}(t) ) + \mathbf{\dot{x}_d}(t)$. Thus, the required controls are given by,
\begin{equation}
\left[
  \begin{array}[c]
     sv\\ \omega
  \end{array}
\right] =
1/d\left[
  \begin{array}[c c]
     gd\cos\theta & d\sin \theta\\
    -\sin\theta & \cos \theta
  \end{array}
\right]\bigg(k_v(\mathbf{x_d}(t) - \mathbf{x_p}(t) ) + \mathbf{\dot{x}_d}(t)\bigg).
\end{equation}

Once the controls are set, the wheel speeds can be set as,
\begin{eqnarray}
v_1 = \frac{2v +b\omega}{2}\\
v_2 = \frac{2v -b\omega}{2}
\end{eqnarray}

Title: Motion planning and robot controlling


问:
Is MoveIt! suitable for fixed-wing aircraft path planning and obstacle avoidance?
I have seen that it is possible to use MoveIt! for path planning and obstacle avoidance for quadcopters/quadrotors.

For example:

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

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

Is MoveIt! as suitable for path planning and obstacle avoidance for fixed-wings aircraft as it is for quadrotors?

The main difference I can think of is that quadrotors can stop at will, while fixed-wing aircraft have to continue moving to stay in the air. Will this be a problem for path-planning and obstacle avoidance in MoveIt?

答:
Not really MoveIt! is designed for robotic arms, and is being heavily adapted for the applications you see here, fixed wing aircraft typically use very diffrent types of motion planning becouse of the fact that they must maintain some forward velocity that is related to its bank angle. Aircraft motion planning typically also contains maxium g force constraints as well.

When picking a motion planning algorithm you need to pick what you want to optimize, typically Speed or Energy. Depending on your environment you might find the excellent thesis Path Planning for Fixed-Wing Unmanned Aerial Vehicles to be helpful, using a sampling based path planning from OMPL.


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

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

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

Larger propellers give more thrust per revolution from the motor.

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

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

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

How can I achieve more agility in my quad?

答:
Choosing the correct prop/motor combination can be challenging.  Even worse, the vast majority of RC motors will have vague or non-existant specifications.  This makes it very hard to do "real" math.  Instead you will have to rely on prop thrust ratings or use a known combination that other people have tested.

Propellers:
Manueverability of a quad is dependent on how quickly you can change the thrust (how fast you can change the RPM of the props).

A smaller prop is easier to speed up and slow down whereas a large prop takes a very long time to change speeds.  Beyond a certain size you essentially are unable to fly.  This is why you see hexacoptors and octocopters that use more, smaller props instead of giant quadrotors.

On the flipside, propeller efficiency is related to the area of a prop (or radius squared) so a small increase in prop diameter will make the quad vastly more efficient.

The faster you want to go, the more aggressive a pitch you want.  Since quadrotors are generally hovering this means you want the lowest pitch available.  If you want to go somewhere fast a higher pitch might be apropriate.

Motors:
Generally you just choose a motor that matches the given prop.  Having a motor that is too large will be heavy, and a motor that is too small will perform poorly or burn up.

A smaller prop requires a higher RPM motor because they must spin faster to generate equivalent lift.

If you put everything together, an efficient quad will have properly sized, low RPM motors with very large props.

An acrobatic quad will want smaller, more aggressive props, faster motors, and you might even overvolt the motors for faster response.

While you will be hard pressed to find torque curves for Rc motors, you will have thrust and current ratings for a given prop which makes it fairly straightforward to determine how much you can lift and approximately how long you can fly once you have chosen a combinatoin.

As a general rule you want a 2:1 thrust/weight ratio for a standard quad and 3:1 or higher for something acrobatic.  1.5:1 has been known to fly.


问:
Would the strength and speed of a robot skeleton be a danger to its wearer?
Expanding upon the title, I am querying the use of robotic skeletons to augment human strength and speed. If such a robot had the capacity for example to bear weight 5 times heavier than the wearer and move its robotic limbs twice as fast as the wearer, is there not a danger because such powerful and sharp movements could break their bones and seriously injure them because it moves beyond their human capabilities?

The robots means of producing movement I would think is important here but unsure how so. The nature of passive or actively powered movement and when each mode is used will also determine performance of the exoskeleton. I am not well versed in this area so will appreciate any feedback.

答:
Yes, an exoskeleton would definitely be a danger to its wearer, if it were not properly controlled.

In science fiction this problem is solved by the system requiring the human wearer to bear some of the weight themselves. Thus the 5x multiplier would still require the wearer of the exoskeleton to exert their full effort to lift the 1/5 of the weight themselves.

Similarly, the user would only be able to move more quickly because it is less effort to move a light weight than a heavy one, so in this case the exoskeleton is reducing the apparent weight to allow it to be moved more quickly.

Any control system which allowed the wearer of the exoskeleton to be injured through normal use of the exoskeleton would not be considered safe and would require the control system to undergo another risk assessment and the problems with the control system to be removed.

Incidentally, this is no different to a robot being strong enough to damage itself. I once worked on a robot which was more than capable of ripping straight through the protective cage which surrounded it.

The cage was not there to protect humans outside of the cage from an out of control robot, as this was considered a very low risk. It was primarily to prevent humans getting into the working envelope of a properly controlled robot, because out of control humans were considered a much greater risk (mostly to themselves *8').


问:
MPU9255 gyro data to roll pitch?
So I have -32768 to +32768 coming out from MPU9255 (gx,gy,gz) which is converted to 0-250 dps(degrees per second) using 131 which is Gyro's sensitivity.

My question would be how do you use this data to convert it into Roll and Pitch?

I am trying to make a stabiliser. I have tried using
$$
\theta = \sum^n_n\omega*\delta(t)
$$

where n = infinity
I don't if my equation is wrong or not here is my code:

```<code>dt = now_c - pr_dt;
pr_dt = dt;
Pitch_gyro += Gxyz[1]*(dt/1000000.0);
Roll_gyro += Gxyz[0]*(dt/1000000.0);
</code>```

This is my function:

```<code>Gxyz[0] = (double)(gx/131);//131;
Gxyz[1] = (double)(gy/131);//131;// 250/32768.0;
Gxyz[2] = (double)(gz/131);//131;// 250/32768.0;
</code>```

Any guide as to how to solve this I have looked into euler angles. I still don't understand how you get the angles given angular velocity which is from gyro.

答:
The problem you have is that the gyro is outputting angular velocity. Taking the integral of the angular velocity you only get the angle offset from some constant c, normally you would deal with this by initializing the system with some known orientation, typically by letting it rest flat for a moment before using it to track angle.

But there is another problem, gyros have some implicit bias in them. This means that when it is not moving it will still report that it is, you have to take this into account when you build your system saving them when you boot up during that time when your device is not moving.
millisecond
So your code might look like this:

```<code>init(){
    bias_x = Gxyz[0];
    bias_y = Gxyz[1];
    bias_z = Gxyz[2];
}

loop(){
    dt = now_c - pr_dt;
    pr_dt = dt;
    // x, y, z gyro are in deg/millisecond
    x_gyro += (Gxyz[0] + bias_x)*(dt/1000.0);
    y_gyro += (Gxyz[1] + bias_y)*(dt/1000.0);
    z_gyro += (Gxyz[2] + bias_z)*(dt/1000.0);
}
</code>```

But there is another problem the measured angle will diverge over time from the actual angle becouse of the accuracy of the gyroscope, $0.1^\circ/s$ after 5 minutes the gyro will read $ 30^\circ$ off where it should be, and after an hour it will be $ 360^\circ$ off the original position, you will have no information on the orientation at all.

Title: MPU9255 gyro data to roll pitch?

Body:
The problem you have is that the gyro is outputting angular velocity. Taking the integral of the angular velocity you only get the angle offset from some constant c, normally you would deal with this by initializing the system with some known orientation, typically by letting it rest flat for a moment before using it to track angle.

But there is another problem, gyros have some implicit bias in them. This means that when it is not moving it will still report that it is, you have to take this into account when you build your system saving them when you boot up during that time when your device is not moving.
millisecond
So your code might look like this:

init(){
    bias_x = Gxyz[0];
    bias_y = Gxyz[1];
    bias_z = Gxyz[2];
}

loop(){
    dt = now_c - pr_dt;
    pr_dt = dt;
    // x, y, z gyro are in deg/millisecond
    x_gyro += (Gxyz[0] + bias_x)*(dt/1000.0);
    y_gyro += (Gxyz[1] + bias_y)*(dt/1000.0);
    z_gyro += (Gxyz[2] + bias_z)*(dt/1000.0);
}

But there is another problem the measured angle will diverge over time from the actual angle becouse of the accuracy of the gyroscope, $0.1^\circ/s$ after 5 minutes the gyro will read $ 30^\circ$ off where it should be, and after an hour it will be $ 360^\circ$ off the original position, you will have no information on the orientation at all.


问:
Irobot Create 2 Open Interface Communication
I am able to connect the create 2 robot to my laptop with a serial cable.  I am using putty_beta terminal to run. I am not able to key in commands in the terminal. but I am able to receive information from the robot. I want to achieve two way serial connection. What can I do?

答: I was not able to send commands just using putty, because putty sends every character individually. You need to write your own code or use something  like https://github.com/xa4a/go-roomba to communicate with the roomba</p>


问:
Does Inverse Kinematics need the current joint angles?
I had a discussion with a study colleague about the IK solver. The question was: Does IK need the current joint values to calculate the requested position.

I think it doesn't need it. From my understanding, IK only needs a translation and rotation respected to the e.g. base frame, but no information about the current joint values or e.g. gripper frame for the calculation itself. My study colleague argue that we always give the IK Solver the current joint values through our .msg file and that's right. However, I'm sure that the IK solver doesn't use it for the calculation. Maybe, in case of optimization if it finds more than one possible solution.

Would be nice if anyone can help

Greetings

R.Devel

答:
It depends on the method that you use for computing an IK solution. If you have an analytic formula for IK solutions then you do not need the current joint values of the robot. You just plug in the translation and rotation of the end-effector to the formula and you get a solution (or a set of solutions). (Sometimes knowing the current joint angles is better, though, because you might want to select which IK solutions you want based on your current joint angles.)

However, when using iterative methods such as differential IK, you will need an initial point to start with. The algorithm will kind of drive the robot from the initial joint values towards your desire end-effector position. That's when the current joint values come into play.


问:
Confirm my understanding on BLDC motors
This question assumes an ideal system with 100% efficiency.

Lets say I have this propeller which if spun at 1000 RPM in water will need a 48 Watt motor to drive it.

So I get a 1000 Kv 16V motor and a gear reduction of 1:16 so now it will spin at 1000 RPM and thus will use 48 watts of power.

That means that the ESC will be using 3 Amp to power the motor.

Now if I power the ESC with 48V instead of 16V and set it to 33% instead of 100%
The effective voltage on the motor is still 16V and the motor will still use 48W, but since the ESC is getting 48V it will use 1 Amp not 3.

So I want to choose a brush-less motor for an ROV propeller that will need 200W of power at 1000RPM and the voltage applied to the ESC varies between 12V and 48V.

So I choose a motor and gearbox that when 10V (headroom to allow the motor to slow down a little and still maintain enough speed to drive the prop) is applied to it, it spins at 1000RPM and it has max power of 300W.

Then in the control system I have Voltage and current sensors in the ESC and I drive the motor at constant power mode.

The system would now what voltage is the ESC running at and vary the PWM signal till reaching wanted power.

Is this right or am I missing something?

答:
Now if i power the ESC with 48V instead of 16V and set it to 33% instead of 100% The effective voltage on the motor is still 16V and the motor will still use 48W, but since the ESC is getting 48V it will use 1 Amp not 3.

This is not a good mental model. Perhaps you are mixing the instantaneous voltages seen by the inverter switching with the smoother currents experienced by the windings due to their inductance? The following is a typical rough model:

$V_{ESC}-V_{emf}=L_{motor}\frac{dI}{dt}+R_{motor}I$

The voltage is changing at the switching frequency and the current must be changed from positive to negative as the poles of the motor rotate.

Keep in mind that the supply voltage  will not be nicely constant. It will drop (greatly if poorly designed) when you drive the motors.

Design Approach

All that said, when dealing with the system level, I think it's good that you are using power as your design variable. Power translates across electrical-mechanical systems well.

There are energy losses throughout the system. Enough that you should be careful to mention for each power value, where in the system it is. (eg output of the gearbox, output of the motor, output of the esc, input to the esc).

You need 200W at the propeller (I'll assume you have accounted for losses when delivering  propeller energy to the water). $1000RPM\implies\frac{200W}{105 Rad/sec} \implies 1.9 Nm$ of torque ($P = \tau\omega$) delivered by the gearbox. More due to losses. Let's say 2.3Nm (An uneducated guess).

At 85% efficiency for a 16:1 gear you need 235W at the motor output. $200W/.85$

(side note, nobody uses the same units for velocity constants which is really annoying. Google tells me that hobby motors like to use Kv for units of RPM/V so I'm going to go with that. )

Torque constants and velocity constants are the same number with units of $Nm/Amp$ and $V/(Rad/Sec)$. Our $1000\frac{RPM}{V}\implies105\frac{Rad/Sec}{V}\implies0.0095Nm/Amp$

Estimating the torque required:

$\frac{2.3Nm}{16\times.85}=.17Nm$ Motor Torque$

Taking the motor as a system, Power out = Power in - Losses,

$P_{in}=IV$, $P_{loss}=I^2R+{other}$, $P_{out}=\omega\tau$, and $\tau=IK$ where $K$ is the torque (velocity) constant.

$P_{in}=P_{loss}+P_{out}$

$IV = I^2R + \omega IK \implies V=IR+\omega K \implies V=IR+V_{emf}$

You can compare this equation to the typical rough model from the start and see that we have arrived at the same point, with some differences due to ignoring different parts of the system.

So we need $16000RPM/(1000RPM/V)=16V$ to counteract back-emf, plus some Volts for our motor losses.

12V is your minimum design voltage so that motor won't work.

If you really need a 12V minimum voltage, you can see that you need higher Kv motor. Make sure it has enough torque as well. The torque listed in the datasheet is unlikely to be for the RPM you need, so it is not useful when designing. Resistance is more constant (it changes as the motor heats up) and is a better motor characteristic to use when designing. You can use the equations above to calculate what R needs to be for a given voltage.

Is it possible to use a 12v motor with a 48v bus by limiting the voltage

Yes. You don't need to limit the voltage. But for your 200W output design goal you said you will controlling the voltage and current. The controlled voltage will be about 12v.

You can see from the equations that saying a motor is an X volt motor or Y amp motor has no clear meaning because those are things you are changing and controlling. Better to specify the motor constant K, the winding resistance R, and the inductance L.

If you are looking at hobby outrunner motors and they say it is a 12v motor, what they really mean is that 12v will be  enough to overcome back-emf during typical RPMs needed to fly a typical propeller in air. That same "12v" motor will not necessarily have enough torque to drive a propeller in water.. Easier to just choose a motor with a K and R that fits your needs.

Title: Confirm my understanding on BLDC motors


问:
Using an Xbox controller to fly a Quadrocopter
So I have a quadrocopter, it does come with a remote but I intend to run certain modifications to the copter, like installing a camera, a mechanical manipulator, and other random modifications. The remote that comes with the copter isn't flexible enough to help with such functions and plus it lacks any more buttons.

I was wondering if I could somehow program the quadrocopter to respond to my Xbox controller. I was planning on using my laptop's Bluetooth connection to talk to copter. The Xbox controller which is connected to the computer would be then used to control the quadrocopter. So my question is, how exactly do I program the controller? How do I go about making all of this possible?

I understand this question is really vague and that there are too many options out there, but I do need help figuring this out.

答:
Xbox and PS3 controllers are very versatile, it is true, but don't forget about range.

Bluetooth was only intended for short range operations out to about 10m (33ft.) for class 2 devices (xbox and ps3 controllers have class 2 transmitters) and 100m(330ft) for class 1 devices. Flying devices could most certainly go beyond that very quickly and you will risk losing control.

You're better off using an RC radio. Even though they use the same part of the RF spectrum (2.4GHz), RC radios typically have more power and are good for a couple of miles in good weather. You can get RC controllers with 8 channels and more, thereby offering greater flexibility of number of controlled devices.


问:
Robots with less than 6 degrees of freedom
Is there any possibility to have a robot with less than six degrees of freedom & still be able to achieve any position & orientation around end effector?

答:
Short answer: No.

Long answer: In how many dimensions you are defining 'any'?

The best way to understand it is actually through math.

Let's say you have a desired position $$p=\left[\begin{matrix}x\\y\\z\end{matrix}\right]$$ and an orientation $$\omega=\left[\begin{matrix}\chi\\\psi\\\zeta\end{matrix}\right]$$ in three dimensions.
Now let's say we have a robot with six degrees of freedom $$Q=\left[\begin{matrix}q1\\q2\\q3\\q4\\q5\\q6\end{matrix}\right]$$.

Assuming you know your position and orientation you are trying to find your joint angles. This can be written in matrix form.

$$\left[\begin{matrix}q1\\q2\\q3\\q4\\q5\\q6\end{matrix}\right]= F\left[\begin{matrix}x\\y\\z\\\chi\\\psi\\\zeta\end{matrix}\right]$$.

Where F a 6x6 matrix with your inverse kinematics functions.

Notice how you have 6 knowns (your position and orientation) and six unknown (your joint angles).

Basically you have a 6-by-6 system to solve. If you have fewer degrees of freedom then you have fewer unknowns which means that you can't solve independently. Meaning your position and orientation are linearly dependent.

For example changing your position $x$, will change your $\chi$ or your $\psi$ or even your $y$. Imagine trying to move a glass of water in a straight line and suddenly the glass turns over and then back again.

So think a robot with less than six degrees of freedom as a robot that you can't control its behavior at any time rather than a robot that can't reach a certain position at any time.

Now if you have a task that does not require to move along and rotate around an axis (e.g. $z$ & $\zeta$) then you can ignore them and now you have a 4-by-4 system to worry about. Therefore, for this 2D task, a robot with four degrees of freedom can achieve 'any' position and orientation. Similarly, if you put a constraint on the force along the $x$ direction, you now have an $F_x$ variable that entered your system making it a 7-by-7 system that requires seven degrees of freedom to achieve 'any' position and orientation.

Generally, 6 degrees of freedom is the standard robot because it can control its end effector along each dimension independently. Any fewer degrees of freedom can still be useful in some more limited tasks. Higher degrees of freedom can tackle more complicated tasks, though in those case there is a selection whether all parameters will be satisfied independently or no.

The bottom line is, for general cases in a 3D environment you need 6 degrees of freedom.

I tried to keep my answer short without using too much math but let me know if you are still unsure about the effect the number of degrees of freedom have on the position and orientation of the end effector.


问:
iRobot Create 2 -language set error type 2
I have an iRobot Create 2 and I am connected to it with the 7-pin connector to a desktop machine via USB.  Serial communication is working fine under that configuration.  I can tell it to restart with ctrl-G and read the messages it sends back.  On power up the serial port outputs the following:

2015-08-24-1648-L

r3-robot/tags/release-3.5.x-tags/release-3.5.4:6058 CLEAN

bootloader id: 4701 5652 7E52 3FFF

assembly: 3.5-lite

revision: 2

flash version: 10

flash info crc passed: 1

battery-current-zero 257

When I plug in the raspberry pi 3 board with a 7-pin connector to the on-board UART, I can communicate with the iRobot without issue.  However, the iRobot starts to continuously sound "uh-oh" every few seconds (no other beeps follow)  after about 20 or so seconds of powering up the raspberry pi until the robot enters sleep mode.  The iRobot serial port outputs the following message to the raspberry pi every time the robot sounds "uh-oh"

4701 5652 7E52 3FFF

ERROR: language set error type 2

Does anyone know what this error means?

My last resort is to scope the serial port from the raspberry pi to check for noise; unfortunately I don't have access to my scope at the moment.

答:
Scope showed data being sent to the robot.  I discovered the console was enabled on the raspberry pi 3 and disabled it; the problem is now resolved.

Specifically, run the following commands

sudo systemctl stop serial-getty@ttyS0.service

sudo systemctl disable serial-getty@ttyS0.service

Then edit /boot/cmdline.txt and remove the following option from the file

console=serial0,115200

Save and reboot.  For more information see
http://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/


答:
In abstract theory, yes. You can have a body constrained to a path (1 Dof, forward and back along the path) and the path can loop through all possible orientations. Likewise you can constrain the body to a higher order manifold (a surface allows 2 or 3Dof depending on the physical mechanism of constraint).

Mechanisms that we can build have other requirements (like supporting loads and forces) that limit what we can do.

Here's a simple example of a practical mechanism. Say you have a 2 DoF mechanism that controls orientation and distance along a line. The accuracy of the distance, and orientation, is limited to the precision of your encoders. You can replace that 2Dof mechanism with a 1DoF screw who's pitch is equal to the linear encoder resolution. As the output spins on the screw, it can reproduce every position and orientation that the 2Dof mechanism could. The cost is that you have to spin around a full revolution to move one step in the linear direction.

Another good example is a car. A 2DoF mechanism on a 3DoF plane. You can achieve any position and orientation with a car, but you may need to do some loops or back-and-forth driving to get there.

So, keeping in mind that a 6DoF robot has limited positions and orientations that it can reach, and limited resolution, Yes, there is the possibility that a 5 or fewer Dof machine could achieve the same range of position and orientations.

Title: Robots with less than 6 degrees of freedom

Body: Is there any possibility to have a robot with less than six degrees of freedom & still be able to achieve any position & orientation around end effector?


问:
How to derive the Cubic Interpolation algorithm?
I have a data point array. Which is recorded at 20Hz(0.05 second. It can be 30Hz, 40Hz, 50Hz. 20Hz is an example value)

I want to interpolate this data to bigger frequency for example 1kHz(0.001 second) with cubic interpolation to get smooth data set.
y(t) = at^3 + bt^2 + ct + d

But I can't figure out how can I derive the function and implement with C.

答:
As I understand it, you want to fit a degree three polynomial to course data to be able to use the polynomial to interpolate between the course data points.

To be able to fit the coefficients ($a$, $b$, $c$, and $d$) of the degree three polynomial so that it goes through the original data points, you need exactly four data points, $(t_1,y_1), \cdots, (t_4,y_4)$.  If you have more than four data points, the polynomial values will not necessarily go through the original data points.

Edit: Calculation of Polynomial Coefficients

For four sequential data points ($i,i+1,i+2,i+3$), the following equations must hold:
\begin{eqnarray}
at_i^3 +bt_i^2 +ct_i + d &=& y_i \\
at_{i+1}^3 +bt_{i+1}^2 +ct_{i+1} + d &=& y_{i+1} \\
at_{i+2}^3 +bt_{i+2}^2 +ct_{i+2} + d &=& y_{i+2} \\
at_{i+3}^3 +bt_{i+3}^2 +ct_{i+3} + d &=& y_{i+3}
\end{eqnarray}
This can be written as a matrix-vector equation
$$
\left[\begin{array}{llll}
t_i^3 & t_i^2 & t_i & 1 \\
t_{i+1}^3 & t_{i+1}^2 & t_{i+1} & 1 \\
t_{i+2}^3 & t_{i+2}^2 & t_{i+2} & 1 \\
t_{i+3}^3 & t_{i+3}^2 & t_{i+3} & 1
\end{array}\right]
\left[\begin{array}{c}
a \\ b \\ c \\ d
\end{array}\right] =
\left[\begin{array}{l}
y_i \\ y_{i+1} \\ y_{i+2} \\ y_{i+3}
\end{array}\right]
$$
which can be solved for the vector of unknown coefficients  ($a$, $b$, $c$, and $d$) using
$$
\left[\begin{array}{c}
a \\ b \\ c \\ d
\end{array}\right] =
\left[\begin{array}{llll}
t_i^3 & t_i^2 & t_i & 1 \\
t_{i+1}^3 & t_{i+1}^2 & t_{i+1} & 1 \\
t_{i+2}^3 & t_{i+2}^2 & t_{i+2} & 1 \\
t_{i+3}^3 & t_{i+3}^2 & t_{i+3} & 1
\end{array}\right]^{-1}
\left[\begin{array}{l}
y_i \\ y_{i+1} \\ y_{i+2} \\ y_{i+3}
\end{array}\right]
$$
These coefficients can then be used to calculate the value of $y$ for a given $t$ where $t_i<t<t_{i+3}$:
$$
y = at_3 + bt^2 +ct +d
$$

I would recommend using a cubic spline interpolation method so that you will get a smooth interpolating curve that goes through all the original data points and that can handle more that four data points. See Numerical Recipes 3rd Edition: The Art of Scientific Computing by Press, et al. for very good C or C++ code to perform cubic spline interpolation.


答:
Physically Speaking No.

Even most 6-axis (6DoF) industrial robots are unable to achieve full range of motion within their work envelope (or the work envelope is artificially restricted as more commonly seen). 7-axis (7DoF) robotic arms (commonly know as collaborative robots) have a much greater flexibility; They are generally only restricted by physical interference with their own casting (body).

In the below link, the author discusses the relative restrictions on modeling an Nth degree robotic arm. Specifically, as to how difficult it is to model how the casting restricts End-of-arm-Tooling in both position and orientation, as the mathematics can produce a valid result that results in an unattainable position (robot physically intersecting itself).

Sources: A complete generalized solution to the inverse kinematics of robots


答:
Maybe you are looking for spline interpolation such as Cubic Hermite Splines, etc. However, it really depends on how you want you path looks.

If it is something like

and you want something of third order (specifically, a velocity profile of third order), you can solve for a function $P_{01}(t) = at^3 + bt^2 + ct + d$ which satisfies, for example,
$$
\begin{align}
P_{01}(t_0) &= x_0\\
P_{01}(t_0) &= x_1\\
P_{01}'(t_0) &= 0\\
P_{01}'(t_1) &= 0\\
P_{01}''(t_0) &= 0\\
P_{01}''(t_1) &= 0,
\end{align}
$$
where $P'$ indicates the first time derivative of $P$, etc.
You can substitute all the boundary conditions above to the function and solve for all the coefficients $a$, $b$, $c$, and $d$. You may want to have a look at polynomial interpolation and Vandermonde matrix. Note that if you change boundary conditions, you can also make the path looks smooth (i.e., not so zigzaggy).

If you just want a straight line between two consecutive points, you can even do
$$
P_{01}(t) = x_0 + \left(\frac{x_1 - x_0}{t_1 - t_0}\right)(t - t_0).
$$

You don't need to use higher-order polynomials.

If you, instead, want something like

Spline interpolation might be more suitable.

Title: How to derive the Cubic Interpolation algorithm?

Body:
I have a data point array. Which is recorded at 20Hz(0.05 second. It can be 30Hz, 40Hz, 50Hz. 20Hz is an example value)

I want to interpolate this data to bigger frequency for example 1kHz(0.001 second) with cubic interpolation to get smooth data set.
y(t) = at^3 + bt^2 + ct + d

But I can't figure out how can I derive the function and implement with C.


问:
Stepper motor control
I am trying to understand the stepper motor to Mach3 type software control interfaces, mostly from a logical perspective, deducing most of everything because I have no concrete resource to refer.

So basically I have purchased a "LinkSprite" 3 axis engraver. It says it comes with Arduino GRBL board which interprets G-code. Sends it to stepper driver shields.

Bottom

I can see the drivers need to send a approximate sign wave of some sort to one or both windings to actuate them.

Top

Mach3 I read essentially transmits two signals per axis to the motion controller/breakout board (which in turn is connected to the drivers), one being the number of steps the other the direction and probably via parallel ports GPIO or something.

So what underlying transmission protocol carries mach3 signals, like i2c or something via the parallel poet? How is steps and direction, and axis encoded?

What does the motion controller do exactly? Minimally does it just breakout out the signal to the drivers? What is the drivers inputs?

My Arduino GRBL board I read interprets G-code, but isn't that what Mach3 does?

How can I connect from stepper motor waveform on windings to some interface like Mach3 the encodings and concrete information of this logical path of the workings of the control of the stepper motors?

答:
So you have three different questions here I will answer them separately:

Q: How is Mach 3 controlling steppers?

Mach 3 normally uses a step and direction interface where it is abusing the parallel port on your PC to output signals.

A step and direction port does just what it sounds like, it has one pin where every transition of the signal from low to high to low (or vice versa) commands the motor to take one "step" (fraction of a rotation) forward, the other signal indicates what direction the step should go, where high is forward and low is reverse or vice versa. There are 7 data pins on a parallel port enough to control 3 steppers.

These step and direction commands are going to servo drivers that interpret those commands and move the stepper, the motion controllers are normally very dumb with minimal logic.

Q: How is GRBL controlling steppers?

GRBL is just interpreting the G-Code line by line and controlling the steppers, which brings us to your last question.

Q: How does G-code translate to real world movement?

G-Code is a standard numerical control programming language for encoding moving things.

G-Code is first parsed by a parser that decodes the commands, say a movement command like G01 X1 (Fast move to x value of 1)

The parsed command is then compared to the current state of the machine to find out what needs to change, so in our example say we were at x 0 (the origin) it would find out that we need to move 1 unit in the x direction

The controller would then command the appropriate number of steps at the appropriate speed to complete the desired movement, for our example if our controller was told that 100 steps corresponded to 1 unit, it would command 100 steps in the forward direction

The Servo driver then outputs the right waveforms to move the stepper.

The controller would then loop to step 1 to interpret the next line of G-Code

A GRBL/Stepper shield is handling steps 1-4 all on its own, with the computer feeding in lines of G-Code as it needs it.

Mach 3 is handling lines 1-3 and just outputting the resulting step and direction command to a separate box with Servo Drivers.

My example is very basic, normally the Motion control software is pretty sophisticated, handling things like relative vs absolute position movements, soft limits feed rated coordinated axis movement etc... but that should give you an idea of how it works under the hood.

Title: Stepper motor control


问:
Will two 8-bit microcontrollers running in parallel perform similarly to a single 16-bit microcontroller?
Let's say I have multiple (8 bit) sensors which are sending signals to two microcontrollers simultaneously. In this case, I am looking to harness the parallel processing capability of the two microcontrollers to process the signals at the same time.

However, I am curious whether I can substitute the above setup by using only one 16-bit microcontroller? Then, would sending two 8-bit signals simultaneously be possible, using the 16-bit bus on the microcontroller?

Assuming in both cases above, they are running at the same clock speed (MHz).

Edited

Sorry, this is all still new to me.

One aspect that I'd like to understand is: Can we make two 8-bit signals from two different 8-bit sensors share the 16-bit bus at the same time?

答:
Your question is really missing critical informations about your setup, so answer cannot catch all possibilities.

But if we assume the typical Arduino setup, than the sensors would not use 8 wires, but some serial protocol (Serial, I2C,...). Especially if you mentioned multiple of them.

Also usually processor asks sensor for data and sensor reply with values, not that sensor is spamming the processor on its own (or not more, than sends interrupt, when data are collected)

Also they would probably not send data to both processors simultaneously, as it would mean, that both processors would be blocked by reading one pice of data - better setup is to send half sensors to one processor, second half to other and synchronise only minimum of processed data between processors.

So the speed of the protocol would be one of very limiting facts here (400 kbit/s ~ 50 kbyte/sec for fast I2C on 16 MHz Arduino means, that while receiving one byte=8bits, your processor is able to do like 16.000.000/50.000 = 320 instructions, for asking sensor for value you address the sensor and send register number, so at least 3 bytes are transferred, also there are some kinds of handshaking - so we have more like 960 instructions per byte) and the transfers usually cannot go in parallel, as they are using the same wires.

two processors would be able serve more data, as each of them can have its own data line and so two sensors can be questioned in paralel. 900 instructions may be enough to do some simple data manipulation over collected values.

16-bit processor cannot generally process two independent data in one instruction, even if it have 2x longer registers. So the there would not be gain from longer word in this way

on the other hand 16-bit processor can make computations faster if it comes to bigger data types, like int/long/real (to contrast only bytes), many times more than 2x faster. But jumps, loops and so are not such faster, as well as 8-bit calculation. So it deeply depends on how you process the data (how much computation and what kind you do).

if the sensors would send data only occasionally (as many sensors need a time to collect something) and you would do a lot of complicated computations over them, and those computations would need (nearly) raw data from all sensors (not just average over half second or so), then the 16-bit can win with sheer computing power and lack of need to synchronize data over more units

if there would be too much data from sensors and such data could be computed independently and mainly in 8-bit logic (if (dist <128) near=true;), the 8-bits can win with two communication lines to sensors and two computing units (so 2x number of instruction/sec) - but in robotic it is not so simple usually (left half of robot is not independent from right).

for many cases also the size of disposable RAM is factor

complexity of programming differs in single-unit(16-bit) and two or more networked units (8-bit)

Many Arduino libraries and examples are not very excellent, when it comes to parallel processing more inputs at the same time (first of all you must have forgot, that something like delay() exists, then lot of communications (like Wire for i2C) happily waits for the full request fulfilled (so waste a lot of instructions just waiting for communication be completed))

so you can spend more time in inefficient library implementation than in the rest of program. This is not problem for simple scratches, for which Arduino is planned, but is serious limitation in more complex computations

so you may use different approach to the same HW and use AVR rather then Arduino way (but it needs a lot more skills and knowledge).

Lots of 16-bit processors have a faster clock, more RAM and more and more elaborated HW build in devices, so they can do even more work faster. Some have two or more I2C subsystems, so they can communicate with two buses at the same time and share the results inside without transferring them around

so usually you have two different architectures which cannot be simply compared with just "it has the same clock, but 16-bits"

So your question cannot be answered simply, without knowing what sensors you are going to use, how many, which processors you are considering, how you want process your data and what peripherals you want to manipulate.

If you are all confused now, then simply start with the processor you currently have and just few sensors and try to solve only small part of final project. You will learn a lot along the way.

If it works with one sensor but not two, you have problem in your programming and you have the simplest case to learn, how to solve it.

If it works with four sensors but not five, you are probably hitting some limits

try to measure, where you spend more time, if in the logic, or the communication

if communication is the main problem, try other libraries or more independent processors

if logic is the limit, use better algorithm or faster processor, or split it in net, if everything else fails

if you hit RAM limit reconsider the algorithm, or use processor with more RAM or try to split it to two cooperating units, each with half of sensors

But first of all - start playing and having fun, usually it is much faster way to some results, then theorising over all possible details of the Death Star Project at one time before you manage even driving straight with two wheels.


问:
Calculating the singular configuration of a 3 revolute joint manipulator
I would really appreciate it if somebody could help me calculate the singular configuration of this simple manipulator

I am confused since J is a 2x3 matrix and I cannot simply calculate the derivative.

Thanks in advance.

答:
Singular configurations are configurations at which the Jacobian is rank-deficient. In this case $J$ is a square matrix, you can find conditions for singularity by solving $\det(J) = 0$.

The last row of $J$ being all ones means that no matter the configuration, you can always generate some angular velocity. This actually implies that the conditions you get from solving $\det(J) = 0$ will be the conditions for linear velocity singularities.


答:
It really depends on the problem, ideally two 8 bit processors work in parallel while one 16 bit processor works by itself. What if the problem is add three 3bit numbers (a+b+c). Can two 8 bit processors take advantage or maybe the single 16 bit? Now if we add three 8bit numbers the single 16 bit processor will be quicker. Alternatively if we ask to add four 3bit numbers (a+b+c+d) then the two 8 bit processors will be superior because one can compute x=a+b and another y=c+d in one instruction time then z=x+y in a second instruction requiring only two instruction time periods while the 16bit would need three.

Now consider the last problem but if there are allowed abcd to be 8bits then its not even clear, we need more information and the same is for your problem. Clearly there is no simple rule or way to answer your question as you naïvely hoped. So do some studying and figure it out for yourself. Or at least provide a coherent question.

Title: Will two 8-bit microcontrollers running in parallel perform similarly to a single 16-bit microcontroller?

Body:
Let's say I have multiple (8 bit) sensors which are sending signals to two microcontrollers simultaneously. In this case, I am looking to harness the parallel processing capability of the two microcontrollers to process the signals at the same time.

However, I am curious whether I can substitute the above setup by using only one 16-bit microcontroller? Then, would sending two 8-bit signals simultaneously be possible, using the 16-bit bus on the microcontroller?

Assuming in both cases above, they are running at the same clock speed (MHz).

Edited

Sorry, this is all still new to me.

One aspect that I'd like to understand is: Can we make two 8-bit signals from two different 8-bit sensors share the 16-bit bus at the same time?


答: If $J$ is not square, solve $$|J^TJ| = 0$$ for $\theta_i$.</p>

Title: Calculating the singular configuration of a 3 revolute joint manipulator

Body:
I would really appreciate it if somebody could help me calculate the singular configuration of this simple manipulator

I am confused since J is a 2x3 matrix and I cannot simply calculate the derivative.

Thanks in advance.


问:
BeagleBone to Arduino analog communication

I have a BeagleBone Black, an Arduino Duemilanove and a WS2812b LED strip driven with 5 V.

I have no level shifters, nor I intend to order one.

The Arduino works perfectly with a LED strip, and I need the BeagleBone Black just to send simple commands like 0, 1, 2, 3, 4, 5... to make the Arduino perform one of five modes.

The BeagleBone Black's USB port is taken by other device that I need, and I do not intend to use USB splitters.

What is the best way to communicate between the BeagleBone Black and the Arduino in this situation? If I do not want to use level shifter I2C and RS232 TTL communication is impossible?

Is it OK to use for example just one wire (plus ground) and communicate via the analog port using analogWrite() on the BeagleBone Black and analogRead() on the Arduino, and is there some additional advice on communicating this way?

答: It should be possible to make pseudo logic lines over analog between the BBB and the arduino using analog signals. The only real downside is that it will be slower and you have to write more code. Just be sure that you keep in mind the analog pins on the BBB only accept 1.8v so don't put anything beyond that on it.</p>


答:
BeagleBone black has 6 UART ports - you can connect one of them to the Arduino digital pins and use software serial on the Arduino. See:

Using the BeagleBone > Serial ports / UART

SoftwareSerial Library

Title: BeagleBone to Arduino analog communication

Body:
I have a BeagleBone Black, an Arduino Duemilanove and a WS2812b LED strip driven with 5 V.

I have no level shifters, nor I intend to order one.

The Arduino works perfectly with a LED strip, and I need the BeagleBone Black just to send simple commands like 0, 1, 2, 3, 4, 5... to make the Arduino perform one of five modes.

The BeagleBone Black's USB port is taken by other device that I need, and I do not intend to use USB splitters.

What is the best way to communicate between the BeagleBone Black and the Arduino in this situation? If I do not want to use level shifter I2C and RS232 TTL communication is impossible?

Is it OK to use for example just one wire (plus ground) and communicate via the analog port using analogWrite() on the BeagleBone Black and analogRead() on the Arduino, and is there some additional advice on communicating this way?


问:
Ardupilot on Raspberry Pi
I'm making a quadcopter for the first time and want to be as low cost as possible, and when it comes to flight controllers APM is the best open-source project, and is compatible with Raspberry Pi.

My question is, will it perform as good as of the shelf APMs, if I add GPS, IMUs, and all of the other sensors, the same as in ready-made?

Consider that APM is clone from ebay.

答:
Firstly, you may be confusing ArduPilot/ArduCopter software with the ArduPilot Mega (APM) hardware platform. ArduPilot/ArduCopter is indeed a great piece of software and is still maintained. The ArduPilot Mega (APM) has been discontinued, and as such, has very limited support and development.

Regardless of that, I looked into this whole issue, of which hardware platform to choose, a while back, see Flight Controllers. What you need to remember is that some of the newer, and smaller, FCs are using very fast processors (i.e. STM32F4), which are dedicated to the flight controller, without having to use a portion of their limited processing power/time to deal with unnecessary I/O activities, which could affect the Pi.

For example, the newer processors used in the SP3 Racing F3 and the Naze32 and even the underpowered CC3D running OpenPilot/LibrePilot can be, or feel, more responsive, than a fully loaded Pi running ArduPilot/ArduCopter.

Admittedly the ArduPilot software is very expansive and fully featured, but has, over the years, become rather demanding, so much so that it has outgrown its AVR platform - that is to say, the latest version (3.3.x) will not run on an Arduino Mega (or Uno) (i.e. ArduPilot Mega (APM) 2.6 is no longer supported and which is limited to version 3.2.1), and requires a PixHawk, or one of its derivatives, to provide sufficient processing power for the drone not to fall out of the sky, or even take off.

It depends what you want the software to do. If you need high response speeds (for racing) then maybe the Pi is not the way to go. I you want an all singing and dancing flight controller then a PixHawk might be a better bet.  However, the Pi does have its advantages. The question is do you require those advantages?

Finally, you say that the APM you want is from eBay, so (as I have already stated above) that will be a APM 2.6, or if you are unlucky, or cheap, APM 2.5. This will not run that latest version of ArduPilot/ArduCopter, but probably perfectly adequate for a starter quadcopter. However, if you want all of the latest ArduPilot/ArduCopter software, then a PixHawk, or clone thereof, is going to last you longer, and provide much better performance, but cost twice as much (\$40 vs \$20).

Also, if you use the Pi and then have to buy all of the additional sensors separately, then it will cost [much] more than if you had bought a fully featured Naze32 Full (not just 10DOF) Revision 6.

If you want to save money, get a CC3D or a Naze32 and run LibrePilot. You can always upgrade at a later point. I, also, wanted an APM, or Arduino based board, but after really looking into it, I realised that it just wasn't worth it anymore, and that the software has outpaced the hardware. Three or four years ago, it probably would have been perfect - now, not so. Likewise, I wanted to use a Pi, but then realised that it would be too slow (i.e. unresponsive) for my requirements. I ended up getting the latest and greatest Naze32, and a SP3 Racing F3. However, I still want to use ArduPilot/ArduCopter, and will do, in a few years, when maybe, probably, an even better platform than the PixHawk will come around...

Disclaimer: Please note that the above is only my opinion, and, as such, others may choose to disagree, or have a completely different take on things.

Title: Ardupilot on Raspberry Pi