问:
How to use RL (Robotics Library) with Xcode?
I came across RL to program robotic manipulators. But according to the website, currently supported websites are Ubuntu and Windows only. Since Ubuntu and Mac OS are based on UNIX kernel, is it possible to deploy RL on MacOS Xcode?

Link : http://www.roboticslibrary.org

Thank you.

答:
The RL is an open source project, therefore you have access to the source code. The sour code may have references to operating system specific functions and libraries, but offering compatibilitz to linux and windows is a good sign.

I recommend that you download the sourcecode and try to integrate it to a simple XCode project as c++ source code (assuming RL is C++). If it shows a few errors you can try to solve them one by one. If there are too many you should look for a guidance on porting or migrating source code from Win/Linux to XCode.

You can probably get good help on this on StackOverflow. e.g. start here or here.


问:
Robot detection in motion
In the environment, I have two robots and a couple of fixed obstacles. In order to detect obstacles I am using ultrasonic sensors. For robots, they need to detect each other and from which side other robot is coming (front, left, right or back), and do this during the motion. For this purpose, I cannot use PIR sensors, because robots are constantly moving. Also, I need to differentiate between moving robots and stationary obstacles, so ultrasonic sensors are also not helpful.

So I came up with idea to somehow mark the robots with some property unique to environment, so when we detect object with that property, we know that it is a robot, and not another obstacle. One of ideas might be to put lasers on one robot, and on other robot put four laser sensors, one for each side, so we precisely can say from which side the other robot came from. Another option might be to use IR transmitters on one robot and four IR receivers on other robot? What do you suggest, is there any other type of sensors that might help?

答:
First: You have said that robot do not communicate with each other. But can they communicate with a third party (not necessarily a robot). Then you can mark your robots - objects with some kind of code (Like QR) and put a camera (Observer) on top of the environment. Then send the message to each robot about their relative position to each other. (Since there is only one way communication: Master -> Slave this will be a simpler network then creating a network between all robots.)

If they can not communicate in high level at all, lets think about all the mediums and signals that can deliver some data and from your description this data should indicate the ID of robot, not just identify it as robot.

There is light as you have guessed. Other then what you have suggested already (IR sensors) you can put camera on each of them and mark objects and robots (with their different sides) but both material and computation is costly. There are various ways to do it and a lot of challenges you need to face. Even with IR sensors you need to make sure data from different source will not mix (may be use time dividing).

There is sound: Sound Localization : You can combination of Frequency Modulation and Sound Localization. If all robots (and object can too but may seem unreasonable) continuously produce a sound in a unique frequency. Then each robot will get two (or more) microphones. You can use Time-to-Frequency Domain transformations (like fourier) to filter unrelated sounds and identify different sources and their stregths. Then use differential signal strength or phase from all microphones to approximately locate direction and distance of other robots. It is mechanically simple, requires some computation (FT is not that costly). You may even find-design digital circuit to process the signals instead of programming.

There is electromagnetic waves: Many RF devices provide information on signal strength from unique sources, and there are really cheap RF modules in market. It will not give you idea about direction but only distance. And since the electromagnetic waves travel way more faster then sound, it is really hard to differentiate difference between signals (you need very accurate hardware) so we can not use a technique easily like sound localization.

Of course there must be more ways but right now these are all i can think of on top of my head.

ContentLicense: CC BY-SA 3.0

Title: Robot detection in motion


问:
How to calculate what wind speed is required to lift 1kg?
as the title says, i want to calculate how much km/h is required to lift 1kg of weight.
Please explain this to me as simple as you can since i'm really noob in this.
Thanks.</p>

答:
That is a very difficult question and as far as I know it is nearly impossible to answer in that way. You need to define the "sail" you use further. Read this and specify your problem further.

Perhaps this is enugh for you:

Energy of moving air

$E = \frac{1}{2} \cdot \rho \cdot A \cdot v_{wind}^3 \cdot t$

where:

E - Energy

$\rho$ - Density of air

A - Area of the sail

v - velocity of the wind

t - time

Energy of lifted weight

$ E = m \cdot g \cdot h(t) = m \cdot g \cdot v_{lifitng} \cdot t $

where:

m - mass of the object

g - 9.81 m/s^2

h(t) - height at time t

Assuming that you have a system which can convert the wind energy in a perfect way to potential energy, than you can at least calculate some boundary values. If you want your question answered, specify the geometry of the sail, wind angle etc. further.


问:
Programming Inverse Kinematics in C++
I want to write my own kinematics library for my project in C++. I do understand that there are a handful of libraries like RL (Robotics Library) and ROS with inverse kinematics solvers. But for my dismay, these libraries DO NOT support MacOS platform. I have already written the Forward Kinematics part, which was quite straight forward. But for the Inverse Kinematics part, I am quite skeptical since the solution to a IK problem involves solving sets of non-linear simultaneous equation. I found out the Eigen/Unsupported 3.3 module has a APIs to non-linear equations. But before I begin on this uncertain path, I want to get some insight from you guys on the plausibility and practicality of writing my IK library. My manipulator design is rather simple with 4 DoF and the library will not be used for other designs of manipulators. So what I am trying to achieve is taylor-made IK library for my particular manipulator design than a rather a 'Universal' library.

So,

Am I simply trying to reinvent the wheel here by not exploring the already available libraries? If yes, please suggest examples of IK libraries for MacOS platform.

Has anyone written their own IK library? Is it a practical solution? Or is it rather complex problem which is not worth solving for a particular manipulator design?

Or should I just migrate all my project code (OpenCV) to a Linux environment and develop the code for IK in Linux using existing libraries?

答:
It is rather straightforward to implement inverse kinematics for a particular manipulator in C++.   Of course, you need to begin with the inverse kinematic equations themselves.   Putting those into code will only involve a few trigonometric functions such as acos, asin, and atan2 (use atan2 instead of atan), and probably a couple of square and square root terms.  </p>

<p>You will learn a lot by doing this.  </p>

Title: Programming Inverse Kinematics in C++

Body:
It is rather straightforward to implement inverse kinematics for a particular manipulator in C++.   Of course, you need to begin with the inverse kinematic equations themselves.   Putting those into code will only involve a few trigonometric functions such as acos, asin, and atan2 (use atan2 instead of atan), and probably a couple of square and square root terms.

You will learn a lot by doing this.


问:
Why are industrial machines called robots?
The definition of a robot is as follow: "A robotic paradigm can be described by the relationship between the three primitives of robotics: Sense, Plan, and Act."

An example could be the famous "Kuka Robots". The Kuka robot is preprogrammed and does mainly one loop over and over again. Some of them could have measurement sensors but that is all. They do not think or plan nor do they make decisions.

An automatic door opener, used in a building is not a robot either but according to the robotic paradigm definition they are more a robot than a Kuka machine. They actually get some data from a sensor followed by planning and acting.

So why are Kuka machines called robots?

答:
The definition of robot is as follows:

"A machine built to carry out some complex task or group of tasks, especially one which can be programmed"

wiktionary

So a robot is a tool which can be programmed. The KUKA robot fits in this definition. But a hammer can not be programmed, so a hammer is not a robot.


答:
I agree with SteveO that there is nothing wrong with reinventing the wheel if you want to learn about wheels.  And for a single application, 4 DoF arm, the IK is probably not too hard.

But I feel like I should mention that most of the kinematics libraries out there are mostly targeted towards Linux.  And as such, probably not too hard to compile from source for MacOS.

Here are some common libraries:

Robotics Toolkit - Matlab, so will work in Mac out of the box.

Orocos - C++, supports Mac OSX

OpenRave - C++ and Python.  Binaries for Linux and Windows, but there are instructions for compiling for Mac OSX.

ROS MoveIt! - This might be most difficult to install on a Mac.  It looks like ROS Jade has more complete instructions for building for Mac than ROS Kinetic.

Title: Programming Inverse Kinematics in C++

Body:
I want to write my own kinematics library for my project in C++. I do understand that there are a handful of libraries like RL (Robotics Library) and ROS with inverse kinematics solvers. But for my dismay, these libraries DO NOT support MacOS platform. I have already written the Forward Kinematics part, which was quite straight forward. But for the Inverse Kinematics part, I am quite skeptical since the solution to a IK problem involves solving sets of non-linear simultaneous equation. I found out the Eigen/Unsupported 3.3 module has a APIs to non-linear equations. But before I begin on this uncertain path, I want to get some insight from you guys on the plausibility and practicality of writing my IK library. My manipulator design is rather simple with 4 DoF and the library will not be used for other designs of manipulators. So what I am trying to achieve is taylor-made IK library for my particular manipulator design than a rather a 'Universal' library.

So,

Am I simply trying to reinvent the wheel here by not exploring the already available libraries? If yes, please suggest examples of IK libraries for MacOS platform.

Has anyone written their own IK library? Is it a practical solution? Or is it rather complex problem which is not worth solving for a particular manipulator design?

Or should I just migrate all my project code (OpenCV) to a Linux environment and develop the code for IK in Linux using existing libraries?


问:
Prediction of Ready to Use Robotic Control Cards Codes
Suppose you have a control card. We do not have access to the control card's code and we do not know which control algorithm is used (PID, PD, PI, Fuzzy, ...). We can only measure the control inputs we apply and the output signals the card generates. For examples a quadrotor card, inputs are yaw, pitch roller and throttle and the outputs are propeller pwm signals. Can we predict the algorithm and coefficients/properties used? Is there such a method or study? There are many ready to use control cards, we can imitate or improve for robot control. I think it is important to develop a method for extraction/prediction of algorithm on control board. Thank you for your help and your views.</p>

答:
What you are trying to do is to identify a system. Since you kind of know what to expect, your system is not black box, it is grey box or white box.

There is a lot of theory on how to identify these systems. The field itself is called System Identification and you can find a lot of books and publications for all kinds of systems (blackbox, greybox, whitebox etc.)


问:
Arduino output SPWM using Matlab
I have Arduino and Matlab which has hardware support package for Arduino.
I want to create SPWM signal (sinusoidal pulse width modulation) to be the output of the Arduino board.
I could generate the signal required in Matlab using this code

```<code>function spwm = SinWave(frequency)
nsamples = 1250 * frequency;
t = linspace(0,1,nsamples);
sn = sin(2*pi*frequency*t);
st = sawtooth(2*pi*frequency*10*t);
spwm = abs(sn) > abs(st);
plot(t, sn);
hold on;
plot(t, st);
plot(t,spwm);
axis([0,1,-1.2,1.2]);
</code>```

Now SPWM has the samples for the signal, I tried sending it on pin 13 using the following function

```<code>function writeSPWM(arduino, spwm)
for k=1:length(spwm)
    writeDigitalPin(arduino, 'D13' ,spwm(k))
end
</code>```

Then I used the following two lines in command window

```<code>a = arduino()
writeSPWM(a, SinWave(5))
</code>```

I getting my signal shape with very low frequency(it is really much bigger)
Is there a better way to achieve my goal? using Matlab is necessary but I have no problem if I have to combine coding throw Matlab and Arduino C.

答:
It seems that all the code you wrote is in Matlab, and at each cycle it should communicate via the USB port with arduino to turn the pin on or off. This take a lot of time.

The fastest solution would be to write the whole algorithm as an Arduino sketch, and only get the current desired frequency via the Serial (USB) connection from Matlab. Matlab would set the desired frequency, send it via serial to the arduino. From there the latency of the USB (Serial) connection would not intervene.

When you do the Arduino programming, make sure to use the PWM pins in PWM mode and not as a simple digital output turned on or off.

EDIT:

Here is a PWM tutorial for the arduino.

for SPWM the duty cycle has to be changed frequently. You will not be able to change it for each cycle, but maybe for every 10 cycles. It will be still ok.

You could start by calculating a sinus on the arduino using an interrupt that is set for maybe every 2 milliseconds. That interrupt should increment your time variable (make sure that it does not overflow, or it overlfows in a controlled manner and make sure to use some sort of scaling to get seconds).

This will be the t from the sinus time signal equation:
$SPWM(t) = A\sin (\omega t + \phi)$

A (amplitude) I think in this case is irrelevant. probably the phase shift ($\phi$) is also irrelevant. $\omega$ you can calculate form your frequency.

$\omega = 2 \pi f$, where $f$ is the frequency.
You set to constant value at first, afterwards you make function that gets it form the serial port form Matlab (make sure NOT to include this in the interrupt, because it is slow)

At the end of the interrupt you update the PWM duty cycle basted on the SPWM(t) value the interrupt calculated.

I am sure there are many other approaches, but for me this seems the simplest one which delivers acceptable performance. Also, please make sure that the cycle time of the interrupt is longer than the runtime of the code in the interrupt.

Title: Arduino output SPWM using Matlab


答:
I did several implementations of IK with different setups (up to 8-DOF)
Of course you can just sit down and write the algorithms on your own. (Assuming you know what are you doing) For this approach I suggest using the Eigenlib and some basic maths.
Anywas the more elegant approach ( from my point of view) is using matlab: implement the algorithm as you like and let matlab generate the code for you. The matlab code generation feature is pretty nice tool and its reliable (haven't found any errors in the generated code so far). After you have this generated code write any wrapper for any os you like.
These are just my two cents</p>

Title: Programming Inverse Kinematics in C++


问:
Cheapest GPS that is accurate to ca. 30cm in woodland
As part of my PhD field work it would be useful to have latitude/longitude measurements for the locations of ant nests that I am working on. These ant nests can be as close as 50cm together so the accuracy of the system would (I think) need to be higher than is available from a phone or basic GPS system. Does anyone know what system would be best for getting this sort of accuracy? My budget is probably only around £200. If it isn't possible in that price range it would be good to know what system I would need to use so that I can see if I can just borrow such a system.

Thanks a lot!

答:
I suggest you are going to look into Chen at al 2015
"Computationally efficient carrier integer ambiguity resolution in multiepoch gps/ins: a common-position-shift approach"
This is a very good paper, which allows location down to a centimeter level.
Anyway this approach is not plug and play, I fear you have to implement it on your own.
I'm not aware of any open source implementation so far.
More over if you are trying to locate the ants within a forest, then gps is a not the best approach. Gps uses some wavelengths which are absorbed easily by water and well the trees do contain at lot of water. Long story told short: gps in the forest will never be as accurate as you need.

I know this is not the answer you expected, hope it can help a bit


问:
Why do space probes need heating?
I know that temperature influences the characteristics of semiconductors and other materials, but we know how and can take that into account. Furthermore, lower temperatures makes electronics more efficient, sometimes even superconducting.

I remember reading somewhere that engineers building Curiosity even considered low temperature electronics for the motors driving the wheels but still decided against it in the end.

Why is it, apparently, so hard to build components with operating temperatures matching those on Mars, Europa, or in space?

Edit: None of the answers address my question thus far. I know that all parts, both electronic and mechanical, and greases and so on have relatively narrow working temperatures. My question is, why don't we build special cold metals and cold greases and cold chips that have their narrow operating temperature band at -100 C or whatever?

Valid answers could be: it's too expensive, insufficient science has been done to determine materials appropriate for such cold, such cold materials cannot be manufactured in the sweltering heat of planet Earth.

答:
I would suggest that the key reason is reliability - once a probe has been launched into space, it HAS to work.

As such, it is a lot safer to heat up a known, reliable, material that has been subject to extensive testing, than it is to "invent" a new material that cannot be fully tested on Earth.

Title: Why do space probes need heating?


问:
How can I apply different control approach without having a state space model?
Recently i am working on a hydraulic control system of a vehicle. But in this system I don't have any mathematical modeling of the system so i am not able to get any state space model for the given system. I have to control the length of Piston in Hydraulic Cylinder by giving input of desired piston position. Modeling of this system is established in Matlab/Simulink using physical modeling tools SimScape Toolbox and simFluids. As one approach i had already try to apply a feedback with P-control as show in the figure Matlab System  and also the gain of P control is derived by trial and error.

Now if i want to apply state obeserver or optimal Control than how can i apply on this given system.

And is necessary to derive mathematical model of this system to desing controller?

Thank You.

答:
There are different approaches to your issue.
First and most likely easiest one is the approach suggested by 50k4.
With a simplfied model you can tune some basic controller like PID.
But there are tons of nice Design approaches, which can work totally without the model.
Those controllers are usually grouped under the name "soft controllers"
Some key words are Fuzzy, genetic algorithm or neural network....

Basically for every controling process you need some knowledge; in most cases you just take the mathematical description of the system.
For those soft controlling approaches you take your own expert knowledge of the system... sounds a bit strange but it can work out pretty nicely.

At the end you are able to control systems where it is impossible to get a mathematical system description


问:
NAO applications using ROS
I want to develop an application for NAO robot using ROS (I already started to use ROS with NAO). But I don't know how to choose a scenario for my robot depending on ROS packages (SLAM, objects recognition...).

My question is: is there any ROS packages for NAO applications that i can started with (turtlebot robot for example has the navigation stacks -SLAM- in ROS).

Can anyone help me please??

答:
There are quite a few NAO related packages available for ROS. One of them is a Kinect based teleoperation package: which may not have been updated recently.

http://wiki.ros.org/nao/Tutorials/Using%20Kinect%20to%20Teleoperate%20Nao%20without%20cross-compiling%20%28electric%20on%20NaoQi%201.12%29

But on the bigger scheme of things, perhaps you can try setting up MoveIt! for NAO, and subsequently use it for motion planning on the arms.

https://github.com/ros-naoqi/nao_moveit_config/blob/master/tuto/tuto_moveit.rst

There is also a NAO path follower stack at http://wiki.ros.org/nao_path_follower

Title: NAO applications using ROS


问:
When should FPGAs be used in Robotics?
FPGA has good points such as a lot of IO points but then again you need to think things on very low level with flip-flops and pioneer on areas where things are not yet mature -- for example see this question here about development-tools on FPGAs -- this is my understanding currently! Now FPGA has been used to create excellent dexterity in robotic hands like here. Now some people market FPGA for fast prototyping and "forward looking" designs like here, I don't fully understand them: if you don't need a lot of IO points for things such as sensors, why to choose FPGA for a robot? So

When should FPGA be chosen for a project in robotics?

答:
I'm not sure what in the linked question about development tools makes you think that they are not mature. It is true that most of them are proprietary and not open source. But I thought that the tools were quite mature even back when that question was asked three years ago. Today Xilinx, Altera, and Lattice all have freely available development environments that run on Windows and Linux with 32 and 64-bit support. If you insist on open source Icarus Verilog can do quite a bit. But I'd personally stick with the vendor specific tools.

FPGA's are more than just a bunch of configurable flip flops. Consider the Altera NIOS II. A 32-bit soft-core processor capable of running Linux. Mix and match communications and other peripherals from OpenCores or from Xilinx, Altera, or Lattice and you've built a custom microcontroller with everything you need and nothing you don't. You can even write C code for the NIOS II processor and have certain functions implemented directly in the FPGA hardware if you need the speed. Is that high level enough thinking for you?

FPGA's have a high initial investment cost. But it's cheaper and easier to add functionality later in the design process. That's what's meant by "forward looking" designs. Consider a project where you want to add some additional motors to your robot but you've run out of PWM generators on your microcontroller. What do you do? Add another microcontroller? Buy separate PWM chips and connect them to a communications interface? What if all your communications interfaces are in use? With an FPGA, this is reduced almost entirely to a copy and paste operation. It's a lot easier, cheaper, and quicker to scale a design to include new functionality without buying as much additional hardware with an FPGA.

But probably the biggest reason to use an FPGA is speed. I'm not talking about pure clock speed. But when you need a lot of things to happen simultaneously. As Gossamer mentioned, parallelism is what FPGA's are really good at. Filter designs especially benefit from this kind of parallel architecture. If you need to filter and respond to a rapidly changing sensor, then you need an FPGA. They are also quite good at video processing as this too benefits from parallel processing.

Take for instance this high-speed hand robot. It needs to process the video from the high-speed (1000 frames per second) machine vision camera as well as the tactile sensors and respond by manipulating numerous actuators in only a few milliseconds. This type of project is when you need to choose FPGAs.

Title: When should FPGAs be used in Robotics?


问:
iRobot Create 2 to Vacuum (2)?
Does the Create 2 have firmware support (navigation, brush & fan control, ...) to support the vacuum functionality?

Can I use parts from my 655 or 805 Roomba to convert the Create 2 back to a vacuum?

答: Yes and yes.  The Create2 has the same firmware as any other 600 series Roomba.  There is nothing preventing you from replacing the missing components to have a functional vacuum. </p>

Title: iRobot Create 2 to Vacuum (2)?


问:
SLAM without data association?
I would like to build 2D EKF-SLAM in openGL. I've implemented the entire virtual environment in which there is a robot that moves in 2D and there are some landmarks(feature-based map). I have the motion and observation models. Also, I've implemented the sensors with Gaussian noise. Now, I would like to use MRPT to build SLAM. At this point, I don't want to use data association that is the robot moves and detects its pose and landmarks and discard the previous data which means I only concern with the current state vector. My question is Is it possible to build SLAM without data association? Please suggest me some articles so that I can enrich my background about only this issue. </p>

答: If you build a robot in simulator only, then the data association is not a problem. The true landmarks would the robot see at time $t$ can be given by hand. But if you equip a small vehicle with a laser scanner or depth camera and willing to run a real SLAM job, then data association is a really big problem you have to solve, especially for a grid-based map. By the way, it seems that you can implement a landmark based SLAM by SURF feature, but in fact, it requires a lot of computing resources - especially for EKF SLAM and it can make your job fail.</p>

Title: SLAM without data association?


答: Use a Lidar system and then elaborate the data using a point cloud libray( i've never done this but i just want to tell you that it's a possible solution)</p>

Title: Robot detection in motion

Body:
In the environment, I have two robots and a couple of fixed obstacles. In order to detect obstacles I am using ultrasonic sensors. For robots, they need to detect each other and from which side other robot is coming (front, left, right or back), and do this during the motion. For this purpose, I cannot use PIR sensors, because robots are constantly moving. Also, I need to differentiate between moving robots and stationary obstacles, so ultrasonic sensors are also not helpful.

So I came up with idea to somehow mark the robots with some property unique to environment, so when we detect object with that property, we know that it is a robot, and not another obstacle. One of ideas might be to put lasers on one robot, and on other robot put four laser sensors, one for each side, so we precisely can say from which side the other robot came from. Another option might be to use IR transmitters on one robot and four IR receivers on other robot? What do you suggest, is there any other type of sensors that might help?


问:
How can I turn a bowl/glass upside down?
I want to dispense water/cut-vegetables from a glass/bowl(240 ml) by turning it upside down. The screencast shows the idea:

I can directly mount the clamp on a servo motor, but I think that will be a lot put a lot of downward force on the shaft. What will be a good mechanical arrangement to do this? Thanks!

Ref:

Servo MG996R with Metal Gears

Cup:

答:
Here's an idea

Explanation

Instead of the servo bearing the weight, there is an axis through the bowl that the servo is attached to. This takes all of the strain off of the servo. The servo arm is attached to the bowl and rotates the bowl on the shaft through the bowl.


问:
Inverse kinematics for a four-legged robot
I want to make a 4 legged robot like spider or dog, but I don't know how I can use kinematics to make it walk and run. I didn't find any resource to know how these types of robots walk and run by balancing their center of gravity balanced in each step and how they move their legs to move any direction. Right now I am trying to make a robot in gazebo simulation and test its working, only then I'll go for real hardware.</p>

答:
You do not (only) need inverse kinematics. Inverse kinematics can give you e.g. the angles in your leg joints for a particular leg position, however it does not define a gait type.

For 4 legged robots there are many possible gait types you can implement. You have static gait types where the projection center of gravity is always inside your support triangle and you only lift 1 leg up at at time, or you can have dynamic gait types which is the opposite (CoG not in support triangle, not only 1 leg lifted)

Simpler are the static gait types. For static gait types you have periodic, where you do the same steps over and over again or non-periodic, where leg placement is dependent e.g on ground conditions. Also here, obviously the periodic gait type is the simpler.

You can find an example and implementation of a static periodic gait type for a quadruped robot here. Also here you can find an interesting approach implemented in Excel.


问:
Autonomous boat obstacle avoidance
I am currently considering joining the MicroTransat challenge and develop an autonomous boat able to survive the harsh Ocean environment.
However, as for security and to ensure the boat doesn't sink due to collisions, I am looking for possible ways to implement a basic obstacle avoidance system.
The prototype will harvest power from solar panels (and maybe a Stirling engine) and will run a Raspberry Pi as route planner.

Up to now I have come up with the following:

AIS receiver: can be useful to track ships above 300t and simple receivers don't use too much power;

Hydrophones array: may sense boat engines and the sound origin, very unreliable as a system;

Lidar/ultrasonic rangefinder: not suitable for marine environment;

Computer vision: difficult to implement but highly reliable, I guess sea waves will be a issue.

Ideally, the boat should keep away from other boats, floating objects and rocks, yet just ship avoidance would be very helpful.

Which one(s) do you believe can be included to offer a basic obstacle avoidance ability?

答:
Have you considered forward-looking active sonar ?

Perhaps using off-the-shelf fishfinder hardware?

My understanding is that active sonar sensitive enough to detect (relatively soft) fish a hundred feet away can detect icebergs,  large boats, rocks, shoreline, etc. over a mile away, because they are harder and so more reflective to the sonar.
(My understanding is that the first successful acoustic echo ranging device was specifically created for obstacle detection -- to detect icebergs in response to the RMS Titanic disaster of 1912).

Title: Autonomous boat obstacle avoidance


问:
Is it better to use software or hardware for object sorting?
For a sorting machine where the objects to be sorted have various sizes, color, shapes, and patterns, is it more optimal (in terms of minimal time of the overall process and maximal precision and accuracy) to use a sorting algorithm or to use different dimensions in the physical design to do the sorting?</p>

答:
It really depends on the objects you are sorting, and the flexibility you're looking for as the system is maintained over the years.

Using physical methods to sort is very reliable.  Many times you can align the parts, such as by using curves, chutes, vibration, and parts feeding mechanisms.   Look up vibratory bowl feeders and cap feeders for examples.   You can sometimes pre-sort a large collection of different products into smaller groups of products, too, and the solution for one group may be different from the solution for the other groups.  If you can properly orient and align the objects, it may be simpler to use physical sorting methods than trying to identify the different parts using software.   But this isn't a black-and-white statement.   For instance, if one of your parts is always higher than the rest of the parts, a simple through-beam sensor located higher than all but the tallest product, tied to an ejecting cylinder is quite straightforward to implement.   In this case, there is both software and hardware involved.   However, as the product mix changes over time, you may have to redesign the hardware sorting mechanisms to accomodate those changes.   This redesign can sometimes be quite difficult.

If you want the most flexibility (as in the case where the parts you are sorting may change over time), then a vision-guided system offers this.   However, even these systems will benefit by first controlling the fed parts before they encounter the vision system.   This is especially true if the objects have different visual characteristics when viewed from one side as compared to being viewed from another side.  You can use speed changes of conveyors to guarantee spacing between parts to facilitate the vision processing, plus other parts feeding techniques that reduce the area in which your vision system must operate.  So again, it is a combination of mechanical and software means.

The software-guided sorting usually takes longer to set up and train, and you'll have to deal with things like color variations, structured lighting, and possibly speed issues.   But it offers greater flexibility as requirements change.   Many robotics manufacturers offer very powerful vision-based add-ons (Fanuc is one), which help shorten the vision-to-robot integration time.

Therefore "it depends."


问:
which is best IMU for Quad-Copter
Actually i am trying to write my own Flight Controller for Quad-Copter that is controlled by Remote over radio signals.So for a flight controller i have to buy a inertial measurement unit(IMU).So problem is that i visit a two different sites both selling a MPU6050 Triple Axis Accelerometer and Gyro.But both sites name it same but it's look different IMU unit that one is buying from hallroad.org.and that one is .is that same IMU or different if they are different what is difference b/w them?Which is best for Quad-Copter Flight-Controller?

答: Both products are based on the same chip - MPU6050. I won't be surprised if passive components used in both modules will be the same too. That means, that from performance side, there will be probably no visible difference. The only thing that differs those two is their interfaces - the red one has two additional pins. Check what they do, and think if you need them.</p>

Title: which is best IMU for Quad-Copter


问:
Equation to limit rate of change of end-effector in X and Y coordinates
Some vector math is involved here so prepare yourself.

I am developing a robotic arm that moves in two dimensions.  It is a rotary-rotary design which looks roughly like the picture in this post:
Building Robotic arm joint

I am now trying to limit the speed of the end-effector.  I am using Simulink and believe that the best way to limit the speed is the limit the rate of change of the X and Y coordinates that I tell it to move to.

Now, I also want the end-effector to be able to move in a straight line and believe that I can accomplish this by defining functions that calculate the maximum rate for movement in the X or Y direction based on the distance the arm is trying to travel.  The equasion I came up with is this :

```<code>xRate = (abs(currentX - nextX) / max(abs(currentX - nextX), abs(currentY - nextY))
yRate = (abs(currentY - nextY) / max(abs(currentX - nextX), abs(currentY - nextY))
</code>```

So basically, XRate: distance in x / max between distance in X and distance in Y.

Now, for the actual problem.  Because this limits the speed in both X and Y, the end-effector can travel (for instance) 1 in./sec in both directions at the same time.  Meaning that it is travelling at OVER 1 in./sec overall.  If, however, it is only moving in ONE direction then it will only move at that 1 in./sec speed because there is no second component.  It boils down to the fact that the max speed the arm can move is 'sqrt(2)' and the minimum is '1'.

My main question is:  Given that I need to calculate a max xRate and a max yRate, how can I limit the overall speed of the end-effector?

Secondarily, is there a way for me to implement a rate control that will limit the overall rate instead of limiting X and Y independantly using Simulink?

答:
Rather than trying to limit the 'x' and 'y' velocities separately, you should be limiting the overall velocity and calculating the component velocities from that overall velocity. In other words, something like:

```<code>dx = currentX - nextX
dy = currentY - nextY
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 )
xRate = dx * rate
yRate = dy * rate
</code>```

So for moving only in X:

```<code>dx = currentX - nextX                              = 1
dy = currentY - nextY                              = 0
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate
xRate = 1 * rate                                   = maxRate
yRate = 0 * rate                                   = 0
</code>```

While moving only in Y:

```<code>dx = currentX - nextX                              = 0
dy = currentY - nextY                              = 1
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate
xRate = 0 * rate                                   = 0
yRate = 1 * rate                                   = maxRate
</code>```

And for the diagonal movement you suggested:

```<code>dx = currentX - nextX                              = 1
dy = currentY - nextY                              = 1
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate / sqrt(2)
xRate = dx * rate                                  = maxRate / sqrt(2)
yRate = dy * rate                                  = maxRate / sqrt(2)
</code>```

Body:
Rather than trying to limit the 'x' and 'y' velocities separately, you should be limiting the overall velocity and calculating the component velocities from that overall velocity. In other words, something like:

dx = currentX - nextX
dy = currentY - nextY
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 )
xRate = dx * rate
yRate = dy * rate

So for moving only in X:

dx = currentX - nextX                              = 1
dy = currentY - nextY                              = 0
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate
xRate = 1 * rate                                   = maxRate
yRate = 0 * rate                                   = 0

While moving only in Y:

dx = currentX - nextX                              = 0
dy = currentY - nextY                              = 1
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate
xRate = 0 * rate                                   = 0
yRate = 1 * rate                                   = maxRate

And for the diagonal movement you suggested:

dx = currentX - nextX                              = 1
dy = currentY - nextY                              = 1
rate = min (maxRate, maxRate / sqrt( dx^2 + dy^2 ) = maxRate / sqrt(2)
xRate = dx * rate                                  = maxRate / sqrt(2)
yRate = dy * rate                                  = maxRate / sqrt(2)


问:
Question about EKF covariance equations
I am trying to perform uncertainty aware planning, where my planner tries to connect start and goal in such a way that the resultant path provides the least covariance at the end. This is inspired by techniques such as LQG.

The way I 'estimate' what covariance would result from a certain path is by using the EKF equations while assuming maximum likelihood observations, and I am trying to test what's called the 'light-dark' scenario that was used in many papers: where a 2D robot is traversing the environment, and there's a specific region where it would receive measurements that would reduce the covariance greatly. Hence, the uncertainty aware planner tries to take the robot to this 'light' area, receive good measurements, and then proceed to the goal. As seen in this picture from [1], the final covariance drops significantly by using this modified path, than the shortest path from start to goal (ignore the red line).

https://i.stack.imgur.com/dPYDC.jpg

I am trying to replicate similar behavior with my planner, which does result in covariance reduction compared to some other path that doesn't visit the good area, but the reduction isn't significant at all. In my sample environment, which is a 20x20 grid, the X coordinate of 17 represents the 'light' area, so I express the environmental noise as a matrix which is written as
$\begin{bmatrix} x-17+0.01 && 0 \\ 0 && x-17+0.01 \end{bmatrix}$,

, hence would get a (0.01,0.01) matrix whenever I'm precisely at the x=17 column in the grid. Problem is, my result looks something like this, with the covariance ellipses plotted in red (the span of which I obtain from the Eigen values of the matrix).

Although the robot does visit the good area thanks to the planner, my covariance still increases rapidly once I leave: so I'm guessing I am making a mistake in my EKF equations. This is how I am 'simulating' the covariance at coordinates x2, when stepping from x1 to x2 with P1 being the covariance at x1 (adapted from equations in some open source code).

```<code>function P2 = predictCovariance(P1, x1, x2)
H = eye(2);
u = x2-x1;

G = [u(1) 0 ; 0 u(2)];
Q = eye(2);
R = eye(2);
M = [(x2(1)-17 + 0.01) 0 ; 0 (x2(1)-17 + 0.01)];
P = P1 + G*Q*G';
S = H*P*H' + M*R*M';
K = (P*H')/S;
P2 = (eye(2)-K*H)*P;
end
</code>```

[1] Van Den Berg, Jur, Sachin Patil, and Ron Alterovitz. "Motion planning under uncertainty using iterative local optimization in belief space." The International Journal of Robotics Research 31.11 (2012): 1263-1278.

答:
There seem to be several problems with the EKF equations in the code snippet: which I've come across before as part of an LQG related code available online. I am by no means an authoritative reference on filtering equations, but this is out of my own experience working in belief space and the 'light-dark' scenario.

That's not how the $G$ matrix works in the prediction equation. $G$ is the process noise Jacobian. $G$ could literally just be an identity matrix, with the predicted covariance equation reading

$ \bar{P} = A*P_{prev}*A^T + Q $

where $Q$ is the process noise covariance matrix.

Exactly similar to point 1: the $M$ matrix does not represent what you've coded it to: it's the measurement noise Jacobian. The measurements are encoded in the $H$ matrix, which is the measurement Jacobian: hence, how far you are from your 'light' area needs to be represented in the $H$ matrix, not the noise matrices. Hence $M$ can be set to $I$, and $R$ can be any Gaussian noise you choose.

Once you fix these problems and obtain right values for $H$, $\bar{P}$ and $S$, rest of the equations should be fairly straightforward, and are correctly written in the code.

Title: Question about EKF covariance equations


问:
Inverse kinematics Calculation for 3dof robotic arm
I am doing a project, to draw images provided using robotic arm. Initially edge detection is done on image to be drawn and coordinate value is obtained as (x,y).
How to calculate 3 joint angles inverse kinematics from this value.

答:
The manipulator in the figure seems like an planar manipulator with 3 degrees of freedom (DoF). However, from the description it seems that you only have 2 coordinates as reference coordinates. As the 3 DoF of the manipulator suggests, you would need 3.

The simplets is just to set the third one to zero, and solve the IK for (x, y, 0). You can come up with better approaches. If you want to draw something you might have a felt tipped pen where the orientation does not matter or if you have a pen, it might matter. In this case you can derive a way to make sure that the orientation matches the heading direction (you can take the next (x,y) sample to calculate the orientation)

You can find a detailed example of how to calculate joint angles for a RRR planar manipulator here or here


问:
Standard Deviation from one axis to another axis
I have radar mounted on a car.  For each detection, the radar returns these variables.

relative distance between the object/host vehicle in forward direction

standard deviation of the relative forward distance

relative distance between the object/host vehicle in left/right direction

standard deviation of the relative left/right distance

I'm trying to do coordinate transform of the above data, so that I get relative distance/standard deviation in global coordinates (North, South, East, West)
Distance is easy since it only requires to rotate the axis by the amount of angle between the vehicle body-fixed axis and the global axis.

How about standard deviation?  How do I transform the standard deviation from the vehicle body-fixed axis to global axis?

答:
Standard deviation is used to represent probability distribution - in your case if you have $\sigma = 1m$ for forward distance it means that there is ~68% chance of true forward distance to the obstacle be less than 1m away from your measurement. You have two variables, so you should project your probability distribution on a 2D surface - you will get something like that:

Each line represents points of equal probability of being a true position. Center of ellipsis is your measurement and has a highest probability.

Now, when you project these values to global coordinate system you will likely get something like:

You cannot represent such a probability distribution using only two variables - you have to use 2x2 covariance matrix.

Good tutorial on graphical interpretations of covariance matrix can be found here: http://www.visiondummy.com/2014/04/geometric-interpretation-covariance-matrix/

In general you can find your covariance matrix for global coordinate system with: $\Sigma = R S S R^{-1}$ where $R$ is rotation matrix from local to global coordinates and $S$ is diagonal matrix with your variances as diagonal elements.


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

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

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

答:
A couple things, the first is that the controller does not really care what the "real" values are. Everything is relative, if the controller sees that it is sinking it will increase the thrust until it is not sinking. If it is tilting too far to the left it will decrease the right thrust and increase the left thrust. (Here is a good resource if you want to design your own controller)

The other thing is that we normally assume that thrust response from the motor, ESC, prop combo is instantaneous so in an ideal world if we told the motor to change from 5% speed to 100% speed in an instant it would happen but in the real world there is some delay this is normally modeled as the difference between a sine wave input at a certain frequency and its output. This is called Phase and Gain margins.


问:
How should emergency stops be wired?
Emergency stops are obviously a good idea on most robots, how should they be wired?  What systems should be killed immediately, and what should stay working?</p>

答:
In addition to the points that ronalchn makes, if you have a safety critical system, the E-Stop selected should use at least a 4-wire interface rather than a simpler two wire interface.

The E-Stop should then have two internal switches, one normally closed, the other normally open (like one of these OMRON options, see A22E-M-11-EMO
 and A22E-M-11-EMS on p2 of the datasheet). Activating the E-Stop both opens the NC(Normally closed) switch and closes the NO(Normally open) switch.

The reason for this is redundancy.

One failure mode of a two wire normally closed e-stop circuit is that the wires get shorted, thus opening the NC switch would do nothing. This could happen in a situation where a cable is crushed, the insulation displaced and the now bare wires touch each other.

If you decide to wire your E-stop in the opposite way though, with a normally open circuit then one of its failure mode is that the e-stop wire gets cut, thus closing the NO switch would do nothing. This could happen in a situation where a cable is caught between two surfaces or where movement pulls a cable out of its socket.

The risk of these failure modes means that neither on their own are sufficient.

By including both NC and NO E-Stop circuits, you virtually eliminate this risk, since either E-Stop circuit registering an E-Stop condition would cause an overall E-Stop condition. There is an exceedingly small chance that the NC circuit could be shorted at the same time as the NO circuit is disconnected, but any safety system worth its salt would make the window of opportunity for this vanishingly small (i.e. transistor switching rates).

On the subject of what to kill on an E-Stop, in my opinion you should kill everything which can move and everything which could cause damage (such as a laser).

My experience is with industrial robotics though, where the mechanics are typically designed so that it is inherently safe to kill the power at any time. Axes are designed such that motors aren't acting against gravity without significant gearing (for example SCARA robots, where most of the axes are in a horizontal plane) or are designed such that  in an E-Stop condition the motors are shorted, bringing them to an abrupt stop.

Title: How should emergency stops be wired?

ContentLicense: CC BY-SA 4.0


问:
Monobrick Communication Library-reading nxt sensors
In my program, I'm need to detect if the NXT touch sensor is pressed.

```<code>var nxt = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
nxt.Connection.Open();
nxt.Sensor1 = new TouchSensor();
nxt.Sensor1.Reset(false);
nxt.Sensor1.Initialize();
Console.WriteLine(nxt.Sensor1);
</code>```

When I start the program, the sensor value always reads 0. But I discovered that if I go into the "View" menu in the NXT and see the touch sensor value, the program value reads 1. I can't do that for my setup. Also, I can't use Bluetooth; my computer doesn't have it. Can someone help me?

EDIT: my full code

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MonoBrick.NXT;
using MonoBrick;
using System.Windows.Forms;
using System.Reflection;
using System.Threading;

namespace MonoBrick
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            try
            {
                var nxt = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
                nxt.Connection.Open();
                nxt.Sensor1 = new TouchSensor();
                nxt.Sensor1.Reset(false);
                nxt.Sensor1.Initialize();
                Console.WriteLine(nxt.Sensor1.ReadAsString());
                nxt.Beep(500);
                System.Windows.Application application = new System.Windows.Application();
                application.Run(new Window1());
                nxt.Connection.Close();
            }

            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
                Console.WriteLine("Press any key to end...");
                Console.ReadKey();
            }
        }
    }
}
</code>```

答:
You need to read the value continually in order to get the updated value, see the tutorial on there website.

Here is what the code to do that might look like (untested as I do not have a NXT):

```<code>using System;
using MonoBrick.EV3;
public static class Program{
    static void Main(string[] args)
    {
        var nxt = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
        nxt.Connection.Open();
        nxt.Sensor1 = new TouchSensor();
        nxt.Sensor1.Reset(false);
        nxt.Sensor1.Initialize();
        ConsoleKeyInfo cki;
        Console.WriteLine("Press Q to quit");
        do
        {
            cki = Console.ReadKey(true); //press a key
            Console.WriteLine(nxt.Sensor1);
            }
        } while (cki.Key != ConsoleKey.Q);
        ev3.Connection.Close();
    }
}
</code>```

Body:
You need to read the value continually in order to get the updated value, see the tutorial on there website.

Here is what the code to do that might look like (untested as I do not have a NXT):

using System;
using MonoBrick.EV3;
public static class Program{
    static void Main(string[] args)
    {
        var nxt = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
        nxt.Connection.Open();
        nxt.Sensor1 = new TouchSensor();
        nxt.Sensor1.Reset(false);
        nxt.Sensor1.Initialize();
        ConsoleKeyInfo cki;
        Console.WriteLine("Press Q to quit");
        do
        {
            cki = Console.ReadKey(true); //press a key
            Console.WriteLine(nxt.Sensor1);
            }
        } while (cki.Key != ConsoleKey.Q);
        ev3.Connection.Close();
    }
}


问:
Line follower robot with 2 or 4 motors?
I am developing a line follower robot and I am not sure about how many motors should I use: two or four. I'm thinking of using four, but I do not know if it's worth it (it will let the car be heavier, consume more power...). Does anyone have an idea? I'm planning in use something like this design here, of Aniki Hirai: http://anikinonikki.cocolog-nifty.com/.shared/image.html?/photos/uncategorized/2014/11/19/cartsix04.jpg.

The engine I'll use is a micro-metal motor, from Pololu, just like in the link:
https://www.pololu.com/product/3048.

I know the question is a little bit vague, but I don't know another way to ask this.

答: If you're using four traditional wheels (all have friction) you should power all of them (skid steer). Otherwise your robot has to drag the unpowered wheels when you turn. You can also over come this problem by using two unpowered frictionless wheels instead giving you differential steering.</p>

Title: Line follower robot with 2 or 4 motors?


答: The best option would be to use two wheels. Then one motor for each wheel in total two. Then, you can use roller coaster at the front. You do not need to provide power to that. Just provide power to back two wheels. By varying the speed of two back wheels (differential drive) you can move straight and turn as well.</p>

Title: Line follower robot with 2 or 4 motors?

Body:
I am developing a line follower robot and I am not sure about how many motors should I use: two or four. I'm thinking of using four, but I do not know if it's worth it (it will let the car be heavier, consume more power...). Does anyone have an idea? I'm planning in use something like this design here, of Aniki Hirai: http://anikinonikki.cocolog-nifty.com/.shared/image.html?/photos/uncategorized/2014/11/19/cartsix04.jpg.

The engine I'll use is a micro-metal motor, from Pololu, just like in the link:
https://www.pololu.com/product/3048.

I know the question is a little bit vague, but I don't know another way to ask this.


问:
Model Predictive Control (MPC) horizon and constraints
I am new to the MPC idea and I am trying to understand the key concepts but there are two things which I found confusing and I didn't find answers regarding to them.

The first one is about the optimized control signal sequence which can be computed from the cost function. If we want to predict, say five steps further, then we will have 5 control signals. After the calculation is done, we will apply only the first signal from the sequence to our system, and them remaining four will be "wasted" (I read that it can be used as an initial guess for the next optimization but thats not my point here). My first question is why don't we just predict one step further, and instead of optimizing five signals, we restrict our optimization to just one, which makes the computation faster?

The second question is about constraints. Lets say that I have some restriction on my input signal, say $0 < u < 5$. With some math, we can include these constraints to the optimization task but it takes more time to solve. Why don't we just do an unconstrainted optimization and after our input signals are ready we apply our contraints on them? Obviously this can not be done for state contraints, but i am interested about input constraints.

Thanks for your answers in advance.

答:
To your first question: That is because you optimize with those next steps in mind. Intuitively, you don't have to apply a "ridiculous amount" of input if you know that you are also fine if you keep on applying a "normal amount" of input for a while. You apply only the first control, but the rest is part of the calculation.

To your second question: You calculate specific inputs, if you cut them off after the calculation, then why would your controller still work?


问:
Can I use the RaspberryPi to receive the GameCube remote's RF signals?
I have an old gamecube that doesn't work and I want to gut it and fill it with Arduino boards and/or Raspberry Pi if necessary.  I want the project to eventually have some kind of AI aspect, but I'm also toying with the idea of using a wireless GameCube remote and wavebird to issue commands at the push of a button.

I guess this would be mostly good for testing purposes, but I'm mostly curious if and how I would go about making my RaspberryPi understand Gamecube remote input.  Furthermore, would this kind of idea be feasible?

答:
Yes, it's definitely feasible. I realize this won't be a "complete" answer according to the rules here, but either way here's some links to point you in the (hopefully) right direction:

Rather complete tutorial on making a GameCube controller to USB converter

The same adapter ready to go for $30CAD

Short forum discussion about GameCube serial interface


问:
SLAM: Why use two cameras (stereo) if SLAM can be done using single camera (monocular)?
I am aware that algorithm for monocular SLAM is complex compared to stereo SLAM. But my question is if by any means it is possible to do SLAM using one camera why one should use two cameras to do the same thing?</p>

答: The most important point is the scale. If you do monocular SLAM, your map will only be accurate up to scale so that you e.g. cannot compute the length of the travelled path in meters. The scale between your map and the world is not even constant over time so that if you come back to your starting point, it's going to be difficult to match the beginning and end of you map as they have a different scale. </p>


问:
Create 2 kill switch?
Any ideas on ways to install a kill switch on the Create 2?  I saw how the battery attaches to the main board with springs, so that blocks me from using a plain old battery switch.  Are there any test points that can be grounded to shut down when in full mode?</p>

答:
Something I've always wanted to try (but never have) is to use two pieces of copper tape, back-to-back (with something thin and insulating like packing tape between them) to interrupt the connection between the one of the spring terminals and one of the battery contacts. Then, this thin conductor sandwich could be brought out to somewhere more convenient to install a kill switch. (You could solder wires to the copper tape once you're somewhere less constrained.) Let us know how it goes!

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.

Title: Create 2 kill switch?


答:
If you can convert the GameCube interface to be a USB game controller, this should go fairly smoothly.  I used to buy used USB Xbox and Playstation2 controllers to control our underwater vehicles, and use Python's pygame library for joystick support to read the input from it.

Pygame makes it pretty easy.  For example, this script to show joystick position.

Title: Can I use the RaspberryPi to receive the GameCube remote's RF signals?

Body:
I have an old gamecube that doesn't work and I want to gut it and fill it with Arduino boards and/or Raspberry Pi if necessary.  I want the project to eventually have some kind of AI aspect, but I'm also toying with the idea of using a wireless GameCube remote and wavebird to issue commands at the push of a button.

I guess this would be mostly good for testing purposes, but I'm mostly curious if and how I would go about making my RaspberryPi understand Gamecube remote input.  Furthermore, would this kind of idea be feasible?


问:
Need clarification on potential fields for robotics
I am taking a course on AI robotics from a computer science department but my background is in mechanical engineering. I am having some difficulty with ambiguous terminology in virtual potential fields. All of the sources I have seen to define the virtual potential fields with a physics basis:
$$F(q) = \nabla U(q) $$
or that the force imposed by the potential field is the gradient of the potential function.

Then, the CS sources I have seen will later set the velocity set point of the robot controller equal to:

$$\mathbf{q}_s = \nabla U(q)$$

essentially using the imposed force as a velocity setpoint. But none of the sources mention this swap. So am I missing something, or is the term virtual potential field sort of a misnomer? Maybe it should be virtual velocity potential field?

Here are some CS course slides I am looking at:
http://cs.gmu.edu/~kosecka/cs685/cs685-potential-fields.pdf
http://www.cs.cmu.edu/~motionplanning/lecture/Chap4-Potential-Field_howie.pdf

Thank you!

答:
It is possibly a misnomer. We CS people shouldn't really be talking physics ;)

Nevertheless, the idea used here is quite simple. Simple enough that many people have "invented" it on their own before learning its existence. I believe the reason it's called a potential field is due to the way many people implement the idea.

Let's take an example. For me, the moment of "inventing" this method was in a head-to-head Snake game, so say you are navigating an environment where there is a goal you want to go towards but also dangerous locations you want to avoid. In the case of Snake, the goal was the apples and the dangerous locations were your and your opponent's bodies.

Now say you want to simply have a "tendency" towards the goal which is stronger the closer you are to it, and a tendency to avoid danger which is also stronger the closer you are to it. Out of purely non-scientific intuition, let's say the strength of this tendency ($T$) is relative to the inverse distance ($R$) squared. So:

$$T \sim \dfrac{1}{R^2}$$

(Naturally, there is a $\sum$ for every source of tendency)

In physics, "the strength is relative to the inverse of distance squared" looks like potential fields, and I believe that's where the name of this method came from.

Now in different applications of this method, you might do a different thing with the calculated $T$. You could use it in a physically meaningful way (as if it really were a potential field), but that often leads to problems. In the navigation problem above, you would likely end up orbiting your goal instead of reaching it. More easily, you could set your velocity to the same value as the strength of your potential field and screw physics.


问:
Possible stabilize Crazyflie 2.0 drone autonomous flight without additional sensors?
I just bought the Crazyflie 2.0 drone. This is my first drone, and it is my first time programming a drone.

My first goal is simple: Make the drone hover in place stably for 10 seconds.

I found a simple example script that turns up the thrust and then lands the drone. I modified this to 1) extend the time to 10 seconds, 2) reverse thrust if the drone starts tipping, and 3) constantly display the roll, pitch, and yaw in the console.

When I run this, the drone often flies randomly around the room and runs into things; it does not just lift up and hover stably. Why is this? How can I improve things so that it's much more stable? Do I need more sensors, or can I pull this off with just programming?

```<code>"""
Simple example that connects to the first Crazyflie found, hovers, and disconnects.
"""

import time
import sys
from threading import Thread
import logging

import cflib  # noqa
from cfclient.utils.logconfigreader import LogConfig  # noqa
from cflib.crazyflie import Crazyflie  # noqa

logging.basicConfig(level=logging.ERROR)

class HoverTest:
    """Example that connects to the first Crazyflie found, hovers, and disconnects."""

    def __init__(self, link_uri):
        """ Initialize and run the example with the specified link_uri """

        self._cf = Crazyflie()

        self._cf.connected.add_callback(self._connected)
        self._cf.disconnected.add_callback(self._disconnected)
        self._cf.connection_failed.add_callback(self._connection_failed)
        self._cf.connection_lost.add_callback(self._connection_lost)

        self._cf.open_link(link_uri)

        self._status = {}
        self._status['gyro.x'] = 0
        self._status['gyro.y'] = 0
        self._status['gyro.z'] = 0

        print("Connecting to %s" % link_uri)

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""
        print("Connected to %s" % link_uri)

        # The definition of the logconfig can be made before connecting
        self._lg_gryo = LogConfig(name="gyro", period_in_ms=10)
        self._lg_gryo.add_variable("gyro.x", "float")
        self._lg_gryo.add_variable("gyro.y", "float")
        self._lg_gryo.add_variable("gyro.z", "float")

        # Adding the configuration cannot be done until a Crazyflie is
        # connected, since we need to check that the variables we
        # would like to log are in the TOC.
        try:
            self._cf.log.add_config(self._lg_gryo)
            # This callback will receive the data
            self._lg_gryo.data_received_cb.add_callback(self._gryo_log_data)
            # This callback will be called on errors
            self._lg_gryo.error_cb.add_callback(self._gryo_log_error)
            # Start the logging
            self._lg_gryo.start()
        except KeyError as e:
            print("Could not start log configuration,"
                  "{} not found in TOC".format(str(e)))
        except AttributeError:
            print("Could not add gyro log config, bad configuration.")

        # Start a separate thread to do the motor test.
        # Do not hijack the calling thread!
        Thread(target=self._hover).start()

    def _connection_failed(self, link_uri, msg):
        """Callback when connection initial connection fails (i.e no Crazyflie
        at the specified address)"""
        print("Connection to %s failed: %s" % (link_uri, msg))

    def _connection_lost(self, link_uri, msg):
        """Callback when disconnected after a connection has been made (i.e
        Crazyflie moves out of range)"""
        print("Connection to %s lost: %s" % (link_uri, msg))

    def _disconnected(self, link_uri):
        """Callback when the Crazyflie is disconnected (called in all cases)"""
        print("Disconnected from %s" % link_uri)

    def _gryo_log_error(self, logconf, msg):
        """Callback from the log API when an error occurs"""
        print("Error when logging %s: %s" % (logconf.name, msg))

    def _gryo_log_data(self, timestamp, data, logconf):
        """Callback froma the log API when data arrives"""
        # print("[%d][%s]: %s" % (timestamp, logconf.name, data))

        self._status['gyro.x'] = data['gyro.x']
        self._status['gyro.y'] = data['gyro.y']
        self._status['gyro.z'] = data['gyro.z']

    def _hover(self):
        start_time = time.time()
        run_time = 7

        thrust_multiplier = 1
        thrust_step = 500
        thrust = 20000
        max_thrust = 39000
        roll = -1.00
        pitch = -2.00
        yaw = 0

        # Unlock startup thrust protection.
        self._cf.commander.send_setpoint(0, 0, 0, 0)

        # Turn on altitude hold.
        self._cf.param.set_value("flightmode.althold","True")

        while thrust >= 20000:
            # Update the position.
            self._cf.commander.send_setpoint(roll, pitch, yaw, thrust)

            time.sleep(0.01)

            if thrust >= max_thrust and time.time() - start_time >= run_time:
                # Reverse thrust
                thrust_multiplier = -1

            if thrust <= max_thrust or thrust_multiplier == -1:
                thrust += thrust_step * thrust_multiplier

            # Reverse thrust if the drone tips over.
            if abs(self._status['gyro.x']) >= 75 or abs(self._status['gyro.y']) >= 75:
                print('Aborting')
                thrust_multiplier = -2

            print(self._status['gyro.x'], self._status['gyro.y'], self._status['gyro.z'])

        self._cf.commander.send_setpoint(0, 0, 0, 0)

        # Make sure that the last packet leaves before the link is closed
        # since the message queue is not flushed before closing
        time.sleep(0.1)
        self._cf.close_link()

if __name__ == '__main__':
    # Initialize the low-level drivers (don't list the debug drivers)
    cflib.crtp.init_drivers(enable_debug_driver=False)
    # Scan for Crazyflies and use the first one found
    print("Scanning interfaces for Crazyflies...")
    available = cflib.crtp.scan_interfaces()
    print("Crazyflies found:")
    for i in available:
        print(i[0])

    if len(available) > 0:
        le = HoverTest(available[0][0])
    else:
        print("No Crazyflies found, cannot run example")
</code>```

As you can see, I tried simply adjusting the roll and pitch (to -1.00 and -2.00), but that did not help much. When I use the GUI and a joystick to control the drone and I adjust the roll and pitch trim values to -1.00 and -2.00, this definitely helps stabilize the drone.

Any ideas are welcome. Thank you!

答:
You will not be able to achieve stable horizontal flight without external sensors. The reason is that the Crazyflie 2.0 quadcopter does not have sensors to know where it is in the room, it only has sensor to know its orientation and its altitude (using a pressure sensor).

Chuck is correct in saying that a quadcopter only pushed thrust downwards. The crazyflie runs a stabilisation loop that uses Gyroscope and Accelerometer to measure and correct its orientation. There is also an altitude-hold loop that uses the pressure sensor and accelerometer to keep a stable altitude. This also means that you do not need to care about the current orientation: just send the wanted orientation setpoint and the onboard control loop will do its best to keep the platform at the given setpoint.

To have a stable horizontal flight you should be able to ask for roll and pitch of 0, and alt-hold with a rising rate of 0m/s (this is encoded with thrust=32568 for the moment in the Crazyflie when alt-hold is enabled).  In theory this should result in zero horizontal acceleration since the propeller would only push downwards. Unfortunately, practically this is not working because this is open-loop control and any imperfection in the sensors, motors, motor orientation, or anything else physical, will result in the quadcopter drifting away.

The only way against this drift is to have another sensor, aware of the environment, that can correct this physical imperfection thus closing the position loop. This could be anything from onboard motion sensor to external positioning or camera systems.


问:
Programming Inverse Kinematics in C++
I want to write my own kinematics library for my project in C++. I do understand that there are a handful of libraries like RL (Robotics Library) and ROS with inverse kinematics solvers. But for my dismay, these libraries DO NOT support MacOS platform. I have already written the Forward Kinematics part, which was quite straight forward. But for the Inverse Kinematics part, I am quite skeptical since the solution to a IK problem involves solving sets of non-linear simultaneous equation. I found out the Eigen/Unsupported 3.3 module has a APIs to non-linear equations. But before I begin on this uncertain path, I want to get some insight from you guys on the plausibility and practicality of writing my IK library. My manipulator design is rather simple with 4 DoF and the library will not be used for other designs of manipulators. So what I am trying to achieve is taylor-made IK library for my particular manipulator design than a rather a 'Universal' library.

So,

Am I simply trying to reinvent the wheel here by not exploring the already available libraries? If yes, please suggest examples of IK libraries for MacOS platform.

Has anyone written their own IK library? Is it a practical solution? Or is it rather complex problem which is not worth solving for a particular manipulator design?

Or should I just migrate all my project code (OpenCV) to a Linux environment and develop the code for IK in Linux using existing libraries?

答:
I suggest adopting an existing library.

ROS can be installed on OS X

Tasks also runs on OS X.

Each can also be integrated with V-REP or gazebo fairly easily for simulation and visualization. I have also created a homebrew-robotics tap for installing various robotics related tools on OS X via homebrew and a set of Linux setup scripts in robotics_setup.

Title: Programming Inverse Kinematics in C++


问:
Alternatives to Kalmam Filter
I am currently working on a self balancing robot project. I am going to use a MPU6050 to get data from both the accelerometer and the gyroscope. Since I need to get accurate data in a very small amount of data I need to filter the raw data I get. So many people have suggested me to use the Kalman Filter but I could not comprehend it (the maths behind it). Are there any other types of filters I can use in my project?

Thanks in advance.

答:
Particle filters (epecially in Monte Carlo localization) always seemed easy to intuitively understand to me. You basically simulate bunch of possible states of your robot, rank them with probabilities and occasionally you throw away the improbable ones.

There's obviously more to it (and more math), but this should be enough to make a small working test.

Title: Alternatives to Kalmam Filter


答:
A good choice for sensor fusion with the MPU6050 is a second order complementary filter, which I used for the orientation estimation in a project. The complementary filter is computational cheap and so a good choice for a microcontroller. A paper about the implementation you can find here:

http://www.academia.edu/6261055/Complementary_Filter_Design_for_Angle_Estimation_using_MEMS_Accelerometer_and_Gyroscope

Title: Alternatives to Kalmam Filter

Body:
I am currently working on a self balancing robot project. I am going to use a MPU6050 to get data from both the accelerometer and the gyroscope. Since I need to get accurate data in a very small amount of data I need to filter the raw data I get. So many people have suggested me to use the Kalman Filter but I could not comprehend it (the maths behind it). Are there any other types of filters I can use in my project?

Thanks in advance.


问:
How to make sense of IMU (BNO055) data
I have a project that I'm working on that needs data about which directions something has moved and how quickly from a given point (accelerometer and magnetometer?). I have the working python code for the BNO055, I'm just having trouble interpreting it. I guess these are my specific questions:

Is the data from a starting point (doesn't seem likely) or a set time period that continues? If so, what is that time interval? Do I define it by how often I ask for the data?

Is magnetometer and accelerometer data what I should be using for my task?

What is a rough pseudocode outline for how I could convert this data into something easier to understand (i.e. an updating distance or x,y,[z] coord system)

答:
So, it sounds like you're trying to get rough odometry of a hexapod using a accelerometer and magnetometer. You are right to be choosing a sensor to get lateral and angular accelerations, but I think the magnetometer is not as good of a choice as a MEMS gyroscope, which should be about the same price but not affected by magnetic fields. In my experience, the environment indoors is not a terribly friendly one for magnetometers, as there are a lot of pieces of metal around, and even less friendly when you're near a source of stray electromagnetic fields (like near motors). That answers your second question, I think.

For the first question, according to the API I sent and you confirmed, the data that comes to you from the sensor is some form of the instantaneous acceleration and magnetic field "felt by" the sensor when you read it.

As far as your third question, there's no simple answer, but I'd refer you to this question: https://stackoverflow.com/questions/26476467/calculating-displacement-using-accelerometer-and-gyroscope-mpu6050 .

Title: How to make sense of IMU (BNO055) data


问:
Why ODE for optimal control theory?
I am trying to understand optimal control theory which forms the base for reinforcement learning techniques in AI. Whenever I open a lecture or a book or any online notes, everything starts with an ODE and then derivation goes the payoff function which is straight forward.

I am trying hard to comprehend why an ODE models any system? Many say it easy to begin with but why this model?

$dx/dt = f(x(t))$

I could not find the reason and decided to ask for help.

答:
The reason why ODE's are used is simply: physics. It would be great if any system could be modelled by a simple linear function like $x(t)=at$, but nature is not so simple, or linear. Even when you neglect nature, dynamical systems, like $\dot{x}(t)=f(x(t))$ still pop up everywhere, like CroCo said, it is the basis of the mathematical modelling of many systems.

I would suggest looking into differential equations first before starting with reinforcement learning.

Title: Why ODE for optimal control theory?


问:
How to know when a Li-Po battery is discharged?
I'm building a quadcopter and I've seen that a Li-Po battery must not be entirely discharged, otherwise it could damage it.

How do you know when you have to stop your quadcopter or robot in order to prevent damages, since the voltage doesn't drop? Which part should control the battery charge? ESCs? BEC? Flight controller?

答:
Lithium polymer batteries do have a drop in their voltage as they discharge.

Use a simple zener/opamp circuit (this is a good example of one), or just analogRead from a resistor system parallel to the battery. Determine what your definition of "low battery" is (some experimentation may help, see what values you get for a discharged battery), and set your processor to understand that.


问:
Denavit-Hartenberg Humanoid robot
In humanoid robot, Which way we determine DH Parameter:

DH parameter for each leg separability.

Or, DH-Parameter for two leg together.

and if I can calculate from any way, what about trunk how can insert it in DH calculation?

答: If you have no idea about where to start the best is to google Nao + DarwinOP + HUBO2 + DH and you will have lot of pdf articles and reports coming out that you may read. For each humanoid robot you will have a description of kinematic chains and DH modeling.  </p>

Title: Denavit-Hartenberg Humanoid robot


答: Check this website pratical approach to kalman filter it will give you a comprehensive description of kalman filter for a balancing robot (like yours) both theoritical and pratical (you have the code as well). And it runs on an Arduino !</p>

Title: Alternatives to Kalmam Filter


答:
Want to get orientations from accelerometers and gyroscopes?

Use the Madgwick filter.

From the paper, "Results indicate the filter achieves levels of accuracy exceeding that of the Kalman-based algorithm."

As @CroCo mentioned, the Kalman filter is the optimal estimator.... for a linear system signal in the presence of zero-mean, Gaussian noise. Accelerometers and gyroscopes have a non-zero bias, and they also experience bias drift which means that, even if you could measure and offset the bias, the bias isn't stable and changes over time.

The Madgwick filter is free, and even better, there are already efficient implementations of the filter already written in C, C#, and Matlab. You can learn the math if you want, but again the math has already been done and the finished product - the filter - is free to download and use.

Title: Alternatives to Kalmam Filter


问:
Gazebo joint->SetForce() call applies forces to the whole model. How to circumvent that?
The following code applies a force to the joint in an update method call. The problem is that the force seems to dissipate / is applied consecutively to other parts of the model, specifically the chassis, which holds the rotating laser. How can I circumvent that?

The chassis shold be a moving vehicle so I can't just fix it to the ground plane, using a fixed joint.

This is my onUpdate() from within the gazebo plugin. Essentially its making the joint rotate back and forth on a specified axis.

```<code>public: void OnUpdate(const common::UpdateInfo & /*_info*/){

    rotation = this->joint->GetAngle(0);
    this->joint->SetStopDissipation(0,0);
    double degree = rotation.Degree();
    if (degree <= -90) {
            this->joint->SetForce(rotationAxis,effort*2);
    }
    else if (degree >= 90) {
            this->joint->SetForce(rotationAxis,-effort*2);
    }
    std::cerr << degree << "\n"; }
</code>```

The definition from the model.sdf is this:

```<code>    <joint name="back_and_forth_joint" type="revolute">
        <child>laser</child>
        <parent>chassis</parent>
        <axis>
            <xyz>1 0 0</xyz>
            <limit>
                <lower>-1.57079633</lower>
                <upper>1.57079633</upper>
            </limit>
        </axis>
    </joint>
</code>```

Thanks.

Update:

One of the possibilities is to simply add mass to the chassis like so:

```<code>        <link name='chassis'>
        <pose>0 0 .1 0 0 0</pose>
        <inertial>
          <mass>10</mass>
        </inertial>
</code>```

答:
As you mentioned in your update,

One of the possibilities is to simply add mass to the chassis

This works because, at some point, you need a reaction force. An applied force (or torque) at any point in a structure will be transmitted through the structure back to a "fixed" object. The fixed object is generally the Earth, and connection to the Earth is through poles or other supports inserted into the Earth (a foundation) or through a friction contact with the surface (such as tires, etc.)

You are correct in that you can't connect a mobile vehicle to the Earth using a fixed joint, but you can use a series of flexible joints to simulate contact with the Earth. How are you simulating motion right now?

What you're experiencing, by the way, is the same behavior you'd see if you applied a force to an object in space where there is no "fixed" object to apply the reaction force.

The Earth is essentially infinitely massive, for the purposes of providing reaction forces for anything you or I would ever do. What you're looking for, if you can't or won't model the connection between the wheels and the ground, is to make the chassis "sufficiently massive" such that it doesn't generate an appreciable acceleration when your external force is applied.

If you've watched Battlebots, then you've probably seen instances where the chassis is NOT sufficiently massive and the robot flips when an actuator is used. There's nothing to absorb the reaction force, so the entire body moves. The effect is more pronounced as ratio of applied force the mass of the "base" body is increased.


答: There are a number of off-the-shelf battery monitors that will notify you when the battery voltage has dropped to a critical point. In our lab we use one that emits a loud noise (as an example see the Hobby King Battery Monitor 3S).</p>

Title: How to know when a Li-Po battery is discharged?

Body:
I'm building a quadcopter and I've seen that a Li-Po battery must not be entirely discharged, otherwise it could damage it.

How do you know when you have to stop your quadcopter or robot in order to prevent damages, since the voltage doesn't drop? Which part should control the battery charge? ESCs? BEC? Flight controller?


答:
When establishing a set of kinematic frames for a humanoid robot, it's common to use a frame on the torso as the base frame and then branch out to the limbs from there. So there is a tree of kinematic frames. The base frame is a floating frame.

DH parameterization of the kinematics can be useful for drawings and showing or communicating the relative positioning of joints, but you will probably find that it's easier to work with full SE3 transforms between frames instead of trying to use DH parameters.

Title: Denavit-Hartenberg Humanoid robot

Body:
In humanoid robot, Which way we determine DH Parameter:

DH parameter for each leg separability.

Or, DH-Parameter for two leg together.

and if I can calculate from any way, what about trunk how can insert it in DH calculation?


问:
How to Calculate the Translational and Rotational Velocity of a 4 Wheeled Robot?
I have a robot with a 4 wheel drive using mecanum wheels to allow for more mobility. For the engineering documentation I am looking to find both the translational velocity and rotational velocity of the robot. To begin I started with the (incorrect) assumption that the tangential velocity of the wheels was the overall linear velocity, but that yielded unreasonably high values. What is the correct way to mathematically evaluate the translational and rotational velocity of the robot?</p>

答: The problem you describe, calculating the cartesian velocity form the wheel velocities is known as the direct kinematic problem of the mobile robots. You can find a detailed explanation on who to do this for 4 wheeled robots with mecanum wheels here.</p>


问:
Programming Forward and Inverse Kinematics of PUMA 560?
I am currently coding a Forward and Inverse Kinematics solver for a PUMA 560 robot. For the Inverse Kinematics part I am using the closed for solution given in this paper. But my issue is, my solution for IK for a given set of (x,y,z) does not return the same values returned by my FK values. The reason I am doing this is to verify my code accurately computes the FK and IK.

These are the DH parameters for my robot (These are Python code, since I was testing my algorithm on Spyder IDE before implementing on C++).

DH Parameters

Link lengths

   a = [0, 650, 0, 0, 0, 0]

Link offsets

  d = [0, 190, 0, 600, 0, 125]

Link twist angle

  alpha = [-pi/2, 0, pi/2, -pi/2, pi/2, 0]

So basically I finding the T transformation matrix for each link from the the base frame {B} to wrist frame {W}. This is my code;

 Function to compute Forward Kinematics

```<code>def forwardK(q):

#T06 is the location of Wrist frame, {W}, relative to Base frame, {B}
T01 = genT(q[0],0,d[0],0)
T12 = genT(q[1],a[0],d[1],alpha[0])
T23 = genT(q[2],a[1],d[2],alpha[1])
T34 = genT(q[3],a[2],d[3],alpha[2])
T45 = genT(q[4],a[3],d[4],alpha[3])
T56 = genT(q[5],a[4],d[5],alpha[4])

#Tool frame {T}
#T67 = genT(0,0,d[5],0)

T03 = matmul(T01,T12,T23)
T36 = matmul(T34,T45,T56)
T06 = matmul(T03,T36)
#T07 = matmul(T06,T67)

x = T[0][3]
y = T[1][3]
z = T[2][3]

print("X: ",x)
print("Y: ",y)
print("Z: ",z,"\n")
print("T: ",T,"\n")

return T06
</code>```

 The function to compute  T Matrix

```<code>def genT(theta, a, d, alpha):
T =  array([[cos(theta), (-sin(theta)), 0, a],
    [sin(theta)*cos(alpha), (cos(theta)*cos(alpha)), -sin(alpha), (-   d*sin(alpha))],
    [sin(theta)*sin(alpha), cos(theta)*sin(alpha), cos(alpha), cos(alpha)*d],
    [0, 0, 0, 1]])

return T
</code>```

from the T Matrix relating the {B} frame to the {W} frame position vector of the {w} [x y z] is extracted. R Matrix (orientation) of the {W} relative to the {B} is obtained by the following piece of code;

```<code>T = forwardK([30,-110,-30,0,0,0])
x = T[0][3]
y = T[1][3]
z = T[2][3]
R = T[0:3,0:3]
</code>```

Where T is the transformation matrix relating {W} to {B}. Then this information is fed in to the invK(x,y,z,R,ARM,ELOBOW,WRIST) function to check if the algorithm returns the same set of angles fed to the forwardK(q1,q2,q3,q4,q5,q6) function.

In the invK(x,y,z,R,ARM,ELOBOW,WRIST)
      - ARM, ELBOW, WRIST are orientation specifiers to describe various possible configurations of the manipulator. Each of these parameters are either {+1,-1}. These values are then used in the closed form geometrical solution presented by the afore-mentioned paper.

I did not post the code for the invK(x,y,z,R,ARM,ELOBOW,WRIST) since it is a direct implementation of the closed form solution presented in the paper and also it significantly long hence making it highly unreadable.

What do you think I am doing wrong? I am quite sure the way I am computing the FK is correct but I could be wrong. The matrix multiplications of my Python code are correct since I double checked them with Matlab. Any advice is appointed.

答:
Take a look at the DH matrices on the Wikipedia page. I think, at a minimum, you have some sign errors. It also looks like maybe you use the same T matrix in both directions; from the base to the end effector and the other way. You can't do that. The way it's (almost) written, you have a T matrix that goes from the link coordinates backward; it doesn't go forward, but you're still using it in your forward kinematics calculations.

Try using one known set of parameters and invoke your genT function. Verify that the result gets you moved correctly, but I don't think it will.

:EDIT:

Your matrix is not the same. The matrix $^{n-1}T_n$ is:

$$
\left[
\begin{array}{cccc}
\cos{\theta} & -\sin{\theta}\cos{\alpha} & \sin{\theta}\sin{\alpha} & r\cos{\theta} \\
\sin{\theta} & \cos{\theta}\cos{\alpha} & -\cos{\theta}\sin{\alpha} & r\sin{\theta} \\
0 & \sin{\alpha} & \cos{\alpha} & d \\
0 & 0 & 0 & 1
\end{array}
\right]
$$

which can be viewed as a conglomeration of the rotation matrix and translation vector:

$$
\left[
\begin{array}{c|c}
R & T \\ \hline
0 & 1
\end{array}
\right]
$$
The inverse of that, $^nT_{n-1}$, is:
$$
\left[
\begin{array}{cccc}
\cos{\theta} & \sin{\theta} & 0 & -r \\
-\sin{\theta}\cos{\alpha} & \cos{\theta}\cos{\alpha} & \sin{\alpha} & -d\sin{\alpha} \\
\sin{\theta}\sin{\alpha} & -\cos{\theta}\sin{\alpha} & \cos{\alpha} & -d\cos{\alpha} \\
0 & 0 & 0 & 1
\end{array}
\right]
$$

which is the same as:

$$
\left[
\begin{array}{c|c}
R^{\mbox{T}} & -RT \\ \hline
0 & 1
\end{array}
\right]
$$

The inverse of a rotation matrix is the same as the transpose of the rotation matrix. The $\sin{\theta}$ term in the rotation matrix (at 2,1 or 1,2) is positive in both cases; yours is negative. That alone leads me to think your formulation is wrong. The signs on the other terms seem incorrect also.

As I mentioned before, try using a basic setup that you know the answer to, plug that into your T matrix function, and verify it gives you the correct output.

With software especially, any time you create a function you should try to perform a "Unit Test" to ensure that you are getting valid outputs from every sub-function you write.

My preference would be to do something graphically (hand-drawn), where maybe you have a link with a length of 1, and you rotate it 30, 45, 60, and 90 degrees. Verify that the resulting frames are all located in the correct places. You should consider also trying locations in all four quadrants - atan is the devil.


问:
Strain gauges or flex sensors
I've been thinking about making myself a fancy data glove. Now that I'm looking into it, I notice a lot of DIY stuff works with these so called flex sensor based on conductive carbon ink.

I'm not familiar with these sensors but from what I have learned so far, they are more expensive and less accurate compared to a simple strain gauge. Or are they just hard to use because of the length and bend radius of the finger?

So actually I'm just wondering what the pros and cons are of these sensors when faced with data gloves.

答: The sensors, which are called flexible or bending sensors, are actually capacitors or coils.  If you bend the structure the value of capacitor or coil going to  be changed. If you can produce the flexible sensor correctly and precisely, you will get good results. However, the sensor used as a strain gauges are includes crystals like piezo and these crystals produces electric vibrations in case of load vibration or bending.

Title: Strain gauges or flex sensors


问:
Arduino + SIM900: Identify if call is received?
I try to find command to identify if call is received and when user press any button of number on their phone. I use arduino + sim900A + Ethernet. I try alot but still no see command to do that. Are there any way exit ? If you know, please help me.</p>

答: AT + CLCC will get back number to know status of recipient</p>


问:
Polling or Timer interrupt?
We hope to build a simple line follower robot and we got a problem when we were discussing about PIC programming.

We planed to write a endless loop, check the sensor panel reading and do the relevant stuff for that reading.

But one of our friends told us to use a timer interrupt to generate interrupts in definite time periods and in each interrupt check the sensor panel reading and do the relevant stuff for that reading.

But we can't figure out which is best: the endless loop in main method OR timer interrupt method.

What is the best way, and why?

答:
Old post, still answering for other people's reference.

I am working on a similar project. Even to me a friend had suggested to use timer.

Finally my suggestion would be to use as high speed controller as possible (mine is 80MHz). Use 5us Timer Interrupt (Scheduler). Do the following in this  Scheduler Interrupt Routine:

CheckSensors()

ClockActuators() (if using Steppers then make all the Clk pins low initially  and then high the Clk for whichever motor needs to run)

StateChange() / ApplicationRoutine() / SwitchContext() (for more info on State Machine refer: https://barrgroup.com/Embedded-Systems/How-To/State-Machines-Event-Driven-Systems) (to be frank, could not digest the ending part of the article but got the idea. I am using simple Switch Case in StateChange().)

In main()'s while(1) loop:

Check Input from Keypad / Touch Screen / Serial Comm etc.

Update Display (If this is too long and makes Keypad response slow then try to put the above step i.e checking keypad/touch/serial in interrupt.)

Title: Polling or Timer interrupt?


答:
You can tell by the voltage.  LiPo batteries have a distinct "knee" in their performance, generally around 3.4V-3.6V:

It will be slightly different depending on the exact battery, and how you've arranged them in your battery packs (you need to account for the current load when measuring the voltage) -- so it makes sense to characterize your own battery first.

Since your batteries will be in a quadcopter, the best solution will depend on whether you favor the safety of the battery (immediate hardware shutoff) or the safety of the platform (warn the autonomy, allow it to land safely before it shuts itself down in software).


问:
What is killing the robots exploring Fukushima?
This article discusses how the robots sent to explore the Fukushima reactors have been damaged by radiation that exceeds 650 sieverts per hour:

http://www.theverge.com/2017/2/17/14652274/fukushima-nuclear-robot-power-plant-radiation-decomission-tepco

This is the seventh such robot that has died probing the reactor.  I assume the robots are well-shielded....

What exactly is damaging the robots (alpha, beta, gamma particles) and how? Is the damage permanent?

答:
Ionizing radiation can induce a voltage by freeing electrons in a material.

If the radiation is capable of freeing electronics at a rate faster than the material is capable of dissipating it, then the voltage grows to the point that it reaches the breakdown voltage of the material, at which point the material conducts electricity. This usually "fries" the object.

Support structures don't generally care about the induced voltages, but electronics would. The article you linked stated, as @Paul mentioned, that one robot failed because the tracks got stuck; on a previous unit the camera failed due to higher-than-anticipated radiation levels.