问:
How to use gear motor 9 with Arduino
I am new to robotics. I want to make a robot using Arduino Uno R3. I need to use Gear Motor 9 for that here is the link.

The problem is that motor needs 50mA current. But arduino only outputs only 40mA current.

I want to supply the motors with another power source and use a switch to connect both the circuits. Can you please tell me what type of switch I can use.

Thanks in Advance.
P.S. Sorry if I used any wrong technical terms

答: This motor is based on a simple DC motor. Don't be mistaken, it will draw much more than 50ma when running with even small load, just look at it's datasheet. In case you want to control the motor's speed, you will need some kind of DC motor driver, which you could build (look up H-bridge) or buy, and than use PWM technique to control it. In case you want just to turn it on and off, the simplest solution would be a relay controlled by arduino's digital output and connected in series with your additional power supply and the motor.  </p>

Title: How to use gear motor 9 with Arduino


问:
Can triangulation by measuring angles to 3 beacons to find location work over a large outdoor area
To determine an outdoor location I think that I need to measure the angles between at least 3 beacons and take into account the order I sweep the beacons.  Is this a workable solution to get positional accuracy of about 30cm in a house block sized area?

Rewrite of question, note no distance measurement is suggested only angle measurements.
I am proposing that it might be possible to have a minimum of 3 local rf beacons and a robot device that sweeps an antenna through a circle identifying the angles between these beacons and to use this information and the order that the beacons are seen to find an absolute location.  I tried to prove this geometrically and it seems that with the 3 beacons there is 2 unique solutions without knowing the order and 1 solution if the order is known.  There would (I believe) be no need to try to find the distance to the beacons.  My question is, could this be implemented for a reasonable cost with some nRF24L01 based transcievers and some sort of rotating antenna?

答:
The theoretical answer is: yes. The pragmatic answer is: no.

If you know the location (xyz coordinate) of the three beacons in your inertial (fixed) reference frame, then all that is needed to determine the location of the device you would like to track is the straight-line distance from your device to each of the three beacons. More correctly, the distance information would narrow down the position of your device to exactly two locations.

Depending on the transmission technology of your beacons (RF, sonar, light), and the surrounding environment, it may or may not be practical to calculate the straight-line distance.

It is difficult with both sonar and RF to get reliable distance calculations because of reflections from the surrounding environment. Distance calculations using time-of-flight are very reliable and accurate. However, you need line-of-sight.

Take a look at this technology. It is the closest that I have encountered for practical location over a large area: http://www.ubisense.net/en/

ContentLicense: CC BY-SA 3.0


问:
Raspberry Pi vs BeagleBone Black Rev C on vending machine
I wish to start my vending business, but none of the existing vending machines fit my needs.
So, I need to choose the "brains" to my vending machine under current development.

The user experience of my vending machine will be:

User change their products on touchscreen display (firegox open rails application running in the "brains"), insert moneys, after that products will be returned to the user and notification (json query) will be send to it saas.

There are requirements:

Popular (I want to use a widely used computer for better support)

Debian-like or CentOs like system (easy to develop rails apps on them)

Big count of GPIOs

Working with touch-screen and large display (at least 15")

Working with mdb protocol (for currency detector needs)

So, I need your hints. It seems that BeagleBone is more powerful then Raspberry Pi, but there is one problem: It doesn't support many of the video outputs. Is there any solution to make good video output on BeagleBone? Do other such computers exist?

答:
I would recommend sticking to Raspberry Pi for few reasons:

Popularity - Raspberry gives 30,900,000 results in Google and Beagle Bone Black only 1,900,000.

Raspi have Raspian - Debian for ARM

Raspberry could easily drive even 32' or more HD display. Beagle has some limitations on resolution.

Raspberry will work with MDB protocol if you buy some hardware (MDB to RS232) Example here: http://www.waferstar.com/en/MDB-PC.html

Future proof - you could use compute module if you wish to make your product modular.

Reasons for Beagle Bone Black
3. Pin count - 96 vs 40 for Raspberry.

I think that you design with using web browser only to connect to Ruby on Rails application could be too much for embedded design because this could be achieved with Tkinter for Python or similar http://visualruby.net/ if you want to use Ruby language.


问:
is it possible to track movement on a tennis court?
I'd like to track my run in an indoor tennis court. GPS won't be available so I was thinking researching for other solutions:

Accelerometer: I concluded it's a no go because while playing tennis the player makes a lot of movements that include spinning his body that can alter the data.

Then I thought that a 3/4 point IR system might help but again from what I've understood it's hard for the IR system to track the movement since they won't be able to focus on the player.

So my final thought went to radio systems but I couldn't find any info and it's also hard for me to see a theoretical solution at least on how I can mesure the movement/speed of the player.

So here is my question: Is there any existing system that is able to track random movement of an object (athlete) and give info like speed and distance? is there anywhere resources about how such a system might be achieved or at least the exact technology used for it?

Any suggestions and ideas are greatly appreaciated.

答:
For this project, as well as others like mine (I'll mention after), I would also consider Low Energy Bluetooth or BTLE.

It would be using radio signals like you said.

I would like to see how I, or a cat, or anyone spends there time. Working from home I spend most my day in the house and mostly at the desk or behind the computer screen. But it would be interesting to collect, analyze and visualize this information.

Two methods:
1) Just set up a few fixed-point broadcasting "towers" with the Arduino on the user as a receiver, recording tower_ID and tower_amplitude and simply triangulate.

2) Set up the user / tennis player / cat as the broadcaster and each tower as a receiver.

Each can be ideal for different situations. Consider how long the User must wear the device, how heavy it can be and thus how much power it can carry.
^ My bet would be that method 1 would require more sophistication and thus a larger arduino / shield / power combination to be worn on the User (Tennis player) / Person (Me) / Cat (not me).
^^ Not so good for tennis or action sports, but not a big deal for me lounging around the house in my sweat pants ([See Loss Of Regimen in TheOatMeal blog about working from home post] for lolz)

With the second method you could use a cheap BTLE transmitter that is lightweight (most the weight of these are made up of the watch battery used to power them) about the size and weight of a 3 stacked quarters.
The receiver towers could then be designed with power systems that don't require the cost of reduced weight.
The Second method would, however, require a little extra post data munging since you would need to reconcile data from multiple source inputs rather than method 1's use of a single source with multiple inputs.

I am still digging around with the project myself having just started researching today and won't get around to designing later this month.

Please feel free to contact me with any ideas, suggestions or questions
@
My Personal Website or LinkedIn

My website / blog is way over due for a make-over and update of past and current projects. But in the coming months I will post projects such as the Brain-Computer-Interface I used to control a synthesizer with, a tactile interface which gave users texture feedback from interacting with digital objects (such as feeling a smooth surface in a picture of granite or a rigid or bumpy surface from accord pictures or programmed game objects with meta data read by the Arduino controlled feedback system build into and around a mouse)


问:
More powerful alternatives to Lego Mindstorm NXT 2.0?
I'm interested to build Robot from my imagination, and I was looking to purchase a robotic kit.

I find the Lego Mindstorm NXT 2.0 really interesting for many reasons : You can plug whatever brick you want, and you can develop in the language you want.

I am a developer, and the use of this kind of robotic would be interaction mostly (not moving, so the servo motors are useless to me, at least now).

But regarding the spec of the NXT main component, I feel it's a bit low (proc, ram & rom).

That made me wonder if any of you know something similar (where I can plug whatever I want on it, and most importantly, program the reaction), but with a more powerful hardware ?

Price will also be a limitation : I like the NXT also because I can build what I want under 300 USD. I don't want to spend 10k USD on my first kit, but I would appreciate buying a better piece of robotic if the price isn't too distant from the NXT's.

Do you have some alternatives to check out ?

Thanks for your help !  :)

答:
If you look for more advanced kits than the NXT brick, consider picking any ARM board you like. For example the Raspberry Pi, the CubieBoard or the PandaBoard. All of them can be rather easily combined or expanded with electronics or sensors you like, some of them, like the RasPi have plenty of GPIO pins.

Considering hardware extensions, VEX Robotics have many different parts like structural elements, wheels, motors, sensors, nuts, bolts and sprockets who are standardized by the company to fit nicely with each other.


问:
Could a robot be programmed to be human?
This is all hypothetical. If it was possible, it would have been done by now.

I realise that this area has been touched upon in many sci-fi movies but I wondered that if it was even feasible, how could it be achieved?

I know that it would raise a lot of ethical questions, I don't doubt that but I'm interested in the science.

What would a robot's brain have to be like to function like a human brain? For example, for it to have emotion (e.g. love, empathy), learn new things and remember them, make all those connections that a human brain does?

Thanks to all who reply!

答: The correct question is "Will humans ever be able to know everything about themselves?" In order to transfer an exact copy of A to B you first have to have full knowledge about A especially when it comes to things as complex as the way humans live and think. If at some point in the future humans manage to unravel all the mysteries of the human body and mind, then and only then they will be able to program an machine to behave in the exact same way. Of course this is also restricted by the technologies that one has at his/her disposal. When it come to brute computation power computers already have the upper hand. However when it comes to associative thinking humans are the winners. Another question is if such a thing is necessary/desired? It has been suggested by psychologist that the more human-like a machine looks like, the more troubled people feel in its presence.


问:
How to correctly compute direct kinematics for a delta robot?
I'm trying to put together a simple simulation for a delta robot and I'd like to use forward kinematics (direct kinematics) to compute the end effector's position in space by passing 3 angles.

I've started with the Trossen Robotics Forum Delta Robot Tutorial and I can understand most of the math, but not all. I'm lost at the last part in forward kinematics, when trying to compute the point where the 3 sphere's intersect. I've looked at spherical coordinates in general but couldn't work out the two angles used to find to rotate towards (to E(x,y,z)).
I see they're solving the equation of a sphere, but that's where I get lost.

Can someone please 'dumb it down' for me ?

Also, I've used the example code to do a quick visualization using Processing,
but the last part seems wrong. The lower leg changes length and it shouldn't:

```<code>//Rhino measurements in cm
final float e = 21;//end effector side
final float f = 60.33;//base side
final float rf = 67.5;//upper leg length - radius of upper sphere
final float re = 95;//lower leg length - redius of lower sphere (with offset will join in E(x,y,z))

final float sqrt3 = sqrt(3.0);
final float sin120 = sqrt3/2.0;
final float cos120 = -0.5;
final float tan60 = sqrt3;
final float sin30 = 0.5;
final float tan30 = 1/sqrt3;
final float a120 = TWO_PI/3;
final float a60 = TWO_PI/6;

//bounds
final float minX = -200;
final float maxX = 200;
final float minY = -200;
final float maxY = 200;
final float minZ = -200;
final float maxZ = -10;
final float maxT = 54;
final float minT = -21;

float xp = 0;
float yp = 0;
float zp =-45;
float t1 = 0;//theta
float t2 = 0;
float t3 = 0;

float prevX;
float prevY;
float prevZ;
float prevT1;
float prevT2;
float prevT3;

boolean validPosition;
//cheap arcball
PVector offset,cameraRotation = new PVector(),cameraTargetRotation = new PVector();

void setup() {
  size(900,600,P3D);
}

void draw() {
  background(192);
  pushMatrix();
  translate(width * .5,height * .5,300);
  //rotateY(map(mouseX,0,width,-PI,PI));

  if (mousePressed && (mouseX > 300)){
    cameraTargetRotation.x += -float(mouseY-pmouseY);
    cameraTargetRotation.y +=  float(mouseX-pmouseX);
  }
  rotateX(radians(cameraRotation.x -= (cameraRotation.x - cameraTargetRotation.x) * .35));
  rotateY(radians(cameraRotation.y -= (cameraRotation.y - cameraTargetRotation.y) * .35));

  stroke(0);
  et(f,color(255));
  drawPoint(new PVector(),2,color(255,0,255));
  float[] t = new float[]{t1,t2,t3};
  for(int i = 0 ; i < 3; i++){
    float a = HALF_PI+(radians(120)*i);
    float r1 = f / 1.25 * tan(radians(30));
    float r2 = e / 1.25 * tan(radians(30));
    PVector F = new PVector(cos(a) * r1,sin(a) * r1,0);
    PVector E = new PVector(cos(a) * r2,sin(a) * r2,0);
    E.add(xp,yp,zp);
    //J = F * rxMat
    PMatrix3D m = new PMatrix3D();
    m.translate(F.x,F.y,F.z);
    m.rotateZ(a);
    m.rotateY(radians(t[i]));
    m.translate(rf,0,0);

    PVector J = new PVector();
    m.mult(new PVector(),J);
    line(F.x,F.y,F.z,J.x,J.y,J.z);
    line(E.x,E.y,E.z,J.x,J.y,J.z);
    drawPoint(F,2,color(255,0,0));
    drawPoint(J,2,color(255,255,0));
    drawPoint(E,2,color(0,255,0));
    //println(dist(F.x,F.y,F.z,J.x,J.y,J.z)+"\t"+rf);
    println(dist(E.x,E.y,E.z,J.x,J.y,J.z)+"\t"+re);//length should not change
  }
  pushMatrix();
    translate(xp,yp,zp);
    drawPoint(new PVector(),2,color(0,255,255));
    et(e,color(255));
    popMatrix();
  popMatrix();
}
void drawPoint(PVector p,float s,color c){
  pushMatrix();
    translate(p.x,p.y,p.z);
    fill(c);
    box(s);
  popMatrix();
}
void et(float r,color c){//draw equilateral triangle, r is radius ( median), c is colour
  pushMatrix();
  rotateZ(-HALF_PI);
  fill(c);
  beginShape();
  for(int i = 0 ; i < 3; i++)
    vertex(cos(a120*i) * r,sin(a120*i) * r,0);
  endShape(CLOSE);
  popMatrix();
}
void keyPressed(){
  float amt = 3;
  if(key == 'q') t1 -= amt;
  if(key == 'Q') t1 += amt;
  if(key == 'w') t2 -= amt;
  if(key == 'W') t2 += amt;
  if(key == 'e') t3 -= amt;
  if(key == 'E') t3 += amt;
  t1 = constrain(t1,minT,maxT);
  t2 = constrain(t2,minT,maxT);
  t3 = constrain(t3,minT,maxT);
  dk();
}

void ik() {
  if (xp < minX) { xp = minX; }
  if (xp > maxX) { xp = maxX; }
  if (yp < minX) { yp = minX; }
  if (yp > maxX) { yp = maxX; }
  if (zp < minZ) { zp = minZ; }
  if (zp > maxZ) { zp = maxZ; }

  validPosition = true;
  //set the first angle
  float theta1 = rotateYZ(xp, yp, zp);
  if (theta1 != 999) {
    float theta2 = rotateYZ(xp*cos120 + yp*sin120, yp*cos120-xp*sin120, zp);  // rotate coords to +120 deg
    if (theta2 != 999) {
      float theta3 = rotateYZ(xp*cos120 - yp*sin120, yp*cos120+xp*sin120, zp);  // rotate coords to -120 deg
      if (theta3 != 999) {
        //we succeeded - point exists
        if (theta1 <= maxT && theta2 <= maxT && theta3 <= maxT && theta1 >= minT && theta2 >= minT && theta3 >= minT ) { //bounds check
          t1 = theta1;
          t2 = theta2;
          t3 = theta3;
        } else {
          validPosition = false;
        }

      } else {
        validPosition = false;
      }
    } else {
      validPosition = false;
    }
  } else {
    validPosition = false;
  }

  //uh oh, we failed, revert to our last known good positions
  if ( !validPosition ) {
    xp = prevX;
    yp = prevY;
    zp = prevZ;
  }

}

void dk() {
  validPosition = true;

  float t = (f-e)*tan30/2;
  float dtr = PI/(float)180.0;

  float theta1 = dtr*t1;
  float theta2 = dtr*t2;
  float theta3 = dtr*t3;

  float y1 = -(t + rf*cos(theta1));
  float z1 = -rf*sin(theta1);

  float y2 = (t + rf*cos(theta2))*sin30;
  float x2 = y2*tan60;
  float z2 = -rf*sin(theta2);

  float y3 = (t + rf*cos(theta3))*sin30;
  float x3 = -y3*tan60;
  float z3 = -rf*sin(theta3);

  float dnm = (y2-y1)*x3-(y3-y1)*x2;

  float w1 = y1*y1 + z1*z1;
  float w2 = x2*x2 + y2*y2 + z2*z2;
  float w3 = x3*x3 + y3*y3 + z3*z3;

  // x = (a1*z + b1)/dnm
  float a1 = (z2-z1)*(y3-y1)-(z3-z1)*(y2-y1);
  float b1 = -((w2-w1)*(y3-y1)-(w3-w1)*(y2-y1))/2.0;

  // y = (a2*z + b2)/dnm;
  float a2 = -(z2-z1)*x3+(z3-z1)*x2;
  float b2 = ((w2-w1)*x3 - (w3-w1)*x2)/2.0;

  // a*z^2 + b*z + c = 0
  float a = a1*a1 + a2*a2 + dnm*dnm;
  float b = 2*(a1*b1 + a2*(b2-y1*dnm) - z1*dnm*dnm);
  float c = (b2-y1*dnm)*(b2-y1*dnm) + b1*b1 + dnm*dnm*(z1*z1 - re*re);

  // discriminant
  float d = b*b - (float)4.0*a*c;
  if (d < 0) { validPosition = false; }

  zp = -(float)0.5*(b+sqrt(d))/a;
  xp = (a1*zp + b1)/dnm;
  yp = (a2*zp + b2)/dnm;

  if (xp >= minX && xp <= maxX&& yp >= minX && yp <= maxX && zp >= minZ & zp <= maxZ) {  //bounds check
  } else {
    validPosition = false;
  }

  if ( !validPosition ) {
    xp = prevX;
    yp = prevY;
    zp = prevZ;
    t1 = prevT1;
    t2 = prevT2;
    t3 = prevT3;
  }

}

void  storePrev() {
  prevX = xp;
  prevY = yp;
  prevZ = zp;
  prevT1 = t1;
  prevT2 = t2;
  prevT3 = t3;
}

float rotateYZ(float x0, float y0, float z0) {
  float y1 = -0.5 * 0.57735 * f; // f/2 * tg 30
  y0 -= 0.5 * 0.57735    * e;    // shift center to edge
  // z = a + b*y
  float a = (x0*x0 + y0*y0 + z0*z0 +rf*rf - re*re - y1*y1)/(2*z0);
  float b = (y1-y0)/z0;
  // discriminant
  float d = -(a+b*y1)*(a+b*y1)+rf*(b*b*rf+rf);
  if (d < 0) return 999; // non-existing point
  float yj = (y1 - a*b - sqrt(d))/(b*b + 1); // choosing outer point
  float zj = a + b*yj;
  return 180.0*atan(-zj/(y1 - yj))/PI + ((yj>y1)?180.0:0.0);
}
</code>```

答: It is very easy to conceive the direct kinematics, which has a closed form anyway. Just read this nice paper. Don't just read crappy tutorial and wikipages, try read some papers.</p>


问:
Velocity derivatives using Quaternions
How to compute the angular and linear velocities Quaternions? I am new to this area and although I have studied the algebra I am unable to understand how to compute the velocities.</p>

答:
The best way is of course to get yourself familiar with geometric algebra first.

```<code>Lounesto, Pertti. Clifford algebras and spinors. Vol. 286. Cambridge university press, 2001.
</code>```

After that, everything can be derived by yourself. But I guess most people here only like quick and dirty approaches. Use this book instead:

```<code>Kuipers, Jack B. Quaternions and rotation sequences. Vol. 66. Princeton: Princeton university press, 1999.
</code>```

straightly answers your question.

If you want to have more geometric sense of the algebra manipulations, John McCarthy's couldn't have done it better.

```<code>McCarthy, J. Michael. Introduction to theoretical kinematics. MIT press, 1990.
McCarthy, J. Michael, and Gim Song Soh. Geometric design of linkages. Vol. 11. Springer, 2010.
</code>```

Title: Velocity derivatives using Quaternions

Body:
The best way is of course to get yourself familiar with geometric algebra first.

Lounesto, Pertti. Clifford algebras and spinors. Vol. 286. Cambridge university press, 2001.

After that, everything can be derived by yourself. But I guess most people here only like quick and dirty approaches. Use this book instead:

Kuipers, Jack B. Quaternions and rotation sequences. Vol. 66. Princeton: Princeton university press, 1999.

straightly answers your question.

If you want to have more geometric sense of the algebra manipulations, John McCarthy's couldn't have done it better.

McCarthy, J. Michael. Introduction to theoretical kinematics. MIT press, 1990.
McCarthy, J. Michael, and Gim Song Soh. Geometric design of linkages. Vol. 11. Springer, 2010.


问:
Perfect implementation of Asimov's 3 Laws
After seeing the movie, I, Robot, I got this question.

If Asimov's 3 Laws (actually implementing law 1 automatically implements the other 2) are perfectly implemented on a quantum computer that controls an army of humanoid robots, and it  decides that taking complete control over the politics and economics via revolution is the best way to ensure human happiness, shouldn't it be allowed to proceed peacefully to ensure minimal loss of life? Isn't the hero's decision to destroy the computer fundamentally wrong?

答:
I disagree that implementing law 1 automatically implements the other 2.  Law 1 only states that a robot may not injure a human.  Nothing in that law implies that the robot must obey people or protect itself.

I suggest you read the original iRobot series of short stories.  They do a much better job of illustrating the different ways these 3 laws can lead to counter-intuitive robot behavior due to the logic leading to a paradox or inconsistency based on the current circumstance.  What you will learn is that Asimov based his stories around these rules to create convenient and interesting plots, not to actually provide a road-map for how robots should be built.


问:
Seamless motor movement
With the lego NXT Mindstorm kit I would like to have a rotating carousel that has "perfect" movement. This carousel has baskets and therefore it has quite a bit of inertia. I would like to find a method to calculate the perfect time to slow it down--taking into account motor friction, and momentum etc.

Here is some data I've collected:

The motor power is the power to the motor. The break time was the time it took to stop from the time that the motor power was set to 0. The over-turn dist was amount of rotation in degrees that the motor continued to rotate after the power was set to 0.

Is there a specific method or approach to optimize the motors movement so movement can be precisely rotated to X degrees?

答: Do you have any feedback from the motor (it's speed or position)? In this case you should consider using a closed loop control here like PID</p>

Title: Seamless motor movement


问:
Open source implementations of EKF for 6D pose esimation
I am looking for open source implementations of an EKF for 6D pose estimation (Inertial Navigation System) using at minimum an IMU (accelerometer, gyroscope) + absolute position (or pose) sensor.

This seems to be such a recurring and important problem in robotics that I am surprised I cannot find a few reference implementations. Does everyone just quickly hack together his own EKF and move on to more interesting things? Is that not rather error-prone?

I would ideally like a well-tested implementation that can serve as a reference for fair evaluation of possible improvements.

答:
I believe this should tick all your boxes:

http://wiki.ros.org/robot_localization

It's a ROS node for 6D pose estimation that has the following features:

Fusion of an arbitrary number of sensors. The nodes do not restrict the number of input sources. If, for example, your robot has multiple IMUs or multiple sources of odometry information, the state estimation nodes within robot_localization can support all of them.

Support for multiple ROS message types. All state estimation nodes in robot_localization can take in nav_msgs/Odometry, sensor_msgs/Imu, geometry_msgs/PoseWithCovarianceStamped, or geometry_msgs/TwistWithCovarianceStamped messages.

Per-sensor input customization. If a given sensor message contains data that you don't want to include in your state estimate, the state estimation nodes in robot_localization allow you to exclude that data on a per-sensor basis.

Continuous estimation. Each state estimation node in robot_localization begins estimating the vehicle's state as soon as it receives a single measurement. If there is a holiday in the sensor data (i.e., a long period in which no data is received), the filter will continue to estimate the robot's state via an internal motion model.

It has both an EKF implementation (ekf_localization_node) and a UKF (ukf_localization_node). Feel free to ask questions on the ROS Answers site.


问:
Torque control and monitoring of servo
I am trying to control the servo motor operation by torque control by interfacing the sensor to an avr , which will continuously monitor the torque value from the sensor and control the torque according to the given set point .Is it possible to make such a setup? If yes how?

Thanks.

答:
Yes, torque control of a motor with an AVR microcontroller is possible.  In fact, torque control of a joint is common practice in robotics.  This is a good example of a feedback loop.

There are many ways to measure the torque of a motor.  An expensive way is to use an off-the-shelf strain gauge based force/torque sensor on the output.  A cheaper way is to just us a rotary spring and measure the angle before and after the spring.  If you have a brushed or brushless motor that you are controlling yourself, the motor's torque is proportional to the current draw.  there are ways to measure this electronically as well.

As for control, you will probably use some variant of PID control.

Title: Torque control and monitoring of servo


问:
Best UGV platform?
My lab is interested in a good all-terrain UGV that can also be used indoors. We are particularly interested in the Clearpath Husky, Clearpath Jackal, and the Robotnik Summit XL (or XL HL), though we would welcome any other suggestions. Does anyone happen to have experience with more than one of these, and can speak to their pros and cons?</p>

答:
TL;DR: the Clearpth Husky is a solid machine that will pull it's weight, but expect to get a few laughs from their complete lack of quality control.

I can speak to the Clearpath Husky since my lab has two of them and I've worked with them quite a bit. It's a solid vehicle, great for mounting sensors on, works well indoors and outdoors. On the software side, it comes pre-installed with ROS, and has out-of-the-box for all the sensors it ships with (unless they mounted the IMU sideways...). That said I have had really bad experiences with Clearpath (and have heard similar stories from other labs). Their robots are clearly made to look good in a photograph, but on closer inspection, especially when you pop open the panels, it tells a different story. The battery only lasts about 1 hour when new and degrades to 20 mins within a year; there are stress fractures around the sheet metal bends, covered up by paint; when we opened the panels we found structural bolts with no nuts on them, they were just sitting loose in the hole; and the wiring / soldering job looked like it was done by a complete amature (I mentor FIRST Robotics and I would not have accepted that from even my grade 10's) This was especially bad on their Kingfisher USV boat which we bought this summer (which incidentally was delivered 3 months late) where the layout of the electronics was so bad that we had to mash in a GPIO header in order to get the door back on.

Title: Best UGV platform?


问:
Best strategy for area scanning using little sensing bots
I'm currently working on a school project about simulating robots scanning an area, but it has been a struggle to find what strategy the robots should use.  Here are the details:

I am given a certain amount of robots, each with a sensing range of $r$.  They spawn one after another.  Their task to scan a rectangular area.  They can only communicate with each other when they are within communication range.

I am looking for the best strategy, (i.e. time efficient solution) for this.
Any reply or clue to the strategy will be appreciated.

答:
Distributed cooperative coverage algorithms for robots sounds like an area of active research.  I suggest looking at some academic papers.  Here are a few to get you started:

Multirobot Cooperative Model applied to Coverage of Unknown Regions

Cooperative Coverage of Rectilinear Environments


问:
How can I modify a low cost hobby servo to run 'freely'?
I've got some hobby servos (Power HD 1501MGs) and I'd like to be able to control them (via an Arduino) so they will either go to the angle I set, or put them in a 'free running' mode, where the load will take them wherever it goes.

Is this even possible, or am I just going to end up stripping the gears?

My first thought is to simply kill the power to the servo, but the force required to move them in that state is more than I'd like.

If it is possible, am I looking at a hardware change, or could I do it in software?

答:
What you're asking isn't going to be very easy with a standard RC servo.

What you're asking for is a back-drivable servo. I.E. one which you can freely rotate by applying an external torque. It is certainly possible to create these, and they are used on many robots, but most RC servos require considerable torque to back drive them. I would call them semi-backdrivable.

What prevents you back driving them? Two things:

Friction: Firstly, friction in the gear chain and motor. RC servos are always geared down; the output spins slower than the motor. Of course this means that when you try to back drive it, you have to spin the motor very quickly. Any friction or cogging in the motor will be felt dozens of time over at the output.

Current: something surprising about electric motors is that, if you short the terminals, they become harder to turn. The rotation of the motor generates an electric current which works against your rotation. The electronics inside the servo might well allow enough current to flow, even when off, that it noticeably prevents backdrivability. In the past I have noticed that some large stepper motors, even when ungeared, are almost impossible to back drive when plugged in to unpowered equipment. But when you unplug them, they can be spun freely.

So, one way you can improve the back-drivability is to prevent current flowing. The obvious way to do this is to fully disconnect the motor from its electronics. But this is hard to do, even using FETs, because the diodes inside the FETs might well allow current to flow. However, you could use a relay, which really would disconnect the motor. You'd only have to use it on one of the motor's terminals.

'Proper' servo controllers (like the ESCON from Maxon) actually contain a current controller which can actively prevent current flowing by applying the correct voltage at the motor terminals. Replacing the electronics in the servo with something capable of current control might really help.

What you should do: Open up the servo, unsolder the motor, and re-assemble it. How easy is it to back-drive now? If it's easy, then it may be possible to do what you want. If it's still too hard for your application, then you're going to have to choose a different servo, or make your own. Make one with a single gear stage so that the gear friction is reduced as much as possible, and use drive electronics with a current control loop to guarantee zero current flow.


问:
I don't understand Integral part of PID controller
I dont understand integral part of PID controller. Let's assume this pseudocode from Wikipedia:

```<code>previous_error = 0
integral = 0
start:
  error = setpoint - measured_value
  integral = integral + error*dt
  derivative = (error - previous_error)/dt
  output = Kp*error + Ki*integral + Kd*derivative
  previous_error = error
  wait(dt)
  goto start
</code>```

Integral is set to zero in the beginning. And then in the loop it's integrating the error over the time. When I make a (positive) change in setpoint, the error will become positive and integral will "eat" the values over the time (from the beginning). But what I dont understand is, when error stabilizes back to zero, the integral part will still have some value (integrated errors over time) and will still contribute to the output value of controller, but it should not, because if error is zero, output of PID should be zero as well, right?

Can somebody explain me that please?

答:
The main purpose of the integral term is to eliminate the steady state error.
In the normal case there is going to be a small steady state error and the integral is mainly used to eliminate this error.
It's however true that when the error gets to 0 the integral will still be positive and will make you overshoot. Then after overshoot the integral will start to go down again. This is the negative effect of the integral term.
So there is always the trade-off and you have to tune the PID controller to make sure that the overshoot is as small as possible and that the steady state error is minimized.
Here is where the derivative term come into play. The derivative term helps to minimize the overshoot in the system.</p>


答:
Sorry, but this is not an answer. I couldn't fit my response to 'Ben' in the comments.

I am only asking about perfect logic, as even near-perfect logic could lead to a contradiction. Here's my proof of law 1 implementing law 2 and 3:

If the system is almost convinced that it knows better about your good than yourself, it will use law 1 to do so. If it is not sure, it will ask you before proceeding (if any negative risk is involved). If it has no decision to take, it will remain inactive but thinking, until you give it an order. In most cases, it wouldn't know better than you and will obey, otherwise it will use the 1st law to refuse to do so.

As law 2 is already implemented by law 1, law 3 also follows from law 1:
As it knows it is more beneficial to you when it is in existence than when it is not, it will protect itself for your good only, again according to law 1.

I am assuming that 'harm' in law 1 refers to mental harm also, only then preventing harm becomes synonymous to doing good (as even a slight discomfort or annoyance would get interpreted as 'harm').

Title: Perfect implementation of Asimov's 3 Laws

Body:
After seeing the movie, I, Robot, I got this question.

If Asimov's 3 Laws (actually implementing law 1 automatically implements the other 2) are perfectly implemented on a quantum computer that controls an army of humanoid robots, and it  decides that taking complete control over the politics and economics via revolution is the best way to ensure human happiness, shouldn't it be allowed to proceed peacefully to ensure minimal loss of life? Isn't the hero's decision to destroy the computer fundamentally wrong?


问:
How do I determine the heading of a six wheeled robot?
I have a robot simulation that simulates Mars Exploration Rover with six steerable wheels.

In case of the following steering configuration

```<code>// --- //  front wheels
//     //  middle wheels
// --- //  rear wheels
</code>```

I'd say the heading of the rover with respect of the rover's body is about 45 to the right.
My question is what is the right approach of calculating heading with respect of the rover body?

Do I simply sum the steering angles of steering actuators and divide it by the total number of the steering actuators?

Additional Note:
Assuming no slippage on a perfectly flat plane.

答:
A vehicle like this that can move in any direction regardless of orientation is called "holonomic".  This decoupling is a little counter-intuitive because we are used to cars, which always move in the direction they are pointing (kinda, see: ackerman steering).  But aircraft and boats deal with this all the time.  The terminology they use is: heading is the direction the craft's nose is pointing, and course is the direction of travel.

So in your example, I'd say the robot's heading is North (or 0 degrees), and it's course is 45 degrees to the right.

Of course this is assuming there is no wheel slippage.  In which case i don't think there is a formal method because wheel slippage is something people try to avoid.  And since wheel slippage is un-sensed, you need to determine your course with external sensors.


问:
How does power get to the flywheel in a motorized gyroscope?
When I look at my toy gyroscope (I have never seen the inside of a motorized gyroscope), the central flywheel is suspended within the various gymbals and needs a lot of freedom of movement.  It's hard to see how an electric motor in the flywheel hub could be supplied with power.

How do "real" gyroscopes maintain angular velocity in their flywheel?

答: Well, since there is no information about the specific gyro, you are talking about, one can think of providing power through some kind of slip rings or simpier brush contacts.</p>


问:
Software to simulate mechanics of production line
Is there any software where I can simulate production line elements (joints, motors, springs, actuators, movement)? For example I want to simulate mechanism to unwind paper from big roll to weld it later with bubble foil and finally make bubble foil envelope, mechanism will look like this:

I need it as simple as possible and preferably free.

答: This project looks promising http://gazebosim.org/.</p>


问:
How to convert PID outputs to appropriate motor speeds for a quad copter
I am building an autonomous robot using PID control algorithm. So, far I have implemented PID using online resources/references. I am testing for stabilizing an axis of the quad copter. However, I am not successful to stabilize even one axis.
Description: My input for the PID is an angle value i.e the orientation of the quad copter measured by AHRS (a Gyroscope that measures angles) and the motors take integer values as speeds. What I am doing is,

```<code>motor_right_speed = base_speed + adjusted_value;
motor_left_speed = base_speed - adjusted_value;
adjusted_value += PID_output;
</code>```

Where ajusted_value is a buffer that accumulates or subtracts the PID output value based on either PID output is +ve or -ve.

I also tried,

```<code>motor_right_speed = base_speed + PID_output;
motor_left_speed = base_speed - PID_output;
</code>```

Both don't seem to be working.

I have tested using a wide range of P gain values (from very small to very large), but the quad copter only oscillates; it does not self-correct. Your help with suggestions would be greatly appreciated. Thanks!

答:
I would recommend to double check the algorithm and make sure that is able to output negative values. You should post your pid code.

The approach you are using is a simple and quite effective control strategy in which the knowledge of the model is not required to get the job done. By 'knowledge of the model' I mean the system of equations that describes the dynamics of your quadcopter in space. You just need the reference value, the filtered measurement (the estimated angle) and three coefficients.

In your project you want your roll and yaw angle to be 0, at least in hovering mode right. Let's consider as a measured variable y(t), the roll angle theta(t) at time t (the pitch angle phi will be another one). So y(t) = theta(t).

First of all, make sure that your estimated angles are accurate.

Then define the control error as the difference between the desired position, y_des = 0, and the actual measurement at time t, y(t).

e(t) = y_des - y(t)

In order to understand the effect of each coefficient, (Kp,Kd and Ki) we need to look at the control formula.

The control input u(t) is the sum of three different terms:

The proportional term is described by the Kp gain which tells the control how intense should the response be compared to the error. What does it mean? If at time t, the quad is 3 degree away from your setpoint (e(t)=3) then apply a torque Kp times that value to get it back the correct position. If the value is to high you will pass your set point and you will notice oscillations around the 0 value. The steady state error will decrease with increasing gain, but the tendency towards oscillation will also increase. You can't get good results only with this term.

The derivative term is characterized by the Kd gain. In the formula, this coefficient is multiplied by the derivative of the error. In other words, this gain tells the controller how fast should it react to changes in error's values. If you are going away from your set point,  the error's derivative will be different than zero and positive (or negative) so apply a torque proportionally to this value. The derivative action will not help if the sample time is too large.

The integral term is described by the Ki gain. This coefficient weights the contribution of how long does the quadcopter remains in a state of error. If you are testing the control only on one axis and you are using a too low Proportional gain, Kp, you will notice that the quad won't be able to reach the 0 degree reference value and will be "stuck" at a certain angle. Adding Ki != 0 will help by providing an extra torque value after an interval of time. The Ki gain will determine this extra torque value.

Here is example using arduino. (This is a basic code and what's above is pub version of the explanation)

```<code>  // Roll PID
  errorRoll = abs(SetpointRoll - estimatedKalmanRoll); //distance away from setpoint
  if(errorRoll<thresholdRoll)
  {
    //we're close to setpoint, use conservative tuning parameters
    myRollPID.SetTunings(consKpRoll, consKiRoll, consKdRoll);
  }
  else
  {
     //we're far from setpoint, use other parameters
     myRollPID.SetTunings(aggKpRoll, aggKiRoll, aggKdRoll);
  }

  myRollPID.Compute(); // This computes rollpid
</code>```

Same thing for pitch, yaw and altitude

```<code>  // computes motor IN based on roll, pitch, yaw Pid OUT and throttle value
  motorA = thr + rollpid - yawpid;
  motorB = thr + pitchpid + yawpid;
  motorC = thr - rollpid - yawpid;
  motorD = thr - pitchpid + yawpid
</code>```

Check this answer as well.

Hope this helps,
Ciao.

Body:
I would recommend to double check the algorithm and make sure that is able to output negative values. You should post your pid code.

The approach you are using is a simple and quite effective control strategy in which the knowledge of the model is not required to get the job done. By 'knowledge of the model' I mean the system of equations that describes the dynamics of your quadcopter in space. You just need the reference value, the filtered measurement (the estimated angle) and three coefficients.

In your project you want your roll and yaw angle to be 0, at least in hovering mode right. Let's consider as a measured variable y(t), the roll angle theta(t) at time t (the pitch angle phi will be another one). So y(t) = theta(t).

First of all, make sure that your estimated angles are accurate.

Then define the control error as the difference between the desired position, y_des = 0, and the actual measurement at time t, y(t).

e(t) = y_des - y(t)

In order to understand the effect of each coefficient, (Kp,Kd and Ki) we need to look at the control formula.

The control input u(t) is the sum of three different terms:

The proportional term is described by the Kp gain which tells the control how intense should the response be compared to the error. What does it mean? If at time t, the quad is 3 degree away from your setpoint (e(t)=3) then apply a torque Kp times that value to get it back the correct position. If the value is to high you will pass your set point and you will notice oscillations around the 0 value. The steady state error will decrease with increasing gain, but the tendency towards oscillation will also increase. You can't get good results only with this term.

The derivative term is characterized by the Kd gain. In the formula, this coefficient is multiplied by the derivative of the error. In other words, this gain tells the controller how fast should it react to changes in error's values. If you are going away from your set point,  the error's derivative will be different than zero and positive (or negative) so apply a torque proportionally to this value. The derivative action will not help if the sample time is too large.

The integral term is described by the Ki gain. This coefficient weights the contribution of how long does the quadcopter remains in a state of error. If you are testing the control only on one axis and you are using a too low Proportional gain, Kp, you will notice that the quad won't be able to reach the 0 degree reference value and will be "stuck" at a certain angle. Adding Ki != 0 will help by providing an extra torque value after an interval of time. The Ki gain will determine this extra torque value.

Here is example using arduino. (This is a basic code and what's above is pub version of the explanation)

  // Roll PID
  errorRoll = abs(SetpointRoll - estimatedKalmanRoll); //distance away from setpoint
  if(errorRoll<thresholdRoll)
  {
    //we're close to setpoint, use conservative tuning parameters
    myRollPID.SetTunings(consKpRoll, consKiRoll, consKdRoll);
  }
  else
  {
     //we're far from setpoint, use other parameters
     myRollPID.SetTunings(aggKpRoll, aggKiRoll, aggKdRoll);
  }

  myRollPID.Compute(); // This computes rollpid

Same thing for pitch, yaw and altitude

  // computes motor IN based on roll, pitch, yaw Pid OUT and throttle value
  motorA = thr + rollpid - yawpid;
  motorB = thr + pitchpid + yawpid;
  motorC = thr - rollpid - yawpid;
  motorD = thr - pitchpid + yawpid

Check this answer as well.

Hope this helps,
Ciao.


答:
You might also try the CoroBot by CoroWare.  It can be used outdoors, but is much smaller than the Husky.

Edit: Unfortunately, CoroWare seems to be out of business now.

Title: Best UGV platform?

Body: My lab is interested in a good all-terrain UGV that can also be used indoors. We are particularly interested in the Clearpath Husky, Clearpath Jackal, and the Robotnik Summit XL (or XL HL), though we would welcome any other suggestions. Does anyone happen to have experience with more than one of these, and can speak to their pros and cons?</p>

ContentLicense: CC BY-SA 4.0


问:
Robot docking for self-recharging
I want to build a simple obstacle avoider robot, but this time I want it to be self-recharging so I am building a dock for this purpose, so I want it to be able to locate the dock and go for it when battery voltage is lower than a fixed value.

I am having trouble to chose the right components for locating the dock, I think I am going to use an IR emitter on the dock so the robot can head toward it when battery is low (let's forget about the orientation problem for the moment, but if you have any thoughts about it that will be helpful) but I am not sure if the robot is able to detect the IR LED (or whatever) from a long distance (over 10 meter)

Is it possible to use this solution for this distance? If not, what do you suggest?

(If there is a simple ready solution to buy that's ok, let's say I have no budget limit)

答:
Have a look at the second part of the page, Testing Automatic Docking.

Here they explain how it works with Kobuki turtlebots.

Kobuki's docking station has 3 IR (Infrared) emitters. The emitted IR
  lights cover three regions in front of the docking station: left,
  central and right, each divided in two sub-fields: near and far. Each
  beam encodes this information, so the robot knows at any moment in
  which region and sub-field he is. Also, as regions and fields are
  independently identified, they can be overlap on its borders.

Kobuki has 3 IR receivers. When the robot is placed within the field
  of the docking station, and at least one IR receiver is facing toward
  it, the robot will catch the signal and stream it to the controller
  netbook. The information is available on
  /mobile_base/sensors/dock_ir topic, in the form of
  kobuki_msgs/DockInfraRed messages.

Title: Robot docking for self-recharging


问:
More powerful alternatives to Lego Mindstorm NXT 2.0?
I'm interested to build Robot from my imagination, and I was looking to purchase a robotic kit.

I find the Lego Mindstorm NXT 2.0 really interesting for many reasons : You can plug whatever brick you want, and you can develop in the language you want.

I am a developer, and the use of this kind of robotic would be interaction mostly (not moving, so the servo motors are useless to me, at least now).

But regarding the spec of the NXT main component, I feel it's a bit low (proc, ram & rom).

That made me wonder if any of you know something similar (where I can plug whatever I want on it, and most importantly, program the reaction), but with a more powerful hardware ?

Price will also be a limitation : I like the NXT also because I can build what I want under 300 USD. I don't want to spend 10k USD on my first kit, but I would appreciate buying a better piece of robotic if the price isn't too distant from the NXT's.

Do you have some alternatives to check out ?

Thanks for your help !  :)

答: For a programmer, you might want to check out Gadgeteer.  No soldering or electronics experience required.  There is a wide range of processors that run .NET MF and interface with compatible devices.  GHI is one of the larger purveyors of Gadgeteer devices.</p>


问:
Good 3D simulator for outdoor autonomous navigation
What's an appropriate tool for simulating a car driving in a simple closed-loop racetrack? I'm trying to implement the control logic for an autonomous vehicle, and I'd like to be able to first simulate the behaviour before testing on a physical platform. The target environment is mostly 2D, but there are some 3D obstacle like small ramps and arches, so I can't use a strictly 2D simulator.

I've looked at some robotics simulators, as listed here, but they seem like overkill and none of them seemed designed to model outdoor environments. I've done a little work with Gazebo, and I can't find any guide of texturing the ground/sky/background.

All I really need is some way apply a texture map to the ground and sky, create a handful of obstacles, and then to calculate a camera feed as a simple two-wheeled chassis moves along a mostly 2D course. However, I need the video input to be as realistic as possible because I don't have access to the real world racetrack. I need to be able to test and train the control logic in the simulator, and then load that logic onto the real mobile platform and have it navigate the course.

答: This sounds similar to work my colleague did on high-speed vehicle control.  He used TORCS (The Open Race Car Simulator).  See this project page for a video, screenshots, and the published paper of his work.</p>


问:
Linear State space model for mobile robot
How can I write a linear state space model for a 4 wheel mobile robot with Ackerman steering in terms of error. I want the robot to follow a line. The robot is rear wheel drive </p>

答: Read and understand this. Refer to other sections of that site, if needed.</p>


答: I know this is not exactly what you wanted, but you should look into the Pure Pursuit algorithm for line following.</p>

Title: Linear State space model for mobile robot

Body: How can I write a linear state space model for a 4 wheel mobile robot with Ackerman steering in terms of error. I want the robot to follow a line. The robot is rear wheel drive </p>


问:
world files for simulating roads and tracks
Hello I wanted to simulate a busy urban road,similar to Darpa Urban Challenge for an autonomous self-driving-car. I'm in search of simulators for that.

I've seen gazebo since its integration with ROS is easier but editing world files or indeed creating them itself is difficult. In torcs simulator I have seen many world files but not many sensors.  I don't want much physics in my simulation. I want a light weight simulator(for checking out path planning on an urban road) and in which creating roads are easier.

I've even searched for gazebo sdf files similar to urban city but in vain.

答:
You might want to start by checking out AIM - Autonomous Intersection Management by the University of Texas at Austin.  It is a simple 2D simulator, but sounds like it has the features you need.

Also, you might want to search for civil engineering traffic simulators.  I'm sure there are a bunch of them.

One more option, you can use something like MASON a multi-agent simulation toolkit to code your own simulator with multiple intelligent agents.


问:
DualCopter Degree Of Freedom
I am a newbie in this drone field. I am curious to know what type of rotation and translation a dualcopter can achieve ? By rotation and translation i mean can it be able to roll, pitch and yaw like quadcopters?
If not, in any copter what makes them to roll pitch and yaw? Furthermore are there any dualcopter design that have movable wings that will rotate the rotors itself or do up and down motion while flying?</p>

答:
A quick google search yields this video of an RC dual copter that looks like it is able to control its pitch, roll and yaw:
https://www.youtube.com/watch?v=_cwCHgmDbz0

Skip to 5:50 for the part where he actually flies it.

As for quadcopters, there is a well known video circulating on the internet of a presentation given at a TED conference by Raffaello d'Andrea of ETH Zurich about quadcopters in which he clips opposing rotors of a quadcopter and demonstrates that he is still able to control the height of the quadcopter using a specialized control algorithm. The video can be found here. https://www.youtube.com/watch?v=w2itwFJCgFQ

In it, he mentions that "we relinquish control of yaw (z axis rotation), but roll, pitch and acceleration can still be controlled with algorithms that exploit this new configuration." I'm not sure if you're looking into a control algorithm like this because the craft continuously rotates during flight.

Title: DualCopter Degree Of Freedom


答:
Where your robot will go will depend on where the axes of the wheels intersect.

If all the axes are identical, it can turn around any point on the axes, or go straight, perpendicular to the axes.

If all the axes intersect in one point, the robot will travel on a circle around that point.

If the axes are parallel, it will go only straight, perpendicular to the axes.

If the axes intersect in multiple points it can't go anywhere without sliping.

Title: How do I determine the heading of a six wheeled robot?

Body:
I have a robot simulation that simulates Mars Exploration Rover with six steerable wheels.

In case of the following steering configuration

```<code>// --- //  front wheels
//     //  middle wheels
// --- //  rear wheels
</code>```

I'd say the heading of the rover with respect of the rover's body is about 45 to the right.
My question is what is the right approach of calculating heading with respect of the rover body?

Do I simply sum the steering angles of steering actuators and divide it by the total number of the steering actuators?

Additional Note:
Assuming no slippage on a perfectly flat plane.


问:
control circuit of a humanoid robot (something like iCub or Asimo)
My friend and I are building the upper body of a humanoid robot for our M.Sc thesis project. There are 24 DC motors in this robot. The thing I want to know is what is the best way to command these motors simultaneously?

The design I had in mind is for each motor to have its own micro for position and velocity control and then one master micro to command and control the slave micros. If this is the best way to go how does the master micro command slave ones simultaneously?

Another question I have is what is the best micro for the robot to go with between ARM and PIC? I want the master micro to receive its command from a PC. Any help would be appreciated.

答:
what is the best way to command these motors simultaneously?

Like all engineering questions, the answer is it depends.

First, for some general things to keep in mind read this answer even though it's about ROS, but some of the same principles apply.

In short, one particular factor deciding between one-micro-handles-all and dividing motors among slave micros is how powerful each micro is. If one micro could handle all, it's kind of overkill to use many micros. On the other hand, distributing the control means you could use cheaper micros and probably be more energy efficient. You may also save on wiring, depending on where the motors are located. Note that the slave micros don't necessarily have to control one motor, but they could control a couple of related motors.

If you go with master-slave architecture, first you need to understand what motors are meaningless without the other. I.e. what motors need to be perfectly coordinated. The motors driving the fingers come to mind.

That said, it would make sense to have one micro driving the finger motors, and one micro for each other joint. That means a failure in one micro disables a joint or the whole hand. In the former case, redundancy in the arm compensates for the lost degree of freedom and in the later case, well if you have two fingers and one of them is not working or both are not working, then there's really no difference. If you have more fingers, then of course you need to assess the possibilities and decide between more micros or better coordination.

The master micro is of course connected to the slaves through bus(es); SPI, I2C or otherwise. The master would have to query the slaves periodically for information (such as the current state of the motors), do the control calculations and send instructions to the slaves to drive the motors. What needs to be transferred and the frequency really really depends on the type of the motor, the maximum speed of your robot, the internal safety features of the robot and various other things.

That is probably what you would want with a lower level control. On the PC, what you would probably want is a more higher level control. So you tell the robot arm to go to some (Position, Orientation) and the master micro would take care of the details of how much and how fast each motor exactly has to move at every period.

If this is the best way to go how does the master micro command slave ones simultaneously

Of course, you cannot achieve perfect simultaneous-ness. However, with a fast-enough bus, the master micro may be able to tell all the slaves what to do with a delay that is acceptable. If you have multiple buses, by driving the buses inside interrupt service routines, you could send commands on different buses in parallel which further reduces the delay.

However, don't fret it so much. You would likely have to make your robot slow because you cannot guarantee you can stop in time in a dangerous situation. There are actually two main reasons for this.

You most likely don't have enough information from the robot to decide safe vs unsafe situation. If you cover your robot with robot skin and be able to process all the data on the slave or master micros, you may be able to gather enough information, but chances are that you probably don't do this.

Your PC connection and processes are probably not real-time and depend on other non-real-time sensors and processes (such as cameras and image processing). That means that you don't have any guarantee that you can in fact respond in a timely manner.

Since you have to make your robot slow (to minimize the damage in case of collision, both to the robot and to nearby humans), then your control loop likely has a much larger period than your bus communications have. Therefore, in comparison, the delay between controlling different motors (through different slaves) is likely to be negligible.

Another question I have is what is the best micro for the robot to go with between arm and pic?

I have to say that this is a bad question. Each of ARM and PIC have a wide variety of microcontrollers with a varying features and powers. That question is like asking "should I buy a Mazda or a Honda?" You really need to look for what features you want and how much you want to pay for it. You need to take into account what compilers you would have access to and what libraries are available. You need to look for what speed the micro can have, whether it has an FPU, whether it has interrupts on events you are interested in, whether it has enough pins to drive all you need to drive, whether it can support as many buses as you would like etc.

So the answer is to look at as many datasheets as you can and see for yourself what matches your ideals best.


问:
I am new in robotics....I want to know about SLAM algorithm....How should I proceed?
Please give me guidance how should I proceed to know about SLAM algorithm? I am following some youtube videos but those are not so much helpful for me..... </p>

答:
You should approach it as you would any subject in which you'd like to learn more.

Start by clarifying for yourself:

why do you want to know more about SLAM algorithms

how much time do you want to put into the subject

how do you learn best -- listening to a speaker, reading a text, writing some code and observing how it works, having a discussion with others

Based on your objectives then it is possible to come up with a learning plan to progress through the subject.

Understand the basics, read the wikipedia article, look at a presentation... SLAM stands for Simultaneous Localization and Mapping.  Understand what localization and mapping are independently, then why you'd want to do that simultaneously and why it is difficult.

read "simultaneous localization and mapping" on wikipedia

google "introduction to robotics slam" and follow some links, such as the pdf from ai robotics school

Build up the pre-requisite knowledge if you don't have it.  If you were confused watching some youtube videos such as this Intro Course maybe you need to back up and watch the first 12 lectures first.
https://www.youtube.com/watch?v=xoULHsN3bjQ

If you feel like you already have all the basics, then I guess trying to apply it in practice would be a good way to learn more about the different algorithms.  You can probably shortcut a bit by using existing robot platforms like LEGO Mindstorms or a TurtleBot running ROS or whatever you have available to you.

google "slam lego"

google "slam ros" or "intro to navigation ros" and read more about gmapping

When you get stuck, back up and dig into part of the subject in more depth and repeat.

Good luck.


问:
remote control laser meter
I am looking to buy a laser distance meter and to connect it to a motor and a 3g cellular to control both the motor and to mesure the distance. I will appriciate your advice on how to do so. thanks</p>

答:
It sounds like all you need is a single beam distance measurement.  There are lots of devices like the Bosch laser distance meter.  But i don't think they have the range you want, and also probably no computer interface.

SICK makes a 2D laser scanner that used to be standard in robotics.  (You can see many of these mounted atop the DARPA Grand Challenge cars for example).  I think the standard used to be the LMS200 series, but it looks that has been replaced by the LMS500 series.  These work outdoors, have ranges up to 80 meters, and are easily interfaced with a computer.

Title: remote control laser meter


问:
Use linear quadratic regulator to minimize output error
I would like to create an Infinite-horizon, continuous-time LQR with a cost functional defined as

$$J = \int_{0}^\infty \left( e^T Q e + u^T R u \right) dt$$

where e is the states' error $x-x_d$, but I have trouble concluding to the appropriate Ricatti equation since $x_d$ is a function of time therefore leading to a term of $\dot x_d$ . Is this problem solvable? Any ideas?

答:
I am not familiar with an infinite-horizon formulation for time-varying LQR, but I can supply an answer for a finite-horizon formulation.

For a finite-horizon formulation the Ricccati equation for a time-varying LQR problem (i.e. the equilibrium point $x_d$ changes with time) is called the "Differential Riccati Equation".

Derivation: Lets assume you want to implement a LQR controller that stabilizes the system:

$$\dot{x} = f(x,u)$$

around some trajectory $\left(x_d(t),u_d(t)\right)$. If you linearize the system around this trajectory you get:

\begin{align}\dot{\bar{x}} &= A(t)\bar{x}(t)+B(t)\bar{u}(t)-\dot{x}_d \\ &\approx A(t)\bar{x}(t)+B(t)\bar{u}(t)\end{align}

where $$\bar{x}(t) = x(t)-x_d(t)$$ $$\bar{u}(t) = u(t)-u_d(t)$$
and
$$A(t) = \frac{\partial f}{\partial x}|_{(x,u)=(x_d,u_d)}$$ $$B(t) = \frac{\partial f}{\partial u}|_{(x,u)=(x_d,u_d)}$$

The approximation made in the equation for $\dot{\bar{x}}$ introduces an error into your control law, but yields a tractable problem. The magnitude of the error will depend on the problem, but this approach works in many applications (see reference at end for an example).

Now we want to solve the LQR problem for a finite-horizon cost function given by:

$$\int_{0}^T \left( \bar{x}^T Q \bar{x} + \bar{u}^T R \bar{u} \right) dt,~~~\text{where}~~Q=Q^T\geq 0,~\text{and} ~R=R^T>0$$

We chose a quadratic cost-to-go function of the form:

$$ J(\bar{x},t) = \bar{x}(t)^TS(t)\bar{x}(t),~~~\text{where}~~S(t)=S(t)^T>0$$

such that the Hamilton-Jacobi-Bellman condition for the optimality of our chosen $J(\bar{x},t)$ becomes:

$$0 = \min_{\bar{u}}\left[ \bar{x}^T Q \bar{x} + \bar{u}^T R \bar{u} + \frac{\partial J}{\partial \bar{x}}\left(A(t)\bar{x}(t)+B(t)\bar{u}(t)\right) + \frac{\partial J}{\partial t} \right] $$

The control law that minimizes this expression is found by solving for $\bar{u}$ in

$$0 = \frac{\partial}{\partial \bar{u}}\left[ \bar{x}^T Q \bar{x} + \bar{u}^T R \bar{u} + \frac{\partial J}{\partial \bar{x}}\left(A(t)\bar{x}(t)+B(t)\bar{u}(t)\right) + \frac{\partial J}{\partial t} \right]$$

Hence, the $\bar{u}$ that minimizes the cost-to-go $J(\bar{x},t)$ is:

$$\bar u(t) = -R^{-1}B^T(t)S(t)\bar{x}(t)$$

If we insert this expression for $\bar{u}$ into the Hamilton-Jacobi-Bellman condition, we get:

$$0 = Q-S(t)B(t)R^{-1}(t)B^T(t)S(t) + S(t)A(t)+A^T(t)S(t)+\dot{S}(t)$$

This equation is called the Differential Riccati equation, and it consists of the standard LQR algebraic Riccati equation and an additional time-dependent term $\dot{S}(t)$.

You solve for $S(t)$, and consequently $\bar{u}(t)$ and $J(\bar{x},t)$, by setting $S(T) = 0$ and solving the differential equation:

$$-\dot{S}(t) = Q-S(t)B(t)R^{-1}(t)B^T(t)S(t) + S(t)A(t)+A^T(t)S(t)$$

backwards in time.

Reference: Section 3.A in http://groups.csail.mit.edu/robotics-center/public_papers/Tedrake09a.pdf


问:
Shortest path using wave planner?
How could I compute the shortest path between point a and b using wave planner?

I don't see how using the wave planner would give me the shortest; it would just give me a path! As far as I can tell, I would only be able to give a random path to the destination, but nothing else than that.

答:
According to this website http://www.cs.tufts.edu/comp/150IR/labs/wavefront.html
It shows a method of converting the zero to number and calculating the fastest distance.I am assuming you mean wavefront instead of wave planning</p>

Title: Shortest path using wave planner?


问:
Is the accuracy of estimated position in localization better than estimated position in SLAM?
We estimate position of robot in localization and SLAM. My intuition says we get better position estimation in localisation than in SLAM because we have better sensor model likelihoods in localization because of given complete environment than in SLAM.

I would like to know the difference in accuracy of estimated position in localization and SLAM.

答:
Localization has the goal of identifying where a robot is within an environment.  Whether you have an accurate representation of the environment already or not is the distinction you are trying to compare.

It seems the accuracy of your position would be contingent on the accuracy of the mapping you can build.  In a fixed indoor environment with few obstacles and high definition sensors like LIDAR it would seem you could create a very accurate map and the difference in accuracy between the approaches would be null since both maps would be the same.  The complexity of the operations to get there is different, but the accuracy seems like it would be the same.

If you are in a complex and changing environment it would be a different story.  The map you had cached using localization alone may no longer be accurate for path planning or navigation you would get from a SLAM approach.

If you trust your map and you trust your sensors (dead reckoning, odometry, gps) as to where the robot is in the environment than I suppose it follows SLAM would not yield any additional accuracy.


问:
Is there a place for posting "look at what I did" videos?
Robots are somewhat videogenic, and the old saying "show me, don't tell me" is especially applicable.

But of course, a video is not a question, so it doesn't fit the Stack Exchange format.  Maybe video links would be more suitable in a CodeProject post.  It just seems like this board hits the right cross-section of people, whose projects I would be interested in seeing.

答: Let's Make Robots is a good place to show off ones projects. See the robots section to see other peoples work as well.</p>


问:
Trying to design a mechanical system with vertical and horizontal movement
I'm trying to devise a system to lift a 10kg weight a distance of 1.4m vertically, and allow it to move in/out a distance of 30cm. I'd like the motions to be able to occur simultaneously if possible.

I'm thinking for the vertical motion I can use a suspended climber system. However I am unsure as to how I devise a system for the horizontal motion (in the horizontal plane I need nothing to protrude - only when the device is told to extend, so a horizontal suspended climber system isn't a possible solution.

I'm thinking I will need to use 2 electric motors.

Also - I'd like to mount it to the side of a car - so lightweight and low power draw is a must.

Does anyone know if there is anything available that will do this? Or suggest how I could combine a couple of systems to make this work?

Any information is appreciated.

答:
I haven't seen anything specific to your specifications, but it seems like you'd want to look into servo motors that meet your needs:
http://www.jameco.com/jameco/workshop/howitworks/how-servo-motors-work.html

and look for inspiration from automated storage and retrieval systems or perhaps a gripper arm that can extend horizontally but fold down vertically to avoid protruding.  Maybe not the best example for what you want but maybe it'll get you headed in the right directions from this vertical lift example from a robotics competition: http://www.youtube.com/watch?v=ioilEy1I8lY


问:
Velocity derivatives using Quaternions
How to compute the angular and linear velocities Quaternions? I am new to this area and although I have studied the algebra I am unable to understand how to compute the velocities.</p>

答: When I studied the relationship between the rotation matrix and quaternion, I have found a literature, here is the link. I think it will instruct you how to compute the velocity derivatives using quaternions.</p>

Title: Velocity derivatives using Quaternions


问:
How do I determine the heading of a six wheeled robot?
I have a robot simulation that simulates Mars Exploration Rover with six steerable wheels.

In case of the following steering configuration

```<code>// --- //  front wheels
//     //  middle wheels
// --- //  rear wheels
</code>```

I'd say the heading of the rover with respect of the rover's body is about 45 to the right.
My question is what is the right approach of calculating heading with respect of the rover body?

Do I simply sum the steering angles of steering actuators and divide it by the total number of the steering actuators?

Additional Note:
Assuming no slippage on a perfectly flat plane.

答:
What I see you have a reference problem ,

I suggest installing AHRS (Attitude Heading and Reference System) system over your Robot,
this will indicate the direction of your robot heading and will sense the rotation of the body ,

for being simper you can use 1 Axis Magnetometer that will act as compass which will show only body heading ,

if you used 6 DOF (Degree of freedom) system it will show heading and body rotation ,

check this :- 6 DOF AHRS using MPU 6050 , A low cost


问:
Control circuit of humanoid robot: is it worth to learn and use ROS?
I am building the upper body of a humanoid robot for my M.Sc thesis project with 24 DC motors and multiple sensors (something like i-cub or Nao). I have basic knowledge of communication protocols and I have worked with micros before but I have no knowledge and experience on working with ROS. The question I have is whether or not it is worthy and practical for me to learn ROS and use this for my robot or should I stick with what I already know.</p>

答:
ROS is good for when you start writing code to run on a PC.  It lets you write independent modules that interface through standard messages and service calls.  Furthermore, it has a large user base with lots of off-the-shelf tools, drivers, and higher-level behaviors.

What ROS is not good for is inter-microcontroller communication.  (ROS's communication is Ethernet based).  The overhead required for a microcontroller to "talk" ROS is not worth it in my opinion.

So what I would recommend (what I have done numerous times in the past), is to write your own inter-microcontroller communication using whatever you are comfortable with.  Then the micros will need to interface with a computer.  This can be some embedded thing like a Gumstix, RaspberryPi, etc.  Or it can be over a serial or bluetooth link to a standard PC.  In either case, you define that protocol as well.  Now on the PC, you write a ROS node to expose the functionality of your hardware.  For a very custom robot, you will probably have to define your own messages for control as well as sensor feedback.  But then you can start to interface with all of the ROS ecosystem.

One of the first things i do is to create a URDF file.  Then write a node to publish the joint_state message to interface with the robot_state_publisher.  Now you have an excellent 3d visualization of your robot in rviz.  From there, you can overlay maps, display sensor data, and interact with the robot in power full ways.


问:
Best localization method?
I am making a robot that is supposed to roam inside my house and pick up trash using openCV. I plan to send information from my arduino mega to my arduino nano connected to window pc using radio transceivers. I also plan to send video feed from raspberry pi camera over WiFi to the windows PC. The windows PC then uses openCV and processes other information from the sensors and sends command back to arduino mega.

I have right now:

Arduino mega

raspberry pi + usb camera + wifi dongle

Xbox 360 kinect

wheel encoders

sonar distance sensor

arduino nano

windows PC

I want to know how to keep track of the robot like the room it is. I think what I am trying to do is SLAM, but I just need to make the map once because the rooms don't change much. I am open to ideas.  Cost is a factor.

答: Looking at your hardware, only the wheel encoders are suitable for environment-independent localization, which is not enough in most cases. The localization method using the wheel encoders called "odometry". The other sensors you have are suited more for known environments and map-based navigation. The camera could be used for markers detection and mapping, the distance sensor can be used for matching the location to a map (Particle Filter is the thing). In any case, I would add some inertial sensors(gyro, accelerometer or integrated IMU) to your system, to improve the localization performance.

Title: Best localization method?


问:
Bluetooth integration with MSP430
I am trying to integrate bluetooth in a project with MSP430 so to be able to communicate between it and my PC. Doing a search on eBay I found the following item:

HC-05 06 Transceiver Bluetooth Module Backboard Interface Base Board Serial

There are also a lot of other bluetooth modules that appear to be a lot more expensive and their boards are populated with IC's that this one doesn't have. So I am wondering if this is what I need or it has another use.

答: This module has a simple serial interface that can be hooked directly to the MCU's UART pins, and provide seamless wireless serial communication with a paired device or computer with virtual Bluetooth serial port. If this is the intention, it would be the right choice.</p>

Title: Bluetooth integration with MSP430


答:
I suspect what you really want is a complete MCU Bluetooth module, something like the one pictured below:

(via
Erich Styger
"Getting Bluetooth Working with JY-MCU BT_BOARD V1.06")

When I look carefully at the above complete MCU Bluetooth module, I see 2 circuit boards soldered together:

the RF module, a green PCB with a gold meandering Bluetooth antenna on it and the RF integrated circuits (ICs), and

the interface board, a blue PCB with convenient header pins and a handful of small parts.

In the original question, I only see the blue interface board, without a RF module or even an antenna. As far as I can tell, that interface board is useless without a RF module attached to it.

My understanding is that it is impossible for Bluetooth or any other radio communication system to work without an antenna.

Title: Bluetooth integration with MSP430

Body:
I am trying to integrate bluetooth in a project with MSP430 so to be able to communicate between it and my PC. Doing a search on eBay I found the following item:

HC-05 06 Transceiver Bluetooth Module Backboard Interface Base Board Serial

There are also a lot of other bluetooth modules that appear to be a lot more expensive and their boards are populated with IC's that this one doesn't have. So I am wondering if this is what I need or it has another use.


问:
How to choose the state space model for 1 axis gyroscope to implemnt a good kalman filter
I am using this gyroscope in order to measure the rotation of my robot around the z axis.
I want to implement a kalman filter in order to improve the values.
What i came with since now is this space model:

$$
 θ(k+1)=θ(k)+dt*θ'(k)+w(k)
$$
$$
 y(k)=θ(k)+z(k)
$$
where $θ$ is the angle, $θ'$ is the angular rate given by the gyro and $w$ is the noise. (I hold up my gyro and measured 50 values while it was steady and find out that the variance is equal to 0.0002).
What i want to ask:

is what i did is correct?

How can i find out $z(k)$? .According to the data sheet noise density is equal to 0.03 dps/sqrt(hz),how can i use this information to find out $z(k)$ and correct $w(k)$ if it is wrong.

答:
Assuming the angular velocity is constant (i.e. $\dot{\theta}_{k+1} = \dot{\theta}_{k}$) It seems to me the state vector should look like this

$$
\underbrace{
\begin{bmatrix}
\theta_{k+1} \\
\dot{\theta}_{k+1}
\end{bmatrix}}_{\textbf{x}_{k+1}}
=
\underbrace{
\begin{bmatrix}
1 & \Delta t \\
0 & 1
\end{bmatrix}
}_{F}
\begin{bmatrix}
\theta_{k} \\
\dot{\theta}_{k}
\end{bmatrix}
+
w_{k+1}
$$

$$
\begin{align*}
y_{k+1} &= h(\textbf{x}_{k+1}) + z_{k+1} \\
        &=
\underbrace{
\begin{bmatrix}
0 & 1
\end{bmatrix}}_{H}
\begin{bmatrix}
\theta_{k+1} \\
\dot{\theta}_{k+1}
\end{bmatrix}
+
z_{k+1}
\end{align*}
$$

where $w_{k+1}$ is the process noise not the sensor noise (be careful). You could assume it to be zero if you think there is no noise affects your state vector and the noise only comes from the sensor (i.e. $z_{k+1}$) and it must be Gaussian noise with zero mean and known variance (i.e. $\mathcal{N}(0, \sigma^{2})$). Once you get the matrices and the noise parameters, applying Kalman filter is straightforward. Hope this helps


问:
Kalman filter model values or state space original value? Which values to use?
I am using L3GD20 and I am trying to implement a kalman filter for it on the stm32f3 discovery board. I have though a few questions about that:

After the filter gave me the values, do I have to make an average between them and those of the original model or should I use them as they are?

According to this document, we don't use the original state space vectors in the filter, so how could we have "correct" space state estimated values?

答: To apply Kalman filter successfully, you need two requirements namely the system must be linear (i.e. both the motion and observation models) and the noise to be Gaussian with zero mean and some variance besides the models must be specified accurately. Kalman filter is a time domain recursive filter. Meeting these requirements, Kalman filter is one of the best filters to go, so you don't need to average the filtered data. This answers your first question.  For the second question, I didn't read the attached pdf, Kalman filter estimates your state vector. I don't understand what do you mean by saying "we don't use the original state space vectors"?  </p>


问:
Collaborative Behavior: Implementing a Bucket Brigade With Robot Arms
I was wondering whether something like this is possible: A block of ice(say) needs to be transferred piece by piece from a source to a destination with the help of 5 robots standing in a straight line between the source and destination. The first robot picks up a piece of the block from the source and checks if the next robot in line is busy. If yes, it waits for it to complete its task and proceeds, otherwise it transfers the piece and goes back to collect another piece. Please help me on implementing this if it is possible, as I am thinking to make it a project topic.

to clear out the confusions, here's a smaller prototype of the project i'm thinking,

i have two cars, one wired, another wireless. the wired car is the master here, the wireless, the slave. through a remote, i send a command to the wired car to instead command the wireless car to move forward. the wired car will then check if the wireless slave is already executing some previously given command or no, and accordingly send the command.

conversely, the master may send the command as soon as it receives it, it's on the slave now to complete the task it's doing, and then execute the command it just received.

答:
The generic answer is yes, such a project could be implemented using existing hardware and frameworks (ROS, MRDS, something else, or none).  The collaboration part is pretty simple in this scenario, it's a straightforward handshake between producer & consumer.

The hard part would be first defining each of the jobs in detail, procuring hardware that meets the requirements, and actually getting each robot to do his assigned task reliably.  As others have pointed out, you'll need to be a lot more specific.


问:
Connect to video stream with Java app instead of console and mplayer
I'm building a quadcopter using Raspberry Pi. There is the Pi Camera connected to the Raspberry Pi which is streaming the captured video. I can connect to this stream via Wi-Fi on my notebook (Linux) by using the console command "nc" and then show it by "mplayer".

What I want to do though is avoid the console commands and connect to this stream directly through my Java application. The reason is I want to do some image processing operations with this video so I need to have it in my application.

Is there anyone able to help me?

答: You should check it out OpenCV (open computer vision) it suport bindings for java and stream and it has very powerfull image processing tools! Hope it helps... OpenCV java stream stackoverflow


问:
DualCopter Degree Of Freedom
I am a newbie in this drone field. I am curious to know what type of rotation and translation a dualcopter can achieve ? By rotation and translation i mean can it be able to roll, pitch and yaw like quadcopters?
If not, in any copter what makes them to roll pitch and yaw? Furthermore are there any dualcopter design that have movable wings that will rotate the rotors itself or do up and down motion while flying?</p>

答:
A dualcopter, of the form you are talking about, can control all roll, pitch, yaw and it's altitude.

To do so, it employs two rotors running in opposite directions to cancel any torque. This would give the copter the ability to control its altitude and yaw (by changing the relative speeds of both the rotors).

For the rest, such a copter usually employs rotors which can tilt forward and backward, therefore, when you want to move forward, both the rotors tilt forward, and both tilt backwards if you want to move backwards. They usually tilt in opposite directions rather than changing their relative speeds for yaw control which gives it a better yaw authority.

Title: DualCopter Degree Of Freedom


问:
Measuring the performance and response rate of ESCs
How would i go about measuring and quantifying the performance of an ESC? I am looking to measure the response rate(in Hz) of an ESC, as well as it's performance(i.e how fast it starts and stops, as well as how much it increases/decreases the motor's speed per tick).

I'm assuming that i can manually program an ESC and it's response rate with a programming card/module that is compatible with said ESC, but i would still not be able to measure the exact performance of the ESC.

I would appreciate any and all inputs and suggestions.

P.S This question is linked/asked in conjunction with a previous question of mine here on the Robotics StackExchange here   Why can't i use different ESCs together on a multirotor?

答:
After reading your other question, I reason that the one quantity you can look at is the rpm of your motor at different input values.

To measure this, you may use a tachometer and give your ESC an input from your transmitter and then record your tachometer readings for several inputs.

I myself user different esc's on one of my tricopter's, reason being, the ones I purchased earlier are no longer available. It flies fine as the flight controller compensates for any differences, but you may notice erratic behaviour while flying aggressively.

On a different note, you could also open up the esc and look at the hardware used. Almost all esc's use an avr running at the same speed, so if you flash the same firmware in them, they would operate the same, given that the rest of the hardware is identical.


问:
Find Centre Of Circle, when robot can "see" a partial arc
I originally asked this here but I am struggling to take the concepts, particularly "Circumcenter", discussed there and apply it in my context. So here it is in my context...

I have a small robot that can "see" (via a camera) a partial arc (from a birds-eye view)

Therefore I know the height and the width of the square and therefore the width and height of the arc, I am sure there must be a way of approximating the circles centre?

What would be the quickest (not necessarily the most accurate) way of helping my robot find the centre.

In my head these are the steps of the problem:

Break up the arc into evenly spaced vectors ?

Work out the angle between the vectors

Use this information to complete the circle ?

Work out radius of circle

Find the center of the circle

Basically I would love some input on this problem because I think i know

?

Dot Product

?

Add up the lengths of all the vectors to get circumference and then divide by pi, then divide by 2 (or divide by Tau : ) )

I think this is where circumcentre comes in

Basically I feel I have some pieces of the puzzle but I am not sure how they fit together.

I am currently using python with OpenCV and you may have guessed, I am not great at understanding math unless its expressed in algebraic formula or code.

Here are some illustrive pictures to reference:

答:
I would recommend the following steps:

Get slope of the arc (say m1,m2) at 2 random points on the arc (say p1,p2)

Get slopes orthogonal to m1,m2 using m1*m1_oth = -1

Use new slopes and point p1,p2 to get 2 lines

Point of intersection of the lines is your center.

I believe this should not be computationally intensive. Haven't tried it though.


问:
Assigning Serial number and GUID to a microcontroller
This might be a out of league question and may seems to be very odd.I am using multiple Arduino UNO boards over network and want to assign a GUID and Serial number to each board so that when ever they send any data to a central server, server is able to find which Device it is if we have assign name for each device.

first way to do this is to assign GUID and serial number of device before each message that is send to central server manually while programming and then burn that hex to arduino.

Now is there any way out that we can burn a program that always give a output as a string (GUID+Serial number of device) like we program EEPROM for this and then burn our main code in Arduino which pick the GUID+Serial ID combo from EEPROM and write it before every message which arduino is pushing to central server.

Or my another way of asking is can we program EEPROM with a different program and our Arduino separately like 2 files running in parallel or is it not possible?

Is there any other way of doing this?

答:
(I know it's old but I still feel I need to add my solution)

I have a similar issue, multiple units sending data and need a way to know what unit it is. I create a random unitId and save it in eeprom. If needed I can read it on serial port or by activating one at a time and check on the receiver side.

I guess I could easily write a small sketch to write a specific unitId if that was needed.

Code I have in setup()

```<code>long unitId;
...
Setup(){
 long notunitId;
 ..
 pinMode(RESET_PIN, INPUT_PULLUP);
 unitId = (long)EEPROM.read(0) << 24 | (long)EEPROM.read(1) << 16 | (long)EEPROM.read(2) << 8 | (long)EEPROM.read(3);
  notunitId = (long)EEPROM.read(4) << 24 | (long)EEPROM.read(5) << 16 | (long)EEPROM.read(6) << 8 | (long)EEPROM.read(7);
  if (digitalRead(RESET_PIN) == LOW) {
    Serial.println("Force generation of a new unitId");
    unitId = notunitId = 4711;
  }
  if (unitId == -notunitId) {
    Serial.print("unitId from eeprom: ");
    Serial.print(unitId, HEX);
  } else {
    randomSeed(analogRead(7)*analogRead(6)*analogRead(5)+micros());
    unitId = random();
    notunitId = -unitId;
    EEPROM.write(0, unitId >> 24 & 0xFF);
    EEPROM.write(1, unitId >> 16 & 0xFF);
    EEPROM.write(2, unitId >> 8  & 0xFF);
    EEPROM.write(3, unitId     & 0xFF);
    EEPROM.write(4, notunitId >> 24 & 0xFF);
    EEPROM.write(5, notunitId >> 16 & 0xFF);
    EEPROM.write(6, notunitId >> 8  & 0xFF);
    EEPROM.write(7, notunitId     & 0xFF);

    Serial.print("Generated new unitId: ");
    Serial.print(unitId, HEX);
  }
  Serial.println();
</code>```

And in loop I then just add unitId to the message wherever needed.

Body:
(I know it's old but I still feel I need to add my solution)

I have a similar issue, multiple units sending data and need a way to know what unit it is. I create a random unitId and save it in eeprom. If needed I can read it on serial port or by activating one at a time and check on the receiver side.

I guess I could easily write a small sketch to write a specific unitId if that was needed.

Code I have in setup()

long unitId;
...
Setup(){
 long notunitId;
 ..
 pinMode(RESET_PIN, INPUT_PULLUP);
 unitId = (long)EEPROM.read(0) << 24 | (long)EEPROM.read(1) << 16 | (long)EEPROM.read(2) << 8 | (long)EEPROM.read(3);
  notunitId = (long)EEPROM.read(4) << 24 | (long)EEPROM.read(5) << 16 | (long)EEPROM.read(6) << 8 | (long)EEPROM.read(7);
  if (digitalRead(RESET_PIN) == LOW) {
    Serial.println("Force generation of a new unitId");
    unitId = notunitId = 4711;
  }
  if (unitId == -notunitId) {
    Serial.print("unitId from eeprom: ");
    Serial.print(unitId, HEX);
  } else {
    randomSeed(analogRead(7)*analogRead(6)*analogRead(5)+micros());
    unitId = random();
    notunitId = -unitId;
    EEPROM.write(0, unitId >> 24 & 0xFF);
    EEPROM.write(1, unitId >> 16 & 0xFF);
    EEPROM.write(2, unitId >> 8  & 0xFF);
    EEPROM.write(3, unitId     & 0xFF);
    EEPROM.write(4, notunitId >> 24 & 0xFF);
    EEPROM.write(5, notunitId >> 16 & 0xFF);
    EEPROM.write(6, notunitId >> 8  & 0xFF);
    EEPROM.write(7, notunitId     & 0xFF);

    Serial.print("Generated new unitId: ");
    Serial.print(unitId, HEX);
  }
  Serial.println();

And in loop I then just add unitId to the message wherever needed.


答:
First you need to understand the math, then you need to know how to program it.

So let's begin with the math. This is high school material, so I go through it quickly.

The math

Any two points you take on a circle make a line (of course). The line bisector of that line passes through the center of the circle. If you have two of such line bisectors that are not parallel, they collide at the center of the circle.

The reason that this happens is quite trivial, but if you don't know it, just accept it at this point.

That said, the line segments don't need to be far apart for their line bisectors to collide at the center of the circle. They could cross each other or they could share a point as one of their ends. In short, any pair of lines are ok as long as they are not parallel. Sharing one end point and having the other end point different can ensure that this is the case.

The programming

To do the programming, first you need three points on the circle (arc).

These three points don't need to be spaced out evenly. The more points you have and the farther they are from each other can increase your precision. Let's stick to three points at the moment.

How can you find three points? That's quite simple. Run three horizontal lines through your image and record where you cross the arc. There would be at least three collisions, but there could also be more.

Now choose three as you like, preferably the two farthest points and one that is closest to the middle. Then find their bisectors and see where they collide.

And that's it! You have your center.

As a bonus, if you find more points and have the time, you can increase your precision by calculating more candidate points for the center and simply average them. That would give you a smaller computation error. In the figure below, that would be the average of the points identified by the arrows:

Note that these points should have theoretically coincided, but due to computational error are a bit offset.

Title: Find Centre Of Circle, when robot can "see" a partial arc

Body:
I originally asked this here but I am struggling to take the concepts, particularly "Circumcenter", discussed there and apply it in my context. So here it is in my context...

I have a small robot that can "see" (via a camera) a partial arc (from a birds-eye view)

Therefore I know the height and the width of the square and therefore the width and height of the arc, I am sure there must be a way of approximating the circles centre?

What would be the quickest (not necessarily the most accurate) way of helping my robot find the centre.

In my head these are the steps of the problem:

Break up the arc into evenly spaced vectors ?

Work out the angle between the vectors

Use this information to complete the circle ?

Work out radius of circle

Find the center of the circle

Basically I would love some input on this problem because I think i know

?

Dot Product

?

Add up the lengths of all the vectors to get circumference and then divide by pi, then divide by 2 (or divide by Tau : ) )

I think this is where circumcentre comes in

Basically I feel I have some pieces of the puzzle but I am not sure how they fit together.

I am currently using python with OpenCV and you may have guessed, I am not great at understanding math unless its expressed in algebraic formula or code.

Here are some illustrive pictures to reference: