问:
What algorithm should I implement to program a room cleaning robot?
For this question assume that the following things are unknown:

The size and shape of the room

The location of the robot

The presence of any obstacles

Also assume that the following things are constant:

The size and shape of the room

The number, shape and location of all (if any) obstacles

And assume that the robot has the following properties:

It can only move forward in increments of absolute units and turn in degrees. Also the operation that moves will return true if it succeeded or false if it failed to move due to an obstruction

A reasonably unlimited source of power (let's say it is a solar powered robot placed on a space station that faces the sun at all times with no ceiling)

Every movement and rotation is carried out with absolute precision every time (don't worry about unreliable data)

Finally please consider the following properties of the robot's environment:

Being on a ceiling-less space station the room is a safe but frustratingly close distance to passing comets, so the dust (and ice) are constantly littering the environment.

I was asked a much simpler version of this question (room is a rectangle and there are no obstacles, how would you move over it guaranteeing you could over every part at least once) and after I started wondering how you would approach this if you couldn't guarantee the shape or the presence of obstacles. I've started looking at this with Dijkstra's algorithm, but I'm fascinated to hear how others approach this (or if there is a well accepted answer to this? (How does Roomba do it?)

答:
Looking at the simpler problem that you were asked - a rectangular room, with no obstacles and clean every part at least once.

The solution is to find a corner of the room, and finding a corner won't be a big problem. Once that has been achieved, then just follow a spiral path to the center of the room.


问:
Does a controlling system need to be more complex than the system being controlled?
Is there any theoretical principle, or postulate, that states that the controlling system has to be more complex than the system being controlled, in any formal sense of the notion "complex"?</p>

答:
Complexity is not a word that's used in control theory but I think I know what you mean. The short answer would be no.

Complexity in systems to be controlled is usually looked at in terms of how many state variables are needed to fully describe what's happening or, more often, how many Degrees of Freedom exist.

There is a theorem that says whether a Linear Time Invariant (LTI) system is controllable, and if you look at it right it might fit what you are thinking, but LTI systems are a subset of the systems control theory works with.

As soon as you move from only math to the real world, a couple things become quickly apparent.

1) The whole point of most of control theory is to control a system that is more complex than the controller. If not for disturbances and non-linearities, we'd just write an equation for the perfect control input rather than use techniques like PID.

2) Underactuated control is a whole sub-field of control dedicated controlling systems that have not only disturbances, but also fewer controlled degrees of freedom than actuated degrees of freedom.

ContentLicense: CC BY-SA 3.0


问:
Remaking an RC transmitter for controlling aircraft
I am thinking about working on alternative drone controllers. I am looking into making it more easy to use and a natural feel (debating between sensor bracelets, rings, etc.).

The main issue I have is, I've been looking over all the standard RC transmitters that are used to control RC aircraft, but I am not sure what technology is inside of them, what kind of ICs they use for the actual RC signals.

I want more information on how to make an RC transmitter myself, mainly the protocol that's used to send messages, and what circuitry is needed to actually transmit that, what kind of components do I need and how should I implement the software?

I was aiming at doing this as a side project (hobby), but now I have the chance to use it as a uni project as well, so I'd like to give it a shot now, but I lack the proper information before getting started.

I'd rather not take apart my current RC controller and use an oscilloscope to decode the protocol.

Any answers (short or long) and reading material is appreciated.

Other questions, can the protocol be implemented in software on an embedded system (Raspberry Pi, Arduino, Intel Galileo, etc.)?
I am asking this because the frequency for these are 2.4 GHz.

This is part of a bigger project, drone related currently, and I could use alternative methods of sending the information, through other wireless means, as the first prototype, suggestions are welcomed.

Need: aircraft RC transmitter protocol info, RC transmitter components & schematics, anything else that might help with the transmission side

答:
If you are looking at automatic control, consider using a radio modem instead of RC transmitter/receiver. One example. These are often used on hobby drones for relaying telemetry and control via ground station software.

The Pixhawk is a drone flight computer that works well for this. Designed by researchers, there are lots of inputs and a couple different open source code bases.

Remember that RF communications is not magic and the spectrum is full of noise (other users). Choose your frequencies wisely.


答:
I am, unfortunately, not going to address your entire question but, rather, focus on the frequency used for communications. Why do you say:

because the frequency for these are 2.4 GHz

By these,  do you mean the Pi, Arduino or Galileo?

These boards are not confined to using 2.4 GHz. The reason 2.4 GHz is so popular is that it is one of the bands that the telecommunication authorities have deemed available for consumer use1, Bluetooth2, XBee (Series 1 and 2), and Wi-Fi3 being the common examples.

It is worth noting that 900 MHz devices generally have a larger range than 2.4 GHz devices. So, depending on the range that you require, you could chose from a wide range of communications devices and frequencies, for example:

Long Range 868MHz XBee Pro (for Europe), or 900MHz (for US) XBees - However these seem to have reached End-Of-Life;

Low Power 868MHz XBees (for Europe), or 900MHz (for US) XBees

868/915MHz RFBees

Also, other frequencies used, in addition to 2.4, 900, 868 MHz, are the 315 and 433 MHz bands:

Simple 433 MHz circuits.

NRF905 Arduino Compatible Wireless Communication Transmission Module

CC1101 Wireless RF Transceiver 315/433/868/915MHZ + SMA Antenna Module

If you do decide to stick with 2.4 GHz then it is well worth considering the successors to the popular nRF24L01:

This product is not recommended for new designs. Nordic recommends its drop-in compatible nRF24L01+ or for a System-on-Chip solution the Nordic nRF24LE1 or nRF24LU1+.

A note on protocols

One of the advantages of using XBees is that they already implement a pretty rugged and secure protocol, so there is less need for you to have to re-invent the wheel. However, they are relatively slow (the data rate is 250kbps half duplex), so should you require FPV then XBee will not be sufficient. See also Drones and camera streaming.

Protocols implemented in software (using a Pi, Arduino, or whatever), could be a little slow and it is probably better to use one that is implemented in hardware as the control of aircraft is somewhat time sensitive, that is to say, the least lag possible is required, for accurate flight control.

Title: Remaking an RC transmitter for controlling aircraft

Body:
I am thinking about working on alternative drone controllers. I am looking into making it more easy to use and a natural feel (debating between sensor bracelets, rings, etc.).

The main issue I have is, I've been looking over all the standard RC transmitters that are used to control RC aircraft, but I am not sure what technology is inside of them, what kind of ICs they use for the actual RC signals.

I want more information on how to make an RC transmitter myself, mainly the protocol that's used to send messages, and what circuitry is needed to actually transmit that, what kind of components do I need and how should I implement the software?

I was aiming at doing this as a side project (hobby), but now I have the chance to use it as a uni project as well, so I'd like to give it a shot now, but I lack the proper information before getting started.

I'd rather not take apart my current RC controller and use an oscilloscope to decode the protocol.

Any answers (short or long) and reading material is appreciated.

Other questions, can the protocol be implemented in software on an embedded system (Raspberry Pi, Arduino, Intel Galileo, etc.)?
I am asking this because the frequency for these are 2.4 GHz.

This is part of a bigger project, drone related currently, and I could use alternative methods of sending the information, through other wireless means, as the first prototype, suggestions are welcomed.

Need: aircraft RC transmitter protocol info, RC transmitter components & schematics, anything else that might help with the transmission side


问:
Fastening sheet steel on nylon
I'm trying to attach a small piece of sheet steel (30mm x 50mm x 1mm) to a small piece of nylon (50mm x 50mm x 4mm). Does anyone know how they could be fastened using small screws (

Any thought appreciated.

答:
Consider attaching a pemnut or a nutsert to the steel sheet, then using a screw from the nylon side into those threads.

You might also consider drilling and threading several holes in the steel, screwing in short studs or screws, brazing them into place (or using threadlocker or epoxy), then grinding or polishing the steel surface.
Self-clinching threaded studs are another possibility.

Title: Fastening sheet steel on nylon


答:
what kind of ICs they use for the actual RC signals

Traditional FM RC

The over-the-air signal to a RC aircraft is often a FM-modulated binary PPM signal in a narrow slice of the 72 MHz band.

That band is reserved only for RC aircraft.

The Phillips NE5044 is a typical RC encoder IC.

Often the receiver includes either a 4017 decade counter or a 4015 shift register -- that chip decodes the RC PPM signal at its CLK input into to several independent "RC PWM" outputs.

Open Circuits: servo control has more details.

Spread spectrum RC

The over-the-air signal to new RC aircraft is often a spread-spectrum modulated PCM signal spread out over a very wide 2.4 GHz ISM band.
Modern spread-spectrum and error-correcting techniques allow more-or-less error-free communication,
even though that band is shared with microwave ovens, WiFi, ZigBee, Bluetooth, and many other transmitters.


答:
I would just use machine screws. Drill clearance holes in the steel, drill narrower holes through the nylon. Then it will be easy to hand tap threads in the nylon with an appropriate tap for the screws you are using. Threads in nylon will be fine for light-duty use.

(Where I am metric screws are common, and I'd use M3 or maybe M4 screws with the standard pitch, these should be available in a short length.)

Title: Fastening sheet steel on nylon

Body:
I'm trying to attach a small piece of sheet steel (30mm x 50mm x 1mm) to a small piece of nylon (50mm x 50mm x 4mm). Does anyone know how they could be fastened using small screws (

Any thought appreciated.


答: Instead of screws, how about simlpe magnetic force? I extracted this parts from old harddisk drives, the real forceful parts are the small ones on the top. You wouldn't believe that this magnetic force could exist close to a disk drive.

Title: Fastening sheet steel on nylon


问:
Fixed Wing UAV: Do inherently unstable systems desire to be stable for all cases when a closed loop control is implemented on them?
As we all know fixed wing vehicles are designed to have inherent instability which is what enables all fixed wing vehicles to fly.

However does this apply to all cases?

Do inherently unstable systems desire to be stable for all cases when a closed loop control is implemented on them?

答:
Not all fixed wing aircraft are inherently instable. That feature greatly depends on the center pressure and gravity center designed position. Passenger aircrafts are quite stable, and fight planes are just the opposite in order to achieve fast maneouvres, among other reasons.

Read this aviation thread where this question was replied.


问:
How can I detect the edge of a table?
I'm new to robot making and just got my first arduino to play around.

I want to make a robot that will wander on a table, and it will last longer I think if I could make it avoid falling from the table.

What will be the best way to make it detect the edge of a table so I can make it stop and turn around ? It have to be something reliable and preferably cheap.

It will also be better if I don't need to add extra stuff to the table so I can use it on any surface (my first idea was to draw path lines on the table and make a line follower robot, but I don't like this idea very much).

答:
The Roomba solution to this problem was to add cliff sensors, which are really just downward facing proximity sensors:

Although this technique seems to have problems with some surfaces, such as dark tile floors, it sounds like this won't be a problem for your application.

You can even make one yourself with an IR LED and an IR photo diode, for example this Arduino Compatible DIY Infrared Proximity Sensor.

You might also be able to get some ideas from Tiny Wanderer - A Table Top Robot over on instructables.

Title: How can I detect the edge of a table?


答:
I'm going to ignore your section on aircraft and attempt to answer the (vague) question,

Do inherently unstable systems desire to be stable for all cases when a closed loop control is implemented on them?

First, I'll say that system response, stability, etc., are all based on mathematics, and math does not have feelings. That is, a system doesn't "desire" anything - it just is.

Second, there is a difference between controllability and stabilizability. Just because you can't force a characteristic to be what you want doesn't necessarily mean that it's unstable.

Similarly, just because you have feedback, that doesn't mean that your controller is stable.

Consider a bang-bang controller for steering in a car. You get feedback of the car's position in the lane, and you either steer full left or full right depending on which side of center you are.

A bang-bang controller is a closed-loop controller. The stability of the car's position depends on sampling and actuation frequency with respect to the car's speed. After a particular speed the position of the car no longer converges on the center of the road.

Another example would be a system where I want to control speed and altitude of a car, and I have speed and altitude measurements, but my only method of actuation is cruise control. Cruise control can force speed to go to whatever value I want, but it can't influence altitude. Therefore, I rely on the system describing altitude (briefly, $F=ma$) to be stable and, as long as the car has sufficient mass and the speed is relatively slow, that is true - the car's altitude won't randomly fluctuate. That is, speed is controllable and altitude is stable, so as a whole, the speed-altitude system is said to be stabilizable.

So, to summarize, a controllable system is one where you are able to force every state to the value you desire. A stabilizable system is one where you can force all of the unstable states to do what you want, while the rest of the states are inherently stable.

Output feedback doesn't guarantee either controllability or stabilizability. They instead depend on how your actuators are able to uniquely influence the states you care about.

Title: Fixed Wing UAV: Do inherently unstable systems desire to be stable for all cases when a closed loop control is implemented on them?

Body:
As we all know fixed wing vehicles are designed to have inherent instability which is what enables all fixed wing vehicles to fly.

However does this apply to all cases?

Do inherently unstable systems desire to be stable for all cases when a closed loop control is implemented on them?


问:
Can you interface to a Braava Jet?
Is there any open interface access to the new Braava jet just to drive it around?</p>

答: There is no open interface for the Braava family of products.</p>

Title: Can you interface to a Braava Jet?


问:
Create 2 light red/green
I am working on a project with the Create 2. Just recently I have run into a problem with the battery state. The Create 2 has been charging all night so its clean light shows green. However, when I unplug it and press the clean button, it shows red and will not consistently run commands from my Arduino that I have hooked up to it.

What could be the problem?

答:
Red means that your battery is either truly dead, or the Create mistakenly thinks it is. To figure out which it is:

Remove the battery and put it back in after about 30 seconds.

Run the motors (you can just press Clean to start a demo) until the battery is fully drained.

Charge it overnight.

At this point the battery's true state should be reflected in the LED color. If it's still red, then you will need a new battery.

Title: Create 2 light red/green


问:
iRobot Create 2 stuck in Clean mode?
I'm using the Delphi example to command my Create 2, I just adapted the demo code to Unicode (DelphiXE). I use the original iRobot USB to serial cable.

My Create 2 seemed to be responding fine to all the commands send via serial yesterday and correctly received all sensor data back this morning, until I recharged the battery. Now when I send "7" "Soft reset" the robot attempts every time to start a clean cycle. It also attempts to start the clean cycle when I press the clean button. It tells me to move the Roomba to a new location, which is normal in cleaning mode because my wheels are not touching my desk. Communication via serial seem to be fine because I still get the Soft Reset response texts in the log memo of my app when I use the 2 buttons method to soft reset my Create 2, so there is still communication both ways.

I must say I had the same yesterday after charging but after a while unexpectedly, don't know why, the robot responded again fine to my commands.

It really seems to me the Create 2 is stuck in the Cleaning mode, or am I missing something?

BTW, I also tried to fix the problem by removing the battery.

答:
Your robot is fine.

When you send a 7 to reset the robot, you are also exiting Open Interface Mode. If the robot was in a cleaning cycle when you send the 7, it may under certain circumstances resume cleaning after the reboot. This is a feature that allows the Roomba to recover from errors while cleaning. This can give the appearance of being "stuck" in cleaning mode.

Pressing the Clean button will also start a cleaning cycle.

Title: iRobot Create 2 stuck in Clean mode?


问:
What is the correct name for "servo brackets"?
I refer to these types of brackets as servo brackets, or robot brackets:

I know that the two specific brackets, shown above, are known as a short-U (some vendors refer to them as "C", en lieu of "U") and a multi-function bracket, respectively, and that there are other types available, namely:

Long U bracket

Oblique U bracket

i bracket

L bracket

etc.

However, I am sure that there is a correct name for these types of bracket (or this range of bracket, if you will), rather than just servo brackets - either a generic name or a brand name. I have seen the term once before, on a random web page, but the name escapes me. They are either named after their creator, or, if I recall correctly, the institution where they were developed.

Does anyone have a definitive answer, preferably with a citation or web reference, or a little historical background?

答:
After some extensive searching, I believe that they are called Servo Erector Set (SES) brackets, from Lynxmotion, although the article itself also uses the term servo brackets.

About the Servo Erector Set

Think of the Lynxmotion series of servo
  brackets as an Erector Set for servos. These components are extremely
  versatile, making virtually any mechanical arrangement possible. It's
  now possible to build custom robots to your specifications! The
  brackets are available in black anodized aluminum. The ball bearings
  provide for precise low friction movement. The tubing, hubs and hub
  connectors are precision fit and really expand what is possible to
  build. They are made in the USA from high quality aluminum alloy. We
  also have a series of laser cut Lexan chassis, torso, and electronics
  carriers that truly complete the set.

If you want to build a variety of different robots using the SES
  system, consider the complete SES V1.1 Construction Kit which contains
  everything you need to get started.

The article also refers to them as Hitec servo brackets.

Hitec Servo Brackets

Our selection of standard brackets can use most standard size Hitec
  analog or digital servos. The HS-3xx, 4xx, 5xx, 6xx, 54xx, 56xx, and
  59xx servos are verified to fit. Note that servos from other
  manufacturers are not guaranteed (nor likely) to work...

So, the term SES may only be referring to the kit of various Hitec servo brackets.

The first place that I saw the term SES, was on the page, WALKER8 – An Octopod Project, where it is mentioned in the comment:

I decided to go with the SES route

This may not be the most definitive answer, but it is the best that I could come up with. Maybe the answer is simply [Hitec] servo brackets, as the brackets were first designed to fit Hitec servos, and their derivatives.

Whether or not the brackets where designed by Hitec themselves, or some other third party is not clear.

If someone else knows, or has an idea of, a better answer, please post it.


问:
What iRobot products support the open interface besides the iRobot Create?
I have read that certain iRobot products support or can be hacked to support something close to the open interace. There is even a book about hacking Roomba. What Robots have this capability?</p>

答:
Any iRobot product with a 7-pin mini-DIN connector has some subset of the Open Interface. Roomba 500 through 800 series robots without Wi-Fi should correspond to the set in the Create 2 manual while the 400 or Discovery series correspond to the original iRobot Create. However, based on the date of manufacture, it may be necessary to apply a software update to the robot in order to enable this functionality. Robots with Wi-Fi have a mode state machine that differs from the one in the Open Interface specification, but most of the commands are the same.

Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.

ContentLicense: CC BY-SA 4.0


答:
The Roomba Open Interface has been standard on all models since 2005.

Hacking Roomba uses the third generation Roomba Red for many of it's example hacks. The original Create and those early Open Interface capable Roomba's, have their serial ports above the power socket, beneath a removable cover:

More recent Roombas, from 500 series onwards, have the serial port in the same position as the Create 2, but hidden under the top cover:

Wired suggested that the newest Wi-Fi equipped Roomba 980, as the first which is controllable via an official smartphone (Android & iPhone), may not be hacker friendly - implying that it doesn't have an Open Interface, but OI transcripts have been posted, suggesting that it is still possible.

Title: What iRobot products support the open interface besides the iRobot Create?

Body: I have read that certain iRobot products support or can be hacked to support something close to the open interace. There is even a book about hacking Roomba. What Robots have this capability?</p>


问:
Developing for 8-bit AVR-s, what are the current, open and free libraries out there?
I would be very interested to ask for a list of repos of free open code, applicable to 8-bit avr-s and having relation to robotics - object avoidance, process controllers, battery management, etc. This would be of huge help for me, preventing me from wasting weeks and months to invent the wheel.</p>

答:
Lightweight USB Framework for AVRs — this seems to be a giant in its field. I have not used it, however, and cannot comment on it.

Atmel's PID implementation — I can't seem to find the source files at the moment. This is a small and fast integer-arithmetic module, really simple to use. However, choosing the P, I and D coefficients is the real challenge.

Modules from this project can be used for USART and for Dallas one-wire communication. I am not sure about the license — the authors do not apper to claim anything.

libavrutil — haven't used this. Copileft license. Covers all basic hardware: ADC-s, PWM-s, USART etc. C and C++ interface.

Arduino libraries for RC servos

openBMS Lithium ion Battery Management System for Electric Vehicle

The RepRap project has a bunch of open-source stepper-motor-control code that runs on an AVR


答:
There are a number of different approaches to solving this problem:

Distance Sensors

Touch Sensor

RFID Tags around the edge of the table (Or magnets)

Camera (Using image processing, would be harder and the arduino would probably not be powerful enough for this)

With the distance sensor you will need to check whether it is a digital or analogue signal provided by the sensor. For the purpose of your 'cliff sensor' you would probably be fine with digital as you would be able to use the sensor as a toggle to detect when the distance is over a minimum distance.

If you are interested in analogue sensors to provide more information (such as distance from a wall) than just a toggle switch you will need to check what the range is on the device. The sharp sensor pictured in the answer above will provide you with a voltage, which you will have to convert into a distance (It has an inverse relationship with distance). You will require 3 sensors to cover the same range of distances that an ultrasonic sensor covers (e.g. SRF08 Ultrasonic Range Finder). Sharp GP2D120 Distance Measurement Sensor 4-30cm for short range, the Sharp GP2Y0A02YK Distance Measurement Sensor 20-150cm for medium range, and the Sharp GP2Y0A710K0F Distance Measurement Sensor 100-550cm for the long range sensor. I had issues with the ultrasonic sensor dropping to zero sporadically, so you would need to program a catch statement if this dropout is unacceptable in your application. The SRF08 Ultrasonic Range Finder was much easier to work with as it had been tuned by the manufacturer.

Title: How can I detect the edge of a table?

Body:
I'm new to robot making and just got my first arduino to play around.

I want to make a robot that will wander on a table, and it will last longer I think if I could make it avoid falling from the table.

What will be the best way to make it detect the edge of a table so I can make it stop and turn around ? It have to be something reliable and preferably cheap.

It will also be better if I don't need to add extra stuff to the table so I can use it on any surface (my first idea was to draw path lines on the table and make a line follower robot, but I don't like this idea very much).


问:
APM Mission Planner 2.0.18 Install Firmware Failure Mac OS X 10.11
I installed Multiple versions of APM (2.0.7, 2.0.17, 2.0.18) on Windows 7, Ubuntu 14.04, and OSX 10.11. I could connect to my ArduPilot but could not install firmware. Here's the error I would get:

```<code>Started downloading http://firmware.diydrones.com/Copter/stable/apm2-hexa/ArduCopter.hex
Finished downloading /var/folders/r4/s_j4c02s3wvcx6wy41__rnwh0000gp/T/APM Planner.uq1800
Opening firmware file...
Unable to open file: /var/folders/r4/s_j4c02s3wvcx6wy41__rnwh0000gp/T/APM Planner.uq1800
</code>```

答:
For hours I've been dealing with this and no one has documented the same issue online. I tried the following with no success:

Changed permissions of parent folder /var/folders/r4/s_j4c02s3wvcx6wy41__rnwh0000gp/T

Ran APM as sudo

Multiple versions of APM

Multiple operating systems

I had to get a bit creative to come up with a workable solution:

Solution

When APM tried to download the firmware, you could see the temp file until you clicked "OK" in regard to the firmware failure. What I did was copied that file and found the following html in there:

```<code><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://firmware.ardupilot.org/Copter/stable/apm2-hexa/ArduCopter.hex">here</a>.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at firmware.diydrones.com Port 80</address>
</body></html>
</code>```

Obviously this is a server issue so here's what I did to get around it:

Downloaded the file mentioned in the html (http://firmware.ardupilot.org/Copter/stable/apm2-hexa/ArduCopter.hex) to my desktop

Changed the file format from txt to hex

Set APM Planner to advanced mode via File > Advanced Mode

In Initial Setup > Install Firmware Menu I selected Firmware Options > Custom

Chose the hex file I had downloaded

Violá

Body:
For hours I've been dealing with this and no one has documented the same issue online. I tried the following with no success:

Changed permissions of parent folder /var/folders/r4/s_j4c02s3wvcx6wy41__rnwh0000gp/T

Ran APM as sudo

Multiple versions of APM

Multiple operating systems

I had to get a bit creative to come up with a workable solution:

Solution

When APM tried to download the firmware, you could see the temp file until you clicked "OK" in regard to the firmware failure. What I did was copied that file and found the following html in there:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://firmware.ardupilot.org/Copter/stable/apm2-hexa/ArduCopter.hex">here</a>.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at firmware.diydrones.com Port 80</address>
</body></html>

Obviously this is a server issue so here's what I did to get around it:

Downloaded the file mentioned in the html (http://firmware.ardupilot.org/Copter/stable/apm2-hexa/ArduCopter.hex) to my desktop

Changed the file format from txt to hex

Set APM Planner to advanced mode via File > Advanced Mode

In Initial Setup > Install Firmware Menu I selected Firmware Options > Custom

Chose the hex file I had downloaded

Violá


答:
There is no correct name for sheetmetal brackets designed for connecting hobby servos. Using sheetmetal, bent with holes, has been used forever for hobby projects (and industrial ones). It's cheap and easy to have the tools to make custom ones in your garage.

The first usage of brackets like your pic with servos that I saw was Robo One, but I don't follow the hobby/toy market closely.

For hobby servo robotics there was Lynxmotion in 1996 but his techniques were in common use for hobby robotics at the time in custom projects.

For punched and bent sheet metal, erector sets come to mind, started being sold in 1913 and apparently had an electric motor you could build. Meccano Started in 1901.

Regarding the U shape, mechanical engineers call this a clevis when used as a structural or connecting element.

Title: What is the correct name for "servo brackets"?

Body:
I refer to these types of brackets as servo brackets, or robot brackets:

I know that the two specific brackets, shown above, are known as a short-U (some vendors refer to them as "C", en lieu of "U") and a multi-function bracket, respectively, and that there are other types available, namely:

Long U bracket

Oblique U bracket

i bracket

L bracket

etc.

However, I am sure that there is a correct name for these types of bracket (or this range of bracket, if you will), rather than just servo brackets - either a generic name or a brand name. I have seen the term once before, on a random web page, but the name escapes me. They are either named after their creator, or, if I recall correctly, the institution where they were developed.

Does anyone have a definitive answer, preferably with a citation or web reference, or a little historical background?


问:
Use data from gyroscope to calculate orientation
From a gyroscope I'm getting angular velocities [dRoll, dPitch and dYaw] as rad/s, sampled at intervals dt = 10ms.

How do I calculate the short term global orientation (drift ignored) of the gyroscope?

Pseudo code would be helpful.

答:
To get the orientation from each of the axes, you need to integrate the angular velocities with respect to time.

Below is the code implementation of the said integration:

```<code>//What we have
dPitch = 0; angular rate from Pitch
dRoll = 0; angular rate from Roll
dYaw = 0; angular rate from Yaw

//What we want
aPitch = 0; angle from Pitch
aRoll = 0; angle from Roll
aYaw = 0; angle from Yaw

//Calculating the angles:
aPitch += dPitch*dt; // or aPitch = aPitch + dPitch*dt;
aRoll += dRoll*dt; // or aRoll = aRoll + dRoll*dt;
aYaw += dYaw*dt; // or aYaw = aYaw + dYaw*dt;
</code>```

Body:
To get the orientation from each of the axes, you need to integrate the angular velocities with respect to time.

Below is the code implementation of the said integration:

//What we have
dPitch = 0; angular rate from Pitch
dRoll = 0; angular rate from Roll
dYaw = 0; angular rate from Yaw

//What we want
aPitch = 0; angle from Pitch
aRoll = 0; angle from Roll
aYaw = 0; angle from Yaw

//Calculating the angles:
aPitch += dPitch*dt; // or aPitch = aPitch + dPitch*dt;
aRoll += dRoll*dt; // or aRoll = aRoll + dRoll*dt;
aYaw += dYaw*dt; // or aYaw = aYaw + dYaw*dt;


问:
Electronic circuit for heating nylon fishing line muscle
I'm trying to make artificial muscles using nylon fishing lines (see http://io9.com/scientists-just-created-some-of-the-most-powerful-muscl-1526957560 and http://writerofminds.blogspot.com.ar/2014/03/homemade-artificial-muscles-from.html)

So far, I've produced a nicely coiled piece of nylon fishing line, but I'm a little confused about how to heat it electrically.

I've seen most people say they wrap the muscle in copper wire and the like, pass current through the wire, and the muscle acuates on the dissipated heat given the wire resistance.

I have two questions regarding the heating:

1) isn't copper wire resistance extremely low, and thus generates very little heat? what metal should I use?

2) what circuit should I build to heat the wire (and to control the heating)? Most examples just "attach a battery" to the wire, but afaik that is simply short-circuiting the battery, and heating the wire very inneficiently (and also may damage the battery and it could even be dangerous). So what's a safe and efficient way to produce the heat necessary to make the nylon muscle react? (I've read 150 centigrads, could that be correct?) for example with an arduino? or a simple circuit in a breadboard?

thanks a lot!

答:
First you should to select your muscle length. It is necessary to have a constant resistance of the resulting muscles. Wind the copper wire over nylon, and then make a coiled thread.

You can use a standard 12V Power supply for the LED (at least 5 A). Use MOSFET keys and an Arduino to apply current to the muscle. The time taken to heat the muscle depends on the source nylon thread diameter and the diameter of the wire and the ambient temperature. The heating time is controlled by the Arduino.

You may see my experiments with these kind of muscles, here: Artificial Muscles


问:
Considerations to design actuators, and loop feedback systems, for a robotic arm
Let's say I have an industrial sized 6DOF robotic arm. I want to control each one of the six joints despite the non-linearity produced by the chain structure, the gravity and the weight of the loads it could lift.

I don't focus here on the speed nor the power limitations, I just want the arm to respond well. Moreover, I would like to avoid the use of any prior knowledge such as inertial computation. Then I had these considerations, considering that I can play with both the actuator design, and the loop feedback control system:

Limit the maximum speed of each actuator to smooth their error variation.

Increase the damping of the actuators to avoid high frequency instability.

Find a good control system, such as a PID, to make sure the targets are reached without oscillations.

Do you have any other considerations in mind? Do you know what process(es) industrial designers follow?

EDIT: As it is said in the comments, my question concern the design of an adaptive controller for a robot arm, which is, how to design a joint control system (actuator + loop control) that don't need inertia and masses to be computed (the controller could adapt to its own structure, or to the loads it lifts).
I'll be very much interested if you know some paper about adaptive control in the field of robotic arms.

答:
As I commented on your question, I'm not really sure what you're looking for or what your list is for.

I'll try to answer your last question, "What is the process the engineer takes?"

In short, the engineer uses everything you said you wanted to ignore.

Specifications are the heart of engineering. I, and I think most engineers too, detest "feelings" kind of terms, by which I mean qualitative statements.

"I want an actuator that works good" is the kind of statement I mean. What is good? What does that mean to you? Is good low cost, or high reliability, or high power, or high speed, or something else? What is "high" or "low" to you?

In general, design is based on worst case scenarios.

What is the maximum payload mass (and shape!) you want to move?

What is the top speed you want it to move?

How fast do you want it to get from zero speed to top speed?

These three questions go a long way to "ballparking" the actuator(s). Next, you need to pick a design for the arm. Is it SCARA, Cartesian, or something else? This is important because each actuator has to be capable of moving the load and all the actuators after itself.

Now, for each degree of freedom, you have to evaluate the worst case load on the actuator to spec the actuator.

Once you have all the actuators specified, which generally takes several iterations, because heavier actuators require even bigger ones "upstream", then you can begin to design the controller.

Control design has to happen last because you need to have some idea of what kind of output you're going to get for a particular input. You can't define that without a model of the plant (actuator).

You could, of course, "turn off" gravity, mass, moment of inertia, etc. in your simulation, use ideal motors and tune speed regulators on them to perfect responses, but you're just wasting your time. If that's all you want then why not just put a low pass filter on your position request?

So, tl;dr - if you're going to design, you need specifications. If you don't care about specifications, don't waste your time designing, just cheat an answer.


问:
What is the opposite of 'Antagonistic'?
A robotic joint is connected to two actuators, e.g. air muscles. One flexes the joint, while the other extends it. This arrangement is called 'antagonistic'.

But what if I had an electric motor instead of the air muscles? In that case it can only pull on one tendon at a time, and it's not antagonistic. What it the arrangement called in this case? Untagonistic?

答:
The opposite of an antagonist muscle is an agonist muscle, but that doesn't really answer your question.

In nature, muscles are found in antagonistic pairs because they can only really contract, thus once a muscle is contracted, only an opposing muscle can effectively change the state back again (unless the muscle's natural state is opposite to that which is produced by the muscle).

In your system, by using a single motor to replace both flexor muscle and extensor muscle you are departing from the way nature works and thus the analogy breaks down. As far as I can see, there is unlikely to be a term from nature which can answer your question without compromising the metaphor, but since you have a single motor which is both flexing and extending your joint, you could just call it an agonist.

Title: What is the opposite of 'Antagonistic'?


答:
gyroscopes do not measure [dRoll ,...] they measure body rates. These are not the same things. There is a transformation matrix ( that I do not have on hand) that relates body rates to euler rates. The euler rates are then integrated to get the short term change in orientation.

-- relation --

this is the relation between the measured body rates from the imu and the euler rates.

\begin{equation}
\label{eq:euler_rates}
\begin{bmatrix}
\dot \phi \\
\dot \theta \\
\dot \psi
\end{bmatrix}
=
\begin{bmatrix}
1 & \sin\phi \tan\theta & \cos\phi \tan\theta \\
0 & \cos\phi & -\sin\phi \\
0 & \frac{\sin\phi}{\cos\theta} & \frac{\cos\phi}{\cos\theta}
\end{bmatrix}
\begin{bmatrix}
p \\
q \\
r
\end{bmatrix}
\end{equation}

where $\left[ p, q, r \right] ^T$ are the body rates measured from the imu.

Title: Use data from gyroscope to calculate orientation

Body:
From a gyroscope I'm getting angular velocities [dRoll, dPitch and dYaw] as rad/s, sampled at intervals dt = 10ms.

How do I calculate the short term global orientation (drift ignored) of the gyroscope?

Pseudo code would be helpful.


问:
DC Motor Control
My project requires a DC motor for mobility, very similar to an RC car. If precision isn't critical, can I use a solid state relay instead of a motor driver? If the vehicle moves an extra inch on the ground, I don't really care.</p>

答: If you want to use a relay in your airboat, use flyback diodes, otherwise you might get stuck with the gators. </p>

Title: DC Motor Control


答: For a DC motor, you can use a relay instead of a motor controller if you aren't too concerned about precision.  Be careful to account for the inductive surge in current, and ensure your relay can handle the peak current.  You'll also see a reverse current if you stop the motor abruptly, so flyback diodes are a good idea as @hauptmech indicates.</p>

Title: DC Motor Control

Body: My project requires a DC motor for mobility, very similar to an RC car. If precision isn't critical, can I use a solid state relay instead of a motor driver? If the vehicle moves an extra inch on the ground, I don't really care.</p>


问:
Euler-Lagrange systems, autonomous or nonautonomous?
I was reading an article on Euler-Lagrange systems. It is stated there that since M(q) and C(q,q') depend on q, it is not autonomous. As a result, we cannot use LaSalle's theorem. I have uploaded that page of the article and highlighted the sentence. (ren.pdf)

Then, I read Spong's book on robotics, and he had used LaSalle's theorem. I am confused. (spong.pdf)

I did some research, and found out that non-autonomous means it should not explicitly depend on the independent variable. Isn't independent variable time in these systems? So, shouldn't they be considered autonomous?

答: If you structure the system dynamics equations to not depend on the independent variable, an Euler-Lagrange system is autonomous.  If, however, you recast the equations to depend on the state variables (and their derivatives), as Ren did, it becomes non-autonomous.  That clever manipulation allowed him to prove asymptotic stability for the consensus algorithm $\tau_i$.  It might be possible to prove without taking that mathematical direction, but I cannot think of a better way to do it. </p>


问:
Choose and connect a camera to a robot
There are tons of cameras in devices around us these days. There are used photo cameras, smartphones, tablets at my home gathering dust.

I wonder, what the easiest way could be to get a camera module from some device, connect it to my robot project with a soldering iron and make it work from the software point of view. I am planning to use something like Arduino, an STM32 platform, or probably Intel Edison.

May be some camera modules are easier to solder and program for a custom  project? Or shouldn't I look this way and better find a camera module that is specially designed for custom projects?

答:
Sorry to pour water on your fire... while it is certainly possible, whether it is worth the effort is debatable.

While different tablets/smartphones/cameras will employ different optical devices, they will be more or less the same.

This question has been asked before on SE Arduino, Re-use smartphone/tablets parts like a camera. jwpat7's answer goes into specifics for a particular Samsung tablet. You don't specify which tablet/phones you have, so I can not provide any further detailed information, but open up the device and see if it has HRS on the connector.

Note that cortices' answer advises against doing so, due to propriety signals, and the difficulty in decoding them.

A link to the Arduino forum is also provided, How to reuse quality camera from old / broken phone, which, more or less, also recommends against the idea due to the effort required in reverse engineering.

It would probably be far simpler to use a Raspberry Pi, which has an actual camera interface (CSI port) for use with the camera module. You can then use the Python package, picamera.

Title: Choose and connect a camera to a robot


问:
Neural Nework code or library for MSP430G2553 microcontroller
I am new here and i am new to neural network also. :P

I have gone through the concepts of Neural Networks but i want to implement it in my project including microcontroller MSP430G2553 on LaunchPad Series.

I am using some sensors and i want to use some neural network code to manipulate the data from sensors to get some threshold.

I went through this post and tried to implement the codes from the link given but it is giving some error on less ram, i guess it is due to my mcu.

So, i wanted some help regarding the neural network code or library for Energia which i should use.
Thanks in Advance.

答:
One page linked says the algorithm is fine for the ATmega328's 2KB of SRAM, another is for the ATmega2560's 8KB of SRAM.

Your MSP430G2553 has 0.5KB of RAM, so I think that's the primary reason you can't get it to run on that controller.

There are other microcontrollers in the MSP430 line that have more memory - if you look at the other LaunchPads you can see that you've got the one with the smallest RAM available in a LaunchPad - others have up to 64KB.


问:
Difference between g-value and rhs-value in Lifelong Planning A*
What is the difference between g-value and rhs-value of Lifelong Planning A* algorithm?

According to this link, D* Lite, g(s) directly correspond to the
g-values of an A* search, i.e. g(s) = g(s') + c(s',s), and rhs(s) is given as

$$
rhs(s) = \begin{cases}0 & s = s_{start}  \\ \min_{s'\in Pred(s)}(g(s') + c(s', s)) & \text{otherwise} \end{cases}
$$

where, Pred(s) denotes the set of predecessors of node 's'.

Thus, unless node 's' has more than one predecessor, its g-value and rhs-value will remain same.

So, my question is, in which case will the rhs-value and g-value of a node be different?

答:
From the paper, $g(s)$ is only an estimate of the distance travelled (vs a direct measurement, which is how A* computes it).

The rhs-values are one-step lookahead values based on the g-values and thus potentially better informed than the g-values.

The calculation of $rhs$ seems to be purely a sanity check that the estimate of $g(s)$ is accurate, based on the estimate of a predecessor.

in which case will the rhs-value and g-value of a node be different

Even if there is only one predecessor, if the estimate for that predecessor has changed between 2 searches then it's possible for $rhs(s) \neq g(s)$.  And based on the equation above, that can happen in only one of two ways:

the minimum $c(s', s)$ has changed

the minimum $g(s')$ has changed

According to the paper, this represents the case where the robot makes a move and discovers that the cost of moving between two given points has changed from what was previously believed.


答:
If you have an unused smartphone with a camera, your best bet may be to simply use that for the robot.

Many results came up in my brief google search for smartphone robots and smartphone-based robotics software.

Title: Choose and connect a camera to a robot

Body:
There are tons of cameras in devices around us these days. There are used photo cameras, smartphones, tablets at my home gathering dust.

I wonder, what the easiest way could be to get a camera module from some device, connect it to my robot project with a soldering iron and make it work from the software point of view. I am planning to use something like Arduino, an STM32 platform, or probably Intel Edison.

May be some camera modules are easier to solder and program for a custom  project? Or shouldn't I look this way and better find a camera module that is specially designed for custom projects?


答:
To expand on @Ian 's answer :

In that context, I believe a "predecessor" of vertex $u$ refers to any vertex $v$ with a directed edge $(v,u)$, i.e any vertex "from which u is accessible".

For instance, in the typical case of a 2D grid with eight neighbors for each cell and bidirectional edges (or two opposite directed edges), you almost always have multiple predecessors for a given vertex.

$rhs(s)$ integrates information from the immediate neighborhood of $s$ ("one step lookahead") which is why $rhs-values$ propagate faster than the $g-values$ and help better discriminate between multiple vertices in the priority queue to decide which one is the most promising to expand next.

$rhs(s)$ and $g(s)$ are different - vertices are "locally inconsistent" - typically around the area where the edge costs were modified, and as the local search expands to "repair" the previous path around this area, vertices along the new shortest path are made "locally consistent", i.e $rhs(s)=g(s)$

Title: Difference between g-value and rhs-value in Lifelong Planning A*

Body:
What is the difference between g-value and rhs-value of Lifelong Planning A* algorithm?

According to this link, D* Lite, g(s) directly correspond to the
g-values of an A* search, i.e. g(s) = g(s') + c(s',s), and rhs(s) is given as

$$
rhs(s) = \begin{cases}0 & s = s_{start}  \\ \min_{s'\in Pred(s)}(g(s') + c(s', s)) & \text{otherwise} \end{cases}
$$

where, Pred(s) denotes the set of predecessors of node 's'.

Thus, unless node 's' has more than one predecessor, its g-value and rhs-value will remain same.

So, my question is, in which case will the rhs-value and g-value of a node be different?


问:
Quadcopter propeller physics
In propellers as the airspeed increases thrust decreases. Is the air speed component taken as a vector quantity perpendicular to the propeller? If thats true the its quiet easy to visualize in case of airplanes but for quadcopters will it be  <strong>"copter_airspeed * sin(copter tilt)"</strong>? </p>

答: Have a look at investigating flight with toy helicopter</p>

Title: Quadcopter propeller physics


问:
Meaning of 'sign' in Writhe Matrix
Following is the equation of Writhe matrix from the article Topology based Representation(page no. 6).

What is the meaning of 'sign' in the second part of this equation? I am not sure if this is some typo in that article as the other article of Hierarchical Motion Planning(page no. 3), compleletely neglects the term 'sign[...]'

答: Sign is a function that returns +1 whenever the operand is anything positive, -1 if it's anything negative, and 0 if it's zero. I'm not sure if it's mathematically correct for your equation as I'm not familiar with it, but it's not an uncommon function, especially in the realm of robotics. </p>

Title: Meaning of 'sign' in Writhe Matrix


问:
Meaning of symbol, 'curly N' in the equation of Linear Gaussian system dynamics
In the article of Topological Based Representation(Page no. 12), the equation of the Linear Gaussian system dynamics is given as

In above equation what is the meaning of 'curly N'?

答: They are modeling the probability as a normal distribution with the given mean and variance.  </p>


答:
Can you draw a picture of what you're asking for? I think you may be thinking about the problem wrong (no offense). The big problem (I think) is that quadcopter's propellers are not oriented the same as an aircraft's, which means that the velocity direction for calculating advance ratio is not the same for the two types of aircraft.

In an airplane, horizontal motion is (for the most part) normal to the [geometric!] plane of the prop:

In a quadcopter, horizontal motion is (again, for the most part) parallel to the plane of the prop.

As I understand it, the advance ratio is calculated with the ratio of fluid speed across the blades relative to the tip speed of the blade. In an airplane, this is equal to the horizontal speed of the airplane because the plane of the blades is normal to the horizontal motion.

In a quadcopter, horizontal motion causes air to pass along the blades because horizontal motion is in the same plane as the face of the blade. That is, I don't think you use horizontal speed to calculate the advance ratio of a quadcopter.

Instead, I would use (generally) the vertical speed of the quadcopter because the vertical direction is normal to a quadcopter's propellers.

Title: Quadcopter propeller physics

Body: In propellers as the airspeed increases thrust decreases. Is the air speed component taken as a vector quantity perpendicular to the propeller? If thats true the its quiet easy to visualize in case of airplanes but for quadcopters will it be  <strong>"copter_airspeed * sin(copter tilt)"</strong>? </p>


问:
Anthropomorphic Arm
I developed an anthropomorphic arm (structure in aluminium) with 6 DOF (3 plus spherical wrist) for direct kinematic.

I chose magnetic rotary encoders to measure angles but I am not satisfied, due to them causing noise on angle measurements.

What do you advise me?

To add another sensor and perform a sensor fusion?

To replace magnetic encoders with optical ones?

or... what else?

答:
I was going to add this as a comment, but it's more detailed than one so I'll post it as an answer.

You might be able to measure to the sub-millimeter level, but you will find it very, very difficult to control to that level. This is because every mechanical structure has some form of resonance - everything shakes.

If your robot were just a chunk of aluminum, you'd probably be fine. But, because you want something functional, you put joints in the robot. Those joints need to be flexible to be functional, but they also need to be rigid enough (when commanded) to support the weight of the arm plus whatever payload you have.

The fact that a robot moves to a commanded position means that there will be some momentum in the arm. When you bring the arm to a stop there is a jerk that mechanically excites the arm, starting vibration. You can measure the motion of the arm, but controlling the vibration with an actuator, to the level you're talking about, is very difficult.

Regarding measurement accuracy, you haven't given any dimensions for your arm, so it's not possible to give a hard spec on your encoder resolution requirement, but I'll wager that what you have is insufficient.

If your arm is 1 foot long (305mm), then motion of 0.1mm at the end of that arm is equivalent to

$dx = r\sin{(\theta)}$

$\theta = \mbox{asin}{(dx/r)}$

$\theta = 0.018 \mbox{deg}$

You state that your encoder measures to 0.03% of 360 degrees, which means is measures to 30% of 0.36 degrees, or about 0.1 degree. This means that you need 10 times the resolution on your encoder if your arm, from center of the joint to the end of the end effector, is ~300 mm.

Whenever you do get data, you can quickly check for resonance by plotting the autocorrelation of data. Resonance generally some sinusoidal function; this would be pretty apparent in the plot.

If you get an encoder that has exactly the resolution you think you need, then sometimes you can get "noise" where the value being measured is on the edge of a bit threshold. For this reason, I typically try to get an encoder a couple bits higher than what I think I need. I thought there was a thumb rule for this but I can't find it in a cursory search online and I don't have my measurement text with me.

Hopefully this gives you some guidance; if you can update your question (please don't post as a comment) a link to your data along with the dimensions of your arm then it would be possible to give you a more thorough answer.

Title: Anthropomorphic Arm


问:
Autonomous Indoor Positioning System Robot based on CV approach
I have some questions regarding an IPS autonomous robot system,

Configuration:

Mounting a camera to the ceiling of a room

Assume the room is a cube of 5mx5mx5m (LxWxH)

Assume the camera is Microsoft LifeCam Studio (CMOS sensor technology, Sensor Resolution: 1920 X 1080, 75° diagonal field of view, Auto focus from 0.1m to ≥ 10m, Up to 30 frames per second, Frequency Response: 100 Hz – 18 kHz)

A rover

Objectives:

By putting the rover in an unknown location (x,y) in the room, the system should localize the rover's position

After the rover's coordinates will be known, Navigation will be the next step

We want the rover to navigate from the known coordinates (x1,y1) (let's say point A) to another point B on the map (x2,y2)

Control signals will be sent to the rover's servos to complete the navigation task

Methodology:

Camera will capture the environment in real time

Environment will be represented as cells (occupancy grid mapping)

Assume each cell represents 5 cm in the environment

Rover will be localized by the system point A

Determine the navigation to point B

Determine the path of the rover in the grid map (ex: go x cells horizontal then y cells vertical)

Control Signal will be sent to rover's servos

Questions:

Can I use this camera for this task or I need another type of cameras ?

What are the factors affecting the system accuracy ?
(ex: Sensor Resolution - FOV - FPS - Frequency Response - Distance of the camera in the ceiling)

What's is the most important factor to consider to increase the accuracy ?

I would appreciate any opinions regarding the project

King Regards,
Thank you

答:
The camera should work fine as long as you can easily find the rover in the environment. An easy way to accomplish this is to place two different colored markers on the rover. By finding the markers in the image you can get position and orientation.

You'll need to calibrate the camera to get focal lengths and the optical center. This is easily done with the ros package camera_calibration though there are many similar packages out there that would work. As long as you've done a decent job calibrating the camera and can accurately find the markers on the vehicle you should have a very accurate estimate of the rover's position.


问:
Meaning of the equation of graphical model
The paper Topology-based Representations for Motion Planning
and Generalisation in Dynamic Environments with
Interactions by Ivan
et.al., says on page 10 that the Approximate Inference Control (AICO) framework translates the robot dynamics to the graphical model by the following equation:

What does p(x0:T,u0:T) mean? I feel that p means 'prior of' some uncertain quantity, but I'm not sure about this.

答:
It is not a prior. It is the posterior of trajectory and controls. Basically that equation gives you the motion model of the robot similar to the motion models described in Sebastian Thrun's Probabilistic Robotics. $x_{0:t}$ is a set of poses i.e., trajectory and $u_{0:t}$ is a set of controls, i.e., Motor commands for the joints. The posterior here provides a likelihood estimate of the robot's pose after a control command. From what I understand after skimming through the rather obscure paper and another paper Robot Trajectory Optimization using Approximate Inference that the LHS is used to compute a likelihood for the next pose, $x_{t+1}$ if a control action $u_t$ is chosen with the knowledge of $x_t$. The LHS can be viewed as described in the Background section below. From the latter paper, the estimation of state $x_{t+1}$ requires some confidence on the knowledge of current state $x_t$ which is given by the covariance matrix $A$ and mean $a$.

Background:

$p(x_{0:t},u_{0:t})$ is called a state transition probability, it can also be written as $p(x_{t}|x_{0:t-1}, u_{0:t})$ since it can be assumed that $x_t$ is a complete state or here just the pose of the robot, i.e. it is a summary of all that happened in the past poses after executing commands in the set $u_{1:t}$. What this results in is that $x_t$ is conditional stochastically on $x_{t-1}$ and can be estimated by executing the command $u_t$. Which is what the motion model does for you and it is shown as $p(x_t|u_t, x_{t-1})$. It says that the state $x_t$ depends on $u_t$ and can be computed as long as $x_{t-1}$ is known.


问:
Red [ERROR] output in python in ROS
In ROS, I cannot get [ERROR] logs to print in red when I use python. How can I make them appear in red instead of black?

For example, the following Python:

```<code>rospy.logerr("No analog input received.")
</code>```

produces this output in black:

[ERROR] [WallTime: 135601422.876123] No analog input received.

whereas the following C++:

```<code>ROS_ERROR("No analog input received.");
</code>```

produces the following output in red.

[ERROR] [135601551.192412]: No analog input received.

答:
This has been merged as of six weeks ago:

https://github.com/ros/ros_comm/commit/8a1f92fc0c888099fe47005f609883601b7d8d72#diff-1

Title: Red [ERROR] output in python in ROS


问:
Reverse engineering commercial drone control algorithms
I'm wondering if there is a way to figure out the actual controllers used in the commercial drones such as AR drone and Phantom. According to AR drone SDK, users are not allowed to access the actual hardware of the platform yet they are only capable of sending and receiving commands from/to the drone.

Edit:
I'm hoping to to check the actual controller utilized in the software. When I fly AR drone, it seems the platform can't stabilize itself when I perform aggressive maneuvers, therefore, I can guess that they use linearized model which is applicable for using simple controllers such as PD or PID

答:
I would recommend looking at the PX4 software that runs on the pixhawk. It's open source and is available on github.

You won't be able to see the actual control software flying on the other drones as it's proprietary.

https://github.com/PX4/Firmware

--

the software on the pixhawk is well put together and maintained. it is likely more accessible than most because processes are split into modules and comminicate via messages. The ardupilot is another open source flight stack. However, the ardupilot is a god object that is a mess of inheritance. If you are not familiar with oop you best stay away.

The only downside to the px4 flight stack is that it uses cascaded pid for attitude control which isn't all that exotic.

But if you're just looking to get a feel for how controllers are implemented in the real world on embedded systems, the px4 flight stack will be your best bet.


问:
iRobot Create 2: Angle Measurement
I have been working on trying to get the angle of the Create 2. I am trying to use this angle as a heading, which I will eventually use to control the robot. I will explain my procedure to highlight my problem.

I have the Create tethered to my computer.

I reset the Create by sending Op code [7] using RealTerm.
The output is:

bl-start

  STR730

  bootloader id: #x47175347 4C636FFF

  bootloader info rev: #xF000

  bootloader rev: #x0001

  2007-05-14-1715-L

  Roomba by iRobot!

  str730

  2012-03-22-1549-L

  battery-current-zero 252

  (The firmware version is somewhere in here, but I have no clue what to look for--let me know if you see it!)

I mark the robot so that I will know what the true angle change has been.

I then send the following codes [128 131 145 0x00 0x0B 0xFF 0xF5 142 6]. This code starts the robot spinning slowly in a circle and request the sensor data from the sensors in the group with Packet ID 2. The output from the Create seen in RealTerm is 0x000000000000, which makes sense.

I wait until the robot has rotated a known 360 degrees, then I send [142 2] to request the angle difference. The output is now 0x00000000005B.

The OI specs say that the angle measurement is in degrees turned since the last time the angle was sent; converting 0x5B to decimal is 91, which is certainly not 360 as expected.

What am I doing wrong here? Is the iRobot Create 2 angle measurement that atrocious, or is there some scaling factor that I am unaware of? are there any better ways to get an angle measurement?

答:
To get the firmware version:

To get what software the robot has, connect it to a serial application (such as PuTTy) and turn the robot off then on. It should print it out then

New says:
r3_robot/tags/release-3.4.1:

old says:
r3_robot/tags/release-3.2.6:

Title: iRobot Create 2: Angle Measurement


问:
Counting number of people entering a room
We are making a project in which we want to count the no. of people entering and leaving a room with one single entrance. We are using IR sensors and detectors for this ,along with an Aurdino. We have a problem in this system,  i.e when two or more persons are entering or leaving the room at a time we are getting a wrong count. Thanks in advance for your valuable time and solution.....If there is any other better way,please state that.</p>

答:
You question is a bit vague in sense of how many IR sensors you have, what type of them etc. With that in mind, I will try to answer with the following assumptions:

You have IR sensors which are laser-ir diode/resistor/transistor pairs (the person walking cuts the laser beam which can be detected on the photosensitive element).

You have enough of those.

People will not be trying to fool your system.

You can try to put a bit denser array of these sensors both horizontally and vertically so that you may distinguish two persons walking in at the same time. This will call for some heuristics in the sense of how wide a single person is etc.

A much easier solution (involving a bit more sophisticated IR sensor) is using Microsoft Kinect along with Kinect SDK which has skeleton detection already implemented so you can just read if and how many people are entering and leaving the room.


问:
How is Topology-based representation invariant to certain change in environment
The article of Topology-based representation (page no. 13, line 5) says that, topology-based representation is invariant to certain changes in the environment. That means the trajectory generated in topology-based space will remain valid even if there are certain changes in the environment. But how is this possible? Is there any simple example to understand this concept?</p>

答: The concept you might be missing is homeomorphism. The donut=coffee cup visual example at that link might help. Of all the ways you can change the environment (move the obstacles) there is a subset of changes you can make that change the location of the obstacles but keeps the topology the same. Because the topology is the same, the topology based space trajectory will remain valid, even though the obstacles have moved. (Again, depending on the topology, only a subset of all possible changes will keep the same topology.)


问:
Quadcopter PID Algorithm
I'm trying to implement a PID control on my quadcopter using the Tiva C series microcontroller but I have trouble making the PID stabilize the system.

While I was testing the PID, I noticed slow or weak response from PID controller (the quad shows no response at small angles). In other words, it seems that the quad's angle range has to be relatively large (above 15 degrees) for it to show a any response. Even then, the response always over shoots no matter what I, D gains I choose for my system. At low P, I can prevent overshoot but then it becomes too weak.

I am not sure if the PID algorithm is the problem or if its some kinda bad hardware configuration (low IMU sample rate or maybe bad PWM configurations), but I have strong doubts about my PID code as I noticed changing some of the gains did not improve the system response.

I will appreciate If someone can point out whether i'm doing anything wrong in the PID snippet for the pitch component I posted. I also have a roll PID but it is similar to the code I posted so I will leave that one out.

```<code>void pitchPID(int16_t pitch_conversion)
{
  float  current_pitch = pitch_conversion;
  //d_temp_pitch is global variable
  //i_temp_pitch is global variable
  float  pid_pitch=0; //pitch pid controller
  float  P_term, I_term, D_term;
  float  error_pitch = desired_pitch - current_pitch;

  //if statement checks for error pitch in negative or positive direction
  if ((error_pitch>error_max)||(error_pitch<error_min))
    {
      if (error_pitch > error_max) //negative pitch- rotor3&4 speed up
        {
          P_term = pitch_kp*error_pitch; //proportional
          i_temp_pitch += error_pitch;//accumulate error
          if (i_temp_pitch > iMax)
            {
            i_temp_pitch = iMax;
            }
          I_term = pitch_ki*i_temp_pitch;
          if(I_term < 0)
            {
            I_term=-1*I_term;
            }
          D_term = pitch_kd*(d_temp_pitch-error_pitch);
          if(D_term>0)
            {
            D_term=-1*D_term;
            }
          d_temp_pitch = error_pitch; //store current error for next iteration
          pid_pitch = P_term+I_term+D_term;
          if(pid_pitch<0)
            {
            pid_pitch=(-1)*pid_pitch;
            }
          //change rotor3&4
          pitchPID_adjustment (pid_pitch, 'n'); //n for negative pitch
        }
      else if (error_pitch < error_min) // positive pitch- rotor 1&2 speed up
        {
        P_term = pitch_kp*error_pitch; //proportional
        i_temp_pitch += error_pitch;
        if (i_temp_pitch < iMin)
          {
          i_temp_pitch = iMin;
          }
        I_term = pitch_ki*i_temp_pitch;
        if(I_term > 0)
          {
          I_term=-1*I_term;
          }
        D_term = pitch_kd*(d_temp_pitch - error_pitch);
        if(D_term < 0)
          {
          D_term=-1*D_term;
          }
        d_temp_pitch = error_pitch;
        pid_pitch = P_term+I_term+D_term;
        if(pid_pitch<0)
          {
          pid_pitch=(-1)*pid_pitch;
          }
        print(pid_pitch);//pitch
        printString("\r\n");
        //change rotor1&2
        pitchPID_adjustment(pid_pitch,'p'); //p for positive pitch
      }
    }
  }
</code>```

```<code>void pitchPID_adjustment(float pitchPIDcontrol, unsigned char pitch_attitude)
  {
  if (pitchPIDcontrol>(maximum_dutyCycle-set_dutyCycle))
    {
    pitchPIDcontrol=maximum_dutyCycle-set_dutyCycle;
    }
  switch (pitch_attitude){
  //change rotor1&2
  case 'p': //positive status
    PWM0_2_CMPA_R += (pitchPIDcontrol);//(RED)//motor1
    PWM0_0_CMPA_R += (pitchPIDcontrol);//(Yellow)//motor2
    break;
  //change rotor 3&4
  case 'n': //negative status
    PWM0_1_CMPA_R += pitchPIDcontrol;//(ORANGE)//motor3
    PWM1_1_CMPA_R += pitchPIDcontrol;//(green)//motor4
    break;
  }
</code>```

Also, can someone please tell me how this motor mixing works?:

```<code>Front =Throttle + PitchPID
Back =Throttle - PitchPID
Left =Throttle + RollPID
Right =Throttle - RollPID
</code>```

vs what I did in the function:

```<code>void pitchPID_adjustment(float pitchPIDcontrol, unsigned char pitch_attitude)
</code>```

答:
The glaring issue I see at the moment is that you are forcing polarity on the I and D terms. In general, you are using a lot of sign checks, sign assignments, and conditional programming.

None of that belongs in a PID controller. The entire controller should look like:

```<code>pError = Input - Output;
iError = iError + pError*dt;
dError = (pError - previousError)/dt;
previousError = pError;

ControlSignal = kp*pError + ki*iError + kd*dError;
</code>```

That's it. No need for checks, assignments, etc. See my related answer on splitting the control signal as opposed to control each motor pair individually (which is what I believe your goal is with the if elseif code).

Imagine a PID controller as three people watching your vehicle, all trying to give advice based on their "experience" (mode). Each "person" will give you one of three "statements" So you have:

Mr. Proportional - This person looks at where the output is and compares it to what you asked for. The statements given by this person are:

There is a large difference between what you want and what you have - take a big action.

There is a small difference between what you want and what you have - take a small action.

What you have is what you asked for - take no action.

Mr. Integral - This person looks at the same error value Mr. Proportional does, but compares it to how long it's been that way. The statements given by this person are:

You have chronic/acute error (small error for a long time or big error for a small time) - take a big action.

You have mild error (small error for a short time) - take a small action.

Your error history is neutral (time * positive error is equal to time * negative error) - take no action.

Mr. Derivative - This person looks at the same error value Mr. Proportional does, but compares it to how it's changing. The statements given by this person are:

Your error is getting bigger - take a bigger action.

Your error is getting smaller - take a negative action.

Your error is not changing - take no action.

It's important to note statement 2 of Mr. Derivative up there - imagine you're driving a car behind someone who is already at a stop. As you get closer to them (error is getting smaller), not only do you want to let off the gas, but you also want to brake! Derivative action is what gives you "braking" - no other term (P or I) gives you negative action until you're past the setpoint. Derivative is the only term that tells you to slow down because you're getting close.

Another way to help understand these terms is to understand physically what they mean. Say your reference is a speed. This means:

Proportional error compares your speed to your target speed. Want to be going 60 and you're going 55? Speed up. Going 65? Slow down. This is easy.

Integral error compares the integral of target speed to the integral of actual speed. This means that it's comparing a target position to your actual position. Were you supposed to be in the city already? Then you need to speed up. Were you supposed to be in the city and you're still at your house? SPEED THE ENTIRE WAY.

Derivative error compares the derivative of the difference between target and actual speeds. Is the person in front of you pulling away? Speed up! Is the person in front of you pushing their brakes? Slow down! As I mentioned above, if your target is to be immediately behind the person in front of you, then proportional and integral will both "tell" you to speed up. Derivative is the only "person" to tell you you're going to rear-end them if you don't start braking.

SO, what happens when you force signs on the error terms?

Let's suppose you're in a car, trying to follow a friend to a restaurant. Here the friend's speed represents the speed reference and your speed represents your speed feedback. Speed limit on the road is 35mph (55kph). Here's what happens:

Your friend begins to move.

You are still stationary, so the following errors happen:

Proportional error is positive (you want to go 35 and are actually going 0).

Integral error is a little positive (your friend is farther from you).

Derivative error is large and positive (your friend is quickly pulling away from you).

You force signs: force integral error to be positive (already is) and derivative error to be negative.

This means that derivative error is "telling" you that the car is getting farther away from you, but you invert that and assume that derivative error meant to say that you are getting closer to your friend. This is wrong.

Actions: Proportional - press the gas a moderate amount. Integral - Press the gas pedal a little bit. Derivative - Should be press the gas pedal a lot, but you inverted it, so instead you press the brake a lot.

Eventually your friend gets far enough away that the proportional and integral error becomes large enough that it overrides your (incorrectly inverted) derivative term. At this point:

Proportional error is large (still going zero and want to go 35).

Integral error is very large (your friend is very, very far in front of you).

Derivative term is still large (friend is still actively getting farther from you), but you are still forcing it to be negative.

Actions: Proportional - press the gas a lot. Integral - Floor the gas pedal. Derivative - Should be push the gas pedal, but you inverted it, so instead you press the brake.

After some time, you get to 34.999 mph. Proportional error is still (slightly) positive because you want to go 35 and you're actually at 34.999, so proportional error is 0.001

Proportional error is barely positive (still going slower than 35mph)

Integral error is at its largest (you are farthest from your friend thus far because your friend has been going 35 the whole time)

Derivative error is roughly zero (you're almost the same speed your friend is, so now the proportional error stabilizes)

You force signs: Force integral error to be positive (already is) and derivative error to be negative (it's almost zero, so negligible change).

Action: Proportional - No action because you're almost at 35mph. Integral - You are now really far from your friend, so you floor the gas. Derivative - No action because the proportional error is almost stable.

Now, because you were flooring the gas, you pass 35mph and hit 35.01mph. Now, your proportional error becomes negative (want 35, are going 35.01, so error is -0.01).

Proportional error is almost zero (going just over the speed limit)

Integral error is very large and still very positive because you are actually very far behind your friend.

Derivative error is almost zero (because proportional error is still almost zero).

You force signs: Force derivative error to be positive - little change because it's almost zero anyways. The problem here comes when you force integral error to be negative - it was very large and very positive! Now you're forcing it to be negative. This means Mr. Integral was telling you you're very far behind your friend, but you invert that and assume integral error meant to say that you are very far in front of your friend.

Action: Proportional - No action because you're going 35mph. Integral - You are very far behind your friend and should floor the gas pedal, but you inverted that and now think that you are very far ahead of your friend, so you stomp the brake pedal instead! Derivative - No action because proportional error is pretty stable.

At this point you hit a loop - you slam on brakes when your speed just passes 35mph because you invert integral error, then you floor the gas when you fall below 35mph because you un-invert integral error. This should (violently!) jerk the car (aircraft) around and prevent you from ever eliminating any steady state error.

Worse, I'm not sure how this would behave once you get to the set position, but I think the constant sign flipping might prevent you from stopping anywhere close to where you wanted (if it ever stabilizes at all).

Title: Quadcopter PID Algorithm

Body:
The glaring issue I see at the moment is that you are forcing polarity on the I and D terms. In general, you are using a lot of sign checks, sign assignments, and conditional programming.

None of that belongs in a PID controller. The entire controller should look like:

pError = Input - Output;
iError = iError + pError*dt;
dError = (pError - previousError)/dt;
previousError = pError;

ControlSignal = kp*pError + ki*iError + kd*dError;

That's it. No need for checks, assignments, etc. See my related answer on splitting the control signal as opposed to control each motor pair individually (which is what I believe your goal is with the if elseif code).

Imagine a PID controller as three people watching your vehicle, all trying to give advice based on their "experience" (mode). Each "person" will give you one of three "statements" So you have:

Mr. Proportional - This person looks at where the output is and compares it to what you asked for. The statements given by this person are:

There is a large difference between what you want and what you have - take a big action.

There is a small difference between what you want and what you have - take a small action.

What you have is what you asked for - take no action.

Mr. Integral - This person looks at the same error value Mr. Proportional does, but compares it to how long it's been that way. The statements given by this person are:

You have chronic/acute error (small error for a long time or big error for a small time) - take a big action.

You have mild error (small error for a short time) - take a small action.

Your error history is neutral (time * positive error is equal to time * negative error) - take no action.

Mr. Derivative - This person looks at the same error value Mr. Proportional does, but compares it to how it's changing. The statements given by this person are:

Your error is getting bigger - take a bigger action.

Your error is getting smaller - take a negative action.

Your error is not changing - take no action.

It's important to note statement 2 of Mr. Derivative up there - imagine you're driving a car behind someone who is already at a stop. As you get closer to them (error is getting smaller), not only do you want to let off the gas, but you also want to brake! Derivative action is what gives you "braking" - no other term (P or I) gives you negative action until you're past the setpoint. Derivative is the only term that tells you to slow down because you're getting close.

Another way to help understand these terms is to understand physically what they mean. Say your reference is a speed. This means:

Proportional error compares your speed to your target speed. Want to be going 60 and you're going 55? Speed up. Going 65? Slow down. This is easy.

Integral error compares the integral of target speed to the integral of actual speed. This means that it's comparing a target position to your actual position. Were you supposed to be in the city already? Then you need to speed up. Were you supposed to be in the city and you're still at your house? SPEED THE ENTIRE WAY.

Derivative error compares the derivative of the difference between target and actual speeds. Is the person in front of you pulling away? Speed up! Is the person in front of you pushing their brakes? Slow down! As I mentioned above, if your target is to be immediately behind the person in front of you, then proportional and integral will both "tell" you to speed up. Derivative is the only "person" to tell you you're going to rear-end them if you don't start braking.

SO, what happens when you force signs on the error terms?

Let's suppose you're in a car, trying to follow a friend to a restaurant. Here the friend's speed represents the speed reference and your speed represents your speed feedback. Speed limit on the road is 35mph (55kph). Here's what happens:

Your friend begins to move.

You are still stationary, so the following errors happen:

Proportional error is positive (you want to go 35 and are actually going 0).

Integral error is a little positive (your friend is farther from you).

Derivative error is large and positive (your friend is quickly pulling away from you).

You force signs: force integral error to be positive (already is) and derivative error to be negative.

This means that derivative error is "telling" you that the car is getting farther away from you, but you invert that and assume that derivative error meant to say that you are getting closer to your friend. This is wrong.

Actions: Proportional - press the gas a moderate amount. Integral - Press the gas pedal a little bit. Derivative - Should be press the gas pedal a lot, but you inverted it, so instead you press the brake a lot.

Eventually your friend gets far enough away that the proportional and integral error becomes large enough that it overrides your (incorrectly inverted) derivative term. At this point:

Proportional error is large (still going zero and want to go 35).

Integral error is very large (your friend is very, very far in front of you).

Derivative term is still large (friend is still actively getting farther from you), but you are still forcing it to be negative.

Actions: Proportional - press the gas a lot. Integral - Floor the gas pedal. Derivative - Should be push the gas pedal, but you inverted it, so instead you press the brake.

After some time, you get to 34.999 mph. Proportional error is still (slightly) positive because you want to go 35 and you're actually at 34.999, so proportional error is 0.001

Proportional error is barely positive (still going slower than 35mph)

Integral error is at its largest (you are farthest from your friend thus far because your friend has been going 35 the whole time)

Derivative error is roughly zero (you're almost the same speed your friend is, so now the proportional error stabilizes)

You force signs: Force integral error to be positive (already is) and derivative error to be negative (it's almost zero, so negligible change).

Action: Proportional - No action because you're almost at 35mph. Integral - You are now really far from your friend, so you floor the gas. Derivative - No action because the proportional error is almost stable.

Now, because you were flooring the gas, you pass 35mph and hit 35.01mph. Now, your proportional error becomes negative (want 35, are going 35.01, so error is -0.01).

Proportional error is almost zero (going just over the speed limit)

Integral error is very large and still very positive because you are actually very far behind your friend.

Derivative error is almost zero (because proportional error is still almost zero).

You force signs: Force derivative error to be positive - little change because it's almost zero anyways. The problem here comes when you force integral error to be negative - it was very large and very positive! Now you're forcing it to be negative. This means Mr. Integral was telling you you're very far behind your friend, but you invert that and assume integral error meant to say that you are very far in front of your friend.

Action: Proportional - No action because you're going 35mph. Integral - You are very far behind your friend and should floor the gas pedal, but you inverted that and now think that you are very far ahead of your friend, so you stomp the brake pedal instead! Derivative - No action because proportional error is pretty stable.

At this point you hit a loop - you slam on brakes when your speed just passes 35mph because you invert integral error, then you floor the gas when you fall below 35mph because you un-invert integral error. This should (violently!) jerk the car (aircraft) around and prevent you from ever eliminating any steady state error.

Worse, I'm not sure how this would behave once you get to the set position, but I think the constant sign flipping might prevent you from stopping anywhere close to where you wanted (if it ever stabilizes at all).


问:
Dropping PWM on Ardrone Parrot 2.0
I am having some issues with the ARDrone Parrot 2.0 and hope someone else may be running into the same thing.

While hovering, the drone is (seemingly) randomly losing altitude then recovering . It is doing so while not being commanded any velocity inputs and should hold altitude.

We are using the drivers from the ardrone_autonomy (dev_unstable branch) on github. We are able to watch the PWM outputs being sent to the motor and they are dropping from the hover command do a small value before exponentially returning to the hover value when this drop occurs.

The issue could be a communication between the IMU and the onboard controller or on our software control implementation.

Has anyone seen a similar problem or suggestions to test/troubleshoot what is happening?

答:
I have not used the ARDrone but have experience with height hold on another autopilot.

Without the further information, a quick google search found a possible firmware issue with ARDrone in this thread.

If you are using the onboard ultrasound sensor then as I mentioned in my post on How can I detect the edge of a table?. The ultrasound sensors can jump to zero sporadically for part of a second and this could cause the ARDrone to change altitude and then jump back to the real value.

Title: Dropping PWM on Ardrone Parrot 2.0


答:
Reverse engineering is the term you are looking for. Search reverse engineering ar drone or reverse engineering phantom to get started.

Reverse engineering embedded systems can be really educational and fun, if time consuming. Most embedded processors have code security subsystems, but manufacturers often don't bother to turn them on, and if they are turned on, a little research will give you lots of info on bypassing the typically inadequate security.

Title: Reverse engineering commercial drone control algorithms

Body:
I'm wondering if there is a way to figure out the actual controllers used in the commercial drones such as AR drone and Phantom. According to AR drone SDK, users are not allowed to access the actual hardware of the platform yet they are only capable of sending and receiving commands from/to the drone.

Edit:
I'm hoping to to check the actual controller utilized in the software. When I fly AR drone, it seems the platform can't stabilize itself when I perform aggressive maneuvers, therefore, I can guess that they use linearized model which is applicable for using simple controllers such as PD or PID


问:
Best sensor to determine "up" versus "down"
I want to start designing an Arduino project and have telemetry readings that indicate tilt or angle of placement. </p>

<p>Would an accelerometer be the best for determining tilt? Are there good tutorials? </p>

答:
if you aren't moving, the accelerometer will give you the direction of gravity. if you are moving and hoping to use this orientation data for control you'll need to incorporate at least one more sensor. The extra sensor is needed because you have no method separating the acceleration of gravity and the acceleration of the sensor. The other drawback is that the accelerometer has no way to measure heading.

A magnetometer would also give you a measurement of orientation but the calibration process can be a little intimidating. It makes up for the deficiencies of the accel.

If you're looking for a weekend project I recommend using a three axis accelerometer.


问:
Standard equation for steering differential drive robot
I am writing a code in Arduino IDE for NodeMCU Board to control a differential drive 2 wheeled robot.

I am able to steer only one direction for some reason and the steering response time is a little awkward.

Is there perhaps a better strategy for the code that I am using?`

I am using an app called Blynk that has a virtual joystick that controls that feeds the data through Virtual Pins. V1 param 0 and 1 are x and y. x would be left to right on the joystick and y would be forward and back.

Information about the App is available here: http://www.blynk.cc/. I have it working for the most part, but there is some latency since it is through a cloud service.

The main problem I am stuck on is steering while driving forward and backward.

```<code>    //#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int motorA ;
int motorB ;
int X=0;
int Y=0;
int Steer=0;
int maximo=0;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "b41ff7f1659b4badb694be4c59601c2c";

void setup()
{
  // Set console baud rate
  Serial.begin(9600);

 Blynk.begin(auth,"100Grand","Mob4life");

 pinMode(motorA, OUTPUT);
 pinMode(motorB, OUTPUT);
 pinMode(0,OUTPUT);
 pinMode(2,OUTPUT);
 pinMode(4,OUTPUT);
 pinMode(5,OUTPUT);

}

 BLYNK_WRITE(V1)
{
  int X1 = param[0].asInt();
  X=X1;
  int Y1 = param[1].asInt();
 Y=Y1;

}

 BLYNK_WRITE(V0)//      slider  de 100 a 255!!!!
{
 int vel = param.asInt();
 maximo=vel;
}

void loop()
{

  if(X == 128  &&  Y == 128)  //  Stop
  {
   motorA = 0;
   motorB = 0;
   analogWrite(5, motorA);
   analogWrite(4, motorA);
   analogWrite(0, motorB);
   analogWrite(2, motorB);
   }

   if(Y > 130 && X > 127 && X < 129)   //Forward
  {
    motorA = Y;
    motorB = Y;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA);
    digitalWrite(0,LOW);
    motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB);
    digitalWrite(2,HIGH);
  }

  else if(Y < 126 && X > 127 && X < 129)   //Reverse
  {
    motorA = Y;
    motorB = Y;

    motorA = map(motorA, 450,maximo,126, 0);
    analogWrite(5, motorA);
    digitalWrite(0,HIGH);
    motorB = map(motorA, 450,maximo,126, 0);//something is wrong with HIGH signal
    analogWrite(4, motorB);
    digitalWrite(2,LOW);
  }

   if(Y > 130 && X < 126)   //Steer Left
  {
    motorA = Y;
    motorB = Y;
    Steer = map(X, 450,maximo, 126,0);
     Steer = X / maximo;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA * (1 + Steer));
    digitalWrite(0,LOW);
   motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB * (1 - Steer));
    digitalWrite(2,HIGH);
  }

   if(Y > 130 && X > 130)   //Steer Right
  {
    motorA = Y;
    motorB = Y;
    Steer = map(X, 450,maximo, 126,0);
    Steer = X / maximo;

    motorA = map(motorA, 450,maximo,130, 255);
    analogWrite(5, motorA * (1 - Steer));
    digitalWrite(0,LOW);
    motorB = map(motorA, 450,maximo,130, 255);
    analogWrite(4, motorB * (1 + Steer));
    digitalWrite(2,HIGH);
  }

  Blynk.run();
}
</code>```

Any help would be appreciated. Thanks!`

答:
You named a question "Standard equation for steering differential drive robot", so instead of going deep into your code, I'll try to give you a simple example, how can you steer a differential drive robot.

Assumption: joystick steering - two input variables, throttle (forward speed) and steering. It would be easiest if they change from -255 (full revesre/left) to 255 (full ahead/right).

Here is a code that I wrote for motor controller based on DRV8833 drivers:

```<code>void runMotor(int channel, int _pwm) {
    // make sure PWM is within boundaries
    constr(_pwm, -255,255);
    if(channel <=4) {
        // spin the motors forward...
        if(_pwm >= 0) {
            //and write the PWM
            //in1Pin and in2Pin are arrays of pin numbers
            analogWrite(in1Pin[channel], 255 - _pwm);
            analogWrite(in2Pin[channel], 255);

        }
        // ...or backward
        else {
            analogWrite(in1Pin[channel], 255);
            analogWrite(in2Pin[channel], 255 + (_pwm));
        }
    }

}
void loop() {
    int throttle = getThrottle(); //get new throttle value
    int steering = getSteering(); //get new steering value

    /* here is the essential part:
    * if both values will be 0, the robot will stop
    * if throttle is positive, the robot will go forward, if negative - backward
    * if throttle is 0, but there is some steering, robot will turn in place
    int leftSpeed = throttle + steering;
    int rightSpeed = throttle - steering;

    runMotor(1, leftSpeed);
    runMotor(2, rightSpeed);
}
</code>```

You will need to adjust the code for your drivers, but the essentials are the same: for one motor you add steering to throttle, for the another you subtract. This should give you very nice control over your robot.

Body:
You named a question "Standard equation for steering differential drive robot", so instead of going deep into your code, I'll try to give you a simple example, how can you steer a differential drive robot.

Assumption: joystick steering - two input variables, throttle (forward speed) and steering. It would be easiest if they change from -255 (full revesre/left) to 255 (full ahead/right).

Here is a code that I wrote for motor controller based on DRV8833 drivers:

void runMotor(int channel, int _pwm) {
    // make sure PWM is within boundaries
    constr(_pwm, -255,255);
    if(channel <=4) {
        // spin the motors forward...
        if(_pwm >= 0) {
            //and write the PWM
            //in1Pin and in2Pin are arrays of pin numbers
            analogWrite(in1Pin[channel], 255 - _pwm);
            analogWrite(in2Pin[channel], 255);

        }
        // ...or backward
        else {
            analogWrite(in1Pin[channel], 255);
            analogWrite(in2Pin[channel], 255 + (_pwm));
        }
    }

}
void loop() {
    int throttle = getThrottle(); //get new throttle value
    int steering = getSteering(); //get new steering value

    /* here is the essential part:
    * if both values will be 0, the robot will stop
    * if throttle is positive, the robot will go forward, if negative - backward
    * if throttle is 0, but there is some steering, robot will turn in place
    int leftSpeed = throttle + steering;
    int rightSpeed = throttle - steering;

    runMotor(1, leftSpeed);
    runMotor(2, rightSpeed);
}

You will need to adjust the code for your drivers, but the essentials are the same: for one motor you add steering to throttle, for the another you subtract. This should give you very nice control over your robot.


问:
What is a CIM motor?
I'm trying to make decisions for motors on a robot build. I keep running across CIM Motors. What is a CIM Motor? Where does the designation CIM come from? What does CIM mean?</p>

答:
CCL Industrial Motors according to this thread. So CIM is an acronym for the manufacturer of one of the motors the FIRST guys use. The term seems to have been generalized in that community to mean a big powerful motor in their context. Outside of FIRST/VEX the acronym has no meaning. </p>

<p>It's a DC motor and from the datasheet it looks like it can output around 300W. </p>

Title: What is a CIM motor?

Body:
CCL Industrial Motors according to this thread. So CIM is an acronym for the manufacturer of one of the motors the FIRST guys use. The term seems to have been generalized in that community to mean a big powerful motor in their context. Outside of FIRST/VEX the acronym has no meaning.

It's a DC motor and from the datasheet it looks like it can output around 300W.