问:
Inverse kinematic orientation problem
I am trying IK for 5-DOF robot all revolute joint.

I am working IK with Jacobian inverse i.e

end effector velocity = J inverse * error vector.

In error vector I am feeding (x,y,z) positional error; this gives me correct positioning by first 3 joints only. later 2 joints are pitch and roll used for end effector orientation. How can I input my required orientation and calculate orientation error.

I have Jacobian matrix[6 X 5]  considering all 5 joints; so J inverse will be [5 X 6] matrix. Error vector [6 X 1] consisting first 3 element of positional error, but for last 3 element what should I feed to get required orientation for my robot and how would I calculate the orientation error and in which form I should input my orientation of end effector.

please help me out.

答:
Up till now, I am using the Euler angle representation but I have not been successful. After referring to the book "Robotics Modelling, Planning and control" by Bruno Siciliano form Springer publication. It is concluded that the Euler angle is only used for the manipulator having spherical wrist; the robot which doesn't have one need to use another representation i.e equivalent angle representation.

The orientation error vector or error in orientation can be calculated by the equivalent angle representation or angle-axis representation (both are same) of orientation.

If $R_d$ denotes desired orientation matrix and $R_e$ denotes rotation matrix computed form joint variables, then orientation error is calculated using

$$e_{O}=r \sin \vartheta$$

where $r$ and $v(nue)$ can be calculated from matrix multiplication as

$${R}(\vartheta, {r})={R}_{d} {R}_{e}^{T}({q})$$

This gives the $3 \times 1$ vector which is the orientation error about $X, Y, Z$ axis.
For more information one can refer book I mention above.

using equation

$$\begin{array}{l}{\vartheta=\cos ^{-1}\left(\frac{r_{11}+r_{22}+r_{33}-1}{2}\right)} \\ {r=\frac{1}{2 \sin \vartheta}\left[\begin{array}{l}{r_{32}-r_{23}} \\ {r_{13}-r_{31}} \\ {r_{21}-r_{12}}\end{array}\right]}\end{array}$$

Title: Inverse kinematic orientation problem


问:
What are good options for modifying drones?
I'm apart of a group at my University where we would like to build a drone/UAV and constantly add and modify parts on it.

We were thinking of using an Arduino or raspberry pi, but we really don't want to mess with PID loops. However, with these microcontrollers we can easily add multiple sensors and a GPS. We can build the frame, do soldering, and everything else, but we would like some type of pre-made PID loop or flight controller so we don't need to worry about the drone falling from the sky.

Would anybody have any recommendations for us? Maybe flight controllers that we can add anything else on top of, and then change the code. Or a pre-built drone where we can modify its code and add sensors.

Any help is extremely appreciated. Thanks!

答:
I would recommend looking at acquiring an Intel Aero RTF (Ready-to-Fly) drone, if your group can afford it.

It ships with flight controller, etc. already set up, and the Realsense camera includes IR and depth.

You will have to flash the firmware before you can really do much, but the git repo wiki holds your hand through this pretty reliably. and Intel's evangalist team is very responsive and dedicated. The default examples are pretty robust and informative and you can go from unboxing to basic autonomous flight and computer vision / machine learning just by walking through the wiki. Thanks to the Intel ecosystem, it supports some really neat advanced capabilities including the Movidius VPU, NVIDIA TX2, etc.

The most annoying thing we ran into was power supply; it ships "batteries not included" and also with no AC power adapter. Since it also uses a hard-to-find xt60 type connection, you'll have to order an XT60 to wall solution from Amazon separately.

HTH.

ContentLicense: CC BY-SA 3.0


问:
Line Follower optimization
I'm working on building a line follower robot and want to optimize its performance. It was suggested that I use a PID algorithm. I read a lot about PID but am confused a bit regarding following:

I've calculated the error_value using $k_p * proportional + ...$
But regarding the change in the motor speed I'm confused as to what to use during comparison the difference (i.e. currentposition - setpoint) or the errorvalue. That is should I use

```<code>if (difference > 0)
{ //code for changing appropriate motor's speed using error_value }
</code>```

or

```<code>if (error_value > 0)
{ //code for changing appropriate motor's speed using error_value }
</code>```

Also is there any specified range for the values of the constants $k_p$, $k_i$ and $k_d$?
I'm using a differential wheeled robot for my line follower.

Also I would be happy if someone suggests me any other advanced optimization algorithm for improving the line follower robot.

答:
You may want to check out this question on how to tune PIDs.

It sounds like you're confusing the role of error in this calculation.  The PID equation takes the error measurement (actual position - desired position) and determines how much "response" should be commanded in the controller (e.g. how much force).

So instead of saying if (error_value > 0) { }, you should be saying something like response = get_PID_calculation(error_value).  Depending on the construction of your specific vehicle, that response would be sent to the drive motor as the throttle amount, the steering as desired angle, or some other control input.

Title: Line Follower optimization


问:
Can the A* Algorithm be implemented on an Arduino easily?
I am not very experienced in working with C++. Working with Python is much more easier for me because of the large number of built-in mathematical functions present such as multidimensional array sorting and more. I went through the Udacity document on Motion Planning (Programming a Robotic Car) in Python and it seemed simple enough for me to implement. However, I would like to use the Arduino due to its simplicity and my need to interface other modules with it. Can someone suggest me an easier way or lead me to some resources that can help me code it in C++ for the Arduino? All the A* algorithm C++ source codes I've found online are either huge or difficult to understand. In my case, I'm planning to use a simple grid based implementation of the A* Algorithm. Thanks in advance.</p>

答:
You're welcome to steal the AStar class from my C++ highway driving project.

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

I used AStar to control a car driving on a simulated highway with traffic. In my case, state included position (along and across the highway), speed (along the highway), and time (which implicitly included the expected positions of other cars at that time). However, this AStar class supports any definition of state, including the more common case of position-only that you are interested in.

Here are the file that contains the AStar class:

https://github.com/ericlavigne/CarND-Path-Planning/blob/master/src/astar.h

You'll need to represent the state in order to use the AStar class. As an example, here are the files that represented my state. Your state with position only should be a trimmed down version of this.

https://github.com/ericlavigne/CarND-Path-Planning/blob/master/src/trajectory_state.h

https://github.com/ericlavigne/CarND-Path-Planning/blob/master/src/trajectory_state.cpp

And these files show how to combine the AStar class and a state class (TrajectoryState in my case) to perform A* optimization:

https://github.com/ericlavigne/CarND-Path-Planning/blob/master/src/discrete_trajectory_planner.h

https://github.com/ericlavigne/CarND-Path-Planning/blob/master/src/discrete_trajectory_planner.cpp


问:
Find IMU based on previous works
I'm building a quadrotor robot and my supervisor has asked me to make a report of the IMU modules used in previous works, I couldn't find such reports however. Does anyone know how to find such reports or how to find out what modules they've used? It's really urgent. Thank you all.</p>

答: In an academic setting, look for papers describing similar work to what you're doing, read them, and see if they mention the IMU used.  If they're describing how some hardware was used to accomplish some task, then they should include that information.</p>

Title: Find IMU based on previous works


问:
Receiver is getting really hot
I am building a quadcopter and I am on the last part of it (normally the exciting part) where I bind the controller to the receiver.

I can get the receiver, which is plugged into the quadcopter, to be recognized by the controller. The problem is that I can't get the controller to rotate the propellers.

When I touch the receiver it is hot. Not just warm, but very hot. I replaced the receiver already since it looked like the heat was too much and melted something on it.

Any thoughts as to why the receiver is so hot? Maybe it's because I hooked something up incorrectly? Perhaps the heat is causing the controller not to turn the motors?

Any thoughts or suggestions would be appreciated.

HARDWARE:

Controller - FlySky FS-i6

Receiver - FS-iA6 (6 channels, 2.4 GHZ)

Power Supply - Tattu R-Line 14.8V 1300mAh

The board it connects to is using 5v.

答:
Either the voltage supply to the receiver is too high, or something's not right about what you're trying to drive it with.

Compare the voltage supply to the receiver to the rated voltage of the receiver.  If the receiver specifies a voltage range (i.e. 3V - 5.5V), then the supply needs to be within that range.  If the receiver doesn't specify  a range, then +/- 10% is probably an OK range to assume.

If that's OK, try disconnecting everything from the receiver except for power, and see if it gets hot.  If you have a spare servo lying around (and if the receiver will take a servo), plug it in and see if it works.

Title: Receiver is getting really hot


问:
How to scan photo of printed image and see what pattern it represents
We're participating in a contest with our robot, and one of the challenges is to scan a pattern and see which pattern it is. There are 2 possible images(attached below), and for each of them the robot should place a cube in a specific place. We were thinking of using a colour sensor but that's not precise enough. The robot is wired to a smartphone, so we also thought of taking a picture of the pattern and making a java program to interpret it(that's what we've programmed the robot in), but we couldn't find any tutorials about that on the internet. So we will have 2 separate programs, and the only thing we can't work out is how to process an image so we can see which image we got and tell the robot to run the corresponding program. How could actually do this?

The images of the only 2 possible patterns:

答:
A way to tackle this problem (which is very broad in essence) is to use OpenCV to detect the hexagonal shapes in the picture taken by your smartphone. Then, once you know the locations of the figures in the image, extract the color with OpenCV as well and check if certain cell is orange/black to identify one pattern or another (you must know the existent patterns in advance).

The first link I provide is for shape detection with OpenCV in Python:
https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/

This one is for object detection in Java:
http://opencv-java-tutorials.readthedocs.io/en/latest/08-object-detection.html

Hope this helps.


问:
How do visual obstructions impact the ability to localize using LIDAR?
If a street is extremely crowded to an extent that the terrain is not visible from the point of view of the LIDAR (e.g. in google's self driving car), can it still manage to localize itself and continue to operate? I recall Sebastian Thrun saying that Google's car cannot navigate through snow filled roads since the onboard LIDAR cannot map the terrain beneath the snow (e.g. here).

[Edit : Based on the comments] Clarifying the context, here "not visible" means there is an obstacle between the LIDAR and the terrain

答:
The snow problem you're referring to seems to that the car can no longer tell where the edge of the road is.

Even in heavy traffic, a good driver still maintains enough space from the car in front that plenty of road is visible, and the side of the road identifiable from LiDAR. This is not common practice, but I imagine autonomous cars would be programmed to do so. In that case, plenty of road is always visible for the car.

Google's car seems to have no problems in heavy traffic.


问:
Rotation composition When using Kalman Filter
I am implementing a Kalman Filter for the following situation.
I have a camera set in a room that can detect the position and orientation of a marker (ARUCO) in the room.

Therefore I have the following frame transformations:

What I want to filter with the Kalman is the position and orientation of the marker: $[x, y, z, \phi, \theta, \psi]$ in the room frame.

I already have a prediction model for the marker (constant-velocity).

I am writing the observation model equations. I have the following relationships:

$$ X_{observed} = X_{marker/camera} = R_{camera/room}^T \cdot X_{marker/room}$$
and
$$R_{observed} = R_{marker/camera} = R_{camera/room}^T \cdot R_{marker/room}$$

With these expressions, I express the observation with respect to the estimated variables:
$$X_{marker/room} = (x,y,z)^T$$
$$R_{marker/room} = eul2mat(\phi, \theta, \psi)$$

However, the function $eul2mat$ and the matrix multiplication introduce some non-linearity. Which forces me to use an Extended Kalman Filter. Now I still can figure out the math of this. But the math becomes too complicated for what I'm trying to solve

Of course, if I look at the problem differently. Let's say I only try to filter the pose of the marker in the camera frame. Then the equations are much simpler (a lot of identity matrices appear), and the system is linear.

So here is my question:

Is there a way to make the equations of this system simpler?

PS : This is a simple case, where I don't really need to estimate the full transform directly (marker to room frame). But there might be cases where I need to estimate the full transform so that the state vector might be available for another filtering.

答:
Your post  makes it seem like you have the camera state. If this is true then you could estimate the pose of the marker in the camera frame. You could transform the marker  pose estimates to the room frame outside of the kalman filter.

You also state you're assuming a constant velocity model. This would involve estimating the velocity of the maker in addition to the position. This is missing from your state vector which only includes position and orientation.

You have not mentioned if your camera will be moving around. If the camera does move around this would slightly complicate the prediction update of your kalman filter (assuming you have information about the camera state). You will have to update the predicted marker state given the (assumed) known change in camera state.

Moreover, if you choose to estimate the velocity of the marker with in a moving and rotating camera frame, you will be estimating the velocity in a non inertial reference frame. This can be handled but you may find it easier to estimate the velocity of the marker in the room frame which is inertial.


问:
Mathematical prerequisites for beginning graduate student in robotics
A beginning graduate student in robotics asked me the areas of mathematics that he should brush up on (prerequisites) to begin a masters research program in robotics. What are some good materials/books that are indispensable for a research student? Which ones should we suggest in order that the student develops a solid foundation in robotics?</p>

答: Since robotics is a combination of Electrical, Mechanical and Software Engineering the maths for those fields is obviously relevant. On top of that I would argue that in robotics it is very helpful to have good knowledge of linear algebra, probability and control theory. A good grasp of mechanics obviously helps as well. </p>


问:
Transforming an inverse covariance matrix
I have a linear map, $J$, from one space to another. I can transform a covariance matrix, $P$, from one space to another by using:

$P' = JPJ^{T}$

However, in my situation I have an inverse covariance matrix, $P^{-1}$

The simplest way that I can think of transforming this is:

$P'^{-1} = (J(P^{-1})^{-1}J^{T})^{-1}$

which then using

$(A*B*C)^{-1} = C^{-1}B^{-1}A^{-1}$

should give

$P'^{-1} = (J^{T})^{-1}P^{-1}J^{-1}$

however, when I try this in MATLAB I do not find that these two representations are equal.

$(J(P^{-1})^{-1}J^{T})^{-1} = (J^{T})^{-1}P^{-1}J^{-1}$

答:
It is actually correct.

I was comparing the two matrices using "==" which has no epsilon for comparing floating point numbers.

$(J(P^{−1})^{−1}J^{T})^{−1} = (J^{T})^{−1}P^{−1}J^{−1} = (JPJ^{T})^{-1}$


问:
Real-time video processing on video feed from a drone's camera
I am working on a project where I want to run some computer vision algorithms (e.g. face recognition) on the live video stream coming from a flying drone.

There are many commercial drones out there that offer video streams, like

http://www.flyzano.com/mens/

https://www.lily.camera/

etc..

But none of them seem to give access to the video feed for real-time processing.

Another idea is to have the drone carry a smartphone, and do the processing on the phone through the phone's camera. Or just use a digital camera and an arduino that are attached to the drone.

Although these ideas are feasible, I would rather access the video-feed of the drone itself. So my question is that are there any drones out there that offer this feature? or can be hacked somehow to achieve this?

答:
Another option is to build your own drone, for example with a PixHawk Autopilot. Then connect your PixHawk to an embedded computer as the Odroid XU-4 or the (way more powerful) Nvidia Jetson TX2.
Both of them support Linux (on the TX2 you have linux ubuntu for tegra)
Then you could choose your own camera (I am actually in the process of selecting a new camera for our drones) and interface everything through ROS.

Of course, this is not trivial and it requires some expertise. But I firmly think it is one of the best options out there. Especially using the TX2 because it could open also to you the world of Deep Learning onboard the quadrotor. This is true because the NVIDIA Jetson TX2 has a GPU which is meant for deep learning application.

I hope this will help.


问:
How do you dim 12 volt LEDs?
I was considering using a Raspberry Pi controlling a USB Relay to dim 12V LED lights, but I'm having trouble finding a solution that isn't a simple ON/OFF.  What type of device would I need for dimming?</p>

答:
You probably want a PWM (pulse width modulation) solution. Essentially this means flashing the led on and off faster than you can see. To make it brighter, you increase the amount of on time versus off time.

You could use an external PWM LED driver, or possibly you can produce PWM from the GPIO ports on the Pi and step it up using a transistor and / or relay.

Title: How do you dim 12 volt LEDs?


问:
Talking to a Flask Webserver from a Commandline
Have a bunch of work in setting up a flask webserver to control a robot from an app, and I'm not too pleased with the results for driving.  Touch sensitivity issues are driving me nuts, and looking to maybe try a slightly different route instead.

The flask server has a bunch of empty page web requests(my term) where it has a page for http://192.168.10.1/Forward and some python code to control the motor controller.  When you go to that URL the code executes in the background and the car goes forward. Have all the URL's mapped to buttons in an app and it works till the screen thinks you let go which is constant and pretty aggrevating.

I've now setup a python script with EVDEV to find and search for joystick events which works.  I thought I could use something like this on the event:

```<code>webbrowser.get('lynx').open('http://192.168.10.1/Forward')
</code>```

And it would goto the url with Lynx...but sadly Lynx then wants you to hit Q to Quit then you can send another Joystick command.  I guess there's a way to kill the process after each hit but that seems messy.

If there another way I might be able to do something like that without installing the GUI and does not involve having to figure out how to make two scripts talk to one another a different way all together?

Regards,
Matt

答:
If you're already in Python, use one of the URL libraries, such as urllib.request

On the commandline, you can use curl or wget.

When you go to that URL the code executes in the background and the car goes forward.

You shouldn't really be using GET requests where there is a side effect. https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html


问:
Solving Inverse Kinematics with unknown orientation
This may be a very basic question, but I haven't had much success finding an answer. I'm currently trying to solve the inverse kinematics of a 3-RRR Planar kinematic arm, whose purpose is to move between points on a graph.

In most theoretical cases the (x,y) coordinates and the orientation of the end effector are known. However, in my case I only know (x,y) coordinates and frankly don't actually care about the orientation of the robot.

My current approach has been to use DH-parameters to solve for each angle. This works, assuming I know the orientation of the end effector, which I do not.

Any help will be greatly appreciated, thank you!

答:
There is no way that you can solve for an IK solution without you -- either explicitly or implicitly -- specifying a criterion for choosing one solution among many others. But that does not mean that solving an IK problem without having any preference on the orientation (or translation) is not possible.

If you solve IK problems analytically, you can just randomly select one orientation and then solve the corresponding IK problem.

If you solve your problems numerically, you already implicitly tell the program which solution to choose by giving the program an initial condition.


问:
Quadcopter stable with angular velocity but not with absolute angle
I'm making a flight controller for quadcopter. It is very stable when regulated by angular velocity, but it is horrible when regulated by angle. What are the potential problems when regulating a quadcopter by angle?

System description:

Input:

I'm using MPU6050 configured with low-pass filter for 185Hz cut-off with 2ms delay on both the 3-axis acceleration and angular velocity data. The angular velocity is filtered again with low-pass filter:

```<code>(AV = AVn * alpha + AVn-1 * (1-alpha)), alpha = 0.8
</code>```

The accelerometer angle is calculated using:

```<code>pitch_a = atan2(x_a, sign(z_a) * (sqrt(sqr(z) + zqr(y) * 0.001))) * 180/pi;
roll_a = atan2(y_a, (sqrt(sqr(x) + zqr(z))) * 180/pi;
</code>```

The angular velocity is integrated over the last fused angle:

```<code>pitch_g = pitch + av.y * dt;
roll_g = roll + av.x * dt;
</code>```

And the resulting angle is fused with the calculated accelerometer angle using complementary filter with alpha = 0.98.

This is done with new sensor values every 2ms.

Regulation:

I'm using cascaded PI-P controller. The inner P controller's input is angular velocity and its output is motor power difference. The outer PI controller's input is absolute angle and its output is angular velocity. The outer controller is disabled when controlling the quadcopter by angular velocity. The inner controller runs every 2ms with accuracy of 8us and output limit of +-70. The outer controller runs every 8.5ms with accuracy of ~100us and output limit of +-250. I'm using this library, slightly modified to run when I call it, output integers, use microseconds and zero the integral sum when at very low throttle.

The setpoint is sent from the remote every 50ms, slightly filtered.

Output:

The output from the inner controller is added and subtracted to the according motor. The motors drivers' are controlled with 8-bit 490Hz PWM ranging from 127 to 254.

When controlling the quadcopter by angular velocity it flies stable with P value ranging from 0.2 to 0.8, noisy sensor input and even with one different motor. When controlling it with angle it behaves randomly. It starts to pitch or roll from level orientation, it seems to respond well to step input when it has to pitch or roll but returns to level very slow and overshoots... The angle control feels like a very bad angular velocity control (even tho the angle input is cleaner and it shouldn't have noticeable delay based on the fusion equation). The P range I have tried is approximately 0.5 to 2.0 and the I range is approximately 0 to 0.3. The inner controller runs 4.25 times faster the outer controller.

What can be the problem?

答:
I feel you are feeding Gyro angle which is not under the control of complimentary filter, as accumulation of pitch and roll would have drifts which complimentary filter will not be able to recover. Hence my suggestion is to implement as below:

```<code>pitch = 0.98 *(pitch + av.y*dt) + 0.02*pitch_a
roll = 0.98 *(roll + av.x*dt) + 0.02*roll_a
</code>```

I believe your accumulation (basically integration) is causing problem of drift. See if you can implement as above.

Body:
I feel you are feeding Gyro angle which is not under the control of complimentary filter, as accumulation of pitch and roll would have drifts which complimentary filter will not be able to recover. Hence my suggestion is to implement as below:

pitch = 0.98 *(pitch + av.y*dt) + 0.02*pitch_a
roll = 0.98 *(roll + av.x*dt) + 0.02*roll_a

I believe your accumulation (basically integration) is causing problem of drift. See if you can implement as above.


答: You could try using the MPU6050 integrated DMP for angle measurements. That will possibly help to locate the issue.</p>

Title: Quadcopter stable with angular velocity but not with absolute angle

Body:
I'm making a flight controller for quadcopter. It is very stable when regulated by angular velocity, but it is horrible when regulated by angle. What are the potential problems when regulating a quadcopter by angle?

System description:

Input:

I'm using MPU6050 configured with low-pass filter for 185Hz cut-off with 2ms delay on both the 3-axis acceleration and angular velocity data. The angular velocity is filtered again with low-pass filter:

```<code>(AV = AVn * alpha + AVn-1 * (1-alpha)), alpha = 0.8
</code>```

The accelerometer angle is calculated using:

```<code>pitch_a = atan2(x_a, sign(z_a) * (sqrt(sqr(z) + zqr(y) * 0.001))) * 180/pi;
roll_a = atan2(y_a, (sqrt(sqr(x) + zqr(z))) * 180/pi;
</code>```

The angular velocity is integrated over the last fused angle:

```<code>pitch_g = pitch + av.y * dt;
roll_g = roll + av.x * dt;
</code>```

And the resulting angle is fused with the calculated accelerometer angle using complementary filter with alpha = 0.98.

This is done with new sensor values every 2ms.

Regulation:

I'm using cascaded PI-P controller. The inner P controller's input is angular velocity and its output is motor power difference. The outer PI controller's input is absolute angle and its output is angular velocity. The outer controller is disabled when controlling the quadcopter by angular velocity. The inner controller runs every 2ms with accuracy of 8us and output limit of +-70. The outer controller runs every 8.5ms with accuracy of ~100us and output limit of +-250. I'm using this library, slightly modified to run when I call it, output integers, use microseconds and zero the integral sum when at very low throttle.

The setpoint is sent from the remote every 50ms, slightly filtered.

Output:

The output from the inner controller is added and subtracted to the according motor. The motors drivers' are controlled with 8-bit 490Hz PWM ranging from 127 to 254.

When controlling the quadcopter by angular velocity it flies stable with P value ranging from 0.2 to 0.8, noisy sensor input and even with one different motor. When controlling it with angle it behaves randomly. It starts to pitch or roll from level orientation, it seems to respond well to step input when it has to pitch or roll but returns to level very slow and overshoots... The angle control feels like a very bad angular velocity control (even tho the angle input is cleaner and it shouldn't have noticeable delay based on the fusion equation). The P range I have tried is approximately 0.5 to 2.0 and the I range is approximately 0 to 0.3. The inner controller runs 4.25 times faster the outer controller.

What can be the problem?


问:
How do I tune the cascaded PID controller in my flight controller?
there is a lot of information out there on how to tune quad PID parameters. However, they mostly regard only the master loop that takes user input and fused absolute angles. How and in which order do I tune my cascaded PID loops? Do I first do the rate loop? How can I tell if it's tuned correctly? I can cause it to spin the drone 2 times a second around itself, and that with low throttle. It stops quickly when I reset the stick position.

I feel stupid because I cannot tune the controller I built myself, but maybe you can explain it to me.

答: I have since tuned the system just by using trial and error. The rate constants are much lower than their maximal values at which oscillation started. It helped to just measure which loop caused oscillations when they happened.</p>


问:
What are good strategies for tuning PID loops?
Tuning controller gains can be difficult, what general strategies work well to get a stable system that converges to the right solution?

答:
Embedded.com has moved my article yet again, but here is where it is now.  This shows you both how to write a PID loop (figuring out how to do it in something other than floating point is left as an exercise to the reader) and how to tune it.

PID Without a PhD

The best way depends a lot on your abilities.  The way to get the best tuning, assuming you're an experienced control system hand, is usally to measure the response of the plant ("plant" == "the thing you're controlling"), then depending on how you did the measurements extract a model of the plant and design to that, or just design directly to the measurements.

For certain difficult plants you'll find that you can't ever make satisfactory measurements, in which case you have to go by models alone.  Those are rare, but satisfying when you get them working.


问:
Potentiometer as pressure sensor in linear actuator?
I'm trying to use a linear actuator (sample electric cylinder) for a soil penetration device. Originally, I thought of using a pressure sensor to know when/if I hit a rock. However, I am not seeing many linear actuators with integrated pressure sensors but they do come with potentiometers. So I am thinking, would it be possible to use the potentiometer as a rough way to know if I hit something?

Basically, my program would check if its position does not change for a small time interval. If the position has not changed before it extends the maximum length, then the actuator must have hit something it cannot penetrate well.

Anyone have any ideas?

答:
Pressure: First of I would prefer to use piezo pressure sensors. But you can use pressure sensitive resistor films like velostat: https://www.adafruit.com/product/1361

Proximity: Alternatively, You can use sensors such as capacitive or inductive proximity sensors. It is used quite frequently in the industry to detect touch and contact or measure temparature or distance. For example:

https://playground.arduino.cc/main/capacitivesensor?from=main.caps France

https://www.sick.com/ag/en/proximity-sensors/capacitive-proximity-sensors/c/g201659


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

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

答:
Both your computer and your servos need supplies at a lower voltage than your battery supplies.  So you need some sort of voltage regulation between battery and "the rest".  Just make sure that the servo side is current limited.

Better, make sure that the one to the servos is current limited, and that it indicates to the processor that it's in current limit.  That way if it goes into current limit for more than a moment you can shut the whole thing off.


问:
Could a hot air balloon be powered from the ground like a drone?
Could a small drone electric hot air balloon be made to stay in the air indefinitely?

Use an electric element for heating the air. Powered and tethered from the ground like a kite on a string it would not need a battery.

答:
The other option would be a laser. The baloon could reach migher altitudes without the corresponding increase in wire weight. Of course, it would need some means of holding position. Which it might need anyway - a blimp, for example, will need to be flown actively against a storm when tethered.

Obviously, the baloon needs to be made of some material which can withstand the constant firing of laser.

Microwave power could also be used. IIRC, there was some 1960's idea to power a helicopter that way...yes, here we go: https://en.wikipedia.org/wiki/Beam-powered_propulsion#Non-spacecraft_applications


问:
State space model
I want to design a LQR controller for my two wheeled mobile robot. While designing the controller, I need to find gain, K for the LQR which this required the state space model of wheeled mobile robot. My question is how to find the matrix A, B, C and D for this nonlinear system by using the equations below.

The outputs are x, y and theta while inputs are v and w.

答:
Unfortunately, you're trying to apply a linear controller (the L of LQR) to a nonlinear system. In general, this doesn't work.

As an approximation, you could linearize the system. If the nonlinearities are small it's common to linearize about a nominal point such as $\theta=0$, but in your case this might not work well since it would eliminate any lateral dynamics.
$$
\begin{align}
\dot{x} = v
\\
\dot{y} = 0
\\
\dot{\theta} = \omega
\end{align}
$$

Another option would be to linearize every timestep. This could get expensive though as your feedback gain matrix, $K$, also needs to be recalculated each time.

Finally, a middle ground could be to linearize about several predefined points, e.g. $\theta=[-20,-15,-10,0,10,15,20]$. At each timestep you would separately compute the control action using the $K_j$ computed for each of these linearization points and then interpolate between those values based on the current $\theta$.

Title: State space model


问:
How can i tell if my HS-485HB Servo is an Increased Rotation servo?
Our Robotics Team (Go TuxedoPandas! ordered a mix of regular and "Increased Rotation" servos from Servo city.

However,it appears only the outside packaging is marked. And only with a sticker.

Is there any visual indication on the servo that it is Increased Rotation?

答: An 'Increased Rotation' servo will not have a distinctive difference just by looking at the outside.  It will become apparent when you plug it in and run it with a servo controller.  This servo will rotate approximately 0.2 degrees per microsecond change in signal.  This means it'll yield approximately 180 degrees provided a 1050-1950usec signal (change in 900usec * 0.2 degrees per usec).  A stock servo, given the same signal range would rotate approximately 90 degrees since it moves about 0.1 degrees per usec.  </p>

ContentLicense: CC BY-SA 4.0


答: Using a pot, or a linear encoder, could let you know when the actuator is no longer moving.  But I would not call that a pressure sensor.  If you want to know the actual pressure for a dirt-penetrating device, you could use a piezo crystal, or another tip device that responds to pressures (see haptic sensors).  Alternately, you could sense the current into the actuator to determine the impedance of the environment.  </p>

Title: Potentiometer as pressure sensor in linear actuator?

Body:
I'm trying to use a linear actuator (sample electric cylinder) for a soil penetration device. Originally, I thought of using a pressure sensor to know when/if I hit a rock. However, I am not seeing many linear actuators with integrated pressure sensors but they do come with potentiometers. So I am thinking, would it be possible to use the potentiometer as a rough way to know if I hit something?

Basically, my program would check if its position does not change for a small time interval. If the position has not changed before it extends the maximum length, then the actuator must have hit something it cannot penetrate well.

Anyone have any ideas?


答:
Yes, you'll see the position become fairly stable when you've hit a rock (assuming that your bot is heavy enough to stall your actuator).

Measuring current will also tell you if you've stalled/are stalling.  I have used a Pololu controller which apparently has current feedback over USB but I have not used that feature.  I suggest that you use something like this rather than building your own H-bridge and current sensor.  It will make it easy to experiment with different approaches.


问:
How to use PID control for line following robot?
It's me the greatest noob again.thank you very much for your last help guys.Now,this time I am with a line following robot.I want to use PID control in it.But I'm not getting any perfect resource from where I can learn it.I want to be fluent with it and learn it from the deep.please suggest me some resource from where i can get help.suggest me something that will teach me from beginner level to pro level.I want to learn it from the root and also implement it in my line follower simultaneously. you can also suggest any good algorithm or control system for my line follower.it will be very kind of you.

Thanks in advance.you guys are awesome.

答:
I struggled with this for a long time.  I'm still struggling.  I've used a PID for my (RTK) line-following tractors so far.  They are barely good enough.  I'll try to describe generally how I did it.

Use a PID which varies in output from 0 to 90.

Calculate the cross-track distance (XTD).

Feed the PID with the XTD.

Use the output of the PID to determine the desired course.  0 means "head parallel with the line," and 90 means "head perpendicular toward the line."

Steer (using an IMU) to the desired course.

Sure, it works, but I recommend Pure Pursuit.


问:
Is it possible to put the irobot create2 in a mode where it will not charge?
I recently purchased an iRobot Create2 and have had a lot of issues in the last few weeks with the battery being dead when I go to use it. The robot almost never leaves its charger at this time because I am still working on coding it. This makes me wonder if there is a state I could be leaving the robot in that is preventing it from charging. The only way I can get it to charge is to do a hard reset which then allows it to start charging. My suspicion is that if you put it in full mode and disconnect from it that it can not charge. Can anyone confirm or deny this?</p>

答:
See page 4 create_2_Open_Interface_Spec.pdf

In Passive mode, Roomba will sleep after 5 minutes of inactivity to preserve battery power. In Safe and Full modes, Roomba will never sleep, and if left in this state for an extended period of time, will deeply
  discharge its battery, even if plugged into the charger. The charger will power Roomba in all modes, but it will not charge the battery in Safe or Full mode. It is important that when you are finished working with Roomba that you issue either the Passive or Stop command to protect the battery.


问:
Limits of PWM, Timers and Interrupts?
I have a robot with two wheels/motors and each has a quadrature encoder for odometry.  Using the wheel/motor/encoder combo from Pololu, I get 48 transition changes per rotation and my motors give me a max of 400RPM.  I've found it seems to miss some of the encoder state changes with the Pololu wheel encoder library.

Would I run into issues or limitations on my Arduino Uno using interrupts to track the quadrature encoders while using PWM to drive my motors through an H-bridge chip?

答:
When I'm processing quadrature encoder input in an ISR, I prefer to have a simple ISR running on a timer that's guaranteed to run fast enough to catch every state (not state change) of the encoder.  Interrupting on every pin transition invites a situation where the processor gets bogged down if a pin starts bouncing.  Interrupting at a fixed rate may use up processor resources all the time, but it always uses the same amount of resources, so it doesn't catch you by surprise when you least want it to happen.

For your 48 transitions/rotation, 400RPM motor, that works out to 320 transitions per second: I would set my ISR to interrupt at least twice that fast.  It should do nothing but check the current state of the two pins against the previous one, and then increment or decrement the wheel's counter as appropriate based on what it sees.  At 640Hz, such an ISR should load the processor very lightly, even if you're doing updates for multiple wheels.

I've built quite a few successful control systems that use this method, so it can't be all bad.

OwnerDisplayName: Robert

Title: Limits of PWM, Timers and Interrupts?


问:
Plotting SE(3) points in a 3D graph
I have a data-set containing points in SE(3), i.e the 4 $\times$ 4 transformation matrices and the corresponding dual quaternions. Now, I want to plot these points in a 3D graph. How to generate this plot?</p>

答:
A point in SE(3) has six degrees of freedom, so the three DOF's in a 3D plot would not be sufficient to capture this. I would split it up into two 3D plots. One of them would be quite straight forward, namely just plot the 3D position vector. The other plot should capture the information of the attitude part. There are multiple ways of representing this in 3D, such as Euler angles or axis angle representation, where the axis is of unit length and then scaled that by the angle. I myself would prefer the last one.

If your SE(3) is represented as a 4 by 4 matrix

$$
M = \begin{bmatrix}
R & p \\ 0 & 1
\end{bmatrix}
$$

with $R\in\mathbb{R}^{3\times3}$ a rotation matrix and $p\in\mathbb{R}^{3}$ the position vector. So the position vector $p$ is straight forward to extract. The axis angle information can be extracted from $R$ after some calculations

$$
\theta = \cos^{-1}\left(\frac{\mathrm{Tr}(R)-1}{2}\right)
$$

$$
\begin{bmatrix}
0 & -v_3 & v_2 \\
v_3 & 0 & -v_1 \\
-v_2 & v_1 & 0
\end{bmatrix} = \frac{R - R^\top}{2\,\sin\theta}
$$

Title: Plotting SE(3) points in a 3D graph


问:
What do the model numbers in Harmonic Drive gear drives represent?
According to one of their brochures, Harmonic Drive numbers their models with numbers like 8, 11, 14, 17, etc.

I noticed that Chinese suppliers like Laifaul have a similar numbering scheme, though it is not clear to me that they correspond to the same specs that that the Harmonic models do.

Do these numbers have some physical significance?  Torque?  Dimension?  Or are they just some legacy model numbering scheme?

答: It is the pitch diameter of the flex spline in inches/10. You can see it used it their equations for thrust force on the wave generator.</p>


问:
Reducing motor speed without jamming up
So I built three little bots so far.

One with a raspberry-pi, (6V motors), one with an arduino (12V motors), and another with an arduino but a hacked remote car (7ish, volt motors):

The problem I have with all these is that the motors spin so fast the car just bumps into something in a few seconds. (I have a small house)

I tried to use PWM to control the speed, but at a little less than full throttle (255) they jam up and they can't take the weight I put on them.

Should I buy one of these chassis that slow the motor down and give it torque with a gearbox, or is there anything else I can do?

答:
When you PWM the voltage to the motor you are effectively controlling the current to the motor which is related to torque (acceleration).  The "jamming up" that you notice is basically the inability of the motor to overcome friction.

Think about the PWM as the gas pedal in your car, to get to a constant speed you may push all the way down, gradually back off as you reach your target speed and then modulate it to maintain that speed.

A DC motor driven at a fixed voltage loses torque as it goes faster and faster.  That's why it doesn't speed up to infinity.  Gearing it down effectively limits the top speed you'll see at the output.  It gives you more torque at the output but you're trading off speed.

As Tim notes what you need is a closed speed control loop running over that such that you set a speed set-point and the loop, very quickly, ramps the PWM up and down to maintain the speed.  To do that you need some way of measuring the speed.  Once you have that you may be able to get by with a relatively simple PI controller.

Title: Reducing motor speed without jamming up


问:
Calculating error on line following robot (PID)
I am kind of new to control systems and I am currently making a line follower using PID loop. I am using 6 IR LED Photo-transistor pairs to detect the line but I am not sure how to calculate the error. I searched online and many people use error = set point - position(current), but I am struggling to figure out how to use the input from the 6 sensors to get a precise position.

PS- I tried the loop with digital sensor input and it worked (giving each case an error value) but I am planning to analog values of sensors.

The line width is approximately 1.7 cm and it is a white line on a black track. Also this project is for a competition, and I would really appreciate any advice on which micro controller to use (currently using STM32F401RE or Arduino Uno) or any other thing I can do to make the robot faster and better. Cheers!

答:
I order for you to use a PID loop for line follow, you are going to need an error that is proportional to the distance you are from the line.  That may not be possible with the sensors you are describing.  The best you can do is when the light sensors are analog (their output is proportional the the amount of line they see and they have a beam width that is the same as the width of the line.

If that is the case, line the sensors up so they are spaced one beam width apart as follows:

L3-L2-L1-R1-R2-R3

Then error = 3*L3+2*L2+L1-R1-2*R2-3*R3

For more information and other techniques, here is an article on PID line following techniques with LEGO Mindstorm.  Line follow is used a lot in FLL (First Lego League).

Follow-up:
It looks like the sensor you are using (TCRT5000) can be used as an analog sensor.  It is an active sensor so that will help with ambient light rejection.  The algorithm described above for calculating error should work if you want to do PID control.

See the Application Note for the TCT5000 for more information on how to use the sensor.  The section on 'Resolution' should help you set the sensor spacing.  If possible, set the senor height so that the resolution is smaller then the line width; but, no so small that the line could fit within the "gap" between the sensors (ideal is no gap).


问:
Dynamic model of two wheeled mobile robot
I wanted to design a LQR controller for my two wheel mobile robot. What are the equation of two wheeled mobile robot can be rearranged into state space model? My two wheeled mobile robot is nonlinear system. The outputs of the system are v, linear velocity and w, angular velocity while the inputs of the system are x, y and theta. </p>

答:
At first we should define what a dynamic model is. A dynamic model is equal to a physics engine. The input value is given to the engine, and the engine calculates where the robot will be in the next timestep. The calculation is done with a sinus function, Dynamic Modeling and Stabilization of Wheeled Mobile Robot  For example: the robot looks to north, and both wheels are spinning. Then the robot will drive to north. If only the right wheel is spinning, then the robot will not drive to north but in a slightly different angle to the right.

Let us increase the abstraction level a bit. Writing down the formula for a dynamic model is equal to program a physics engine from scratch. Modeling a two wheeled robot is a special case. The better approach is to use a general purpose physics engine like Physx or Box2D which can not only model a single robot, but a robot plus obstacles. These kind of general purpose physics engine are also using mathematical formulas with sin and cos but are able to model any system: a wheeled robot, a wheeled robot in a maze, an inverted pendulum and so forth. The term is used for the aim to implement real software, for example in Matlab or C++. While the term “dynamic model” is used in theoretical lectures about optimal control.


问:
Calculating covariance of parameter estimation from Hessian
I need a covariance of parameter estimation for reliability estimation. According to the this post, I know the approximation of the Hessian can be calculated as

$$ \sigma^2 H^{-1} = C $$

where H is Hessian, C is the covariance and sigma is the variance of residual. I am trying to understand where it came from and how it is derived but I could not find a related material anywhere. Anyone knows a good reading material regarding this?

答:
The following two materials explain the problem clearly.

Why Hessian is same as covariance matrix.
https://onlinelibrary.wiley.com/doi/pdf/10.1002/9780470824566.app1

How JtJ can be a Hessian approximation.
https://www8.cs.umu.se/kurser/5DA001/HT07/lectures/lsq-handouts.pdf


问:
Coordinate system of SCARA Manipulator
I am trying to understand how to draw coordinate system for forward kinematics. Figure is

Could someone please explain how is the coordinate system drawn as per DH parameter? Basically when do we have to shift the origin of a frame and when not?

P.S: I mainly do not get how they drew frame 2. Why was it not shifted to frame 1's position?

答:
The steps to define a frame for the DH parameters are the following:

$Z_n$ axis in the direction of motion of joint $n-1$

$X_n$ axis such that it is perpendicular to both $Z_n$ and $Z_{n-1}$ and runs from $Z_{n-1}$ to $Z_{n}$ (this defines the origin). The special case here is when both Z axes are parallel and thus there are infinite solutions. In this case, you just choose one.

$Y_n$ axis to complete the right hand rule

What this means is that frame $n$ moves with joint $n$ even though its $Z$ axis passes through the axis of $n+1$. This can be confusing. I'll go through each frame in your example which will hopefully make sense:

Does not move. $Z_0$ goes through joint 1 $X$ goes anywhere you like perpendicular to $Z$ and $Y$ follows.

$Z_1$ goes through joint 2. When it comes to $X_1$, we are in the special case. Take the $X_1$ currently drawn on your diagram and shift down so it intersects $Z_1$ lower than the joint 2. Is it still perpendicular to $Z_0$ and $Z_1$? Does it still run from $Z_0$ to $Z_1$? Yep. There are infinite choices at all the possible heights which are all valid. This particular choice makes sense because it places the origin right in the middle of joint 2. So if we wanted to know the pose of joint 2, we could just take the transform of frame 1. $Y$ follows as always.

$Z_2$ goes through the axis of joint 3 (which is a linear axis). This is one reason why frame 2 could not be in frame 1's position, frame 2 must have a $Z$ passing through the axis of joint 3 and frame 1's position does not lie on this axis. For $X_2$, we are in the special case again. Again the choice to put $X_2$ at the origin of joint 3 makes it easier to identify the location of orientation of joint 3 without an extra transform.

$Z_3$ goes through the axis of joint 4. Again we have a special case and again the choice makes things convenient.

End-effector frame: Technically you could choose any $Z_4$ here, but your choice would influence where you can put your origin. If you choose $Z_4$ as parallel to $Z_3$, we get the special case again, and can easily place the origin at a particular point of interest. This is the most common method for the end-effector frame.

Some notes:

In some cases, you may want to choose a different end-effector $Z$, like if you had a camera on the end and cared more about the orientation of the line-of-sight. This would however constrain your origin to a particular position that may not be the 'location' of the camera.

When given a free choice with the $X$ axis, your choice does not affect any of the subsequent frames. You could slide the current $X$ choices up and down their $Z$ axes as much as you like and none of the rules would be broken.

There's actually another special case, whereby the $Z_{n-1}$ and $Z_n$ intersect. The $X$ axis is the normal to the plane they form, but it's direction is a free choice, so there are two solutions rather than the usual one (or special infinite).

Title: Coordinate system of SCARA Manipulator


问:
SVO edgelet computation
One of the nice contributions of SVO is that it has proposed a way to use 2d edge features in pose optimization by point-to-line constraint. But in the actual code, I could not find where it is assigning any feature with edge type property. I thought the feature detector part does it but it was not. The results from the feature detector do not say whether the feature is edge type or not. Anybody know how it works?</p>

答: The open source version of SVO does not have the added option of the edgelets. That can found in SVO2 which is closed source. However, there is a fork of SVO where someone added the edgelet capability which can be found here.</p>

Title: SVO edgelet computation


问:
How to program a continuous servo motor? (Arduino)
I need to use continuously rotating servo for a camera stabilization system. My professor bought servos that have already been modified for continuous motion--there's no stop in the gears, and the potentiometer allows it to spin 360+ degrees.

I am currently using PWM with an Arduino Uno. The servo does spin continuously, but not in a stable way. I've also taken out the potentiometer in another one of the servo, and on a third servo I used a voltage divider in place of the potentiometer.

I've tried static values and a "sweep" from 0% duty cycle to 100% to get a feeling for how they work, but I just cannot figure it out. I greatly would appreciate any tips on this.

Here is my code:

```<code> //PWM test for continious motion Servo

 int servoPin = 9; // connect servo to pin 10
 int pwmVal = 0; // declare pulse width modulation value

void setup(void) {
  pinMode(servoPin, OUTPUT); //set up the servoPin as an output pin
  Serial.begin(9600); // begin serial monitor
}

void loop(void) {

  //for loop that sweeps values from 0 to 255
  for (pwmVal = 0; pwmVal <= 253; pwmVal += 1) {
    analogWrite(servoPin, pwmVal);
    Serial.println(pwmVal);
    delay(100);
  }
  for (pwmVal = 253; pwmVal >= 0; pwmVal -= 1) {
    analogWrite(servoPin, pwmVal);
    Serial.println(pwmVal);
    delay(100);
  }

  //assign a static pwm value
  pwmVal = 0;
  analogWrite(servoPin, pwmVal);
}
</code>```

答:
If your servos are just regular servos modified for continuous rotation, the way to control them is to send a 50Hz PWM signal (20ms period) with a high level time between 1ms (full left) and 2ms (full right).
You can use the Servo arduino library, which is very easy to use.

Then, Lets assume the servo potentiometer is approximately set to what should be the middle position for the servo.

For continuous rotation to the left, just write myServo.write(0).
The servo will rotate to the left, but since the potentiometer is disconnected from the servo's head, it will never reach the good value, so the servo will keep turning.

To go to the right, use myServo.write(180).

Stopping the servo might be harder, since you have to find exactly the current position of the potentiometer, but you should manage to do it by several trials.

```<code> #include "Servo.h"
 int servoPin = 9; // connect servo to pin 10
 myServo = Servo();

void setup(void) {
  myServo.attach(servoPin);
  Serial.begin(9600); // begin serial monitor
}

void loop(void) {
    myServo.write(0);
    Serial.println("going to the left!");
    delay(2000);

    myServo.write(180);
    Serial.println("going to the right!");
    delay(2000);
}
</code>```

Body:
If your servos are just regular servos modified for continuous rotation, the way to control them is to send a 50Hz PWM signal (20ms period) with a high level time between 1ms (full left) and 2ms (full right).
You can use the Servo arduino library, which is very easy to use.

Then, Lets assume the servo potentiometer is approximately set to what should be the middle position for the servo.

For continuous rotation to the left, just write myServo.write(0).
The servo will rotate to the left, but since the potentiometer is disconnected from the servo's head, it will never reach the good value, so the servo will keep turning.

To go to the right, use myServo.write(180).

Stopping the servo might be harder, since you have to find exactly the current position of the potentiometer, but you should manage to do it by several trials.

 #include "Servo.h"
 int servoPin = 9; // connect servo to pin 10
 myServo = Servo();

void setup(void) {
  myServo.attach(servoPin);
  Serial.begin(9600); // begin serial monitor
}

void loop(void) {
    myServo.write(0);
    Serial.println("going to the left!");
    delay(2000);

    myServo.write(180);
    Serial.println("going to the right!");
    delay(2000);
}


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

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

答:
Since you have servo motors, you can record a sequence of motor rotations when you teach the path, then have the robot repeat these saved values as an array of destinations when you repeat the path.   This teach-repeat method is common in robotics.  Other schemes include using other means to learn the path (such as gps data, visual feedback, etc), and mapping these data points to destination values as your robot traverses the path.  Teach-repeat is a common method of programming robots to follow desired motion profiles.

EDIT

Sorry, I didn’t see your comment about just wanting to display the path until after I had posted my answer.  But the main point still holds:  you need to sample the poses of the robot (either encoder values or independent measurements) during the teaching phase, then use the forward kinematics of your robot to drive your animation.

Title: Path of the robot


问:
How to handle power distribution on a robot?
Our team just finished the FRC competition and I am trying to learn more about robots in general. I'm trying build a robot in a similar setting than the FRC competition. However the RobotRIO is out of my budget.

I'm currently set on buying a Raspberry PI 3B as main controller board as replacement for the robotRIO.

However, I do not quite understand how I'm going to power 12v motor. In our FRC build we had this power distribution panel, but I'm pretty sure I will fry my raspberry PI.

I believe I need some kind of power distribution board to have 5v and 2.5a for the Raspberry PI. And also 12v on some other pin. Does this exist or am I looking for something that do not exist.

My build would be powered by a 12v battery like these Interstate Batteries (am-3062).

答:
For power management, you can use either a DC/DC Convertor, a linear regulator, or a combination of the two.

DC/DC Converter

A DC/DC Converter changes DC voltage levels.  Three common types are:

Buck Converter: Takes a higher input voltage to a lower output voltage

Boost Converter: Takes a lower input voltage to a higher output voltage

Cuk Converter: A combination of a boost and buck converter that can take an input voltage and either boost or drop it.

Linear Regulator

A linear regulator also takes a higher input voltage and provide a lower output voltage.  Typically, the output voltage is "cleaner" with less noise than a DC/DC converter and you will find regulators used to power embedded computers and microcontrollers.

System Recommendations

You can use a Cuk Converter between your battery and the 12V motors.  You can also use a 5V regulator to get the necessary power to your Raspberry Pi.  Instead of using the power distribution panel, you can try everything on a breadboard and then move to a perfboard.  Many of these parts should be available on Digikey, Adafruit, or the electronics vender of your choice.


问:
L298N driver takes too much current
I'm using L298N motor driver to spin stepper motor (42BYGHM809).
When connecting it to batteries(2*9v), the batteries heats up after few minutes and stop working, and when connecting it to power source, the power source reach it's current limit. I think the driver has not enough resistance, but from searching the web I didn't see any tutorial that recommends using a resistor with the driver.
I tried to connect 100ohm resistor and it burnt and tried 450ohm resistor and the motor vibrated but didn't spin.

I saw in the web that when using high voltage it is recommended to remove the 12v connector(as seen in picture), but when removing it the driver doesn't turn on (the led remain off), like it not powered on (All the things i've tried above are with the connector).

Thanks for your help.

(source: bigcommerce.com)

Schematic:

Arduino code:

```<code>#include <Stepper.h>
#include <SoftwareSerial.h>

// *** General ***
const bool DEBUG_MODE = true;
bool new_input = false;
bool use_bt = true;
int motorSpeed = 20;

// *** Stepper ***
const int stepsPerRevolution = 400;
Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7);
float degCount = 0;

// *** communication ***
SoftwareSerial bt (11,12);
int usr_input = 0;
char sign;
const int BT_WAIT_TIME = 3, SER_WAIT_TIME = 1;

void setup() {
  if (use_bt){
    bt.begin(9600);
    //bt.listen();
  }
  Serial.begin(9600);
  myStepper.setSpeed(motorSpeed);
}

void loop() {

  // *** Get usr_input from BT or serial ***
  if (use_bt){
    if (bt.available()){
      Serial.println("BT");
      delay(BT_WAIT_TIME);
      sign = bt.read();
      usr_input = (int)bt.read();
      if (sign == '-'){
        usr_input = -usr_input;
      }
      new_input = true;
    }
  }else{
    if (Serial.available() > 0) {
      usr_input = (int)Serial.parseInt();
      delay(SER_WAIT_TIME);
      while(Serial.available()) Serial.read();
      new_input = true;
    }
  }

  if (new_input){
      new_input = false;
      if (DEBUG_MODE)
        Serial.print("User input: ");Serial.println(usr_input);
      rotate(usr_input);
  }
}

// Rotate motor approximmatly x degrees and return how much degrees it really did.
float rotate(int degrees){
  int steps = round(degrees / 360.0 * stepsPerRevolution);
  if (DEBUG_MODE)
    Serial.print("Steps: ");Serial.println(steps);
  myStepper.step(steps);
  float real_degrees = steps * 360.0 / stepsPerRevolution;
  if (DEBUG_MODE)
    Serial.print("Real deg: ");Serial.println(real_degrees);
  degCount += real_degrees;
  if (DEBUG_MODE)
    Serial.print("Deg count: ");Serial.println(degCount);
  return real_degrees;
}
</code>```

答:
I'm going to guess that the wires from the board to the motor are not connected correctly, but you don't have a clear picture of the board or Arduino and you don't have any picture of the motor connections. What is the resistance on the A coil and B coil? What voltages are you reading if you hold the motor stationary?

What is your battery voltage? From this NI article:

If the motor moves erratically or not at all, then switch one wire from phase A with one wire from phase B.

That's my best guess at the moment. This is a troubleshooting question, so we need more information about your exact setup. Schematics of how it's supposed to be connected are less helpful.

Also, if you could link a datasheet or instructions for the board you're using, then that would be a great help, too.

Title: L298N driver takes too much current


问:
The final step in kalman filter to correct/update the covariance matrix
I see that, in the correction step of Kalman filter, there is an equation to update the covariance matrix. I have been using it in the form:

P = (I - KH)P'

Here P is the covariance matrix, K is the Kalman Gain and H is the observation model. The I is the identity matrix. However, I also see a different equation in some literature:

P = P' - KSKT

where

S = HPHT + Q

where Q is the noise matrix for the observation model. Are these two equations same? If so, how to prove it?

答:
The Kalman Gain is defined as the following:

$K = PH^T (HPH^T + Q)^-1$

From your question, we need to prove:

$P - KSK^T = (I - KH)P$

primes omitted for simplicity

Canceling P, and substitute S with the provided definition:

$K (HPH^T + Q)K^T = KHP$

Substitute the first K on the left hand side with the definition of the Kalman gain provided:
$PH^T (HPH^T + Q)^-1 (HPH^T + Q)K^T = KHP$

S and it's inverse reduces to identity, we are left with:

$PH^TK^T = KHP$

From the transpose property of matrices $(ABC)^T = C^T B^T A^T$ we can rearrange LHS with $P$ as $A$, $H^T$ as $B$, and $K^T$ as $C$:

$(KHP^T)^T = KHP$

Since covariance matrix is symmetric, and KHP must be symmetric (this can be inferred from $P' = P - KHP$) therefore:

$KHP = KHP$


问:
Nested Rotation of a point around arbitrary vector in 3D
I have a point (x,y,z) in the 3D space. This point rotates by theta1 about the arbitrary axis ax1. This axis (ax1) rotates by theta2 about another axis ax2. What will be the new coordinates of the point. I am going to generalize this point transformation to rotation about n arbitrary axes in 3D space. What will be the procedure. Matrix rotation or Quaternion formulation.
Thank you very much.</p>

答:
Rodrigues' formula rotates a vector around an arbitrary vector in space. You points of course can be considered vectors and this way you can apply this formula.

https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

You compound the rotation by rotating the point around axis1 then around axis2.


问:
how to know if the LIPO battery I have is compatible with the motors and motor driver I have
I am building a robot and I have a concern. Will it properly connect a 11.1V 30C 4500mAh to this motor driver :
https://www.pololu.com/product/708

thanks in advance ..

答:
You should check your driver specifications and get the battery accordingly.

The driver specs you need to check:

Voltage Rating

The voltage range that the motor is designed to operate. Within the range you can select a voltage value that suits your needs best.

No Load Current

The current drawn by the motor when its running free with nothing connected to the shaft. (For small motors, when you hold them in the hand and the shaft is not yet connect to the wheels, propellers etc).This indicates the minimum current your power supply must be able to provide in order for the motor to turn.

Stall Current

When you increase the load on the motor shaft, at some point of time, the motor shaft will stop turning. This is called motor stall. The current drawn by the motor in this state is called the stall current. This is also the maximum current that will be needed by the motor.

Power

This is generally given in “Watts”. In a large number of cases, I have seen that the watt rating is not specified. That should not be a problem as long as we have the voltage and current ratings.

Torque

This is an indicator of how much weight the motor can lift at a given distance. If the rating is 1Kgcm, it means, that 1 cm from the shaft, you can attach a maximum of 1Kg load and the motor can lift it.

The battery specs you need to check:

Voltage Rating

The voltage a new battery is expected to deliver

Current/Capacity Rating

The maximum amount of current a battery can deliver in one hour. This is a very confusing specification. Suppose a battery is rated at 1500mAh. That means, it can deliver 1500mA in one hour.

Discharge Rate

This indicates what is the maximum current a battery can deliver. A 1C rating means, the battery can discharge at Capacity x 1.

To answer your question, when you compare these spec values for your driver and battery, if they're in each other's range, you can use your battery with the motor driver.


问:
Places for the up-to-date topics in robotics
Are there specific places/websites where you guys read about the topics that are being searched in Robotics, specially, for the most newest researches. I would like to know the places where the most hottest topics in Robotics are studied for both theoretical and experimental studies. The only place I know is IEEE community. They are doing great specially their magazine but I'm curious if there are any alternatives for  robotics scientists. Please include journals. </p>

答:
This sounds a bit like a shopping question, but I'll provide what I know.

The IEEE societies have always provided me a wealth of information.  In addition to the Robotics Society, with its magazine and journal (IEEE Transactions on Robotics and Automation), they also host a fantastic annual conference.  But there are other societies with robotics-related content, also.  For example, their Systems, Man, and Cybernetics society has several journals, and many topics directly related to robotics.  They also have societies which focus on systems, medical devices, and industrial applications with relevant content to an aspiring roboticist.

ASME has similar societies with a broad array of relevant content.  Check out their Journal of Mechanisms and Robotics, or papers from their biannual Design Technical Conferences.

The International Journal of Robotics Research was a seminal journal, and continues to be a leading publisher of robotics research.  There's also the Robotics and Autonomous Systems journal, which I have not personally found too related to my interests, but is an active publication.

Springer-Verlang also publishes some interesting collections of research papers, often in book form.  Their series on Advances in Robot Kinematics has been quite interesting to me.

Also, don't forget to include patent office searches.

I'm sure there are dozens more good publications.  I'd recommend finding a topic you're interested in studying, then find a seminal paper on that topic.  Tracing back through the chains of references should point you to the publications that have been most active for that topic.


答:
You should look into Denavit-Hartenberg (DH) parameters, which are specifically designed for describing the configuration of a robot arm that consists of a sequence of rotational linkages. This sounds like the problem you are trying to address.

The link above provides matrix rotation formulations for applying the parameters. The formulation includes a translational component for moving along each link in a sequence, but this can be zero if you are dealing with a sequence of only pure rotations (or if you rotate around multiple different axes, but about the same point).

Title: Nested Rotation of a point around arbitrary vector in 3D

Body:
I have a point (x,y,z) in the 3D space. This point rotates by theta1 about the arbitrary axis ax1. This axis (ax1) rotates by theta2 about another axis ax2. What will be the new coordinates of the point. I am going to generalize this point transformation to rotation about n arbitrary axes in 3D space. What will be the procedure. Matrix rotation or Quaternion formulation.
Thank you very much.</p>


答: An alternative visualization would be to draw coordinate axes in the 3D plot to represent each SE(3) point. Provided you have a way to view 3D graphs, this allows the points to be all viewed without projecting down to a lower-dimensional space. e.g., you can do this in Matlab with the drawframe function from Brad Kradochvil's kinematics toolbox. It draws an arrow of a different color for the X, Y, and Z axes.

Title: Plotting SE(3) points in a 3D graph

Body: I have a data-set containing points in SE(3), i.e the 4 $\times$ 4 transformation matrices and the corresponding dual quaternions. Now, I want to plot these points in a 3D graph. How to generate this plot?</p>


问:
What are good strategies for tuning PID loops?
Tuning controller gains can be difficult, what general strategies work well to get a stable system that converges to the right solution?

答:
I'll try to expand a little from my experience for those who may be interested.  I think the problem is we have a lot of control theory that is somewhat inaccessible (and sometimes not useful) and then we have rules of thumb that make assumptions about systems that are often inaccurate.

Stability

Let's talk first about why control loops become unstable.  For this discussion I'll assume a linear system.  Informally this means that if your control signal is a sine wave at a given frequency then your observed output is at the same frequency and if you change the amplitude of your control system your output responds at the same ratio.  This assumption is a good approximation for many real world systems and lets us look at different frequencies in isolation.

If you look at the control path you have a set-point, your PID controller, your system (aka "Plant"), and then your sensor.  Imagine a fixed set-point and a sine wave from your sensor (this is equal to a real world disturbance at the sensor, fed back).  In an unstable system your feedback causes the control loop to amplify the error rather than reducing it such that as time increases your amplitude increases.  The reason this happens is due do a delay, or for this particular frequency a phase shift between the input and output.  For a given frequency we can look at that open loop (i.e. no feedback) shift and amplitude of the output and when we draw all those on a graph we get something like a Bode Plot.  If we have a situation in this open loop graph where the error keeps getting amplified then we have an unstable system.  If the delay is less than 1/2 the wavelength or the gain is less than x1 the system will be stable.  In practice we want some margin from that point (gain margin and phase margin) which is why you'll see this "backing off" in many of the manual/heuristic methods.

The main problem with those manual methods is that you're flying blind and you're pretty much guaranteed to get a poor control system.

Also keep in mind that the meaning P, I and D is related to what your sensor is measuring and what control you're applying.  A common mistake in home built controllers is for people to think they're applying P when they're actually not.  Motor controllers often have a position loop, running over a velocity loop running over a torque loop. (A cascade)

OK but how does this help us?

The first point I'd like to make is that if you're building your own PID controller you should also build a way of measuring the open loop response.  Do a frequency sweep at the input to your controller and measure the sensor's output with the feedback disconnected.  Then you can draw the open loop Bode plot and see why your system is stable and be able to trade off the various controls.  It's also useful to measure the closed loop response and you can do that with any system by doing a frequency sweep of your set-point while the loop is closed.  Both these aren't that hard and don't require a lot of theoretical knowledge.

If you're simply tweaking controls without any understanding of what's going on under the hood you won't be able to optimize your system.  Building some intuition about these systems isn't that hard.  E.g. the proportional gain has no effect on phase but simply increases the open loop gain across all frequencies.  So what you're doing when you're increasing the proportional gain in all those manual tuning methods is finding the frequency where the phase goes to -180.  See this to get some more idea about the impact of the various controls on your frequency response.

Quite often getting best closed loop performance involves tweaking the system and not just the controller gains.  What you want is to make the system as "stiff" as possible.  That will let you ramp up the control parameters and get the best open and closed loop bandwidth.  In my experience in motor control applications the proportional gain is the one that should be doing most of the "work" and the integrator the "rest".  I don't think you need a D term at all.  Having a low pass filter and a notch filter helps a lot in situations where you may have some mechanical resonance but setting them without a Bode Plot is very difficult (the oscillation frequency you observe under closed loop may be different than the open loop one).

If safety is a concern (very powerful motors or a system that could be destroyed by the motor going out of control) you need to put in some limits before you start tuning (e.g. current limit, maximum position error) to protect the system.  Then you need to get some sort of feel for the range of the parameters.  If your feedback has 40 counts per rotation or 4000 counts per rotation your parameters will be a factor of 100 for a given system.  My approach would be to first find a range where you have some poor controllability and then ramp up from there starting with P and then I (though again you're flying blind).  Backing off creates this stability margin.

Beyond closed loop

Closed loop attempts to take out the error from the system.  It's always going to have a somewhat limited performance.  What you want to do is minimize the error your closed loop controller sees and one way to do that is through a technique called feed forward.  In feed-forward you go around the controller and drive a command directly to the system.  An example of that would be acceleration feed-forward.  If you know you're motor's torque constant and you know the load you can pretty much tell how much current you need to drive to get a certain acceleration of the load.  You simply take the command input acceleration, multiply it by a constant and add that to the controller's drive command.  You're basically doing what it would take to drive the system if there was no controller and the closer you can get the less error your loop has to take out and the better your system will perform.  It makes a huge difference in practice.


问:
Source of seminal papers in robotics
Is there a database or website that has collected the seminal papers in different disciplines of robotics like machine learning, AI, mobile robots, etc.

By seminal I mean papers that made a path-breaking impact on the theoretical side, for example, proved a theorem that captivated and inspired a large number of derivative works. So, I am mainly looking for high-impact papers that made fundamental contributions in mathematical modeling, algorithm design etc. and not so much on the hardware application side of it because in that respect videos of Boston dynamics or festo robotics are the better sources of inspiration.

I know some seminal papers like:-

Latombe's planning book

Khatib's potential field method

SLAM paper

Kalman's derivation of his filter

DP paper by Berketsas

But similar seminal papers are missing in say robotic formation control etc.

So my question has someone collected papers that rigorously and mathematically showed some big result in robotics.

答:
Let us first introduce what “theorem prooving” in mathematics mean. The famous book “The art of computing programming” is devoted to that principle. The idea is, that the book has a theoretical part, for example about sorting, and after each chapter there are questions for the practical part. The students can answer the question, and if they are right, they get the mark I from the professor. Theorem proofing means, to teach only material which is already known. Sometimes the algorithm, which were presented by Knuth were around 100 years old.

What does that mean for the area of robotics? Google Scholar has indeed some papers which can be used for student evaluation. They have mostly a title starting with “formal methods” or “Proof”. The idea is, to present only knowledge which is correct and asks if the students have understand it. This suppresses innovation and prevents that the students are exploring failed robotics projects. The problem in AI is, that in most cases the knowledge is not given. That means, there is no standard way in pathplanning, so it is difficult to force the students to answer such kinds of questions. But there are many subfields in Artificial Intelligence who are well suited for proofing something, for example the AIXI theory of Marcus hutter, or the students can proof that the perceptron is able to master the XOR problem.

A quite old paper which goes into the direction is The Use of Forth in the Instruction of Introductory Robotics which is using a teaching programming language to proof on a formal level how “Learning from demonstration” works.

Title: Source of seminal papers in robotics


答:
I am not aware of any online repository that particularly collects seminal papers in robotics. But I think anyone working or having worked in robotics for some time would more or less have their own collection of the so-called seminal papers in their field.

So, here are motion planning-related papers that I think are within the scope of this question. (Please feel free to edit this answer to add more content or correct what I wrote should anything is wrong.)

Lozano-Perez, Tomas. "Spatial planning: A configuration space
  approach." IEEE transactions on computers 2 (1983): 108-120.

This is kind of a paradigm shifting paper in motion planning. Previously a robot was always thought of as a 2D or 3D geometric object in the physical space. While motion planning algorithms at the time worked for problems with a 2D/3D polygonal robot moving in a 2D/3D maze and problems with an easy planar manipulator, it was very difficult to generalize such algorithms to solve complex problems consisting of a multi-DOF manipulator, for example. This paper basically says, "Hey, let's treat a robot as a point to a space (the so-called configuration space)." Then finding a path for a robot from configuration A to configuration B will simply be a problem of finding a path connecting two points in the configuration space. And now pretty much any modern planning algorithms operate in configuration space.

Kavraki, Lydia E., Petr Svestka, J-C. Latombe, and Mark H. Overmars.
  "Probabilistic roadmaps for path planning in high-dimensional
  configuration spaces." IEEE transactions on Robotics and Automation
  12, no. 4 (1996): 566-580.

Kuffner, James J., and Steven M. LaValle. "RRT-connect: An efficient
  approach to single-query path planning." In Robotics and Automation, 2000. Proceedings. ICRA'00. IEEE International Conference on, vol. 2, pp. 995-1001. IEEE, 2000.

These two papers presented ground-breaking motion planning algorithms called Probabilistic Roadmap (PRM) and Rapidly-exploring Random Tree (RRT), respectively. I would not go into details here. But basically they are so fundamental, yet practical. There are literally hundreds of variants being proposed in the literature after these two algorithms.

Karaman, Sertac, and Emilio Frazzoli. "Sampling-based algorithms for
  optimal motion planning." The international journal of robotics
  research 30, no. 7 (2011): 846-894.

This paper presented the very first result of (asymptotically) optimal motion planning algorithms. Novelty of this paper lies not only in the presented algorithms but also the mathematical analysis that was used to prove various properties, including optimality, of planners.

And since the question also mentioned Latombe's planning book, I would feel so wrong not mentioning the following one

LaValle, Steven M. Planning algorithms. Cambridge university press,
  2006.

Title: Source of seminal papers in robotics

Body:
Is there a database or website that has collected the seminal papers in different disciplines of robotics like machine learning, AI, mobile robots, etc.

By seminal I mean papers that made a path-breaking impact on the theoretical side, for example, proved a theorem that captivated and inspired a large number of derivative works. So, I am mainly looking for high-impact papers that made fundamental contributions in mathematical modeling, algorithm design etc. and not so much on the hardware application side of it because in that respect videos of Boston dynamics or festo robotics are the better sources of inspiration.

I know some seminal papers like:-

Latombe's planning book

Khatib's potential field method

SLAM paper

Kalman's derivation of his filter

DP paper by Berketsas

But similar seminal papers are missing in say robotic formation control etc.

So my question has someone collected papers that rigorously and mathematically showed some big result in robotics.


答:
Nathan Ratliff has documented some very nice papers in Control Theory and Motion Optimization. You can access them here and here, resp.

Particularly related to decision making problems, you might want to check Geoff Hollinger and Gaurav Sukhatme's course. The have a good list of readings in a logical flow. In general robotics, you may want to look at Pieter Abbeel's readings list for CS287.

Asides for that, one of the first papers my advisor recommended me was that Alberto Rodriguez on Effector Form Design. It is a beautiful paper with very appealing and seemingly useful mathematical formulation. To put his work into perspective, I think his thesis is worth a read (50 pages or so).

I think generally, papers which get like Best Paper Awards in top robotics conferences have sound theoretical grounds. Also, most graduate level courses incorporate good reading material and often these courses are openly accessible.

Title: Source of seminal papers in robotics


问:
controlling industrial servo with pc
these days I'm learning Orocos patched with xenomai. Although I have found the ways to create a hard real-time control software, I didn't find any information on how I should use this to control the servo motors and sensors like encoders with them? I have thought that I may have to use Ethernet cables to connect the main PC running the real time kernel with some kind of driver/servo drive so that the PC/micro PC and the driver can communicate with each other in hard real-time. I didn't actually find a practical solution in google like how, and which external drives or hardware should I use. </p>

<p>So can anyone show me the way to complete this task? How should I make my linux PC or microcontroller running real-time software should communicate with industrial level of sensors and motors? I am mentioning industrial level motors cas my project needs the accuracy and control in that level. I don't want to learn any HDL or plc and make it more complicated. </p>

答:
Real-time control protocols for drive amplifiers are Ethernet based, but not necessarily compatible with your average Network card.
You can take a look at the following protocols and decide which is easiest to implement with your setup. Again, you may need specialized network cards for some. You can find drive amplifiers which each of these protocols from major manufacturers (e.g. Bosch-Rexroth, Siemens, Beckhoff).

Just fyi in these case "industrial level" means a comms cycle time of downto 1-4 milliseconds. Even less in some cases.

Sercos

Ethercat

Profinet

Ethernet/IP

Also, you can by ready-made protocol stack for most of these, usually through the association steering the development of the protocols. You can just embed that as a library in your source code (again, hw compatibility is not necessarily given with every network card)

You might want to look at CAN and CANopen. It is not ethernet based, but one of the easiest to use and many Microcontrollers offer CAN communication ports.

You mentioned no plc-s but you might want to take a look at RevPi, a sort of mix between a PLC and a RasPi with linux.

Title: controlling industrial servo with pc


答:
I would add Probabilistic Robotics as generally a great book to start mostly mobile robotics.

For Robotics in general, I would start with the Modern Robotics book.  http://hades.mech.northwestern.edu/index.php/Modern_Robotics

Both of these summarize the state of the art at their publication date very well.

Title: Source of seminal papers in robotics


问:
Adding ROS to Raspberry Pi car and teleoperation
I just completed a Raspberry Pi car setup shown in the image below.

With my car now assembled, I can run a simple Python script put the necessary GPIO pins HIGH or LOW and moves the car around successfully.

Now, I have added ROS to the mix and I want to drive the car around using the Turtlebot teleop package.

Roscore is launched and when I execute rostopic list I get the following:

```<code>/rosout
/rosout_agg
</code>```

Obviously, I am missing the /cmd_vel topic.

How can I make ROS aware of the robots' mobile base in order to begin driving it around, please?

答:
You first need to roslaunch the turtlebot_teleop package with

```<code>roslaunch turtlebot_teleop keyboard_teleop.launch
</code>```

That fires up the high level teleoperation, which publishes a geometry Twist message on the cmd_vel rostopic. Looking at the launch file, it looks like it will be called cmd_vel_mux/input/teleop

An option for the low level code is to create your own custom ROS node that subscribes to that specific cmd_vel rostopic, takes the messages from the turtlebot_teleop and figures out how to properly control the motors.

Body:
You first need to roslaunch the turtlebot_teleop package with

roslaunch turtlebot_teleop keyboard_teleop.launch

That fires up the high level teleoperation, which publishes a geometry Twist message on the cmd_vel rostopic. Looking at the launch file, it looks like it will be called cmd_vel_mux/input/teleop

An option for the low level code is to create your own custom ROS node that subscribes to that specific cmd_vel rostopic, takes the messages from the turtlebot_teleop and figures out how to properly control the motors.


问:
brushless motor as a servo
I would like to use(or control) a gimbal brushless motor like a servo meaning I want to control position not rotation speed. The position must be from 0 to 180 and 0 to -180
I will use an Arduino board. And I think a ESC board
Can I use PWM control offered by servo library? Is it possible?
Have someone any idea
a) If is possible to do what I want?
b) Orientation(guideline) about library usage?

Thanks in advance

答: It's possible, but you need something reading the position of the shaft, since a brushless motor is unaware of its own state. You can use potentiometers, incremental encoders, and absolute angle encoders to reach some approximate reading of the state. Then, you would need a PID controller that accepts desired state as input and as output sends current to the motor based on the error between the desired state and the actual state.</p>

Title: brushless motor as a servo


问:
How do I calculate the required loop frequency for a servo controller?
I have a motor which drives a string connected to a load cell. I would like to implement a closed loop controller to control the load applied by the motor to the string.

How do I go about determining the required loop frequency in order to create a stable control system? Is it something like the Nyquist frequency, where the loop speed should be at least twice the highest frequency inherent in the mechanical system?

答:
When the string isn't under tension you have a non-linear system (i.e. you're pushing on a rope) which may also make this harder to control.  The stiffness of your string is going to limit your bandwidth. (The string acts as a low-pass filter, at least when it's under tension).  I've actually worked a little on a similar setup and it was really hard to control.

Since you're sampling the sampling theorem absolutely applies and you must sample at least x2 the highest frequency in your input (either by increasing the sample rate or filtering the input before sampling or both) otherwise you'll get aliasing.

As Kyle points out the other factor is your desired control bandwidth.  I concur with the rule of thumb that the loop should run at least ~x10 that frequency.

Both these conditions need to be met.

There's a pretty good discussion of this in Chapter 6: Sampling in closed loop control systems of Marten Derk van der Laan's (1995) dissertation Signal sampling techniques for data acquisition in process control:

Selection of sampling rates is an important issue. For economical
  reasons, sampling rates are kept as low as possible: A lower rate
  means that there is more time available for control algorithm
  execution, which can thereby be carried out on slower computers.
  Digitizing well behaved analog control systems can heavily affect
  system response. If sampling frequencies is too low, the systems may
  even become unstable. According to the Nyquist criterion, the sampling
  frequency should at least be twice as high as the bandwidth of the
  error signal. This bandwidth is bounded by the system bandwidth, hence
  ws  2wB. However, in order to guarantee satisfactory response, a
  factor of 10 to 20 may be required


问:
RTnet vs CORBA transport
What is the difference between this two. And which should i choose for hard real time control purpose? What are the cons and pros of them one to another?</p>

答:
RTnet and its transport protocol is described at http://www.rtnet.org/. "Hard Real-Time Networking for Real-Time Linux" (That network and web site use one of the numerous imprecise and conflicting "definitions" of the term "hard real-time.")

There are a great many descriptions of the ISO Real-Time CORBA standard on the web (Google). One major difference between RTNet and RTCORBA is that RTCORBA is intended for a wide variety of hard, soft, and non real-time distributed systems. The specification (more carefully) describes what meanings it uses for those terms. To accomplish that range of applicability--and specifically in regard to your question--the RTCORBA spec (not necessarily all vendor implementations) allows for application-specific pluggable transport protocols. Real-time and embedded CORBA products exist which are functionally and performance competitive with RTNet.

Which of the two depends on your application. CORBA in general is much more versatile than you need, unless you want to use a very special application-specific (for example, military aircraft) transport protocol which might not be accommodated by RTNet but which would be accommodated by certain RTCORBA implementations. A detailed answer to your question would require a lot of information about your needs and would probably be a very lengthy answer. Start by reading the web documents, being sure you know exactly what network capabilities you need.

Title: RTnet vs CORBA transport


问:
Increasing Torque by either doubling servos or building a gear box
I'm looking here for suggestions.

I have a HS-805BB with Torque (Kg-cm/Oz-in): 24.7/343 @ 6.0 V to rotate a robot body up and down from one side. It seems to me that this servo is always running at its maximum torque which is not good for its life span and battery consumption, so I thought of two solutions:

Install a second servo on the other side and have both servos working parallel.

Build a gear box to increase the Torque limits.

What are you suggestions as to which option is most preferable?

答:
Installing a second servo for moving the same axis might be problematic from a controls point ofview. Since (I assume) your servos are position controlled (and not torque controlled) delays in commanding them and mechanical toleraces of the assembly may lead to sitations where the two servos act agains each other at the beginning or at the end of motions (maybe even during). E.g. fits servo recieves a command to pull, starts pulling, the other one recieves the same signal a few ms later, until then the first one is actingagainst the second one.

If you have rpm reserves, installing a gearbox would be a good solution.

You can also install some kind of ballancing (e.g. preload with a spring) or counterweight mechanism is your application allows this (e.g. elevator have counterweights, robots have springs sometime in the lowes joint agting against gravity).


问:
How to convert vertical motion to horizontal?
I am interested in using this miniature motor Squiggle Micro Motor to create very tiny horizontal movements. However, due to very limited space, I can only place it vertically within my project.

Assuming this motor is placed as follows, how can one adapt it to simultaneous movement at a right angle? (Ideally with the X-axis movement matched to the Y-axis movement as well as possible.)

答:
If this is true linear motion (non-rotational) then you will need some sort of a pivoting linkage in between the two units to transfer one motion to the other. Something like this would probably work:

As the lower link moves vertically, it rotates the red gear which in turn pushes the second link horizontally.

However, given that your image shows more of a screw type link, I feel like the lower link will be rotating (correct me if I'm wrong here). In that case, then a different approach would need to be taken - at least, a rotational ball joint would need to be used to attached the rotating unit to any linkage.