问:
Is there a way to determine which degrees of freedom are lost in a robot at a singularity position by looking at the jacobian?
For a 6DoF robot with all revolute joints the Jacobian is given by:
$$
\mathbf{J} =
\begin{bmatrix}
\hat{z_0} \times (\vec{o_6}-\vec{o_0}) & \ldots & \hat{z_5} \times (\vec{o_6}-\vec{o_5})\\
\hat{z_0} & \ldots & \hat{z_5}
\end{bmatrix}
$$
where $z_i$ is the unit z axis of joint $i+1$(using DH params), $o_i$ is the origin of the coordinate frame connected to joint $i+1$, and $o_6$ is the origin of the end effector.  The jacobian matrix is the relationship between the Cartesian velocity vector and the joint velocity vector:
$$
\dot{\mathbf{X}}=
\begin{bmatrix}
\dot{x}\\
\dot{y}\\
\dot{z}\\
\dot{r_x}\\
\dot{r_y}\\
\dot{r_z}
\end{bmatrix}
=
\mathbf{J}
\begin{bmatrix}
\dot{\theta_1}\\
\dot{\theta_2}\\
\dot{\theta_3}\\
\dot{\theta_4}\\
\dot{\theta_5}\\
\dot{\theta_6}\\
\end{bmatrix}
=
\mathbf{J}\dot{\mathbf{\Theta}}
$$

Here is a singularity position of a Staubli TX90XL 6DoF robot:

$$
\mathbf{J} =
\begin{bmatrix}
          -50     &    -425     &    -750      &      0     &    -100      &      0\\
       612.92     &       0     &       0      &      0     &       0      &      0\\
            0     & -562.92     &       0      &      0     &       0      &      0\\
            0     &       0     &       0      &      0     &       0      &      0\\
            0     &       1     &       1      &      0     &       1      &      0\\
            1     &       0     &       0      &     -1     &       0      &     -1
\end{bmatrix}
$$

You can easily see that the 4th row corresponding to $\dot{r_x}$ is all zeros, which is exactly the lost degree of freedom in this position.

However, other cases are not so straightforward.

$$
\mathbf{J} =
\begin{bmatrix}
          -50   &   -324.52  &    -649.52   &         0   &   -86.603   &         0\\
       987.92   &         0  &          0   &         0   &         0   &         0\\
            0   &   -937.92  &       -375   &         0   &       -50   &         0\\
            0   &         0  &          0   &       0.5   &         0   &       0.5\\
            0   &         1  &          1   &         0   &         1   &         0\\
            1   &         0  &          0   &    -0.866   &         0   &    -0.866
\end{bmatrix}
$$

Here you can clearly see that joint 4 and joint 6 are aligned because the 4th and 6th columns are the same.  But it's not clear which Cartesian degree of freedom is lost (it should be a rotation about the end effector's x axis in red).

Even less straightforward are singularities at workspace limits.

$$
\mathbf{J} =
\begin{bmatrix}
          -50     &     650   &       325  &          0    &        0     &       0\\
       1275.8     &       0   &         0  &         50    &        0     &       0\\
            0     & -1225.8   &   -662.92  &          0    &     -100     &       0\\
            0     &       0   &         0  &    0.86603    &        0     &       1\\
            0     &       1   &         1  &          0    &        1     &       0\\
            1     &       0   &         0  &        0.5    &        0     &       0
\end{bmatrix}
$$

In this case, the robot is able to rotate $\dot{-r_y}$ but not $\dot{+r_y}$.  There are no rows full of zeros, or equal columns, or any clear linearly dependent columns/rows.

Is there a way to determine which degrees of freedom are lost by looking at the jacobian?

Body:
Not by merely looking at Jacobian but by looking at the Singular Value Decomposition of the Jacobian, one can see the degrees of freedom that are lost, if lost. Of course it technically somehow turns up to finding the null space but yet I guess it is somewhat familiar and easier.

For example let the Jacobian be:

$$J =
\begin{bmatrix}
          -50     &     650   &       325  &          0    &        0     &       0\\
       1275.8     &       0   &         0  &         50    &        0     &       0\\
            0     & -1225.8   &   -662.92  &          0    &     -100     &       0\\
            0     &       0   &         0  &    0.86603    &        0     &       1\\
            0     &       1   &         1  &          0    &        1     &       0\\
            1     &       0   &         0  &        0.5    &        0     &       0
\end{bmatrix}$$
A Singular Value Decomposition of this is given by
$J=U\Sigma V^T$, where

$$U=\left[\begin{matrix}-0.46 & 0.01 & -0.89 & 0.0 & 0.0 & -0.02\\\\0.03 & -1.0 & -0.03 & 0.0 & 0.0 & 0.0\\\\0.89 & 0.05 & -0.46 & 0.0 & 0.0 & -0.01\\\\0.0 & 0.0 & 0.0 & -0.97 & 0.24 & 0.0\\\\0.0 & 0.0 & 0.02 & -0.02 & -0.07 & -1.0\\\\0.0 & 0.0 & 0.0 & -0.24 & -0.97 & 0.07\end{matrix}\right]$$

$$\Sigma=\left[\begin{matrix}1574.54 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 1277.15 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 50.59 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 1.36 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.34 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\end{matrix}\right]$$

$$V^T=\left[\begin{matrix}0.04 & -0.88 & -0.47 & 0.0 & -0.06 & 0.0\\\\-1.0 & -0.04 & -0.02 & -0.04 & 0.0 & 0.0\\\\0.0 & -0.24 & 0.34 & -0.03 & 0.91 & 0.0\\\\0.03 & 0.01 & -0.01 & -0.7 & -0.02 & -0.72\\\\0.03 & 0.01 & -0.01 & -0.71 & -0.02 & 0.7\\\\0.0 & -0.41 & 0.82 & 0.0 & -0.41 & 0.0\end{matrix}\right]$$

Now, it can be seen that the 6th singular value of $\Sigma$ is zero. Therefore, the corresponding (6th) row of $U$ is $$\left[\begin{matrix}0.0 & 0.0 & 0.0 & -0.24 & -0.97 & 0.07\end{matrix}\right]$$, which shows the direction of singularity. It means the end effector at this instant of Jacobian can't move in this direction. In other words, the angular velocity $ω$ of the end-effector about the vector $\hat{n}=-0.24\hat{i}-0.97\hat{j}+0.07\hat{k}$ is not possible at this instant.

The corresponding (6th) column of $V^T$ is
$$\left[\begin{matrix}0.0\\\\0.0\\\\0.0\\\\-0.72\\\\0.7\\\\0.0\end{matrix}\right]$$ which is the direction of the above singularity in the joint space, which means the above singularity is caused at the end-effector when $\dot{\theta_1}=0, \dot{\theta_2}=0, \dot{\theta_3}=0, \dot{\theta_4}=-0.72$ units, $\dot{\theta_5}=0.7$ units and $\dot{\theta_6}=0$.


问:
Path of the robot
I have built a simple robot which will move from a source to destination.
I want to record a 2d path which the robot has taken in real time.
Something which is similar to the image I have take.(similar not exactly the same)

Is there any tool or software which will allow me to do this?
If no, is it possible to generate a similar map not in real time, but after the robot has reached its destination.
Like the robot while traversing will send out information like straight,straight, left left, straight, right, straight and so on.
Can this data be saved and a map generated? The map can be as simple as just the path of the robot.
The robot is simple one built using raspberry pi, arduino. It has components like camera, ultrasonic sensor, servo motor etc.

答: Unfortunately, continuous rotation servos do not report rotations. However, if you are using steppers, you can precisely control and record the rotations. In theory you could determine the coordinates of your wheels from stepper motor data, and therefore be able to generate this image in any point plotter.</p>

ContentLicense: CC BY-SA 3.0

Title: Path of the robot


问:
How to build a liquid filling machine using piston?
My team developed a filling machine for liquids which uses a piston to measure and deliver volumes 0.1 to 1 liters into bottles. It is built mostly with mechanical parts and we'd like to replace most of them with electronic ones.

How do I build a machine to pull liquid from a reservoir and fills a bottle using a piston, with electronic parts such as stepper motor, linear actuators and sensors?

I understand this is somewhat vague. Any aligned response is appreciated.

Update:

This machine should, at its max speed, fill a 1 litter bottle with water in 2 seconds (to deliver 30 bottles per minute). Higher viscosity liquids may take longer.

It should not spill so liquid needs some filling acceleration control.

You may assume two operation modes: with bubbles and without bubbles. The first is a plus.

I'd like to be able to change the volume electronically (via a LCD menu).

I thought of a single main valve that switches between the reservoir and the bottle. That should be controlled electronically too. I could use two valves too.

答:
Yes, general question.  Here's some general bits-o-answer: some assembly is required.

First, I would leave the decision about stepper vs. some other kind of motor until later -- it should be a tactical, not a strategic, decision.

Second, assuming that the positive displacement idea works at all, I would assume that at the core of your machine you still need that piston that you mention.  I would achieve controlled displacement of the piston by using some sort of linear actuator that has lots of available force and considerable mechanical stiffness, coupled with a good distance measurement on the piston.  I'd close my outer loop around the distance that the piston has traveled.

What springs to mind for a linear actuator is either a stepper motor (probably geared down) driving a jack screw, or a small DC gear motor, with an encoder on the motor and speed control, driving a jack screw.  I am personally biased against steppers, so if I were King on this project it would almost certainly be the DC gear motor -- but if you were paying me to implement it with a stepper, I'd say "sure!" and make sure that you selected one that had more than sufficient torque to get the job done.

The field is pretty open as far as the piston position sensor.  I don't know how clean your environment is, but assuming reasonable cleanliness I'd probably choose an optical linear encoder with a good fine line -- but I know there's other technologies out there that would work as well.

For control I'd close the piston, fill the piston by some extra amount to account for bubbles or whatever, switch the flow over to the bottle, then push the piston in by the correct distance to get the amount of fill desired.

Or, I'd find a way to weigh the bottles as I was filling them, and do the job by weight.


问:
How can I compute the covariance of a camera-based relative pose measurement?
I am trying to compute the relative pose between two cameras using their captured images through the usual way of feature correspondences. I use these feature matches to compute the essential matrix, decomposing which results in the rotation and translation between both the views. I am currently using David Nister's 5 point algorithm to compute the essential matrix and subsequently the relative pose. Once I compute this relative pose:

How can I find the uncertainty of this measurement? Should I try to refine the essential matrix itself (using the epipolar error), which results in the essential matrix's covariance and is it possible to find the pose covariance from this? Or is there another way to find the uncertainty in this pose directly?

There is also another issue in play here: While I am computing the relative pose of camera 2 (call it $P_2$) from camera 1, the pose of camera 1 (say $P_1$) would have its own covariance $\Sigma_1$. How can I consider the effect of this on the covariance of $C_2$ ($\Sigma_2$)?

答:
Typically, when doing this type of pose estimation, the essential matrix would be wrapped inside of RANSAC. i.e., you would have a lot of candidate point correspondences and would randomly sample 5 of them to evaluate with Nister's algorithm to give potential pose solutions, do this several times, and pick the best. If there is such a random process involved, you can repeat it many times to get an empirical estimate of the covariance.

You can also do the same thing while sampling from the distribution given by $P_1$ and $\Sigma_1$ to incorporate that uncertainty, though you may need to do this a great many times to capture the effects of small terms.


问:
What parts do I need for my first robot?
I have never built a robot before and I am looking to get started. The problem is that I have no idea what parts I will need... below are a list of things I want the robot to do.

Have a speaker

Be able to sense objects around him so that he doesn't bump into them.

Understand different commands

So pretty much I want to be able to tell my robot to go to the kitchen and he could move over there and tell the person in the kitchen what that person wants. The person would then put it on the robot and he would drive back to the person that made the request. (I know there is not much use to this robot but I think it would still be pretty cool)

I am not worried about learning programming languages so it doesn't matter what languages the board supports. (Have some basic knowledge in Java and Python).

Thanks!

答:
A robot that can accept voice commands and travel to a specified location, do something, and then return is not trivial. The robot you are suggesting is a rather advanced robot for a beginner. I would suggest starting with just a basic robot that can move and avoid objects. Once you get that down I would try each of your objectives one by one in a new robot.

Much of what you'll be able to do at first depends on how good are you with electronics, programming, and mechanics. These are the three main skills that are useful to building and programming robots. What tools do you have available to you? A 3d printer is very useful.

For a first robot, the first place I'd start on the web is the site Let's Build Robots, Start Here. There are a number of other sites on the web that will help you with building a first robot.

Other good starting points are the Lego Mindstorms EV3 kit. I started with an earlier version of this. Another good company is VEX Robotics. Yet another good company is Servo City. They have a line of inexpensive robot kits along with more expensive ones. My current robot, Groucho, uses a base I bought as a kit from Servo City.

You will need to learn to use microcontrollers such as the Arduino. My favorite microcontroller for both robots and other electronics is the Teensy 3.6, available from Adafruit. But I'd start with an Arduino because there is so much information available about it on the web.

While building some small robots, I would suggest start experimenting with the programming side of things. You may also need some sensors. Look into the Robot Operating System. ROS has a simulator so that you don't need to physically build all of your robots. I suggest ROS because it contains a lot of the software building blocks needed for a robot.

I prefer to use Linux for building my robots' brains. There are a lot of Single Board Computers (SBC's) such as the Raspberry Pi. The Pi is a good platform, not only for the "brain" of a robot, but also for learning Linux. It is possible to used almost any operating system to control a robot including Microsoft Windows and the Android operating system (using a tablet or phone to control a robot).

I would suggest that while you're beginning with building robots, that you also learn Linux and work with various packages that you'll need for later. You could download some speech recognition packages and program a computer to answer to simple commands. You could learn ROS. You could learn computer vision. These are some of the things you'll need to use in your eventual robot.

If you are not good with mechanics, like me, then build some kits to learn. If you need to learn electronics, get a breadboard and start practicing blinking lights. If you need to learn programming, then start with a programming language and learn it. I'd suggest Python because it is easier for beginners, and then move onto Java or C/C++.

I wish you luck and welcome to robot building!


问:
Relation between Power, Weight & Speed
Motor

I am going to use these 100rpm 12Volt Motor supplied Power given below.

Surface

Surface will be Plain Wooden. Area of contact between 6 Tyre and surface would be maximum of 4cm2 in total.

Use

They are basically Tyre for my Battle Bot

Direction

All 6 Motors will work in same direction to move my Bot Forward. Not climbing nor Coming down.

Tyre

I'm going to use these Tyre but with different diameter for each Motor (Information given Below).

Structure & Design

Here's a Scaled 3D Sketch of my Battle bot. In case you need it.

Voltage & Tyre Diameter

4 Motors with 7cm Diameter and Power Ratio is 5 (each).

2 Motors with 5cm Diameter and Power Ratio is 7 (each).

What I want is the Relation Between Supplied Voltage, Supplied Current, Weight of Bot and the Speed at which Bot can move.

I'm new to all this so Please tell me if you need more information about anything or if I have gone Wrong Somewhere.

答:
The calculations are difficult. Here are some foundation equations. If you demonstrate interest and refine your question based on what you learn I'm sure that myself or someone else will help you build the equations to the detail you want.

The power equations are the easiest way to start.

Input power

The input power is from your batteries. We start with a simple estimate.

$P_{in} = EI$ where $E$ is voltage and $I$ is current.

Output power

The output power is the motion of your robot.

$P_{out} = \nu f $ where $\nu$ is velocity and $f$ is force.

Entropy

Power is the transfer of energy from one place (batteries in your case) to another (wheels). Every time we move energy from one place to another, some gets lost. We call these losses. Every equation for power (energy transfer) inside a system includes losses.

Conservation of energy

The law of conservation of energy says that the amount of energy in a system does not change. Figuring out the actual boundaries of your system and writing appropriate equations can be challenging. However for your system as you have described so far, we can say that

$P_{out} = P_{in}$

Add in the fact of entropy and the equation looks like:

$P_{out} = P_{in} - (losses)$

Basic relationship

By substitution, the basic relationship between input voltage, input current and speed is the following.

$EI - (losses) = \nu f$

Note:

Energy is transferred many times (from battery to wires to motor
electronics to electromagnetic motor to wheel axle to wheel to
ground) so there are many different losses that need to be estimated
for accurate results.

Newtons second law says that a body in motion (your robot) will stay in motion unless acted upon from an outside force. So you need zero force to go your max velocity.

This means that you need zero power, plus lost power, to go your max velocity.

Next steps

Energy is conserved. The power flows from the battery to the environment through the wheels. So the power is the same at every stage, minus entropy.

$P_{in} = P_{Hbridge} = P_{motor} = P_{wheels} = P_{robot}$ with losses at each stage.

The next step is to start writing more detailed equations for each of these stages so that we can estimate the losses.

You will notice that $f$ is unknown in the simple relationship above. So that is where you need to improve your question.

$f=m a$ where $m$ is mass and $a$ is acceleration.

Mass is constant for your current question, so you need to define what acceleration you need.

Usually we define a motion profile, which defines all the velocity and acceleration changes for all the tasks of the robot. In your case, we can simplify it. You probably just want the robot to accelerate up to maximum speed as fast as it can.

Given your motor specifications and wheel sizes, can you write an equation that estimates the acceleration of your robot if you have no losses? Add this to your question.

Title: Relation between Power, Weight & Speed


问:
Single power source for electronics and actuators
It seems popular to build robotic systems with separate supplies for the electronics and motors/servos, but what would be involved in a circuit that powers both from one source?

If it helps, here is my particular situation. I want to use a single 7.4V Li-Po pack to power an embedded system (2.5-6V operating voltage input, max 1A current draw) and up to 18 standard-sized servos (HS-645, 4.8-6V operating voltage). This would be a hexapod, so it is unlikely that all servos would be stalling at once with normal gait patterns.

答:
You can also add between the controller power an electrolytic capacitor of about 500 or even 1000 microfarads x 12 volts and a diode in series with it, so when the trigger pull much current source with a corresponding drop in voltage will be avoided that Power down controller please and even free you from unwanted noise (about 10 turns of cable around a ferrite core also help eliminate noise).![enter image description here][1]</p>

```<code>+__________mmm___________K|_______________ + controller
Fonte                          ___|___
                             |_________|
                                  |
                                 ground
</code>```

Body:
You can also add between the controller power an electrolytic capacitor of about 500 or even 1000 microfarads x 12 volts and a diode in series with it, so when the trigger pull much current source with a corresponding drop in voltage will be avoided that Power down controller please and even free you from unwanted noise (about 10 turns of cable around a ferrite core also help eliminate noise).![enter image description here][1]

+__________mmm___________K|_______________ + controller
Fonte                          ___|___
                             |_________|
                                  |
                                 ground


问:
Motion planning from a given path
Many articles reference algorithms such as A*, PRM or RRT based planners to motion planning algorithms which seems unreasonable since it is still necessary to parametrize found path with time.I wonder, why? However it is not the main problem.

The issue is that of generating motion profile based on a given path. If there were small number of points, maybe 3 or 4, it would be relatively easy to generate some type of speed profile to follow it. Unfortunately output of A* or any of the mentioned algorithms can have large number of points. Therefore it is not clear how to built motion profile based on given points. Could anyone explain to me please how it should be done?

答:
I have used A* for motion planning in a highway simulation with moving obstacles (other cars). The README includes a thorough description of my approach. I recommend reviewing this project to understand how A* can be used effectively for robotic motion planning. Let me know if you have any questions about how the project works, or if there are additional challenges in your project that don't seem to be covered.

https://youtu.be/ouSjnpnRL7w

https://github.com/ericlavigne/CarND-Path-Planning

Title: Motion planning from a given path


答:
Many articles reference algorithms such as A*, PRM or RRT based planners to motion planning algorithms which seems unreasonable since it is still necessary to parametrize found path with time.I wonder, why?

First of all, RRT, for example, can be used to plan trajectories directly. When the robot in question has $n$ DOFs, such a planning problem happens in a space of dimension $2n$ called state-space (each point in the state-space is a pair of configuration and velocity $(q, \dot{q})$). But since the complexity of a motion planning problem grows exponentially with the dimension of the planning space, it is usually pretty difficult to solve the problem.

Instead, a more practical approach is to decouple a trajectory planning problem into two subproblems: (geometric) path planning and time-parameterization. The thing is that each subproblem can be solved really fast that solving these two subproblems is much, much faster than solving the trajectory planning problem in one shot.

Therefore it is not clear how to built motion profile based on given points.

Actually geometric motion planners (i.e. planners that plan paths in the robot configuration space) do not produce only waypoints, they output also a path between each consecutive pair of waypoints (such paths are usually linear).

To produce a trajectory, the geometric path generated by a planner is given to a time-parameterization algorithm to generate a velocity-profile. A geometric path and a velocity profile together make a complete trajectory.

If the generated path is piecewise linear (that is, each pair of consecutive waypoints are connected by a straight-line path), then a velocity profile that makes the robot follows this path exactly must start and stop at each waypoint (it might not be straightforward to see why, but it is not too difficult to derive this either). Then after a velocity profile has been computed, now you get a complete trajectory. (Such a trajectory is slow due to its start-stop behavior. This can be improved by using a trajectory shortcutting method.)

When the generated path is $C^2$-continuous, you can use fancier time-parameterization algorithms. There are quite a few approaches to solving a time-parameterization problem (convex optimization, numerical integration, etc.). They can give you not just any time-parameterization but time-optimal parameterization (i.e. they compute the fastest way for the robot to traverse the given path without violating any constraints).

Note: There are quite a number of names that people use to refer to the second subproblem (time-parameterization). Such terms include (but not limited to) path parameterization, path tracking, etc.

Title: Motion planning from a given path

Body:
Many articles reference algorithms such as A*, PRM or RRT based planners to motion planning algorithms which seems unreasonable since it is still necessary to parametrize found path with time.I wonder, why? However it is not the main problem.

The issue is that of generating motion profile based on a given path. If there were small number of points, maybe 3 or 4, it would be relatively easy to generate some type of speed profile to follow it. Unfortunately output of A* or any of the mentioned algorithms can have large number of points. Therefore it is not clear how to built motion profile based on given points. Could anyone explain to me please how it should be done?


问:
Raspberry pi quadcopter drifts like crazy
I have recently built a raspberry pi based quadcopter that communicates with my tablet over wifi. The problem is that it drifts a lot. At first I thought that the problem was vibration, so I mounted the MPU-6050 more securely to the frame. That seemed to help a bit, but it still drifts. I have tried tuning the PID, tuning the complementary filter, and installing a real time OS. Nothing seems to help very much. Below is my code written completely in java. Any suggestions are appreciated.

QuadServer.java:

```<code>package com.zachary.quadserver;

import java.net.*;
import java.io.*;
import java.util.*;

import com.pi4j.io.i2c.I2CBus;
import com.pi4j.io.i2c.I2CDevice;
import com.pi4j.io.i2c.I2CFactory;

import se.hirt.pi.adafruit.pwm.PWMDevice;
import se.hirt.pi.adafruit.pwm.PWMDevice.PWMChannel;

public class QuadServer {
    private final static int FREQUENCY = 490;

    private static final int MIN = 740;
    private static final int MAX = 2029;

    private static Sensor sensor = new Sensor();

    private static double PX = 0;
    private static double PY = 0;
    private static double PZ = 0;

    private static double IX = 0;
    private static double IY = 0;
    private static double IZ = 0;

    private static double DX = 0;
    private static double DY = 0;
    private static double DZ = 0;

    private static double kP = 1.95; //2.0
    private static double kI = 10.8; //8.5
    private static double kD = 0.15; //0.14

    private static long time = System.currentTimeMillis();

    private static double last_errorX = 0;
    private static double last_errorY = 0;
    private static double last_errorZ = 0;

    private static double outputX;
    private static double outputY;
    private static double outputZ;

    private static int val[] = new int[4];

    private static int throttle;

    static double setpointX = 0;
    static double setpointY = 0;
    static double setpointZ = 0;

    static double errorX;
    static double errorY;
    static double errorZ;

    static long receivedTime = System.currentTimeMillis();

    private static String data;

    static int trimX = -70;
    static int trimY = 70;

    public static void main(String[] args) throws IOException, NullPointerException {
        DatagramSocket serverSocket = new DatagramSocket(40002);

        PWMDevice device = new PWMDevice();

        device.setPWMFreqency(FREQUENCY);

        PWMChannel esc0 = device.getChannel(0);
        PWMChannel esc1 = device.getChannel(1);
        PWMChannel esc2 = device.getChannel(2);
        PWMChannel esc3 = device.getChannel(3);

        /*Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
                public void run() {
                    System.out.println("terminating");
                    try {
                        esc0.setPWM(0, calculatePulseWidth(MIN/1000.0, FREQUENCY));
                    esc1.setPWM(0, calculatePulseWidth(MIN/1000.0, FREQUENCY));
                    esc2.setPWM(0, calculatePulseWidth(MIN/1000.0, FREQUENCY));
                    esc3.setPWM(0, calculatePulseWidth(MIN/1000.0, FREQUENCY));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                }
            }));
            System.out.println("running");*/

        Thread read = new Thread(){
                public void run(){
                    while(true) {
                    try {
                            byte receiveData[] = new byte[1024];
                            DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
                            serverSocket.receive(receivePacket);
                            String message = new String(receivePacket.getData());

                            data = ""+IX;
                        addData(IY);

                        addData(sensor.readAccelAngle(0));
                        addData(sensor.readAccelAngle(1));

                        byte[] sendData = new byte[1024];
                            sendData = data.getBytes();
                                InetAddress IPAddress = InetAddress.getByName("192.168.1.9");
                                DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 1025);
                                serverSocket.send(sendPacket);

                            setpointX = Double.parseDouble(message.split("\\s+")[0])*0.7;
                        setpointY = Double.parseDouble(message.split("\\s+")[1])*0.7;

                            throttle = (int)(Integer.parseInt((message.split("\\s+")[3]))*12.67)+MIN;

                            kP = Math.round((Integer.parseInt(message.split("\\s+")[4])*0.05)*1000.0)/1000.0;
                            kI = Math.round((Integer.parseInt(message.split("\\s+")[5])*0.2)*1000.0)/1000.0;
                            kD = Math.round((Integer.parseInt(message.split("\\s+")[6])*0.01)*1000.0)/1000.0;

                            trimX = (Integer.parseInt(message.split("\\s+")[7])-50)*2;
                            trimY = (Integer.parseInt(message.split("\\s+")[8])-50)*2;

                            double accelSmoothing = 0.02;//(Integer.parseInt(message.split("\\s+")[8])*0.05)+1;
                            double gyroSmoothing = 0.04;//(Integer.parseInt(message.split("\\s+")[7])*0.01);

                            sensor.setSmoothing(gyroSmoothing, accelSmoothing);

                            //System.out.println("trimX: "+trimX+" trimY: "+trimY);

                            System.out.println("kP: "+kP+", kI: "+kI+", kD: "+kD+", trimX: "+trimX+", trimY: "+trimY);

                        receivedTime = System.currentTimeMillis();

                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
        };
        read.start();

        while(true)
        {
            Arrays.fill(val, throttle);

            errorX = sensor.readGyro(0)-setpointX;
            errorY = -sensor.readGyro(1)-setpointY;
            errorZ = sensor.readGyro(2)-setpointZ;

            double dt = (double)(System.currentTimeMillis()-time)/1000;

            double accelAngleX = sensor.readAccelAngle(0);
            double accelAngleY = sensor.readAccelAngle(1);

            if(dt > 0.005)
            {

                PX = errorX;
                PY = errorY;
                PZ = errorZ;

                IX += (errorX)*dt;
                IY += (errorY)*dt;
                //IZ += errorZ*dt;

                IX = 0.98*IX+0.02*accelAngleX;
                IY = 0.98*IY+0.02*accelAngleY;

                DX = (errorX - last_errorX)/dt;
                DY = (errorY - last_errorY)/dt;
                //DZ = (errorZ - last_errorZ)/dt;

                last_errorX = errorX;
                last_errorY = errorY;
                last_errorZ = errorZ;

                outputX = kP*PX+kI*IX+kD*DX;
                outputY = kP*PY+kI*IY+kD*DY;
                outputZ = kP*PZ+kI*IZ+kD*DZ;

                time = System.currentTimeMillis();
            }

            //System.out.println(IX+", "+IY+", "+throttle);

            add(-outputX-outputY-outputZ-trimX+trimY, 0);       //clockwise
            add(-outputX+outputY+outputZ-trimX-trimY, 1);   //counterClockwise
            add(outputX+outputY-outputZ+trimX-trimY, 2);    //clockwise
            add(outputX-outputY+outputZ+trimX+trimY, 3);        //counterclockwise

            //System.out.println(val[0]+", "+val[1]+", "+val[2]+", "+val[3]);

            try {
                if(System.currentTimeMillis()-receivedTime < 1000)
                {
                    esc0.setPWM(0, calculatePulseWidth(val[0]/1000.0, FREQUENCY));
                    esc1.setPWM(0, calculatePulseWidth(val[1]/1000.0, FREQUENCY));
                    esc2.setPWM(0, calculatePulseWidth(val[2]/1000.0, FREQUENCY));
                    esc3.setPWM(0, calculatePulseWidth(val[3]/1000.0, FREQUENCY));
                } else
                {
                    esc0.setPWM(0, calculatePulseWidth(800/1000.0, FREQUENCY));
                    esc1.setPWM(0, calculatePulseWidth(800/1000.0, FREQUENCY));
                    esc2.setPWM(0, calculatePulseWidth(800/1000.0, FREQUENCY));
                    esc3.setPWM(0, calculatePulseWidth(800/1000.0, FREQUENCY));
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }

    private static void add(double value, int i)
    {
        if(val[i]+value > MIN && val[i]+value < MAX)
        {
            val[i] += value;
        }else if(val[i]+value < MIN)
        {
            //System.out.println("low");
            val[i] = MIN;
        }else if(val[i]+value > MAX)
        {
            //System.out.println("low");
            val[i] = MAX;
        }
    }

    static void addData(double value)
    {
        data += " "+value;
    }

    private static int calculatePulseWidth(double millis, int frequency) {
        return (int) (Math.round(4096 * millis * frequency/1000));
    }
}
</code>```

Sensor.java:

```<code>package com.zachary.quadserver;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.io.i2c.*;

import java.net.*;
import java.io.*;

public class Sensor {
    static I2CDevice sensor;
    static I2CBus bus;
    static byte[] accelData, gyroData;
    static long accelCalib[] = {0, 0, 0};
    static long gyroCalib[] = {0, 0, 0};

    static double gyroX;
    static double gyroY;
    static double gyroZ;

    static double smoothedGyroX;
    static double smoothedGyroY;
    static double smoothedGyroZ;

    static double accelX;
    static double accelY;
    static double accelZ;

    static double accelAngleX;
    static double accelAngleY;

    static double smoothedAccelAngleX;
    static double smoothedAccelAngleY;

    static double angleX;
    static double angleY;
    static double angleZ;

    static boolean init = true;

    static double accelSmoothing = 1;
    static double gyroSmoothing = 1;

    public Sensor() {
        try {
            bus = I2CFactory.getInstance(I2CBus.BUS_1);

            sensor = bus.getDevice(0x68);

            sensor.write(0x6B, (byte) 0x0);
            sensor.write(0x6C, (byte) 0x0);
            System.out.println("Calibrating...");

            calibrate();

            Thread sensors = new Thread(){
                    public void run(){
                        try {
                            readSensors();
                        } catch (IOException e) {
                        e.printStackTrace();
                    }
                    }
            };
            sensors.start();
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }

    private static void readSensors() throws IOException {
        long time = System.currentTimeMillis();
        long sendTime = System.currentTimeMillis();

        while (true) {
            accelData = new byte[6];
            gyroData = new byte[6];

            int r = sensor.read(0x3B, accelData, 0, 6);

            accelX = (((accelData[0] << 8)+accelData[1]-accelCalib[0])/16384.0)*9.8;
            accelY = (((accelData[2] << 8)+accelData[3]-accelCalib[1])/16384.0)*9.8;
            accelZ = ((((accelData[4] << 8)+accelData[5]-accelCalib[2])/16384.0)*9.8)+9.8;
            accelZ = 9.8-Math.abs(accelZ-9.8);

            double hypotX = Math.sqrt(Math.pow(accelX, 2)+Math.pow(accelZ, 2));
            double hypotY = Math.sqrt(Math.pow(accelY, 2)+Math.pow(accelZ, 2));

            accelAngleX = Math.toDegrees(Math.asin(accelY/hypotY));
            accelAngleY = Math.toDegrees(Math.asin(accelX/hypotX));

            //System.out.println(accelAngleX[0]+" "+accelAngleX[1]+" "+accelAngleX[2]+" "+accelAngleX[3]);

            //System.out.println("accelX: " + accelX+" accelY: " + accelY+" accelZ: " + accelZ);

            r = sensor.read(0x43, gyroData, 0, 6);

            gyroX = (((gyroData[0] << 8)+gyroData[1]-gyroCalib[0])/131.0);
            gyroY = (((gyroData[2] << 8)+gyroData[3]-gyroCalib[1])/131.0);
            gyroZ = (((gyroData[4] << 8)+gyroData[5]-gyroCalib[2])/131.0);

            if(init)
            {
                smoothedAccelAngleX = accelAngleX;
                smoothedAccelAngleY = accelAngleY;

                smoothedGyroX = gyroX;
                smoothedGyroY = gyroY;
                smoothedGyroZ = gyroZ;

                init = false;
            } else {
                smoothedAccelAngleX = smoothedAccelAngleX+(accelSmoothing*(accelAngleX-smoothedAccelAngleX));
                smoothedAccelAngleY = smoothedAccelAngleY+(accelSmoothing*(accelAngleY-smoothedAccelAngleY));

                smoothedGyroX = smoothedGyroX+(gyroSmoothing*(gyroX-smoothedGyroX));
                smoothedGyroY = smoothedGyroY+(gyroSmoothing*(gyroY-smoothedGyroY));
                smoothedGyroZ = smoothedGyroZ+(gyroSmoothing*(gyroZ-smoothedGyroZ));

                /*smoothedAccelAngleX = accelAngleX;
                smoothedAccelAngleY = accelAngleY;

                smoothedGyroX = gyroX;
                smoothedGyroY = gyroY;
                smoothedGyroY = gyroY;*/

                /*smoothedAccelAngleX += (accelAngleX-smoothedAccelAngleX)/accelSmoothing;
                smoothedAccelAngleY += (accelAngleY-smoothedAccelAngleY)/accelSmoothing;

                smoothedGyroX += (gyroX-smoothedGyroX)/gyroSmoothing;
                smoothedGyroY += (gyroY-smoothedGyroY)/gyroSmoothing;
                smoothedGyroZ += (gyroZ-smoothedGyroZ)/gyroSmoothing;*/

            }

            angleX += smoothedGyroX*(System.currentTimeMillis()-time)/1000;
            angleY += smoothedGyroY*(System.currentTimeMillis()-time)/1000;
            angleZ += smoothedGyroZ;

            angleX = 0.95*angleX + 0.05*smoothedAccelAngleX;
            angleY = 0.95*angleY + 0.05*smoothedAccelAngleY;

            time = System.currentTimeMillis();

            //System.out.println((int)angleX+"  "+(int)angleY);
            //System.out.println((int)accelAngleX+", "+(int)accelAngleY);
        }
    }

    public static void calibrate() throws IOException {
        int i;
        for(i = 0; i < 100; i++)
        {
            accelData = new byte[6];
            gyroData = new byte[6];
            int r = sensor.read(0x3B, accelData, 0, 6);
            accelCalib[0] += (accelData[0] << 8)+accelData[1];
            accelCalib[1] += (accelData[2] << 8)+accelData[3];
            accelCalib[2] += (accelData[4] << 8)+accelData[5];

            r = sensor.read(0x43, gyroData, 0, 6);
            gyroCalib[0] += (gyroData[0] << 8)+gyroData[1];
            gyroCalib[1] += (gyroData[2] << 8)+gyroData[3];
            gyroCalib[2] += (gyroData[4] << 8)+gyroData[5];
            try {
                Thread.sleep(1);
            } catch (Exception e){
                e.printStackTrace();
            }
        }
        gyroCalib[0] /= i;
        gyroCalib[1] /= i;
        gyroCalib[2] /= i;

        accelCalib[0] /= i;
        accelCalib[1] /= i;
        accelCalib[2] /= i;

        System.out.println(gyroCalib[0]+", "+gyroCalib[1]+", "+gyroCalib[2]);
        System.out.println(accelCalib[0]+", "+accelCalib[1]+", "+accelCalib[2]);
    }

    public double readAngle(int axis)
    {
        switch (axis)
        {
            case 0:
                return angleX;
            case 1:
                return angleY;
            case 2:
                return angleZ;
        }

        return 0;
    }

    public double readGyro(int axis)
    {
        switch (axis)
        {
            case 0:
                return smoothedGyroX;
            case 1:
                return smoothedGyroY;
            case 2:
                return smoothedGyroZ;
        }

        return 0;
    }

    public double readAccel(int axis)
    {
        switch (axis)
        {
            case 0:
                return accelX;
            case 1:
                return accelY;
            case 2:
                return accelZ;
        }

        return 0;
    }

    public double readAccelAngle(int axis)
    {
        switch (axis)
        {
            case 0:
                return smoothedAccelAngleX;
            case 1:
                return smoothedAccelAngleY;

        }

        return 0;
    }

    public void setSmoothing(double gyro, double accel)
    {
        gyroSmoothing = gyro;
        accelSmoothing = accel;
    }
}
</code>```

答: Is it your Yaw that's drifting? You'll need a magnetometer to stop Yaw drift as your accelerometer cannot give you Yaw readings and simply integrating the Gyro Z value will cause drift as you are integrating the gyro noise over time.</p>


问:
Controlling a quadrotor from a PC
I need to control quadrotor from a PC, without using a joystick.

I have got a mini-beetle quad V929 Beetle 4-Axis  and also have this NRF24L01+ Wireless Transceiver Module Chip (2.4 GHz transceiver)
Is it possible to write an Arduino program to make them speak to each other?

I did some research and found that the quad V929 model uses FlySky protocol and only works with A7105 NRF24L01 2.4 GHz transmitter chip not the one which I mentioned above.

Are there any other better ways of controlling the quad from PC or Arduino board?

答:
It's a non-starter to try and send flysky data from a computer, since it is a closed-source protocol designed to be sent from r/c transmitters.

You really want a separate data radio with a serial-type connection, using wifi, xbee, or similar.

I would recommend using one of the many quadcopter flight controllers that speaks the standard MAVlink protocol. Then you can use many programs, such as qgroundcontrol, andropilot, or APM planner to control your quad. You can also use pymavlink to control your quad from python, and you have complete flexibility to set it up with any sort of interface you like with a little programming.

If you're looking for a pre-made micro quad, you may be able to use the new walkera qr-w100, which has wifi. So far they have only created an iphone app, but I hope someone will reverse engineer their wifi command protocol so that we can use a computer or android phone.

Title: Controlling a quadrotor from a PC


问:
Sliding system basic question
I have a basic question. Imagine a plate, with a hole drilled in each corner. Imagine 4 shafts in these 4 holes,attached to another plate.

Intuition tells me that it would take considerable effort to have the design as such that the plate slides without getting stuck.

Let's now replace one of those shafts by a leadscrew. Designs exist where the leads crew would allow to smoothly upper and lower said plate.

My intuition, however, indicates that I could never get such a conceptually simple design to work. Even with plain bearings.

What are the conditions to get this right?

答:
This is a great problem to hone mechanism design skills on.

There is a set of dimensions for which this mechanism works fine.

The condition for this is that the contact of each rod & hole, including the drive screw, remain on the correct side of the friction cone, for all free motion and bending of the elements.

You can start thinking about this by thinking of a single hole and rod. A thin plate with a large hole will jam. A thick plate with a small hole will slide.

A starting point for a basic model(equation) of this is to treat the contact between the rods and holes as flat surface contacts when estimating the friction, as well as assuming the hole edge loads do not start deforming material. You can resolve the external loads into normal contact forces and then compare the driving force (from your screw) to the friction force.

Below is a simple representation of the forces at one hole.

Force $D$ is the driving, actuation force at some distance away from the hole. Force $C$ is the gravitational (and if significant, inertial) force. Forces $A$ and $B$ are the reaction forces of the edge of the hole on the rod.

For our simplified model, the basic rigid body assumptions are used. Capitals are vectors and $\times$ is the cross product. $F$ are forces, $P$ are positions.

$\sum {forces} = m a$ or $F_A + F_B + F_C + F_D = m a$

$\sum {moments} = I \alpha$ or $P_A\times F_A + P_B\times F_B + P_C\times F_C + P_D\times F_D = I \alpha$

where $\alpha = 0$ since we are sliding and not rotating.

Forces $A$ and $B$ have two components. The normal forces needed to balance the moments, and the axial forces that are calculated using a basic friction model.

$F_\mu = \mu F_{normal}$ where $\mu$ is the friction coefficient.

Keep in mind the friction model is discontinuous, and that the friction force component will equal $F_{D_z}+F_{C_z}$ until $F_{D_z}+F_{C_z}$ exceeds $\sum F_\mu$

Solving the above equations for $a$ is, I believe, the most basic equation that will let you estimate things.

If you need to be more accurate, or aggressive in your design, then you need to worry about the bearing loads and where plastic deformation will start destroying your mechanism.

Title: Sliding system basic question


问:
Are there any open-source congnative planing frameworks for robotics?
I have seen a lot of academic papers, but no framework that I can download and use. There are even projects, such as OpenCog, which might be usable in a few years.

I would like to know of the existence of any open-source goal/cognitive/planning frameworks now.

There is a lot of software for motion planning, but I would like a way to determine where the robot wants to do before planning how to get there.

答:
There is a framework for motion planning in ROS, it is called MoveIt!
http://moveit.ros.org/

The main limitation of it, is that it falls apart, but if you get the single configuration in which it works it can do the job.

Otherwise you will have to find your way within all the other packages developed in ROS or YARP (http://www.yarp.it/) that do a similar job.

I am not aware of a state-of-the-art integrated solution yet


问:
Using hall sensors to calculate position
I have a geared DC motor with hall speed sensors. I want to count signals from the sensor to get position of the motor. Hall sensor has resolution of 12 CPR. Gear ratio is 1:810, which means that I don't really need very precise measurement to get close to the desired position.

But in reality it doesn't work. I run the motor at the same direction trying to get exactly 360 degrees. Sometimes I am close to the position I set, sometimes I am too far (like 300 degrees instead of 360).

The code is simple. I just attached the hall sensor to an interrupt pin and count raises of the signal.

Has anybody tried that? Does anybody knows some obvious problem which causes me to fail such miserably?

Here is the motor I am using:

答:
Are you running a PID loop to control the motor?  Without a PID loop, the motor is going to be highly dependent on load and will likely stop differently every time.  Also, since the sensor is relative position only, you will need a way to home the motor to be able to know absolute position.

If you need accurate absolute position, you could use a hall absolute position sensor.


问:
Is Robust Control and robotics well applied together?
There are many control methods who sounds great and have nice math etc. But many of them are not realistic in real life.

In robotics, Adaptive Control is well applied because Adaptive Control make sure that the controller is allways new and perfect for the robot.

But then there are another control method called Robust Control. In fact, Robust Control is only a design method. It's still a LQR/LQG/PID inside, but the parameters are designed so the controller has the best strength aginst uncertainties.

Then my question is: Is Robust Control well applied in robotics, or is Robust Control just another design method who does not work in reality, only in ideal simulation?

答:
Robust control is used for when you know that parameters are going to fall within particular bounds. For example, for a mass-produced robot arm, the arm masses fall between X and Y, the moments of inertia between I and J, etc. You don't know exactly what they are, but you can analyze the boundary conditions (i.e., root locus analysis) and ensure stability and performance parameters are met at all times.

Adaptive control is used for when you don't know that the parameters are going to fall within particular bounds. Maybe you've got a kite controller, but the wind can be anything between zero and a hurricane, or an autopilot system in an aircraft where the total passenger and equipment weight isn't known.

A robust controller is developed and analyzed once, and then the gains are fixed. An adaptive controller must constantly assess the system performance and attempt to adjust control gains on-the-fly. The adaptive controller must be a more computationally complex controller (for comparable systems) because it cannot leverage a priori knowledge like the robust controller.

Ultimately, the best controller is the one that performs the best for your system. I would argue that robust control would probably best be applied to robots working in controlled conditions, or fabricated of mass produced parts, and adaptive control then applied to robots working in uncertain environments.


问:
TU Munich Monocular Visual Odometry Dataset has NaN values in the ground truth data.
I am trying to use the motion sequences in the dataset to create trajectories for VR systems. A major portion of the ground truth data in almost all sequences has NaN values. Is there any other source with the correct values?

Or is any other good monocular visual odometry dataset with various motion sequences included available?

答: NaN values are sometimes used to indicate unavailable data. Is it possible that these are simply portions of the dataset for which ground truth was not available, but you can still evaluate on the remainder of the sequence (and that this is in fact the standard evaluation domain)? It looks like their evaluation code checks for trajectory entries with any NaNs and ignores them with a warning.</p>


问:
What software do you use to design your PCB in the robotics field?
What is the best software (despite the price) for designing the circuits and PCB boards for robots?

I mean having lots of components, different designing methods, best accuracy, ...

I myself use the Altium Designer which I think answers my needs, but maybe there are better ones in the market i don't know about!

答: We evaluated a variety of options and settled on Altium Designer at our shop.  We build nothing but robots with a team of 9 engineers.  I am not sure there is a ton of stuff that is robotic specific in a PCB design, but Altium allows us to interface directly with our Pick and Place machine, easily generate 3D models, and the integration of the library with Subversion makes teamwork easy.</p>


问:
How can i connect two adafruit 16-channel 12-bit PWM/Servo Driver I2C interface (pac9685) to Raspberry or Arduino
I need to control 24 servos but I do not know how to do with I2C.
I saw some componentes that do it with USB, but I need to do it with I2c.

I am working in a robot with 8 legs and 3 degree of freedom in each leg, so i need to connect and control 24 servos to any arduino board, could be possible with an arduino mega and a sensor shield like that show in https://arduino-info.wikispaces.com/SensorShield but I want to do it using two "16-channel servo  drive" like this https://www.adafruit.com/product/1411, each of these can control 16 servos using only 2 pins from the board and it is “Chain-able” design so i could connect 2 of this to an Arduino Uno board or Raspberry but I do not know how to do.
Any one can help me with I2C chains connections.

答:
You will need to control it vai I2C .

There are libraries for pca9685 , if you want to control it vai an Arduino(Micro controller ) https://github.com/Reinbert/pca9685

If you want to use with a RPI , you can directly use python libraries and I2C vai GPIO pins .
https://github.com/voidpp/PCA9685-driver

I too am trying to build a hexapod/quadpod using tiny mg90 servo motors and 3d printed parts .

I am trying to get all of this ROS enabled so that we can perform more advanced level operations using this .

Anyways , for now i am trying to figure out how to operate the servo motors just for a 6 axis robotic arm i am building .


问:
Software real-time of ROS system
As far as I know, a hardware real-time robot control system requires a specific computing unit to solve the kinematics and dynamics of a robot such as interval zero RTX, which assigns CPU cores exclusively for the calculation, or a DSP board, which does exactly the same calculation. This configuration makes sure that each calculation is strictly within, maybe, 1 ms.

My understanding is that ROS, which runs under Ubuntu, doesn't have a exclusive
computing unit for that. Kinematics and dynamics run under different threads of the same CPU which operates the Ubuntu system, path plan, and everything else.

My question is that how does ROS achieve software-real time? Does it slow down the sampling time to maybe 100ms and makes sure each calculation can be done in time? Or the sampling time changes at each cycle maybe from 5ms, 18ms, to 39ms each time in order to be as fast as possible and ROS somehow compensates for it at each cycle?

答:
Hard real time : What ever time cycle you are setting for your loop, it should strictly follow that. In most of the robotics system they follow the cycle time to be 1ms.

You can go to this link for more information of above image.
Current ROS version are having TCPROS (non realtime) for their node to node communication but in ROS2, the community is redesigning ros for hard real time application and instead of TCPROS they are using DDS (Data Distribution Service) for node to node communication.

Title: Software real-time of ROS system


答:
From the webpage for the dataset:

All sequences contain mostly exploring camera motion, starting and ending at the same position: this allows to evaluate tracking accuracy via the accumulated drift from start to end, without requiring ground-truth for the full sequence.

It appears as though they didn't intend the ground truth for these datasets to be complete.

For monocular odometry data with complete ground truth data, you could try KITTI.

Title: TU Munich Monocular Visual Odometry Dataset has NaN values in the ground truth data.

Body:
I am trying to use the motion sequences in the dataset to create trajectories for VR systems. A major portion of the ground truth data in almost all sequences has NaN values. Is there any other source with the correct values?

Or is any other good monocular visual odometry dataset with various motion sequences included available?


问:
On the ardupilot board, what is the difference between A10 / A11 ground pins and the PWM ground pins?
I'm looking for an electrical explanation of the statement here:

Warning: Do not connect power (red + & black -) from the RC10 (A10) &
  RC11 (A11) connectors to the servos, just use the signal lines. Power
  the servos via the PWM Outputs connectors. These solutions will avoid
  the scenario that can possibly happen when the Pan/Tilt servo draw too
  much current and cause the APM to brownout (reset)

I examined the APM2.5 board drawing and schematic here and the grounding is a little unclear. On the schematic, they all just go to GND, but on the board drawing some of the ground pins appear unconnected to traces. I checked for continuity, and there is no continuity between the PWM grounds and the A10/A11 ground pins. By the way, my power setup is that I have J1 enabled and I am using an ESC to power the board.

Can anyone figure out, electrically, what is between these two sets of ground pins?

Ground pins appear unconnected to the traces:

PWM ground just connected to GND:

analog output ground also connected to GND:

答:
I found a possible answer for you here:

A10 & A11 are connected to the input rail because historically those were inputs and the Vcc rail was used to power the sensors.  When you attempt to power servos from the input rail, the extra current draw causes an additional voltage drop across the input diode and fuse and Vcc drops to brownout levels regardless if you are using a BEC or the Power Module.  If you are going to connect servos to A10 & A11 you must provide an alternate source of power not Vcc from the input rail.


问:
Balancing robot - How to control the velocity and angle
We are currently making a balancing robot as a school project.

The robot has a gyroscope and an encoder to get the angle of the robot and the rpm of the wheels. By using the current angle of the robot and defining a target angle we are able to make the robot stand still and not fall over.

We don't understand how to incorporate the encoder (that measures the angular velocity of the wheels) to make the robot stand still when he motor speed is changing. The robot only knows the angle it is at so it won't compensate for the speed. Could one perhaps use the encoder in such a way that dictates the target angle and keep the robot still or even better control it?

We would also like to know if there is a way to automatically adjust TargetAngle to the needed one, like if the floor angle were to change.

Here is a sample of our code:

```<code>error = TargetAngle - CurrentAngle;
integral = integral + error*ki;
derivative = (error - lastError)*kd;

lastError = error;

pidsum = derivative+error*kp+integral;//this is what is used for throttling the engines
</code>```

答:
Consider doing a PID loop on the motor angle.

Target angle can be calculated tick-by-tick based on the motion profile you want the robot to move compensated with the desired robot angle (you will likely want to lean forward when beginning to more forward, etc. like a person would do).

Actual angle can be determined by the encoder position combined with the gyro angle.


答:
Balancing problem is all about eliminating all the torque on the robot with the motors. We are currently working on a balancing system which is more advanced but the idea is almost the same. You should use torque controller using the encoders.

$$\frac{V - Bw}{R} = I$$

Where $$V$$ is the voltage you give to the motor and $$w$$ is the angular velocity of the motor. $$-Bw$$ part is the back EMF from the rotating motor. Since torque is directly proportional to current, you can use PID to calculate the required velocity of the motors. You can calculate the required torque by using the gyro.

Title: Balancing robot - How to control the velocity and angle

Body:
We are currently making a balancing robot as a school project.

The robot has a gyroscope and an encoder to get the angle of the robot and the rpm of the wheels. By using the current angle of the robot and defining a target angle we are able to make the robot stand still and not fall over.

We don't understand how to incorporate the encoder (that measures the angular velocity of the wheels) to make the robot stand still when he motor speed is changing. The robot only knows the angle it is at so it won't compensate for the speed. Could one perhaps use the encoder in such a way that dictates the target angle and keep the robot still or even better control it?

We would also like to know if there is a way to automatically adjust TargetAngle to the needed one, like if the floor angle were to change.

Here is a sample of our code:

```<code>error = TargetAngle - CurrentAngle;
integral = integral + error*ki;
derivative = (error - lastError)*kd;

lastError = error;

pidsum = derivative+error*kp+integral;//this is what is used for throttling the engines
</code>```


问:
Path of the robot
I have built a simple robot which will move from a source to destination.
I want to record a 2d path which the robot has taken in real time.
Something which is similar to the image I have take.(similar not exactly the same)

Is there any tool or software which will allow me to do this?
If no, is it possible to generate a similar map not in real time, but after the robot has reached its destination.
Like the robot while traversing will send out information like straight,straight, left left, straight, right, straight and so on.
Can this data be saved and a map generated? The map can be as simple as just the path of the robot.
The robot is simple one built using raspberry pi, arduino. It has components like camera, ultrasonic sensor, servo motor etc.

答: I would recommend rotary encoded motor mostly used to track no of rotation(steps) used in roomba vacuum cleaner to record steps and compute if needed</p>

Title: Path of the robot


问:
calculating differential drive robot ICC position
I don't understand how to calculate the ICC position with the given coordinates. I somehow just have to use basic trigonometry but I just can't find a way to calculate the ICC position based on the given parameters $R$ and $ \theta $.

Edit: Sorry guys if forgot to include the drawing of the situation. Yes, ICC = Instantaneous Center of Curvature.

答:
OK, I'm going to work on the assumption that you are trying to calculate the Instantaneous Centre of Curvature, and that the values of $R$ and $\theta$ that you have been given are the distance from the ICC to the mid-point of the wheel axle and the direction of travel relative to the x-axis.

That should correspond with the diagram below, taken from Computational Principles of Mobile Robotics by Dudek and Jenkin:

Now, provided you know the position of the robot $(x,y)$ you can find the location of the ICC by trigonometry as:

$$
ICC = [x - R sin(\theta), y + R cos(\theta)]
$$

In the more usual case, we can measure the velocities of the left and right wheels, $V_{r}$ and $V_{l}$. From the diagram, we can see that:

$$
V_{r} = \omega (R + \frac{l}{2})
$$

$$
V_{l} = \omega (R - \frac{l}{2})
$$

Where $\omega$ is the rate of rotation about the ICC, $R$ is the distance from the ICC to the mid-point of the wheel axle, and $l% is the distance between the centres of the wheels.

Solving for $R$ and $\omega$ gives:

$$
R = \frac{l}{2} \frac{V_{l} + V_{r}}{V_{r} - V_{l}}
$$

$$
\omega = \frac{V_{r} - V_{l}}{l}
$$


问:
How can a coaxial stepper motor be used to drive the Z axis effector of a SCARA robot?
I am new to robotics and mechanical engineering. I am trying to understand how the Z-axis (and effector) of a SCARA robot can be driven by a stepper motor with it's shaft coaxially aligned along the same Z axis.  In the photo below, one can clearly see the Z-axis lead screw and effector on the SCARA arm.  I am familiar with lead screws in X-Y stages, where a block is pushed along the length of the screw by rotation.  In this case, the lead screw itself is being translated.

(1) What mechanism can be used to cause the lead screw itself to translate along the Z-axis?

(2) How can the effector (say a robotic claw) be prevented from rotating while it is in motion?

I have seen so-called "through type" stepper motors (see below) in which the lead screw moves right through the motor.  Since this type of motor seems less prevalent on markets such as Amazon, and more expensive, I would like to use a standard stepper motor and actuate the lead screw mechanism using a belt.  This stepper motor will have it's shaft oriented along the Z axis (and will be "coaxial" with the effector arm).

答:
i found out that it is called an RZ tool ... google scara RZ tool

there is a captive rotating "nut" on the threaded shaft that causes the shaft to move linearly

there is a spline (raceway) in the screw shaft to prevent turning

the picture that you posted probably uses a ball screw/spine like this one ... https://tech.thk.com/upload/catalog_claim/pdf/327E_BNS_NS.pdf

here is another closeup

https://patentimages.storage.googleapis.com/38/43/1e/12ef07c54bdf2f/US20050087034A1.pdf


问:
lithium thionyl chloride batteries to generate 20A @ 14.4V
I am building a robot where power density is critical, and looking into using lithium thionyl chloride (SOCl2) batteries. I will be drawing around 20A constantly and need between 12 and 17V. The batteries I have found so far are AA-sized and designed to deliver 100mA, 3.6v, 2.4Ah, and weigh 19g each. I could picture a pack with 4 blocks of these batteries in series, where each block has 20 batteries in parallel. That would mean 48Ah, which is way more than the ~10Ah that I need, and 1.52kg, which is more than I would like the robot be carrying.

So, the question is, is there a way to achieve 10Ah at 20A and 14.4V (i.e. for 5 hours) using SOCl2, carrying much less weight than 1.52kg?

答:
Lithium thionyl chloride / SOCl2 batteries have excellent energy density but are not aimed at high-current applications and are not rechargeable, so it seems likely that you can save weight and cost by using some other kind of batteries.

Quadcopter batteries (typically lithium ion polymer technology, rated for 5C to 15C discharge rates and rechargeable hundreds of times) might be a better choice.  You could use half-a-dozen 2200 mAh packs, or a couple of 5500 mAh packs.

Previous question Quadcopter liPo battery weight/capacity trade off includes some charts comparing energy densities, etc., for several battery technologies.

Note, if your application is controlling several motors, with several motor controllers, you may be able to use higher voltages to the controllers, which use PWM to deliver desired amounts of energy to the motors.  This technique is usable when you have a high-voltage, low-current power source.  However (see below) that doesn't help in the present case.  Likewise, a DC/DC buck converter (that converts high voltages to lower voltages, at ~ 95% efficiency) doesn't help.

The 20A, 10Ah parameters of your SOCl2 example imply 30 minutes of operation.  The 20A, 14.4V parameters imply energy rate is 288 W.  The current drain per cell in the example is 1A (which exceeds the rating of a typical AA  SOCl2 cell).  If we limit per-cell current to 1A, we get 3.6 W per cell.  Then the number of cells required is 288/3.6 = 80 cells, regardless of the cells' series or parallel configuration, which is why a higher voltage to the motor controller, or to a buck converter, doesn't help.


问:
Arduino mobile robot
Is there a way I can control my arduino robot from anywhere in the world. The robot goes out of range of my home wifi so my wifi shield can't help. Is there a way to make sure the robot is always on the Internet no matter where it goes? </p>

答:
Since your robot is already on WiFi, the robot is on the internet. If should theoretically be possible to access the robot from any outside address. However, one of the main problems with this is that most home internet services do not give you a fixed address which makes access difficult.

One way to get around this is to use dynamic domain name service (DDNS). You will need a few things.

A router that supports DDNS. The router handles most of the details of this.

An external DDNS service which forwards any packets from your ip-name to your router.

An ip-name such as myarduinorobot.net. Most of the DDNS services will help you do this. Or you can use any of the common services that register ip-names.

You will need to forward the packets from the router to your robot. If the router supports DDNS, it will support this.

HowToGeek has a good tutorial on how to set this up.

One suggestion I will make is to somehow encrypt your commands to the robot so that some outsider won't be able to use your robot as a security hole.

Another way to do this would be to use the cellular network. Adafruit has several boards that access the cell network including some Arduino shields. Their brand name for these are "Fona" and you will still need a SIM card to use one.

Or you could get a device that uses many different communications systems like the Picom FiPy. This is a processor that runs Python and has WiFi, Bluetooth, and cell data (when I bother to get a SIM card). You could use this as a co-processor to your Arduino.

Happy making!

Title: Arduino mobile robot


问:
How is gyroscope bias exposed and tracked?
For an accelerometer, the measurement is defined in the following way:
$$a_m = R_w^b(a_{w} - g) + b_a + v_a$$
Where $R$ is a rotation matrix, $g$ is gravity, $v_a$ is noise, and $b_a$ is the bias. With this, we can expose the bias and orientation error by rotating $g = \begin{bmatrix} 0 & 0 & 9.8 \end{bmatrix}^T$ and adding the bias:
$$h(x) = Rg + b_a$$

However, for a gyroscope, we don't have anything like gravity to expose this bias in the same way. How is this usually done?

答:
I think you're confused. The method you're talking about would only really work if you know the magnitude and orientation of the accelerations you're trying to measure. If that's the case, then why are you using an accelerometer?

Gravity is essentially a bias. The only thing you're doing different for the accelerometer that you wouldn't do for a gyro is to remove the known bias (gravity) so you can try to find the unknown bias. But again, how do you distinguish between bias and a real reading?

If you're doing this as some sort of a calibration routine - hold the sensor fixed or in some known position/pattern prior to use, then you can do exactly the same thing for the gyro that you're doing for the accelerometer.

As @holmeski noted in the comments, you're skipping a couple steps in your question. For example, you skip from:

$$
a_m=R_w^b(a_w−g)+b_a+v_a
$$

straight to:

$$
h(x)=Rg+b_a
$$

The noise term went away, but the $a_w$ term conveniently went away, too. That's the actual acceleration. This is where I'm making the assumption that you're doing some pre-use calibration routine, like holding the accelerometer still ($a_w = 0$) and in some known orientation ($R = \mbox{known}$) in order to estimate the bias $b_a$ prior to use. But again, you could view this as:

$$
h(x) = \mbox{known bias} + \mbox{unkown bias} \\
$$

For the gyro, there just isn't any known bias like $Rg$, so you just wind up with:

$$
h(x)_{\mbox{gyro}} = \mbox{unknown bias} \\
$$

You skip the $Rg$ step altogether.

Parting note - a calibration routine like this won't last forever because of bias drift or random walk in the sensor output. If the biases were constant, the could be tested and removed at the factory and everyone could use really high quality IMUs for cheap. The bias changes over time, though, so you can't do that. Higher quality accelerometers or gyros have slower rates of drift, so an initial calibration would last longer, but they all drift.


问:
Raspberry PI with HKpilot32
I would like to connect my RP3 to the HKpilot. While most connections are pretty straightforward, I would like to know how ca I power the PI:

It is stated in the above link that "The RPi can be powered by connecting the red V+ cable to the +5V pin", can the HK32 pilot deal with the power consumption of th RP?

It is also stated that "The RPi can be powered ... from USB in", in this case, there is the grouding is shared? From where can I get a 5v  output? Do I need to build a voltage regulator?

Thanks,

答:
I would not attempt to power the Pi directly from the flight controller. The last thing you want is to have unexpected power demands crash your vehicle.

The easiest solution is probably to grab a 5v BEC (if you don't already have a regulated 5v supply available from one of your ESCs or from your power distribution board) and wire that to the appropriate GPIO pins.

You're slightly better off if you power the Pi via the USB port, because this will keep the Pi's own voltage regulator and fuse in the loop.  To do this you would simply need to wire a microUSB connector to your 5v power supply.  ModMyPi has some more in-depth recommendations on the topic of powering a Pi.

Title: Raspberry PI with HKpilot32


问:
Zero-Point/Home Position/Origin of Absolute Encoder: What is the Proper Name?
I'm writing an academic paper describing the calibration of a system. Part of that system is an absolute rotary encoder measuring the angle of a joint. However, the position at which the encoder gives a reading of '0' does not correspond to an angle of zero degrees (see edit). Rather than fussing with how the encoder is mounted, I simply found the value that the encoder returns when the joint is at zero degrees and subtract that value off of future measurements.

Is there a well-established* term to describe this point/value succinctly and, if so, what is it?

I have to imagine that this is an extremely common task in robotic manipulators and I'm having a hard time describing the process without a name for the point/value/position that I'm calibrating for. Zero point? Home position? Origin? Encoder offset?

*By well established, I simply mean something that someone familiar with the field of robotics will understand to mean what I'm trying to describe. My primary field is medical imaging/image guidance so I have no idea what terminology is or is not commonly understood.

Edit: 'zero degrees' meaning 'zero degrees with respect to the arm'. A reading of 0 indicates, by definition, zero degrees with respect to an arbitrary position on the encoder.

答:
How are you getting zero angle if it's not reading zero angle? Is this some arbitrary thing you do on startup? Was this a one-time reading you took and it works every time the thing starts up, regardless of powered-down position?

I ask because it sounds like you're actually using an incremental encoder.

An incremental encoder tells you how many steps the encoder has gone in a particular direction, relative to an arbitrary position, generally whatever the position was on power-on. Incremental encoders will often have an index position that happens once per turn. This may be the term you're looking for.

A true absolute encoder will tell you exactly where it is, regardless of position on power-on. There aren't any index positions on an absolute encoder because every position is known.


问:
Quadcopter filter and Angular rate vs angle (Arduino programming)
I wrote an Arduino program for my quadcopter that sets to power of the 4 ESC's using software.  Now I need to incorporate the gyro and add a "Complementary Filter" to stabilize it.

I am currently using a MPU 6050 for the job.

I primarily want to know what is the best approach to take for compensating the angular rate from the receiver using gyro.

Should i give the use the angle from my receiver and program my quad works to achieve that angle or should I try to control angular rate?

e.g
angular rate:-
receiver roll stick moves produces an angular rate that my PID compares with angular rate of gyro and alters values for the esc's.

e.g
angle:-
receiver roll stick moves produces an angle that my PID compares with the ANGLE of gyro+Accelerometer and then alters my ESC values

答:
Whether to control absolute angle or angular rate depends a lot on how you want your design to work.

For a PID loop, the best parameter to calculate the  error for is the parameter that you want to control.

If you were commanding direction and had a compass sensor, it would make the most sense to control absolute angle rather than rate.

In your case, it seems like the the joy stick is commanding rotation rate and the gyro is measuring rotation rate as well; so, controlling rate might make the most sense in your application.

BUT ... Think of the operator, what does HE really want to be controlled.  IMHO, the operator really wants the quadcopter to hold position.  That is the most important parameter for him.  Rotation rate is only a means to an end.  He is setting rate to achieve position.  The operator's brain is actually running separate control loop that is trying to achieve the desired direction. If a wind blast comes, what does he what held - angular position or angular rate.  IMHO, he wants it to hold angular position.

I know position is an inferred parameter from the gyro rate and the joystick rate; but, angular position error is what I would control.

Again, the design is yours.  Only you know what is best to control.


问:
How can I reduce vibration of motor pulley assembly?
My motor setup is vibrating too much for my intended project.

Here are my assembled parts :

ClearPath® - Integrated Servo System motor, p/n CPM-MCVC-2310S-RQN

two Actobotics 15 Tooth, Flanged XL timing pulley, p/n 615432

one Actobotics 3/8” wide, 10" long, 1/5 pitch XL timing belt, p/n B375-100XL

The motor is running under the velocity controlled option and is spinning 0-4000 rpms depending on a knob setting.

A few ideas: I was reading that with timing belts a larger pinion diameter could lessen vibrations. Should I search for something larger? The current pinions are around 1" pitch. Also maybe my tension on the belt is not right? I'm not sure how to measure this or what tension I'm looking for. The assembly has slots, so I can move by hand to make the belt tighter or looser.

I'm far from an expert and this is my first project. Any advice would be much appreciated.

答:
A diagram would really help improve the answers you get on this. However, since it appears you are using 2 pulleys of the same size, I would guess that the belt may be flapping up and down, which might be causing some harmonic resonance throughout the entire assembly. I would try adding another pulley - an "idler" pulley, with a spring loaded attachment to dampen the fluctuations that are inevitable. One of Actobotics' Aluminum Robotic Shocks ( https://www.servocity.com/aluminum-robot-shocks ) might be just what you need to do that.

Also, a larger pulley size on the other end (not attached to the servo) might reduce some vibration.

First thing to try, before everything mentioned above, is to see what kind of vibration there is with the belt removed. It may be that the motor mount or some other components or architecture  is causing the vibration. If you find the vibration is still there with the belt removed, then it could be that the way you are driving the motor (electronically) is what is really causing the vibration, and so you would need to fine tune that before moving on.


问:
Perspective N point solution: Position drifting linearly with rotation angles?
I am using a PNP algorithm to compute the rotation and translation of a camera given pre-mapped 3D points, and their corresponding projections on the 2D plane. The algorithm I am using is the one described in a CVPR 2017 paper, with implementations in both OpenCV and OpenMVG (I am using the latter).

Strangely, I am noticing a precise 'drift' in the position computed, that changes with the rotation angles. I.e.: If I hold the camera's position constant and just rotate it, according to the OpenCV coordinate convention, changes in pitch cause the position to drift in the Y direction, and changes in yaw cause the position to drift in the X direction (I have not tested roll yet.) When I tried to fit a curve to this dataset of pitch vs Y and yaw vs X values, I noticed a pretty constant variation. After removing scale factors and converting the angles into radians, this is the profile I see:

\begin{eqnarray}
X \approx -4.0 * \psi \\
Y \approx 4.0 * \theta
\end{eqnarray}

My translation units in this equation are meters but not true world units, because I removed the scale factor; angles are in radians. In true world units for the environment I tested in, the factor of 4.0 ended up being a factor of 20.0. Is this some sort of a commonly known transformation I am failing to account for? It's linear, so I am assuming it cannot be dependent on the rotation angle. I have skimmed through the paper and some relevant resources but I am unable to figure out the cause of this relationship.

Curve fitting results from MATLAB:

答:
The problem was a bug in my code where I was accessing the translation part of the solution directly, and not the camera position, so it was indeed a missing transformation.

For future reference, the true camera position from a PNP solution needs to be computed as

\begin{equation}
C = -\mathbf{R}^\top * t
\end{equation}

$\mathbf{R}$ is the rotation matrix and $t$ is the final translation vector returned by the PNP algorithm. Being a linear operator, this encodes a purely linear relationship with respect to the rotation angles.


答:
It really depends on what the what you are calling 'zero degrees'.

Typically 'home' refers to a well established reference point that serves as the reference point for the axis. Often the process of 'homing' reconciles the encoder measurement to this location by turning the motor until the reference location is detected then setting the encoder '0' based on that. If the encoder '0' does not correspond to 'home', this difference is often called the 'home offset'.

Note: I found the following reference for what Servotronix refers to as 'home offset'.  It seems to fit what you are describing.

The configured difference between the zero position for the application and the machine home position.

Title: Zero-Point/Home Position/Origin of Absolute Encoder: What is the Proper Name?

Body:
I'm writing an academic paper describing the calibration of a system. Part of that system is an absolute rotary encoder measuring the angle of a joint. However, the position at which the encoder gives a reading of '0' does not correspond to an angle of zero degrees (see edit). Rather than fussing with how the encoder is mounted, I simply found the value that the encoder returns when the joint is at zero degrees and subtract that value off of future measurements.

Is there a well-established* term to describe this point/value succinctly and, if so, what is it?

I have to imagine that this is an extremely common task in robotic manipulators and I'm having a hard time describing the process without a name for the point/value/position that I'm calibrating for. Zero point? Home position? Origin? Encoder offset?

*By well established, I simply mean something that someone familiar with the field of robotics will understand to mean what I'm trying to describe. My primary field is medical imaging/image guidance so I have no idea what terminology is or is not commonly understood.

Edit: 'zero degrees' meaning 'zero degrees with respect to the arm'. A reading of 0 indicates, by definition, zero degrees with respect to an arbitrary position on the encoder.


问:
How to develop subsumption architecture using two Arduinos?
I know what subsumption architecture is, and I'm sure I should have two different hardware modules (Arduinos) taking responsibility for low level computational tasks.

Now my problem is I have an two Arduinos and I want Arduino A to subsume or inhibit a signal from Arduino B . Does anyone have any idea how this is done? As I can wire Arduino A to send a signal to Arduino B but I'm unsure how to subsume or inhibit the signal? I want to use the Arduino Interrupt pin and functionality; instead of simply saying if the input A signal is < something, do something. As Modules should be activated in their own right, right?

答:
I would wire the two such that if A is subsuming a function of B such that the pin stays low as long as the inhibition lasts. Either B could check the state of this pin or it could have an interrupt set to signal when the pin goes low.

For B, if the action was already happening, a short interrupt routine could stop the action. If the action was about to begin then it could check the state of the pin to see if it should being.

I would put all the logic on A and have B hooked up to the sensors and actutors. Every time something changed it would communicate with A and A would handle all the logic. Just my thoughts. If the logic were difficult, I would use a Raspberry Pi instead of Arduino A.


问:
What parts do I need for my first robot?
I have never built a robot before and I am looking to get started. The problem is that I have no idea what parts I will need... below are a list of things I want the robot to do.

Have a speaker

Be able to sense objects around him so that he doesn't bump into them.

Understand different commands

So pretty much I want to be able to tell my robot to go to the kitchen and he could move over there and tell the person in the kitchen what that person wants. The person would then put it on the robot and he would drive back to the person that made the request. (I know there is not much use to this robot but I think it would still be pretty cool)

I am not worried about learning programming languages so it doesn't matter what languages the board supports. (Have some basic knowledge in Java and Python).

Thanks!

答:
I too was a beginner (and to a large extent still am very much so) so I will share my experience with you, as maybe it might help you find your own path and avoid my mistakes! Caveat first for background - this is more about the construction then the coding as my robot was radio controlled and had no built in intelligence. However it was built from scratch from the ground up - no kit - no prior knowledge, no Autocad or 3D printer, basically nada except for youtube and a concept in my mind and a cardboard to cut out the shape and lay out the parts. In this way I essentially built a battle robot for participation in robot wars and had tight timelines and weight restrictions to contend with.

Anyhow, the point is that you can (as I did) build your desired robot if you (a) know what you want it to do (b) are driven enough to make the effort and sacrifices necessary. Furthermore, you can also easily do so partially from recycled (or re-purposed) items and in your case it won't be as expensive or take as long either!

For the record, my robot used 2 x 14.4 Volt ex-cordless driller motors for driving wheels (tank drive), 2 wheels from an old vacuum cleaner, brackets that hold up fire pipes as engine mounts, old printer rods as the main weapon, used ball bearings from an old scooter and from a photocopier (amazingly exactly the same) for bearings for the weapon. The body was made from an upper and lower - 3 mm poly-carbonate sheet (purchased and then hand cut with a saw), a cut up square tent pole for brackets to connect the top and bottom sheets, screws, a pulley taken from an old tape recorder, end bits of marine foam, a 2400 KV brush-less motor and 3 controllers that I purchased and batteries. Lots and lots of lithium batteries since I had no idea how long they would last in the battle. (So now I am heavily overstocked). Then I also had to buy a radio control transmitter and receiver,  chargers, and fireproof pockets for all those batteries.

There were lots and lots of wrong turnings and the whole expense came to around €300. BUT guess what? I do not regret one cent of this. Mark my words - I learnt much more actually doing than if I had attended a course and paid the same amount to the tutor - and I still have the robot and everything else, so all is good.

For the record my next project will be a robot that uses Arduino, of which I am a great fan, so I might follow you in turn on this one. Anyhow, as you may know, you can get lots of cheap arduino stuff from china. I personally use http://www.banggood.com.  Of course I had to build big and strong as it was for robot wars - but this brought along many additional expenses which you will avoid by staying small. For instance in my case if my weapon motor (brush-less type) had stalled in battle, (youtube indicated that) the current in the cables could have reached many amps, so (being afraid and not 100% sure of what might happen - melting, fire etc) I went for overkill and bought silicon cable that can take 60 amps! I then also bought XT-60 connectors to allow for fast battery swaps etc. (Turned out the battery lasted all 3 minutes of the bout easily, while driving 3 motors at once. It was a Li-PO 3S battery (11.1V nominal/12.6V when fully charged).

Getting back to Arduino (there are other boards out there too!), If you want to start with a ready made (kit form) robot, you can buy one of these http://store.makeblock.com/product/mbot-robot-kit. These are based on an Arduino platform, are cheap and pretty basic though they do take some sensors, and if you want to avoid the cost of something like a lego mindstorms, you could do worse than start here. Its a good place to start coding a robot and if you have children they will love them.

If you prefer to build your own then you can simply copy them! Go to your favourite Chinese supplies store and buy an arduino (€15 approx), 2 controllers (say €10 each), a pack of sensors (say €25), and maybe some wheels and shafts (or just buy the complete motor plus wheels for almost nothing). Then all you need is a platform (can be made of plywood or whatever and a battery. Plan what you want the robot to do and start connecting! As for which software to invest time in, I found this article to be most useful https://blog.robotiq.com/what-is-the-best-programming-language-for-robotics. Of course Arduino has its own language so you can start there. Sorry this was so long but I get carried away when talking about my favourite subject. I will just end by including a photo of my robot to inspire you to be creative. Enjoy and good luck.


问:
Looking for a way to scan cylindrical objects
Can anyone recommend a commercial or solid, reliable DIY solution for scanning cylindrical objects? I've seen a couple of simple hacks for flatbed scanners, but I'm looking for something I could make or buy for a commercial project that work reliably.

Many thanks

答: A company I do work for has a patented device that scans prescription bottle labels resulting in a flat image.  We have been discussing ways of scaling this up for larger cylindrical objects.  Is this still something you are interested in ?</p>


答:
Home positions are often used for calibration but don't necessarily coincide with zero in the coordinate frame of interest.

Encoder offset would be the term used to describe the difference between the joint position and encoder position. I'd recommend that one.

The fact that you are using a joint position that you have selected as the zero position when you are calibrating is not really important.


问:
Quadrotor 2D Dynamics
I am trying to understand the control of the quadrotor in 2 dimensions from the Penn course on aerial robotics. The attached image describes the linearization of the control efforts assuming that the quadrotor is near the hover position. Everything seems fine except Equation 7 to me. The control effort u1 makes sense as u1 = mg + mz¨c. The original equation z¨ = − g + u1*m is solved for u1, and z¨c (the actual z acceleration) is used.

However, the equation for u2 goes from φ¨ =u2/Ixx  to u2 =Ixx*φ¨T (t), where φ¨T (t) is the desired value of φ acceleration instead of the actual value of φ acceleration.

Can anyone explain this to me?

EDIT: For further clarity, let me try rephrasing this question.

We start with three simplified, linearized equations:

$$
\ddot{y} = -g * \phi
$$
$$
\ddot{z} = -g + \frac{u_1}{m}
$$
$$
\ddot{\phi} = \frac{u_2}{I_{xx}}
$$

For $u_1$, we solve to get:
$$
u_1 = m\ddot{z} +mg
$$

and since our control effort is defined as:

$$
\ddot{r_c} =  \ddot{r_T}(t) k_{v}(\dot{r_T}-\dot{r}) + k_{p}(r_T-r) +
$$

we plug in the Z part of this control effort and get

$$
u_1 = m\ddot{z} +mg
$$
$$
u_1 = \ddot{z_T}(t) + k_{p,z}(\dot{z_T}(t)-z) + k_{v,z}(\dot{z_T}(t)-\dot{z}) +mg
$$

In this case, when we took the Z part of the PD control effort, we replaced $\ddot{z}$ with the formula for $\ddot{z_c}$ (our control effort)

However, that is not what happens when solving for u2. We start off

$$
u_2 = I_{xx}*\ddot{\phi}
$$

This time, when we replace $\ddot{\phi}$, I would think it would be replaced the same way as above, using $\ddot{\phi_c}$ our control effort. So it would look like this:
$$
u_2 = I_{xx}*\ddot{\phi_c}
$$
$$
u_2 = I_{xx} [\ddot{\phi_T}(t) + k_{v,\phi}(\dot{\phi_T}(t)-\dot{\phi}) + k_{p,\phi}(\phi_T(t)-\phi)]
$$

Instead, we do this:

$$
u_2 = I_{xx}*\ddot{\phi_T}
$$
$$
u_2 = I_{xx} [\ddot{\phi_c}(t) + k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) + k_{p,\phi}(\phi_c-\phi)]
$$

If we go back to our basic PD control effort formula, this contradicts it. With this replacement, we are saying that:
$$
\ddot{\phi_T} = \ddot{\phi_c}(t) + k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) + k_{p,\phi}(\phi_c-\phi)
$$
which is not true because
$$
\ddot{r_c} =  \ddot{r_T}(t) + k_{v}(\dot{r_T}-\dot{r}) + k_{p}(r_T-r)
$$
which means that the real solution for $\ddot{\phi_T}$ would be
$$
\ddot{\phi_T} = \ddot{\phi_c}(t) - k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) - k_{p,\phi}(\phi_c-\phi)
$$
That is my confusion!

答:
Remember, the $y$ position of the quadrotor depends on the angle $\phi$, therefore, in order to control $y$, we need to control $\phi$ in a way that yields the desired $y$. To control the angle $\phi$, we start from the original equation:
$$
\ddot{\phi} = \frac{u_2}{I_{xx}}
$$
Now the goal is to design a controller by which the angle is controlled. The PD-computed torque controller has this form:

$$
u_2 = I_{xx} [\ddot{\phi_c} + k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) + k_{p,\phi}(\phi_c-\phi)]
$$

Now plug $u_2$ inside the original function of the angle, hence

$$
\begin{align}
\ddot{\phi} &= \frac{u_2}{I_{xx}} \\
  &= \frac{I_{xx} [\ddot{\phi_c} + k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) + k_{p,\phi}(\phi_c-\phi)]}{I_{xx}} \\
  &= \ddot{\phi_c} + k_{v,\phi}(\dot{\phi_c}-\dot{\phi}) + k_{p,\phi}(\phi_c-\phi)
\end{align}
$$

Notice that the term $I_{xx}$ is eliminated deliberately. The notion is trivial. Relying on the mathematical model, we can design a controller that compensates for linear or nonlinear terms (e.g. as the case with $I_{xx}$).

Title: Quadrotor 2D Dynamics


问:
How to implement reference control signal for robot heading?
Some time I found that some robot controller uses a critically damped reference control signal such as in Autonomous Surface Vehicle (ASV) heading controller. My question is how do we implement this reference signal in the actual robot implementation?

See figure .

答: I think you misunderstood the Simulink. The transfer function is the system and the reference signal in the picture you've posted is the step function. The input for the system in the Simulink is a constant value of 20 magnitude. You can see that from the figure. The curve goes to 20 in 18 unit time and stays for the future which indicates the system is stable. </p>


问:
How to reduce the small free rotation/movement of a stepper motor shaft?
I was successful in running a 28BYj-48 stepper motor with 4096 steps per revolution. I am happy with the result. But there is a free movement of the motor shaft itself - you can move the motor shaft slightly with your hand without making any steps. Feels lose, but event the brand new ones has that motion, so I am sure its manufactured like that.

Is there any way to reduce that unwanted free motion? I am trying to add a hand with the motor and now that small movement became quite a noticeable gap.

This is my first question on robotics - so please be pardon any mistakes.

答:
Adding a worm gear to connect the output shaft to the load you are trying to move might solve your problem, since worm gear arrangements are "self locking".

Here is a reference for you: http://mechteacher.com/worm-gear/

By the way, what the others have said is 100% correct. It seems you might be wanting some way to minimize the inherent play that is always present in a gear train. Also, you might want to look on the net for different methods used to control backlash to get ideas on how to control the movement.

Also, is the motor powered or not powered when you detect the movement? Whether or not you can keep power applied will make a difference, too.