问:
How to Visualize a real robot's movements on a map?
I am working on obstacle avoidance and path planning in robotics using X80SV robot. The obstacle avoidance module of the robot works well. The programming language I have used in this work is C#. Next, I wanted to visualize the real-time motion of the robot. What should be done? The robot is equipped with ultrasonic sensors, infrared sensors, camera, human sensors etc. </p>

答:
There seems to be two questions in one:

How should I visualise the trajectory (planned and traversed paths)?

How should I combine "ultrasonic sensors, infrared sensors, camera, human sensors etc. " into path planning?

Also, I didn't get how obstacle avoidance is working 'well' (if it is binary obstacle or a gradient based obstacle marking probability fields). While code snippets are the ideal solutions, I would suggest adding more details to the question and the attempts you have tried.

Nevertheless, I shall attempt to solve that problem.

We need visualisation; So, we need an off-board computer. If we want real-time visualisation, we need to transmit data (planned and traversed path) to the off-board computer. Else, we can store this data and at the end of the run, we can just gather the data.

So, my suggestion: Use WiFi/USB/Bluetooth to transmit data back to computer.

We need path planning (for this I am assuming that SLAM isn't needed because we are talking about path planning); Use any path planning technique as described in this http://ai.stanford.edu/~ddolgov/papers/dolgov_gpp_stair08.pdf (most of it assumes binary ostacles - Obstacle is either present or absent) If probabilistic obstacles are considered, it is a kind of local optimisation problem and more details are definitely necessary. https://www.researchgate.net/publication/2287847_Probabilistic_Methods_for_State_Estimation_in_Robotics

How should I fuse sensor data? What is the cheapest / easiest way of detecting a person? (Because of "human sensors") https://stanford.edu/class/ee267/lectures/lecture11.pdf

How do I visualise data? This is the simplest. Use Python/Octave/MATLAB and visualise. There are many plotters that use CSV format. http://lmgtfy.com/?q=visualising+3D+plots (https://in.mathworks.com/help/matlab/2-and-3d-plots.html) (You can also explore GNU Plot, Qti Plot etc)


问:
Has a robot ever taken a complete IQ test?
And if so, what was the highest score so far?

Some news articles suggest only parts of tests were aced.

Update since people censored this question and closed it. There was an AI that has taken an IQ test and scored similar to a 4 year old.

http://phys.org/news/2015-10-ai-machine-iq-score-young.html

The AI system which they used is ConceptNet, an open-source project run by the MIT Common Sense Computing Initiative.
Results: It scored a WPPSI-III VIQ that is average for a four-year-old child, but below average for 5 to 7 year-olds

Abstract

We administered the Verbal IQ (VIQ) part of the Wechsler Preschool and Primary Scale of Intelligence (WPPSI-III) to the ConceptNet 4 AI system. The test questions (e.g., "Why do we shake hands?") were translated into ConceptNet 4 inputs using a combination of the simple natural language processing tools that come with ConceptNet together with short Python programs that we wrote. The question answering used a version of ConceptNet based on spectral methods. The ConceptNet system scored a WPPSI-III VIQ that is average for a four-year-old child, but below average for 5 to 7 year-olds. Large variations among subtests indicate potential areas of improvement. In particular, results were strongest for the Vocabulary and Similarities subtests, intermediate for the Information subtest, and lowest for the Comprehension and Word Reasoning subtests. Comprehension is the subtest most strongly associated with common sense. The large variations among subtests and ordinary common sense strongly suggest that the WPPSI-III VIQ results do not show that "ConceptNet has the verbal abilities a four-year-old." Rather, children's IQ tests offer one objective metric for the evaluation and comparison of AI systems. Also, this work continues previous research on Psychometric AI.

Update. A robot has passed the Japanese college entrance test and has an 80% chance of being accepted. Since it scored more than the average, that would make the IQ > 100, especially since college applicants have an IQ greater than average, and especially since Japanese are smarter than average humans. http://gizmodo.com/an-ai-program-in-japan-just-passed-a-college-entrance-e-1742758286

The Wall Street Journal reports that the program, developed by Japan’s National Institute of Informatics, took a multi-subject college entrance exam and passed with an above-average score of 511 points out of a possible 950. (The national average is 416.) With scores like that, it has an 8 out of 10 chance of being admitted to 441 private institutions in Japan, and 33 national ones.

答: Just FYI since this is not about exactly the IQ test and also this might be more suitable for computer science community, but Japanese researchers have started a project "Can a Robot Pass the University of Tokyo Entrance Exam?" where by 2021 they aim to achieve the goal.

ContentLicense: CC BY-SA 3.0


问:
Error in simmechanics matlab while doing inverse dynamics using custom joint
I am doing inverse dynamics in Matlab simmechanics in which position and orientation will be input to the end effector.
But it shows error as below.

Error originates in Mechanical block rob33/Subsystem2/Subsystem1/Custom Joint. The coordinate systems attached to this joint must lie on the prismatic axis (for 1 axis) or in the plane of the prismatic axes (for 2 axes). If joint has no prismatic axes, the attached coordinate systems must be collocated, within tolerances.

Model is given below.

In subsystem1, I used custom joint to give orientaion input. Susystem1 model and  custom joint block parameters is given below figure.

Parameters of link1-1 and parallel constaints is given in below figure.

How do I correct this error?

答:
I solved this problem by seeing below image from internet. This image explain the constraints in coordinate system in simulink.

R = revolute ; S = spherical; W = weld; P = prisimatic

As I have custom joint (in between ground and link 1-1) with R1R2R3 joints so body1 CS and body2 CS should coincident.

To do this, I copy CS3 of link1-1 and paste it into CS of ground.


答:
SimMechanics isn't an "inverse dynamics" engine, it's not an inverse kinematics engine, it's a "forward dynamics" or just "dynamics" engine. You provide link dimensions, inertias, and joint constraints. Then you provide either an applied force or an applied motion, SimMechanics propagates those forces (or equivalent forces, in the even of applied motions) through your model, and you get an output that shows what your system does in the presence of those forces.

I don't know what you think your Subsystem1 is supposed to be doing, but it's not doing it. Here is what is actually happening:

Each joint or link has an input location ("Base") and an output locations ("Follower"). Links have inertias and fixed transforms between base and follower, joints have no inertias and obviously have variable transforms between base and follower.

Each system has one and only one ground. This provides your zero-reference.

So, reading your first diagram from left to right, you have a "Root Ground", a welded base, then you start building your robot with joint, link, joint, link, etc.

Eventually you get to "Link 4-1", which I'm assuming is supposed to be an end effector.

Here's where you get into trouble - you tie some coordinate frame from the end effector to "Subsystem1" by attaching it to the follower (output) of a pair of parallel constraints.

Those parallel constraints are attached to the follower of a link, which is the follower of a custom joint, which is attached to ground!

You have made a closed loop, starting and ending at a ground connection.

The problem with this is that SimMechanics seems to be especially terrible at solving for initial conditions. If your starting/default orientation for the revolute joints and those linkages doesn't result in an end effector pose that exactly matches the starting/default orientation for the custom joint and the subsystem1 link, then you get this error because the difference in pose matching results in a separated joint somewhere - typically where you tie back to ground. This is in Subsystem, where the ground connection attaches to custom joint 1, which is where you're getting the error.

It looks like maybe you're trying to do inverse kinematics by creating a "puppet" - you provide a position and an orientation and rely on the SimMechanics solver to find the joint angles that allow the arm to reach that pose. Again, the problem here is if you start with a set of initial conditions where your initial input pose doesn't correspond to your initial robot pose.

You could also get this error if you use your input pose to drive the arm to an unreachable subspace. At that point, the arm "locks up," the input continues to move, and in one time step a joint separates somewhere and you hit a "not coincident" error like this again.

My suggestion would be to check the default orientation of the arm by commenting out the input subsystem1 code (highlight, right click, and choose "comment out). Then uncomment the input, comment out the robot arm (except the end effector, of course), and see if the end effector is in the same position. If it's not, there's your problem. Adjust your default input/robot joint angles as required to get the two to mesh.

Title: Error in simmechanics matlab while doing inverse dynamics using custom joint

Body:
I am doing inverse dynamics in Matlab simmechanics in which position and orientation will be input to the end effector.
But it shows error as below.

Error originates in Mechanical block rob33/Subsystem2/Subsystem1/Custom Joint. The coordinate systems attached to this joint must lie on the prismatic axis (for 1 axis) or in the plane of the prismatic axes (for 2 axes). If joint has no prismatic axes, the attached coordinate systems must be collocated, within tolerances.

Model is given below.

In subsystem1, I used custom joint to give orientaion input. Susystem1 model and  custom joint block parameters is given below figure.

Parameters of link1-1 and parallel constaints is given in below figure.

How do I correct this error?


问:
What is the direction of current flowing through the freewheeling diodes in H-bridge if I use BJT?
I am new to electronics.the question is buzzing in my head since i first saw the H bridge configuration.please answer the question briefly

答:
Basically (in reality anything have a sligth aspeact of everything else, nothing is ideal) the DC motor is mainly inductance in serie with small resistance.

Your typical use is close Q2+Q3 and send PWM to Q1+Q4 (or vice versa).

When PWN is on, Q1+Q4 are open and current goes to DC motor from left to rigth. It start to rotate (or increase rotation when rotating) (slowly as incductace resist change of current, mechanical inertia also works against change). Nothing fancy here. Current goes PWR-Q1-DC-Q4-GND

Then the PWM goes down, Q1+Q4 closes, but morot is rotating (mechanical inertia) and its inductance tries to force current thru from left to right. At the moment it behave as dynamo (or a battery) and voltage goes so high so to force the current of the same value and direction.

And now the diodes kick in. On DC there is - on the left and + on the right (as on baterry forcing the current the same way) and when it reach some limit D2 opens (as there is minus under GND 0 V voltage on the DC left) and the D3 opens (as there is voltage higher than PWR on DC right) and the current flows thru DC in the same way back to main battery. GND-D2-DC-D3-PWR.

But the DC (and everything else) have some resistance, which burns the energy and its inductance have only limited capacity (even if enforced by mechanical inertia of rotating motor) so the current goes slowly down (and will stop eventually as the DC motor would slower so much, that there would be not enought voltage to open diodes and overcome main battery at the same time).

But your PWM goes up again much sooner thant this stop happens, so the DC just slows a little and those Q1 and Q4 opens and main battery suplies current again which forces the DC to rotate faster.

The rate (speed) of PWM is so fast, that mechanical inertia makes that invisible and only statistical difference matters here.

Dependind on the time the PWM is on(up) and time it is off(down) the DC motor have just part of the maximal possible power and so its rotation is slower then maximal possible. As on open Q1+Q4 there is full current from battery it have much better force to move, than if you limit the current with eq. resistor. (if goes full strenght for moment, then no strenght at all instead of going only half streng all the time - so it is able to overcome more resist of environment, even if it is not able to rotate fast)


答:
keep it simple:

when A is H-Level and B L-Level then Q1 and Q4 are in the  saturation region so the current flows in the direction as follow:

on the other option: A is L-Level and B H-Level

the rest of the options: A=B= H-Level or A=B= L-Level are not going to move the motor

Title: What is the direction of current flowing through the freewheeling diodes in H-bridge if I use BJT?

Body: I am new to electronics.the question is buzzing in my head since i first saw the H bridge configuration.please answer the question briefly


问:
sendTransform() takes exactly 6 arguments (2 given)
I was trying to run this tutorial in python code, but i got above error when i try to run it. My python converted program of given tutorial is:

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

import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
import tf
import geometry_msgs.msg
import math

def talker():
    pub = rospy.Publisher('joint_states', JointState, queue_size=1)
    rospy.init_node('state_publisher')

broadcaster = tf.TransformBroadcaster()
rate = rospy.Rate(30) # 10hz
M_PI = 3.145
degree = M_PI/180;

# robot state
tilt = 0
tinc = degree
swivel=0
angle=0
height=0
hinc=0.005

# message declarations
t = geometry_msgs.msg.TransformStamped()
hello_str = JointState()
t.header.frame_id = "odom"
t.child_frame_id = "axis"

while not rospy.is_shutdown():
    # update joint_state
    hello_str.header.stamp = rospy.Time.now()
    hello_str.name = ['swivel','tilt','periscope']
    hello_str.position = swivel
    hello_str.velocity = tilt
    hello_str.effort = height

    t.header.stamp = rospy.Time.now()
    t.transform.translation.x = math.cos(angle)*2
    t.transform.translation.y = math.sin(angle)*2
    t.transform.translation.z = .7
    #t.transform.rotation = tf.createQuaternionMsgFromYaw(angle+M_PI/2)
    t.transform.rotation = tf.transformations.quaternion_from_euler(0, 0, angle)
    # send the joint state and transform
    pub.publish(hello_str)
    broadcaster.sendTransform(t)

    # Create new robot state
    tilt += tinc
    if (tilt<-.5 or tilt>0):
       tinc *= -1
    height += hinc
    if (height>.2 or height<0):
      hinc *= -1
    swivel += degree
    angle += degree/4

    rate.sleep()

if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass
</code>```

How can i remove this, i am using ros indigo. Even if i change that line with :

broadcaster.sendTransform((0.5,1.0,0),tf.transformations.quaternion_from_euler(0, 0, angle+M_PI/2),rospy.Time.now(),"odom","axis")
Its not working. Than it shows error:

```<code> field position must be a list or tuple type
[state_pub-2] process has died [pid 11654, exit co
</code>```

答:
"transformations", if I remember right was initially part of an external script, where quaternion_from_euler returns a numpy array of four values.

https://w3.cs.jmu.edu/spragunr/CS354_S14/labs/tf_lab/html/tf.transformations-module.html#quaternion_from_euler

https://gist.github.com/baalexander/5225140

sendTransform on the other hand, expects a list of values for the rotation argument. The way you're passing the rotation part right now, as the output of quaternion_from_euler would cause a numpy array to be passed instead of a list. You'd probably have to load the numpy array contents manually into a list and pass it to sendTransform.


问:
Baby Child Following Robot
I am Planning to make a crawling bot which will follow a baby,having a pillow on the board.The Problem with the project is:
Suppose a case when the baby falls, the bot should come exactly at the place where the baby's head will hit the ground?
Any idea of how i can make the bot move to that point before the baby's head hit the ground ?</p>

答:
Start first with a robot that can "come exactly at the place" where you throw a ball.
Once you have that, you will gain experience necessary to create the other phase of the project (going towards the baby).
Start simple, then make it more complicated.
Start with a four-wheeled robot (or maybe three-wheeled).</p>

Title: Baby Child Following Robot


问:
Very slow calculations of link orientation for 6DOF IK
I have written a matlab code to solve IK for 6 DOF robotic arm. I use Newton method to numerically solve IK. Also i use Tikhonov regularization to hand bad conditioned Jacobians. It works fast and reliable when i want just to move the last link in certain position, when i use difference between X,Y,Z coordinates as condition to interrupt loop of Newtoon method. But when i want also to get into the right orientation (use difference between Euler angles as interrupt condition) it takes a very long time 2, 5, 10 minutes even more, regardless i want to get to the right coordinates also or not. So there are questions:

How can i accelerate calculations, or why is it so slow?

Can i use quternions instead of Euler angles? Quternions will increase dimension of Jacobian so it will not be a square matrix anymore and it will not be possible to use Tikhonov regularization that works so good.

How often people use numerical methods to solve such things? I saw may examples of using analitycal solutions but not numerical.

How to get sure that programm will find solution using Newton method and programm will find it in finite number of interations?

UPD: here is my matlab code, that was rewritten using damped least squares method and quaternion. But still i have the same problem.
In this code we move along trajectory, but we can remove it and try to jump directly to the destination point.

```<code>%Derivative step for Jacobian composing
step = 0.01;

%Generalized coordinates for start position
q_prev = [34; 89; 1; 1; 89; 0];

%Generalized coordinates for end position. To be sure we can reach it
q_fin = [170; 150; 120; 156; 9; 158];

%get_coordinates() function returns 4x4 matrix of homogeneous transformations. It contains forward kinematics equations
%Coordinates we are at
A_forward = get_coordinates( q_prev );

%Coordinates we need to reach
Dest = get_coordinates( q_fin );

%Getting rotation matrices for start and finish positions
rotmat_curr = A_forward(1:3, 1:3);
rotmat_dest = Dest(1:3, 1:3);

%Matrix_to_quat() - is my analog of rotm2quat() function
%Getting quternions for start and finish positions
quat_curr = matrix_to_quat(rotmat_curr);
quat_dest = matrix_to_quat(rotmat_dest);

%Next steps are not inmportant, but i still comment them

%Here i make a trajectory, and move along it with small steps. It was
%needed for Newton's method but also useful if it is needed to move along a
%real trajectory
                       %X coordinate    Y coordinate    Z coordinate    Quaternion
coordinates_current = [ A_forward(1,4); A_forward(2,4); A_forward(3,4); quat_curr ];
coordinates_destination = [ Dest(1,4); Dest(2,4); Dest(3,4); quat_dest ];

%Coordinate step
step_coord = 5;

%Create table - trajectory
distance = sqrt( (coordinates_destination(1) - coordinates_current(1)).^2 + (coordinates_destination(2) - coordinates_current(2)).^2 +(coordinates_destination(3) - coordinates_current(3)).^2 );

%Find out the number of trajectory points
num_of_steps = floor(distance / step_coord);

%Initialize trajectory table
table_traj = zeros(7,(5*num_of_steps));

%Calculate steps size for each coordinate
step_x = (coordinates_destination(1) - coordinates_current(1)) / num_of_steps;
step_y = (coordinates_destination(2) - coordinates_current(2)) / num_of_steps;
step_z = (coordinates_destination(3) - coordinates_current(3)) / num_of_steps;
step_qw = (coordinates_destination(4) - coordinates_current(4)) / num_of_steps;
step_qx = (coordinates_destination(5) - coordinates_current(5)) / num_of_steps;
step_qy = (coordinates_destination(6) - coordinates_current(6)) / num_of_steps;
step_qz = (coordinates_destination(7) - coordinates_current(7)) / num_of_steps;

new_coord = coordinates_current;
%Fill trajectory table
for ind = 1:num_of_steps
    new_coord = new_coord + [step_x; step_y; step_z; step_qw; step_qx; step_qy; step_qz];
    table_traj(:,ind) = new_coord;
end;

%Set lambda size. I found out that algorithm works better when lambda is
%small
lambda = 0.1;

%In next steps i inialize Jacobian, build new destination matrix, calculate
%orientation error at the first step. As orientation error i use max
%element of quaternions difference.
for ind = 1:num_of_steps
    J = zeros(7, 6);

    %quat_to_matrix() - analog of quat2rotm() function
    rot_matr = quat_to_matrix(table_traj(4:7, ind));

    Dest = [ rot_matr, table_traj(1:3, ind);
             0, 0, 0, 1  ];

    %mat_to_coord_quat() function takes matrix of homogeneous
    %transformations and returns 7x1 vector of coorditaes
    %X Y Z and quaternion
    differ = mat_to_coord_quat(Dest) - mat_to_coord_quat(A_forward);
    error = max(abs(differ(4:6)));

    %Here is the algorithm. It works until we have coordinates and
    %orientation error less that was set
     while (abs(differ(1)) > 0.05) || (abs(differ(2)) > 0.05) || (abs(differ(3)) > 0.05) || error > 0.01

         %first - calculating Jacobian
         for ind2 = 1:6  %for every coordinate
                %Calculating of partial derivatives:
                q_prev_m1 = q_prev;
                q_prev_m1(ind2) = q_prev_m1(ind2) - step;
                q_prev_p1 = q_prev;
                q_prev_p1(ind2) = q_prev_p1(ind2) + step;
                Fn1 = mat_to_coord_quat(get_coordinates(q_prev_m1)); % in q_prev vector ind1 element is one step smaller than in original q_prev
                Fn2 = mat_to_coord_quat(get_coordinates(q_prev_p1)); % in q_prev vector ind1 element is one step bigger than in original q_prev
                deltaF = Fn2 - Fn1; %delta functions vector
                deltaF = deltaF/(2*step); %devide by step to get partial derivatives for every function
                %composing Jacobian from column of partian derivatives
                J(:,ind2) = deltaF;
        end;
        %Next according to damped least squares method
        %calculate velosities along all coordinates
            A_forward = get_coordinates( q_prev );
            differ = mat_to_coord_quat(Dest) - mat_to_coord_quat(A_forward);

            %calculating generalized coordinates velosities
            dq = (J.'*J + lambda * eye(6))\ J.' * differ;

            %integrate generalized coordinates velosities
            q_prev = q_prev + dq;

            %calculate max orientation error
            error = max(abs(differ(4:7)));
    end;
end;
</code>```

答:
How can i accelerate calculations, or why is it so slow?

I think the reason it is really slow is that your calculated joint velocities do not steer the system towards a solution. Consider the time derivative of the forward kinematics equation

$$
\begin{bmatrix}
v\\ \omega
\end{bmatrix} =
\begin{bmatrix}
J_v\\ J_\omega
\end{bmatrix}
\dot{q},
$$
where $v, \omega$ are the end-effector linear and angular velocities, respectively, and $J_v, J_\omega$ map the joint velocity to $v, \omega$ respectively. Difference in X, Y, Z coordinates is actually $v$ in the above equation, that is why you can get $\dot{q}$ (or rather $dq$) that drives the system towards the correct position.

Now the problem is that the difference in Euler angles do not give you angular velocity suitable to use in the above equation. Changing the orientation representation to axis-angle representation should solve the problem.

Can i use quternions instead of Euler angles? Quternions will increase dimension of Jacobian so it will not be a square matrix anymore and it will not be possible to use Tikhonov regularization that works so good.

Yes, you can. But the lower part of the Jacobian, i.e., $J_\omega$, needs to be changed to something like $J_{quat}$ which is a $4 \times n$ matrix ($n$ is the dimension of the joint vector). So the velocity equation above will be

$$
\begin{bmatrix}
v \\ u
\end{bmatrix} =
\begin{bmatrix}
J_v\\ J_{quat}
\end{bmatrix}
\dot{q},
$$
where $u$ can be thought of as a difference in quaternion. (Actually OpenRAVE does have a function for calculating Jacobians suitable to use with quaternions.) It's true that the overall Jacobian will then not a square matrix but as far as I know, that should not prevent you from using Tikhonov regularization.

How often people use numerical methods to solve such things? I saw may examples of using analitycal solutions but not numerical.

I'm not sure how most people do but solving for IK solutions numerically is useful when one needs their robot to track some end-effector trajectory. Although one may be able to solve for an IK solution analytically, there can be multiple solutions for a single end-effector pose and it is not obvious how one can choose a solution for each time step such that the resulting joint trajectory is smooth. Instead, the IK solution for the consecutive time step along the trajectory is computed numerically by using a differential IK method, which is actually based on the Jacobian equation above.

How to get sure that programm will find solution using Newton method and programm will find it in finite number of iterations?

Convergence of Newton method depends on a number of factors. I'm not sure if we can have such universal criteria.


问:
What would be the best way to handle food grains?
I'm trying to handle food grains like rice, wheat in an automated way (to cook simple dishes). For this I have to transfer grain from a larger container to a weighing scale. I know I can use solenoid valves for liquids but all solid handling valves seem to be too big (gate valves etc) and for larger applications. Is there any better way to do this ? </p>

答:
There are all sorts of mechanisms for handling dry goods. If you want to do it on a small scale, look to industrial devices for inspiration, but consumer and retail devices for quick solutions. For example, there are quite a few cereal dispensers on on the market like this Zevro cereal dispenser:

Industrial systems often use augers to measure and move dry materials. I don't see why you couldn't build a small scale delivery device using a cheap auger bit rotating inside a pipe sized to fit the bit:

Dry goods are often measured by weight, so you might want to think about ways to weigh grains and similar materials. There are lots of cheap digital scales with a range of about 0-5kg and accurate down to a few grams. You could try to integrate one of those into your project directly, or cannibalize it for its load sensor, or even build your own load sensor. It'd be easy to put a small hopper on a scale to measure the material, use a simple gate to start and stop the flow of material into the hopper, and a solenoid to dump the hopper into a chute that delivers it for preparation.


答:
That is because in Python, the function sendTransform has interface a but different from the same function in C++.

If you run the following code:

```<code>import tf
br = tf.TransformBroadcaster()
br.sendTransform?
</code>```

you will see that sendTransform should be called like this:

br.sendTransform(translation, rotation, time, child, parent)

You may have a look at this page for an example code.

Title: sendTransform() takes exactly 6 arguments (2 given)

Body:
I was trying to run this tutorial in python code, but i got above error when i try to run it. My python converted program of given tutorial is:

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

import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
import tf
import geometry_msgs.msg
import math

def talker():
    pub = rospy.Publisher('joint_states', JointState, queue_size=1)
    rospy.init_node('state_publisher')

broadcaster = tf.TransformBroadcaster()
rate = rospy.Rate(30) # 10hz
M_PI = 3.145
degree = M_PI/180;

# robot state
tilt = 0
tinc = degree
swivel=0
angle=0
height=0
hinc=0.005

# message declarations
t = geometry_msgs.msg.TransformStamped()
hello_str = JointState()
t.header.frame_id = "odom"
t.child_frame_id = "axis"

while not rospy.is_shutdown():
    # update joint_state
    hello_str.header.stamp = rospy.Time.now()
    hello_str.name = ['swivel','tilt','periscope']
    hello_str.position = swivel
    hello_str.velocity = tilt
    hello_str.effort = height

    t.header.stamp = rospy.Time.now()
    t.transform.translation.x = math.cos(angle)*2
    t.transform.translation.y = math.sin(angle)*2
    t.transform.translation.z = .7
    #t.transform.rotation = tf.createQuaternionMsgFromYaw(angle+M_PI/2)
    t.transform.rotation = tf.transformations.quaternion_from_euler(0, 0, angle)
    # send the joint state and transform
    pub.publish(hello_str)
    broadcaster.sendTransform(t)

    # Create new robot state
    tilt += tinc
    if (tilt<-.5 or tilt>0):
       tinc *= -1
    height += hinc
    if (height>.2 or height<0):
      hinc *= -1
    swivel += degree
    angle += degree/4

    rate.sleep()

if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass
</code>```

How can i remove this, i am using ros indigo. Even if i change that line with :

broadcaster.sendTransform((0.5,1.0,0),tf.transformations.quaternion_from_euler(0, 0, angle+M_PI/2),rospy.Time.now(),"odom","axis")
Its not working. Than it shows error:

```<code> field position must be a list or tuple type
[state_pub-2] process has died [pid 11654, exit co
</code>```

Body:
That is because in Python, the function sendTransform has interface a but different from the same function in C++.

If you run the following code:

import tf
br = tf.TransformBroadcaster()
br.sendTransform?

you will see that sendTransform should be called like this:

br.sendTransform(translation, rotation, time, child, parent)

You may have a look at this page for an example code.


问:
Using Standard Digital camera for Computer Vision
For a University project I have to use computer vision to detect small drones within 40 feet. I know there exists a pixycam for this purpose, but I was not happy with it, when I used it for CV.

I have a normal digital camera which is 16 Megapixels (pic & video), which I don't use anymore. Before I dissect the camera, I was wondering if it is practically possible to train this digital camera for computer vision - detecting small flying drones.  Any thoughts on this - using a digital camera for CV?

Thanks

答:
If the university project is not directly about making a drone detection system using visual technic, it may not be worth the effort to connect the "camera" to the computer. (You may have to install new drivers, etc).

However, technically it's quite possible to run a feature-detection-code once you can integrate the camera to that code. There are several open source and free (as in freedom) image / video processing algorithms that are able to detect features. See GitHub for some examples.

However, they are not tuned for drones. You could help out others by sharing your experience; be it in academic studies or open sharing.

The problem with visual detection is that it will not detect drones at poor visibility conditions, night, fog etc. Implementing an IR camera could help a little.


答:
Let's first assume that the baby can move in all directions but fall only backwards. Under this assumption, the robot would need to track two things (1) the position of the baby (2) the direction of movement (so that it could always position itself behind the baby

Next it would need to be able to recognise when the baby is losing balance and predict where exactly the baby would fall. Finally it would have to carry out some basic inverse kinematics to get its end-effector to put the pillow in the right position.

To accomplish this you would probably need to use a visual tracking library like OpenCV. To process the data you would need a reasonably fast, lightweight computer such as a Raspberry Pi and finally a microcontroller like an Arduino to command the wheels and the servo actuators.

If on the other hand, the baby is allowed to fall in ANY direction, then there is no way of accomplishing this with ANY robot that does not SURROUND the baby at all times.

But most importantly, I think putting human babies and electronics/ wiring/ high power batteries/ metal frames in close proximity is not a very good idea.

Title: Baby Child Following Robot

Body:
I am Planning to make a crawling bot which will follow a baby,having a pillow on the board.The Problem with the project is:
Suppose a case when the baby falls, the bot should come exactly at the place where the baby's head will hit the ground?
Any idea of how i can make the bot move to that point before the baby's head hit the ground ?</p>


问:
What stepper motor driver to use?
I want to control a DVD drive's stepper motor with an arduino uno, but at the moment I'm not sure what kind of motor driver will work for that.

I am currently looking at this one

I have no idea about the specs of a motor driver, so any help would be greatly appreciated!

答:
The A4988 is an excellent choice to drive a stepper motor. It supports step resolution upto 1/16 of a step and can be set up so that it uses just two of your Arduino's pins. Each A4988 can drive one stepper motor with input voltages upto 35V and current draw upto 2A.

Highly recommended for your project.

Here is a sample pin-out you could use to drive a stepper motor...

Vdd - 5V

GND - GND

Vmot - DC power source for your motor (Upto 35V)

1A,1B - To stepper motor first winding

2A,2B - To stepper motor second winding

Connect RESET and SLEEP together

Step - Any Arduino digital pin (stepPin)

Dir - Any Arduino digital pin (dirPin)

To control the motor direction, use digitalWrite(dirPin, HIGH); and digitalWrite(dirPin, LOW);

To step the motor use

digitalPin(stepPin, HIGH);
delayMicroseconds(500);
digitalPin(stepPin, LOW);
delayMicroseconds(500);

If you want to control the step resolution, you need to set the MS1, MS2 and MS3 pins HIGH/LOW according to Page 6, Table 1 of the A4988 datasheet.

Title: What stepper motor driver to use?


问:
Nearest-neighbor data structure for non-Euclidean configuration space
I'm trying to implement a nearest-neighbor structure for use in an RRT motion planner. In order to do better than a linear brute-force nearest-neighbor search, I'd like to implement something like a kd-tree. However, it seems like the classical implementation of the kd-tree assumes that each dimension of the space can be split into "left" and "right". This notion doesn't seem to apply to non-Euclidean spaces like SO(2), for instance.

I'm working with a serial manipulator arm with fully rotational links, meaning that each dimension of the robot's configuration space is SO(2), and therefore non-Euclidean. Can the kd-tree algorithm be modified to handle these kinds of subspaces? If not, is there another nearest-neighbor structure that can handle these non-Euclidean subspaces while still being easy to update and query? I also took a look at FLANN, but it wasn't clear to me from their documentation whether they can handle non-Euclidean subspaces.

答:
You are correct that kd-trees typically only work in small, Euclidean metric spaces. But, there is lots of work for general nearest neighbor applications in metric spaces (anywhere you can define a distance function essentially).

The classic work is on ball trees, which then were generalized to metric trees.

There is some newer work called cover trees which even has GPL'ed code. I have wanted to look into the performance characteristics between these trees and kd-trees for more than two years now.

Hopefully, that fits your application.


问:
Is it better to have weight distributed over the wheels or the center of the robot?
When designing a standard 4 or 6 wheel robot, is it better to have the weight distributed primarily in the center of the robot, or over the wheels, or is there no difference?

Specifically, which weight distribution will make the robot less likely to tip over?

答:
Assuming it is a rigid robot, then the only weight properties of interest is:

the total mass

the centre of mass

In terms of tipping over, the robot is more stable if the angle required before tipping over is maximized. This is achieved by having a low centre of mass, and a centre of mass as far away from the edges of the support polygon as possible.

Intuitively, you can see that if the centre of mass is near the centre of the robot, it is more stable. More formally, if you consider each wheel to be the vertex of a polygon (from a top view), then you will see a support polygon. You can designate the centre to be the point furtherest away from an edge.

Another way to increase stability is to increase the size of the support polygon - that is, place the wheels further out to form a wide base. Adding more wheels can also increase the size of the support polygon, although this mostly impacts three wheeled robots, which have quite a small support polygon relative to the distance between the wheels.

The angle required for the robot to tip may depend on the direction of tipping. If there is movement along that direction, then disturbances are more likely in that direction. That is why cars are more stable forward/backwards, compared to sideways (roll axis), with front wheels further from the rear wheels as compared to the distance between left and right wheels.

The total mass of the robot is also a factor. If the robot is heavier, then a larger disturbing force is required to tip the robot to the required angle before it will continue to tip over. Having said that, you are unlikely to want to simply increase robot mass, so you will:

try to place heavier components lower (batteries can be quite heavy)

increase the size of the support polygon (wheels further out, or 4 wheels instead of 3).


问:
Jacobian Matrix and joint dependecies
I'm working with a robotic arm and needed to compute the jacobian matrix of it in order to send torque commands. THe arm has 6 joints all revolute. After calculating the jacobian matrix from the DH parameters provided in the datasheet, I noticed that the jacobian has dependency only from the first five joints.
The sixth joint corresponds to the hand which only rotates over itself. My question here is: Can the jacobian have no dependency from a joint? On which cases can this happen?

Thanks

答:
The Jacobian matrix itself can sometimes not contain some joint variables. See, for example, this textbook, p.115, where they derive the Jacobian for a SCARA manipulator.

The thing is that even though the Jacobian itself does not contain, for example, the $6^\text{th}$ joint variable, that joint still can contribute to changes in position and orientation of the end-effector. Consider the equation

$$
\begin{bmatrix}v \\ \omega\end{bmatrix} = J(q)\dot{q},
$$
where $v$ and $\omega$ are the end-effector linear and angular velocities, $\dot{q}$ is the joint velocities, and $J$ is the Jacobian (in your case it should be a $6 \times 6$ matrix). If you examine closely, you can see that your $6^\text{th}$ joint can still contribute to $v$ and $\omega$ via the last (right-most) column of $J$.

A Jacobian can be seen as how each joint (velocity) contributes to the end-effector velocities. When a Jacobian does not contain some particular joint variable, it means that the joint configuration does not really affect how other joints can contribute to end-effector velocities.

Title: Jacobian Matrix and joint dependecies


问:
Balancing robot tuning approach
I'm at the stage where I assembled a balancing robot and it's not maintaining a stable position. This is not a surprise I just started testing last night.

My code is here, views of the device are here.

Briefly, it's based on a teensy 3.2, a brushless motor controller that receives I2C commands that drives brushless gimbal motors. It uses an MPU9250 for angle measurement. I'm using PID control, and I made a tkinter-based interface that allows me to send it P/I/D values for realtime testing. I plan on implementing a bluetooth based serial to reduce wires going to the device.

At this stage I'm not asking people for specific help on debugging what's going wrong, I'm asking about a general strategy for testing. I have used the RAM on the teensy before to record PID response time and then send that data to pyplot, which was very informative before. I was wondering if it would be a good idea to detach my wheels and mount the motors to a rigid pedestal - and to do some PID tuning using that system to tweak the wobbliness/stability. My reasoning being "hey if I can't get this thing to stay upright when it's rigidly mounted to the bench, why would it work when it's got wheels on it?"

Are there any comments on this strategy, and would anyone want to offer other ways to go at the problem at this point? Yes, I've read the many posts on PID tuning, I'll follow them as best I can.

I can post pictures and other code examples but newbies only get to put two links into the OP.

答:
Well assuming you are using a filter(Kalman or Complementary) for the IMU, the PID tuning can be quite a cumbersome task. There is not a fixed end approach on tuning your PID. It took my Self-Balancing Robot three days to tune. But here is a general tuning strategy you could use:

Set your Ki and Kd to zero and tune your Kp such that it is just able to balance itself with large oscillations.

Start with your Kd and see to that the oscillations are going away.

Now comes the optimisations and the hard part. You have to now fine tune both Kp and Kd so that oscillations go away and robot is able to balance.

Using the Ki is quite tricky as it slows down your system as you are continuously adding a term. I haven't played much with the Ki term, though people now and then have used it.

Title: Balancing robot tuning approach


问:
Explanation of Quadcopter Dynamics, Components and Control
I am about to build my own quadcopter from scratch. However i am having problem with understanding how it is possible to control the quadcopter without knowing the current rpm of the BLDC motors. According to my understanding the rpm is needed to calculate thrust force etc. in the mathematical model, which will be used for regulation.

The ESCs I have seen have two wires to connect them to the flight controller. The first one is GND and the second is signal wire, which are used for sending PWM signal- no information about the motor speed. There is also the  IMU unit, which provides information about the acceleration of the whole aircraft- but again no information about the motor speed.

I would be grateful if someone could explain it in details how this is.

答:
You're right. You should know the rpm of your propellers to build a mathematical model of your quadcopter and if you already have a mathematical model of your brushless DC motors you could compute them based on the PWM signal that you send to the motors (plus other factors depending on how much the model is accurate). This complex model is useful for simulations but it's not necessary to control your system in a real environment.

As answered before, to actually control your system the controller doesn't need the rpm values of you propellers but only the values of the trust. You can use a PID controller based only on the values given by your IMU.

For a more complex controller you may need approximated relationships between trust and PWM signal but I don't think that exists any controller that rely on rpm of the propellers, it will be a waste of computational resources.


问:
What is the wire used for hand movement of robot called ? where can I find it online ?
I am looking for a specific name of the wire used for the robotic arm movement control and where can I find some of this online. I want to control it using the micro controller so please suggest some good development kit.</p>

答:
If I understood correctly, you are referring to robotic tendons.

There is a lot of material on the subject if you search google.


问:
How to model transition matrix in indirect kalman filter with external orientation estimate
I am trying to implement an indirect/error state kalman filter following Quaternion kinematics for the error-state Kalman filter.
However, instead of modelling the orientation and error in orientation I have chosen to utilize Madwick to estimate the orientation.

The problem is that when I create the transition matrix from the first paper it expects the orientation error which it multiplies with the skew matrix of the measured acceleration and the accelerometer bias (page 40, equation 204). Since I have removed that from my states I can't use it, but then the measured acceleration is never considered (which I assume makes the filter worse). Is there any change I can make to the transition matrix so that it accounts for the acceleration?

答:
After careful reading of the first paper I think the solution to the problem is to simply not include the multiplication. From the proof of 172b and equation 177, in my filter I have $R_t$ (since I get that from the Madgwick filter) and can simply apply that to the error state. So equation 195b is instead $\delta v  = \delta v - (R\delta a_b - \delta g)\Delta t + \mathbf{v_i}$, note that we don't multiply with $\theta$ since the Madgwick filter models that error.

The transition matrix does then not have to include any terms related to $\theta$ which means we only relate error in speed with error in accelerometer $\delta a_b$ and error in the gravity vector $\delta g$. In essence we remove the skew matrix multiplication.

Edit: I will hold of accepting this answer either until I have a chance to try the improvement or until someone else can vouch for it. Other answers are very welcome!

ContentLicense: CC BY-SA 4.0


问:
Can i use a predictive kalman filter to 'increase' my sample rate?
I have a slam algorithm that outputs at around 30Hz, an implementation of ORBSLAM2.

https://github.com/raulmur/ORB_SLAM2

I am reading this into a renderer that expects 60+ Hz.

Because my sample speed is low, I am getting 'shuddering' in the display, as the renderer adds linear 'steps' between the samples.

For example, I am seeing a result like:

```<code>time   sample    result

1         20          20
2         n/a         20
3         n/a         20
4         22          22
5         n/a         22
6         n/a         22
7         24          24
8         n/a         24
9         n/a         24
</code>```

What i need to do, is predict the next sample, and fill in the gaps, so to speak, so that I end up with something like:

```<code>time   sample    result

1         20          20
2         n/a         20.66
3         n/a         21.33
4         22          22
5         n/a         22.66
6         n/a         23.66
7         24          24
8         n/a         24.33
9         n/a         25.66
</code>```

I need to predict 6DOF, for which i have translation xyz, and a quaternion xyzw.
But if I can find a way to predict even one axis, for a start, that would be great.

I have the data outputting as xyz and xyzw, at around 30Hz. I also have an xsens IMU, which i am using to pass in an initial rotation value.

Can i use a predictive filter for this purpose? Is a kalman suitable?

I am looking at:

https://github.com/simondlevy/TinyEKF

and a Bayes filter:

http://bayesclasses.sourceforge.net/Bayes++.html

But am a little out of my depth.

Thank you, please ask if I have not made sense!

答:
In this situation, you probably shouldn't use a Kalman filter for "filling" in the gaps. Typically, you use a Kalman filter (or Bayes filter etc...) to fuse information from different sources.

In your case, you have are using SLAM for localization. The SLAM algorithm is taking in data and estimating the pose of the camera as well as a sparse 3D reconstruction of the environment. Internally, this probably already performs some type of prediction/update for tracking etc...

The problem you are having is that the algorithm is only running at 30Hz, and you need 60Hz of pose data if I understand correctly. If I were you, I would take the states (position and velocity) at each time step and propagate them forward (at 60Hz).

To propagate them forward, I mean integrate your pose using your previous state estimates. For example, if your states were x position, y position, x velocity, and y velocity, then you can assume your velocity is constant and propagate your position using that velocity.

$$x_{k+1} = x_k + v_{x,k} \Delta t$$

$$y_{k+1} = y_k + v_{y,k} \Delta t$$

Note that you will need to write out the equations for your system. In the above equations, the $k$ is the previous time step, and $\Delta t$ is the change in time between the previous time step and the current time step. Once you receive another measurement from the SLAM algorithm, use that measurement instead of the propagated state, then repeat. You can keep the intermediate propagated states, but you don't want to perform an update because your propagated states are not based on sensor measurements. So, basically in between the measurements you get from ORBSLAM, you will have these intermediate measurements.

Edit: Keep in mind that the question you asked is about how to fill in the gaps given low frequency data. I am assuming you do not have extra sensors such as IMU, GPS, encoders, etc... Regardless, if additional sensors are available, this still doesn't address how to obtain data at a higher frequency (although it is likely the IMU will operate above 50Hz). I am suggesting an approach to fill in missing data without adding complexity to your system. Assuming constant velocity is reasonable if the motion isn't highly dynamic. If you do have additional sensors you want to incorporate, I think you would want to reconsider your overall approach because you can use IMU and encoders to improve the feature tracking and reconstruction.


答:
Short answer, yes, if you use your IMU to fill in the gaps.

You can use additional Bayesian filtering to fill in the pose gaps as long as you fuse in your IMU data. The IMU (assuming it has reasonable covariance and frequency) will be closer to the ground truth between the gaps than the forward propogation cBEiN recommends. cBEiN gives the solution for constant velocity between frames, but if you can't assume your robot has zero acceleration or angular acceleration (e.g. it's vibrating) between frames, you have all the tools you need at your fingertips in your trusty IMU. There's not so much drift creating a full state estimate in just 33ms. Integrating the IMU data to create poses between fused states (that is, state estimates made using both IMU and visual data) can fill in the time between your visual frames. An additional benefit is that it will account for sharp accelerations that are too blurry on camera to properly estimate your pose. These are situations which would often result in loss of localization, but by feeding the fused estimate back into your visual SLAM when its covariance is better than the visual odometry's covariance, it ought to put you back on track and prevent some of the major distortions that require additional loop closures to correct. Lastly, if you're using a depth camera, many of these cameras suffer from depth distortion during lateral movements or rotations, which can throw off your localization. If you notice these effects, it's again a great opportunity to fuse your IMU.

If you're using ROS, this is a great use-case for the robot_localization package.

Title: Can i use a predictive kalman filter to 'increase' my sample rate?

Body:
I have a slam algorithm that outputs at around 30Hz, an implementation of ORBSLAM2.

https://github.com/raulmur/ORB_SLAM2

I am reading this into a renderer that expects 60+ Hz.

Because my sample speed is low, I am getting 'shuddering' in the display, as the renderer adds linear 'steps' between the samples.

For example, I am seeing a result like:

```<code>time   sample    result

1         20          20
2         n/a         20
3         n/a         20
4         22          22
5         n/a         22
6         n/a         22
7         24          24
8         n/a         24
9         n/a         24
</code>```

What i need to do, is predict the next sample, and fill in the gaps, so to speak, so that I end up with something like:

```<code>time   sample    result

1         20          20
2         n/a         20.66
3         n/a         21.33
4         22          22
5         n/a         22.66
6         n/a         23.66
7         24          24
8         n/a         24.33
9         n/a         25.66
</code>```

I need to predict 6DOF, for which i have translation xyz, and a quaternion xyzw.
But if I can find a way to predict even one axis, for a start, that would be great.

I have the data outputting as xyz and xyzw, at around 30Hz. I also have an xsens IMU, which i am using to pass in an initial rotation value.

Can i use a predictive filter for this purpose? Is a kalman suitable?

I am looking at:

https://github.com/simondlevy/TinyEKF

and a Bayes filter:

http://bayesclasses.sourceforge.net/Bayes++.html

But am a little out of my depth.

Thank you, please ask if I have not made sense!


问:
CNC Programming - How to mill diagonal edge of a contour (CNC Simulator Pro)?
Hope this is the right place to ask.. I'm a Mechatronic Engineering student and am having difficulty programming the mill to cut diagonal edges of contours.  I've worked through this tutorial which I understand. The problem I'm having is milling around the outside of the diagonal edge, not on it.  I hope that makes sense. I'm unsure about the tool positioning at the start/end of cut, for example. Can someone explain how to do it? Thanks.

答:
The feature you are describing is called the cutter radius correction. You can activate/deactivate it with the G-codes G40, G41, G42.

These will displace the path with the radius of the active cutter in positive or negative direction.


问:
holonomic and non holonomic constraints in layman's term
I'm new to robotics and I've been reading some slides online regarding motion planning. Due to my lack of knowledge in mechanical engineering, I'm having a difficult time understanding what holonomic and non-holonomic constraints mean.

I saw a post here and it says Holonomic system is when a robot can move in any direction in the configuration space, and Nonholonomic systems are systems where the velocities (magnitude and or direction) and other derivatives of the position are constraint.

It seems like holonomic system differs from holonomic constraint. What is holonomic constraint and when do we need it? What is non-holonomic constraint and when do we need that?

Thanks in advance.

答:
A constraint on the $k$ coordinates $r_1,r_2,...,r_k$ is holonomic if it is an equality constraint of the form $$g(r_1,...,r_k)=0,$$ and nonholonomic otherwise. These sorts of constraints arise frequently in mechanical systems (e.g. when deriving Euler-Lagrange equations of motion). A holonomic system is one that is subject to holonomic constraints, and a nonholonomic system is one that is subject to nonholonomic constraints.

An example of a holonomic system is a sphere on a surface, which can roll in any direction. In contrast, a wheel on a surface without slipping is an example of a non-holonomic system because it cannot roll in any direction--it can only roll forward/backward at some heading.


问:
Compact 4 Node Raspberry Pi 3 Cluster for Robots?
Can a Compact 4 Node Raspberry Pi 3 Cluster be enough powerful to elaborate videostreaming input data in real time for a drone?

Thank you for any answer

答:
Possibly depending on what you want to do, one could be plenty powerful enough. I have done several projects using the Raspberry pi camera module and a single raspberry pi to do optical flow at several frames per second and had plenty of power left over to do other stuff.

But if you need it to go faster you could in theory split the processing over more than one raspberry pi by distributing the frames, but In reality I think the overhead of that would dominate unless processing was taking more than 1 second per frame. for the price of a 4 raspberry pi cluster (~\$190 after all the accessories and say at least 400g).

For that price and a lower weight you could get a much more powerful Nvidia Jetson TK1 (\$190 120g) which is powerful enough to apply deep neural networks, or stereo vision in real time and be much easier to use and develop with than some custom 4 raspberry pi solution


问:
Problem with vibrations in air bearing
We have an air bearing for a planar xy motion. Today it consists of four pockets according to picture.

In the current design there are no sealings around the peripheries of the pockets and we suspect that is the reason we get vibrations.

In the current design we control the pressure, same for all for recesses. The flow is adjustable individually for each recess. In practice it is very hard to tune it.

For the non recess surfaces we have used Slydway as we need to be able to operate it without pressure occasionally.

To try to solve the problem we plan to develop a prototype where we can try out the effect of using sealings around the periphery of the pockets. The idea is something like this:

Questions

Is the idea with adding sealings good? (sanity check)

Suggestions for sealings? (I'm thinking a porous material like felt or cigarette filter)

Of course all suggestions are welcome.

Edit

I'm going to try and add grooves around the recesses to evaquate the air that leaks. My thinking is that this will give us a more defined area under pressure.

答:
Non of the commercial air bearings I've seen have attempted to seal like this, so I think that your problems with vibration may lie elsewhere.

The problems I have seen with air-bearing systems have been related to mechanical over constraint.

A high performance linear bearing stage I once worked on used six bearings like these:

Arranged in 3 pairs like this: /\em_

Where /, \ & _ are a pair of bearings (side by side along the track), e was the encoder strip and m was a linear motor.

The problem that we had was that no matter how we tuned the servo loop, if it was tightly tuned enough to get up to the speed and acceleration we needed (3m/s & 2g) then the system would often get into a limit cycle (sometimes erroneously called resonance) when stopping (i.e. it would sit humming).

The way we solved this was to remove one of the air bearings on the / row, relocating it to the middle:

```<code>   Front view       Side
Unstable   Stable   view
  o o       o o      |o
   m         m       |m
   e         e       |e
  o o       o o      \o
  o o        o       /o
</code>```

By removing the excess constraint, we appeared to remove the tendency for a perturbation in one air bearing to affect another bearing and then ripple through to the other bearings.

Depending on your typical direction of motion and the flatness of your surface, you may find that a three point bearing system may work better for your system:

You may also want to consider purchasing commercial air-bearing modules and attaching them to a frame (at least for a prototype) rather than attempting to manufacture your own air bearings. That way you can leverage the knowledge and support provided by the air-bearing manufacturer.

One other point is that we used ordinary Polyimide tape on our air bearings. We considered various more permanent methods, but in the end decided that being able to easily remove old, scarred or scored tape and replace it with fresh tape quickly and easily made the most sense for our application.

Title: Problem with vibrations in air bearing

Body:
Non of the commercial air bearings I've seen have attempted to seal like this, so I think that your problems with vibration may lie elsewhere.

The problems I have seen with air-bearing systems have been related to mechanical over constraint.

A high performance linear bearing stage I once worked on used six bearings like these:

Arranged in 3 pairs like this: /\em_

Where /, \ & _ are a pair of bearings (side by side along the track), e was the encoder strip and m was a linear motor.

The problem that we had was that no matter how we tuned the servo loop, if it was tightly tuned enough to get up to the speed and acceleration we needed (3m/s & 2g) then the system would often get into a limit cycle (sometimes erroneously called resonance) when stopping (i.e. it would sit humming).

The way we solved this was to remove one of the air bearings on the / row, relocating it to the middle:

   Front view       Side
Unstable   Stable   view
  o o       o o      |o
   m         m       |m
   e         e       |e
  o o       o o      \o
  o o        o       /o

By removing the excess constraint, we appeared to remove the tendency for a perturbation in one air bearing to affect another bearing and then ripple through to the other bearings.

Depending on your typical direction of motion and the flatness of your surface, you may find that a three point bearing system may work better for your system:

You may also want to consider purchasing commercial air-bearing modules and attaching them to a frame (at least for a prototype) rather than attempting to manufacture your own air bearings. That way you can leverage the knowledge and support provided by the air-bearing manufacturer.

One other point is that we used ordinary Polyimide tape on our air bearings. We considered various more permanent methods, but in the end decided that being able to easily remove old, scarred or scored tape and replace it with fresh tape quickly and easily made the most sense for our application.


问:
GPS message: compute ephemeris data and pseudo-ranges from subframes
I have raw GPS data (see end of the question for details if you think the protocols are relevant), and I need to extract/compute ephemeris and pseudoranges (my goal is to replace the recursive least squares that the receiver solves to compute the position with a home-brewed method based on sensor fusion). Concerning the ephemeris, I have access to the 3 first subframes of each of the 25 frames of the GPS message. Documentations/books/etc that I have found just vaguely mention that the first subframe contains clock data, and the two others contain ephemeris data. However, none of them precisely says what the words in these subframes are, and how I can use them to compute orbital information (I'm assuming that I only want satellite positions?). Can anyone give me pointers to some references on how to do this? Or (even better), is there any open-source code that already implements this?

I really appreciate your help.

Details on the data: They have been transmitted by a Ublox EVK-7p using the UBX RXM-EPH and RXM-RAW protocols.

RXM-EPH: satellite ID (4 byes), HOW word (4 bytes), followed by three 32-byte arrays corresponding to subrames 1 to 3 of the GPS message.

RXM-RAW: time of week, week, num of satellites, reserved (?) , carrier phase, pseudo-range, doppler, and so on....

Update: I found this which seems to answer most of my questions. It is from 1995 though.

答:
The GPS standard has been the same since the first GPS satellites were launched, so sources from 1995 are very relevant In fact that is the document I would point you to. One of the best libraries for decoding GPS is gnss-sdr, You can look at how they are doing protocol decoding in order to get an idea of how to implement it.

Other docs I would point you would be the official GPS website and the interface control documents. There is a ton of useful information there.


问:
Accessibility distribution of three vector fields
I have to study the controllability of the kinematic model of a Cycab:

$\dot{q}=g_1(q)v+g_2(q)\omega_R+g_3(q)\omega_L$

where

$\dot{q}=\begin{bmatrix}\dot{x}\\\dot{y}\\\dot{\theta}\\\dot{\gamma}\\\dot{\phi}\end{bmatrix}$ $g_1(q)=\begin{bmatrix}cos(\theta+\gamma)\\sin(\theta+\gamma)\\\frac{sin(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$  $g_2(q)=\begin{bmatrix}0\\0\\0\\1\\0\end{bmatrix}$  $g_3(q)=\begin{bmatrix}0\\0\\0\\0\\1\end{bmatrix}$

with $x$ and $y$ the Cartesian coordinates of the midpoint of the rear segment joining the two rear wheels and $\theta$ the direction of the midpoints of the two segments joining the wheels centers with respect to the axis $x$. So, I have to study the accessibility distribution $\{g_1,g_2,g_3.[g_1,g_2],[g_2,[g_1,g_2]],...\}$ so I computed

$[g_1,g_2]=\begin{bmatrix}sin(\theta+\gamma)\\-cos(\theta+\gamma)\\\frac{cos(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$   $[g_2,[g_1,g_2]]=\begin{bmatrix}-cos(\theta+\gamma)\\-sin(\theta+\gamma)\\\frac{-sin(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$

so the rank of $[g_1,g_2,g_3,[g_1,g_2],[g_2,[g_1,g_2]]]$ is equal to 5 so we can say that the system is controllable.

Now, is it correct to study the accessibility distribution without using the vector field $g_3$, so is it correct to say that the system is controllable without using the vector field $g_3$?

答: I noticed that $g_1$ and $[g_2,[g_1,g_2]]$ are not linearly independent so I computed the Lie bracket $[g_3,[g_1,g_2]]$ that is equal to $\begin{bmatrix}0\\0\\\frac{-cos(\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$ and the rank of $[g_1,g_2,g_3,[g_1,g_2],[g_3,[g_1,g_2]]]$ is equal to 5 and the system should be controllable</p>


答:
Chow's Theorem states that:

The driftless system $$\dot q=g_1(q)u_1+...+g_m(q)u_m$$ is locally controllable at $q_0\in\mathbb{R}^n$ if $\text{rank}\bar\Delta(q_0)=n.$

Here, $\bar\Delta$ is the involutive closure of the distribution $\Delta=\text{span}\{g_1,...,g_m\}$ (i.e. the smallest involutive distribution containing $\Delta$). $\bar\Delta,$ also known as the Control Lie Algebra, is found by forming successively larger distributions by repeated computation of the Lie Brackets until an involutive distribution is found.

To answer your question, there is nothing about $\bar \Delta$ that requires the use of $g_3$ as long as $\bar \Delta$ contains $\Delta,$ so we can make statements about the local controllability without including $g_3$ in the distribution. Because this is a local result, you will have to prove that the system is controllable to any point in $\mathbb{R}^n$ in order to say that the system is controllable.

Title: Accessibility distribution of three vector fields

Body:
I have to study the controllability of the kinematic model of a Cycab:

$\dot{q}=g_1(q)v+g_2(q)\omega_R+g_3(q)\omega_L$

where

$\dot{q}=\begin{bmatrix}\dot{x}\\\dot{y}\\\dot{\theta}\\\dot{\gamma}\\\dot{\phi}\end{bmatrix}$ $g_1(q)=\begin{bmatrix}cos(\theta+\gamma)\\sin(\theta+\gamma)\\\frac{sin(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$  $g_2(q)=\begin{bmatrix}0\\0\\0\\1\\0\end{bmatrix}$  $g_3(q)=\begin{bmatrix}0\\0\\0\\0\\1\end{bmatrix}$

with $x$ and $y$ the Cartesian coordinates of the midpoint of the rear segment joining the two rear wheels and $\theta$ the direction of the midpoints of the two segments joining the wheels centers with respect to the axis $x$. So, I have to study the accessibility distribution $\{g_1,g_2,g_3.[g_1,g_2],[g_2,[g_1,g_2]],...\}$ so I computed

$[g_1,g_2]=\begin{bmatrix}sin(\theta+\gamma)\\-cos(\theta+\gamma)\\\frac{cos(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$   $[g_2,[g_1,g_2]]=\begin{bmatrix}-cos(\theta+\gamma)\\-sin(\theta+\gamma)\\\frac{-sin(\phi-\gamma)}{lcos(\phi)}\\0\\0\end{bmatrix}$

so the rank of $[g_1,g_2,g_3,[g_1,g_2],[g_2,[g_1,g_2]]]$ is equal to 5 so we can say that the system is controllable.

Now, is it correct to study the accessibility distribution without using the vector field $g_3$, so is it correct to say that the system is controllable without using the vector field $g_3$?


问:
Why are some motor shafts stiff while others spin freely when not powered?
Most servos and steppers I've worked with are able to spin manually when no power is applied, but I've come across a couple which are stuck in their position. I'm not sure if they are just very difficult to spin manually, or if they would break if forced.

For example, I have this stepper and servo which seem impossible to turn manually.

Is there a specification that would tell you whether or not the motor can spin without power?

答:
IMHO it depends on two factors:

if there is gear on the servo (so to motor rotates fast, the result is slow precise motion with high force), then moving it manually even little means to rotate the motor fast, which accumulats resistance araound the all way, multiplied by the gear ratio

if there is some electronics, then it can switch to "braking" state when powered off for security reasons, so moving it is much harder, than free rotating unconnected motor.

On many servos the two combines.


问:
Dynamic braille interface
I'm a newbie in robotics, and I'm doing a project on dynamic Braille interface. Basically it's a 8*8 array of pins, which can be either totally up or down. How to use least motor as possible?

I'm thinking of using Arduino for easy interface with computer.

答:
With a \$100-200 budget it's unlikely you can duplicate the functionality of a \$695 commercially-produced product.  Your device may be slower, bulkier, noisier, less reliable.

One possible approach is to use dot matrix printer print-heads to drive pins.  See example of pins being driven in a vimeo.com video called  “Dot Matrix Print Head - Testing”.  You might need to replace the pins with push wires so that you could go from a 3-by-9 pin layout to a 4-by-4 or 4-by-5 arrangement.  Some fairly old (and bulky) print-heads already contain push wires.

If the print-head pins are driven ballistically they might not be able to work with the high duty cycle that a Braille dot would require.  If you use push wires, you could have a cam that moves a latch plate back and forth, alternately latching wires in place or releasing them so they can move up or down.  Or you could have a cam that lifts all the  Braille pins at once, and a print head that drives some latch pins sideways to catch those Braille pins that that should remain up.  Another cam would clear all the latch pins at the beginning of each character cycle.

There are miniature solenoids as shown below with roughly 1cm square cross-section, with a 1.5mm diameter pin that moves about 3mm.  (Listed on ebay as “Miniature Electric Solenoid - 9 V - Push Type - 2 oz. Force - 3 mm Stoke”, about \$7.)  The duty cycle of this solenoid is 10%, so like a ballistic print head it would require some latch mechanism, as well as a spring or gravity return.  You would need to attach push wires to the end of the shaft because the solenoids won't cluster closely enough.

Title: Dynamic braille interface


问:
Making a robot move straight between two maze walls
Using a PID with encoders, I can make the robot move straight but there is a 0.5 degrees drift and it eventually hits a wall so I need to adjust to center it between the two walls. I have a sensor on each side that gives me the distance from the wall, so What's the best approach to make the robot adjust when it comes to close to one wall?</p>

答:
Just make the error term in your pid the difference between the sensors you have.

i.e. $$ Error = d_{left} - d_{right} $$
Where a positive error means you are too far right and you need to turn left and a negative error means you are too far to the left and need to turn right.

You might then feed the output of the PID as a delta speed (or power or whatever) into your motors. So say the output of your PID was -8 (you are too far to the left) and your nominal motor power is 50%, you might feed 50+8=58% into your left motor and 50-8=42% into your right motor. Putting you back on track.

Just beware for openings in your maze!


问:
gzclient: segmentation fault
I have archlinux indigo ros.
My probelm is that when I type in terminal:

```<code>$ gzclient
Segmentation fault (core dumped)
</code>```

...

```<code>$ roslaunch turtlebot_gazebo turtlebot_world.launch
    ... logging to /home/islam/.ros/log/0f56780c-18b0-11e7-966d-642737d9d3b9/roslaunch-CatchMe-11800.log
    Checking log directory for disk usage. This may take awhile.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.

    started roslaunch server http://localhost:44337/

    SUMMARY
    ========

    PARAMETERS
     * /bumper2pointcloud/pointcloud_radius: 0.24
     * /cmd_vel_mux/yaml_cfg_file: /opt/ros/indigo/s...
     * /depthimage_to_laserscan/output_frame_id: /camera_depth_frame
     * /depthimage_to_laserscan/range_min: 0.45
     * /depthimage_to_laserscan/scan_height: 10
     * /robot_description: <?xml version="1....
     * /robot_state_publisher/publish_frequency: 30.0
     * /rosdistro: indigo
     * /rosversion: 1.11.20
     * /use_sim_time: True

    NODES
      /
        bumper2pointcloud (nodelet/nodelet)
        cmd_vel_mux (nodelet/nodelet)
        depthimage_to_laserscan (nodelet/nodelet)
        gazebo (gazebo_ros/gzserver)
        gazebo_gui (gazebo_ros/gzclient)
        laserscan_nodelet_manager (nodelet/nodelet)
        mobile_base_nodelet_manager (nodelet/nodelet)
        robot_state_publisher (robot_state_publisher/robot_state_publisher)
        spawn_turtlebot_model (gazebo_ros/spawn_model)

    auto-starting new master
    process[master]: started with pid [11824]
    ROS_MASTER_URI=http://localhost:11311

    setting /run_id to 0f56780c-18b0-11e7-966d-642737d9d3b9
    process[rosout-1]: started with pid [11837]
    started core service [/rosout]
    process[gazebo-2]: started with pid [11852]
    process[gazebo_gui-3]: started with pid [11861]
    process[spawn_turtlebot_model-4]: started with pid [11868]
    process[mobile_base_nodelet_manager-5]: started with pid [11873]
    process[cmd_vel_mux-6]: started with pid [11878]
    process[bumper2pointcloud-7]: started with pid [11880]
    process[robot_state_publisher-8]: started with pid [11882]
    process[laserscan_nodelet_manager-9]: started with pid [11896]
    process[depthimage_to_laserscan-10]: started with pid [11905]
    /opt/ros/indigo/lib/gazebo_ros/gzclient: line 25: 11916 Segmentation fault      (core dumped) GAZEBO_MASTER_URI="$desired_master_uri" gzclient $final
    [gazebo_gui-3] process has died [pid 11861, exit code 139, cmd /opt/ros/indigo/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/home/islam/.ros/log/0f56780c-18b0-11e7-966d-642737d9d3b9/gazebo_gui-3.log].
    log file: /home/islam/.ros/log/0f56780c-18b0-11e7-966d-642737d9d3b9/gazebo_gui-3*.log
    /opt/ros/indigo/lib/gazebo_ros/gzserver: line 30: 11978 Segmentation fault      (core dumped) GAZEBO_MASTER_URI="$desired_master_uri" gzserver $final
    [gazebo-2] process has died [pid 11852, exit code 139, cmd /opt/ros/indigo/lib/gazebo_ros/gzserver -e ode /opt/ros/indigo/share/turtlebot_gazebo/worlds/playground.world __name:=gazebo __log:=/home/islam/.ros/log/0f56780c-18b0-11e7-966d-642737d9d3b9/gazebo-2.log].
    log file: /home/islam/.ros/log/0f56780c-18b0-11e7-966d-642737d9d3b9/gazebo-2*.log
</code>```

and here is the output of debug:

```<code>Reading symbols from gzserver...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffd4e6d700 (LWP 16809)]
[New Thread 0x7fffd038d700 (LWP 16810)]

Thread 1 "gzserver" received signal SIGSEGV, Segmentation fault.
0x00007ffff2838390 in gazebo::event::Connection::Id() const ()
from /usr/lib/libgazebo_common.so.8
</code>```

My GPU is intel HD3000 , core i5 INSPIRON N5110. I have noted that intel hd3000 works with gazebo

Thanks in advance.

答:
It seems that Gazebo 8 is based on Qt5 instead of Qt4. The dependencies should be updated and most importantly, we need to install qwt-qt5 instead of qwt, otherwise our executable is linked to both Qt4 and Qt5 which leads to segmentation fault at start.

Here is my PKGBUILD for Gazebo:

https://gist.github.com/lyx-x/e6908ef82351b462d4b2e480a43b076c

reference: https://aur.archlinux.org/packages/gazebo/

Title: gzclient: segmentation fault


问:
Localization on a robot grid
I have a skid steer drive train with an encoder on each side of the robot along with a gyro to measure the angle of the robot. The width of the robot is 26 inches. Using the encoders I would like to set up an x and y coordinate grid to know the pose of the robot and set up the system to go through waypoints to reach a destination. The robot has a starting reference point and I would like to go to another point in the area. Anybody have an idea of how to approach this?</p>

答:
Possible approach:

Mapping

Localisation

Path planning (+ obstacle avoidance if there a need)

You can check out ROS (Robotic Operating System), which consists of many libraries and tools (including those for robot localization, mapping, path planning, etc.)
Here is the link: ROS

Title: Localization on a robot grid


答:
If that's  all what  you have

1- write a kinematic model  of the robot

2- use any filtering  technique  to improve  your pose  estimate by using  the data from  gyro

That's  all  you can do with  encoders and a gyro

Title: Localization on a robot grid

Body: I have a skid steer drive train with an encoder on each side of the robot along with a gyro to measure the angle of the robot. The width of the robot is 26 inches. Using the encoders I would like to set up an x and y coordinate grid to know the pose of the robot and set up the system to go through waypoints to reach a destination. The robot has a starting reference point and I would like to go to another point in the area. Anybody have an idea of how to approach this?</p>


问:
Will Lidar see a fence?
I am looking at the possibility of using LIDAR to do obstacle avoidance for a robotics project I am working on but the project involves avoiding a chain link fence. Has anyone used LIDAR to detect fences and if so how well did it work? Thanks for your help.</p>

答:
In my experience depending on the point density and the distance to the fence you will see noise where the fence is but it will be far from a flat wall.

You can do some basic math, finding the width of a square in your fence and taking that over the width of the wire used in the fence. you can find the probability of a lidar point "hitting" the fence.

Divide by the total number of points pointed toward the fence, and you can get a rough idea of how many returns from the fence you will get.

If you predict around 10 that would probably be far too small to get a good return, shoot for at least 100-300 depending on what you are trying to achieve.

Title: Will Lidar see a fence?


问:
Long range distance measurements
We are building a plane which should fly autonomously, to achieve best results in the enviroment we are flying in (many Hills and Mountains) we need some sort of reliable height readings.

We already get some information using a barometer and the google maps elevation API but especially for landing and low alltitude flights we need a precise height.

Most sensors have a bad performance on grass (SRF-08 achieves about 1m; Lidar Lite about 3-4m). Is there some (not to expensive) sensor which can measure distances to at least 50m with a precision of about 20cm? Which method would be suitable for this application?

答: I am guessing that because the surface is non-flat and has different levels of reflective that your readings are very noisy. You might get better results if you do sensor fusion between all the sensors and/or just filter the results with a LPF.</p>

Title: Long range distance measurements


答: You need to do some basic trig/geometry to calculate your robots x position and it's heading. Then you can use PID to correct for both. In the past I have just added the output of two PID loops to correct for heading and distance offset. You will probably have to play with constants to get it tuned properly. This should work better than just trying to get the two sensors to the same reading because the difference in sensor and your motor speeds don't form a Linear Time Invariant (LTI) system. The more nonlinear the system the worst standard PID will work.</p>

Title: Making a robot move straight between two maze walls

Body: Using a PID with encoders, I can make the robot move straight but there is a 0.5 degrees drift and it eventually hits a wall so I need to adjust to center it between the two walls. I have a sensor on each side that gives me the distance from the wall, so What's the best approach to make the robot adjust when it comes to close to one wall?</p>


答:
For constructing a Finite State Machien the first step is to analyze your problem on a linguistic level. According to the OP, there are two walls and two sensor measurements. So the robot can be in state:

left_from_center

right_from_center

The next step is is to determine the center of the wall. This can be done also with a state:

calculate_center

And last but not least the robot can drive to:

drive_left

drive_right

So we have a list of 5 states which are well named and can be implemented in the programming language of your choice. Than a little bit testing is necessary for the "calculate_center" state which uses a absolute value for the width of the path and perhaps some other optimization are needed for the action of the robot, e.g. how much drive the robot to left?

It is not as easy as to program a simple PID Controller which consists of only one equation, but a finite state machine give us a nice opportunity for program debugging if the system is working suboptimal. Thanks for the nice question and good luck.


问:
What are good, low cost, actuators for a braille tablet to be controlled by arduino?
I want to basically make a pin matrix controlled either by spring, electromagnets or small motors(spring being the most viable option), something like what’s shown in the image. I'm pretty new to arduino and hardware in general so any input would be appreciated.
I mostly know the arduino end but don't have clue about the hardware part. Plus I don't have the technical expertise, as in I know electromagnets won't be a good option as I have to control individual pins and not clusters. Plus springs have the disadvantage of pushing them back in but other than that a very option. And its not viable to have individual motors for so many pins.

答:
Check out this hackaday project. They use micro stepper motors from aliexpress. They include a link as well. The steppers are a little annoying to interface with but they are cheap and they work for this application.

https://hackaday.io/project/10849-refreshable-braille-display


问:
Communicating between a BeagleBone Black and a servo controller
I am a complete newbie and recently joined a robot team at my school in order to gain some experience. I have been assigned a task of driving a servo using a Pololu Mini Maestro USB Servo Controller. I am using the BeagleBone Black (BBB) with the Python adafruit library. How do I make the BBB communicate with the Servo Controller? If you guys could point me in the right direction, I'd really appreciate that. Right now, I don't even know where to start. Not sure if it matters, but this is the servo I am using: https://www.pololu.com/product/1053</p>

答: The beagle bone black is just a linux computer without the monitor. Look at the user guide (https://www.pololu.com/docs/0J40). It shows examples of writing software to interface with the servo controller.</p>


问:
Plastic shaft supports
I would like to prevent a shaft from being pulled through it's bearings - that is, press a plastic ring around it on either side.  What are these rings called? They're not bearings or hubs.  And where can I find them?</p>

答:
Many shafts and spindles have shoulders (ie, a ring-shaped surface at the junction of different shaft diameters) turned on them to serve such a purpose.  If there is no diameter change in the shaft you are working with, shaft collars sometimes are used to keep the shaft from sliding back and forth.  The wikipedia article mentions several kinds of collars.  Amazon and Ebay sellers list quite a few medium to large sizes.  If the shaft you are working with is small-diameter, eg 1/16"–3/16", then look for shaft collars among model airplane supplies.

I'm not aware of any suppliers of shaft collars made of plastic.  If you are referring to bushings or to grommets, they won't resist sliding unless they are fastened with a band clamp or a collet.

Snap rings also are used to keep shafts from sliding.  Snap rings fit into a thin shallow groove around the shaft.

Title: Plastic shaft supports


问:
5kHz arm control, grasp end effector
I was having a chat with a robotic expert recently. The guy told me that for an arm with motor drives running at 5kHz your are to set the control so that someone can grasp the end effector and move it around (something like the usual teach mode for an arm).

Anyone knows what kind of control this expert was mentioning? What setup this involves? Any doc on this subject? Any input is welcome...

答: It sounds like you want to do gravity compensation for the arm with user feedback to allow changes. Basically makes the arm weightless but allows a user to move it. You need to measure arm position and arm torque (measured using current).

Title: 5kHz arm control, grasp end effector


答: Look up differential drive model. That will give you the basic equations to control the robot but generally speaking you will probably use the gyro to turn toward a specific target waypoint and encoders to drive to them. Don't try and use the encoders for the turn because skid steer robots will have a lot of slip. Also note that because you are basically dead reckoning you will drift over time. The best way to correct for that is to take readings that reference the environment. </p>

Title: Localization on a robot grid


问:
Forward kinematics equations
I'm stuck at computing forward kinematics equations.

I have configuration of the first two joints like on the following image:

Transformation from the origin to the first joint basis is trivial: just translation by $\vec{OO_{1}}$.

The second transform from joint 1 to joint 2 basis makes me nervous throughout this day. First of all it is a rotation around $Z$ axis. So rotational part will look like this:

$
R_{12}=
\begin{pmatrix}
cos(q_{1}) & -sin(q_{1}) & 0\\
sin(q_{1}) & cos(q_{1}) & 0\\
0 & 0 & 1
\end{pmatrix}
$

Problems are all about the translation part. I see two approaches here.
Since angle between $\vec{O_{1}O_{2}}$ and plane $X_{1}O_{1}Y_{1}$ is constant because rotation is performed around $Z$ axis, length of projection of $\vec{O_{1}O_{2}}$ onto $X_{1}O_{1}Y_{1}$ is constant. Here it is:

$\vec{v} = O_{2} - O_{1} = \begin{pmatrix} v_{x}\\ v_{y}\\ v_{z} \end{pmatrix}
$
Its' projection onto $X_{1}O_{1}Y_{1}$ is $\vec{v_{p}} = \begin{pmatrix} v_{x}\\ v_{y}\\ 0 \end{pmatrix}$ and it's magnitude is $m=\sqrt{v_{x}^2 + v_{y}^2}=const$.

Now let's look at what happens after rotation:

So the translation matrix looks like:
$
S_{12}=
\begin{pmatrix}
m\cdot cos(\alpha+q_{1})\\ m\cdot sin(\alpha+q_{1})\\ v_{z}
\end{pmatrix}
$

And full transformation matrix from joint 1 to joint 2 basis is:

$
T_{12}=
\begin{pmatrix}
R_{12} & S_{12}\\
0 & 1
\end{pmatrix}
$

Unfortunately it gives me wrong results even when $q_{1}=0$. Can not see where my reasoning is wrong.

Second approach is more straightforward. Being able to calculate $\vec{O_{1}O_{2}}$ in initial configuration makes it possible just to rotate this vector by $q_{1}$ around $Z$ axis and this has to be our translation vector. Nevertheless I can't make it work.

$R_{z}=
\begin{pmatrix}
cos(q_{1}) & -sin(q_{1}) & 0\\
sin(q_{1}) & cos(q_{1}) & 0\\
0 & 0 & 1
\end{pmatrix}\\
\vec{v} = O_{2} - O_{1} = \begin{pmatrix} v_{x}\\ v_{y}\\ v_{z} \end{pmatrix}\\
R_{z}\vec{v}=
\begin{pmatrix}
v_{x}cos(q_{1})-v_{y}sin(q_{1})\\
v_{x}sin(q_{1})+v_{y}cos(q_{1})\\
v_{z}
\end{pmatrix}\\
T_{12}=
\begin{pmatrix}
R_{12} & R_{z}\vec{v}\\
0 & 1
\end{pmatrix}
$

It works until I rotate the first joint(i.e. only when $q_{1}=0$).

Under works I mean "calculates position of joint 2 origin right". This is done by multiplying transformation matrix $T_{02} = T_{01}T_{12}$ by $\begin{pmatrix} 0 & 0 & 0 & 1\end{pmatrix}^{T}$

答:
You are complicating the translation part of the transformation matrix way to much.

The rotational part:

$
R_{12}=
\begin{pmatrix}
cos(q_{1}) & -sin(q_{1}) & 0\\
sin(q_{1}) & cos(q_{1}) & 0\\
0 & 0 & 1
\end{pmatrix}
$

takes care of the q1 rotation. There is no further need to include q1 in the translation part. In the rotated coordinate system you make a translation on the x and y axis which is constant. You can express it in function of alpha, but there is no need to, since it is constant, you can use:

$
Tr_{12} = \begin{pmatrix} v_{x}\\ 0 \\ v_{z} \end{pmatrix}
$
 as the translation part.

So the transformation Matrix will look like:

$
T_{12}=
\begin{pmatrix}
R_{12} & Tr_{12}\\
0 & 1
\end{pmatrix}
$

Also please note that the coordinate system definitions you posted are not conform the Denavit-Hartenberg convention.

Title: Forward kinematics equations


问:
Which sensors will best suited for indoor/outdoor SLAM system with high accuracy of localization?
We need a SLAM system for mobile platform which will be used in on-site construction.

We are to build a 3D map from clouds of points and need localization in it.

We don’t need fast localization, but we need high accuracy of localization, error of localization should be around 1mm at a distance up to 5 meters.

Which sensor will suit for this - maybe it will be enough only a stereo vision (can it give us required accuracy?), or only LiDAR sensor (what’s about accuracy and usage in direct sunlight?) or we need to use something different and combine several type of sensors?

Can you advise the best solution for this task?

答: I recommend using LIDAR because stereo cameras don't work well in low lighting so if it gets shady your robot will do worst.</p>


答:
First of all, performance of localization depends more on the processing power and the algorithms you have on your robot and less on the sensor you choose. Also, almost none of the SLAM algorithms and sensors you would use will give you  1mm of accuracy. Having said this here would be some options for you:

Kinect :
Kinect or an stereo camera can be a pretty good sensor for localization. It can give you 3D point cloud and can be used as a 2D LIDAR too. If you don't want to spend much of money, this is a good option. But again, this has limited range, FOV and can't be used in direct sunlight.

Lidar: These are better than stereo vision cameras and have wider and larger scanning range. Since you'll be using this on a construction site and assuming a cluttered environment, you would need a 3D lidar. Again these are very costly and if you're just using it to just autonomously navigate through your construction site, a 2D laser scanner is cheaper and more efficient option. This is viable option and I have used it extensively without any problems.

Title: Which sensors will best suited for indoor/outdoor SLAM system with high accuracy of localization?

Body:
We need a SLAM system for mobile platform which will be used in on-site construction.

We are to build a 3D map from clouds of points and need localization in it.

We don’t need fast localization, but we need high accuracy of localization, error of localization should be around 1mm at a distance up to 5 meters.

Which sensor will suit for this - maybe it will be enough only a stereo vision (can it give us required accuracy?), or only LiDAR sensor (what’s about accuracy and usage in direct sunlight?) or we need to use something different and combine several type of sensors?

Can you advise the best solution for this task?


问:
Is there an online RobotC IDE?
I'm on a Linux chromebook, and am using a Vex robot, and am wondering if there is an online IDE for RobotC that will run my computer?</p>

答: You might be able to get it to run via wine. If that doesn't work you can definitely get it running in a virtual machine.</p>

Title: Is there an online RobotC IDE?


问:
Are scissors what I want for moving straight up and out?
I'm a programmer. I had a tiny amount of experience building robots in college a few years ago, but haven't done anything since.

I'd like to build a robot that can move around my house, pick items up and put them down... IE, a robot that could get items out of the dishwasher and put them away.

I was thinking it would have a square base with a wheel at each corner for moving around the floor, a scissor jack so it can adjust its height (I'm hoping to be able to be able to move between 1 foot tall and 7 feet tall), and then a scissor jack at the top for moving a gripper towards or away from it (between a couple of inches and 3 feet away).

Are two scissor jacks actually what I want? It seems like 90+% of robots with grippers go with arms instead, but it seems to me that those are more complicated and would be less precise. I have no robotic experience beyond little car like things - I've never built one with any sort of gripper or actuator, so advise would be much appreciated. (Huh - there's not even a tag for scissor or jack... what do you guys call them?)

Also... do people normally build these parts themselves, or do they buy them? I've searched around but I can't find any scissor jack kit or anything like that. If I need to build it myself... how would I do that? What would I build it out of?

答:
The reason most robots use arms is because they are simple and easier to do inverse kinematics on than other mechanisms. Also you don't want to do a 7ft scissor lift because you will end up needing a lot of torque and your control suffers from the change in extension rate based on the height. You will probably end up making your own arm because buying premade arms get expensive.

With respect to your driveline, make sure your base is not too small. If you raise something to 7 ft you start to have center of gravity (CG) problems given your base is probably small for use in a house. Consider the robot on an incline plane. All your robot needs to tip is for your CG to move beyond your lowest wheel which is your lowest contact point. For example if your CG moves to 4.5 ft when your lift is 7 ft height and you have a 2ftx2ft square chassis then your robot will tip at an incline of ~12.5 degrees. This means that if it manages to tilt 12.5 degrees from something like it being bumped then it will fall over. Also if it's going to be autonomous you might want to avoid skid steering because it makes encoder readings worst.


问:
How to implement RANSAC and kalman filter or particle filter algorithms with ROS packages?
I'd like to implement those algorithms by using ROS packages to solve one way the SLAM problem. I know that gmapping, Rviz, slam_gmapping and robot_pose_ekf (for extended kalman filter) could be useful packages, but I'm kind of lost. I don't ask a tutorial because the next days I'm going to start studying deeper this subject, but I need orientation in the procedure.

"a possible way to implement RANSAC algorithm" http://pointclouds.org/documentation/...

Note: I'm planning to do something like this indoors. https://www.youtube.com/watch?v=17W8dkzkvWA.
I'm working on ubuntu. I have the "kinect" (xbox360), and for now I don't know what kind of cheap 2WD robotic platform choose in pages as amazon, robotshop and ebay (although Canakit 2WD, DFrobot 2WD and alphabot seems to be a good option). More than anything, I need orientation about how to mix everything to solve the SLAM problem with a 2WD robotic platform, the kinect and ROS packages :)

Thanks in advance

答:
Like with anything in engineering, you first need a good definition of what "success" (or "done") means. SLAM running how fast? Under what particular lighting and environmental conditions? Using what kind of processing power, what kind of weight, driving what kind of chassis, with what kind of battery lifetime?
Then, you need to break the problem backwards into sub-components, and establish parameters for those components.
Then, you need to go looking for solutions that exist to fulfill each of the tasks of those components.

It seems like you're going to other way -- "Here's a pile of parts, what can I build with this?"
That's okay for exploratory investigation, and creativity (a box of Legos!) but it's a bit harder to hit any PARTICULAR goal using that method.

So, to build "forward" like you're attempting to, you still need a way to monitor what's going on. Thus, you want to make sure that your development platform (the computer on the robot) has some kind of monitor, or remote access. X Windows over WiFi might work. A 10" LCD on the robot with a wireless keyboard/mouse may work, if it's easy to read from where you need to be to monitor.

Once you can measure and inspect everything, then it's a process of adding each component from the bottom, poking it with expected stimuli, and making sure it performs as expected.

Screw wheels to motors, and connect encoders and motor drive to motor controller. Send commands to motor controller -- do the wheels move as you expect them to?

Add a ROS program to drive your robot. Make sure it connects to the overall ROS system on the control computer. Add a component for driving the motor controllers. Make your program send the appropriate command to make the motors move half a foot. Does the robot move half a foot?
This will also make you familiar with how different processes/modules within a ROS system communicate using the ROS message bus topics.

Then, add a ROS module to read the Kinect data and display it on the monitor. Does it look okay? Can you read this from your control program?

Keep adding bits and pieces, verifying that each piece performs in the way you expect. Ideally, also verify what the piece does when you drive it outside its "sweet spot" or when it loses control or gets a bad command -- saftey is important!