问:
Quadcopter liPo battery weight/capacity trade off
I'm trying to find where additional battery capacity becomes worthless in relation to the added weight in terms of a quadcopter. Currently with a 5500 mAh battery, 11.1V, I can get between 12 minutes and 12:30 flight time out of it. My question, then, is this - within the quads lifting capability of course, is there any way to find out where the added weight of a larger battery (or more batteries) cancels out any flight time improvement? Obviously it's not going to be as long as two separate flights, landing and swapping batteries; I'm just trying to maximize my continuous 'in air' time. I'm trying to figure out where the line is (and if I've already crossed it) with tacking bigger batteries onto the quad and seeing diminishing returns. Thanks!

(Again, for now presume that the quad is strong enough to lift whatever you throw at it. With one 5500mAh, ~ 470 grams, my max throttle is about 70%)

答:
have you seen these new zinc air 8cell 10,000mAh 12V drone batteries?
http://www.tradekorea.com/product-detail/P00265914/drone_battery_10000mAh.html#.UjpxM2QpY2K
saw the chart on different power to weight ratios on the above discussion comparing efficiency to fuel cells (which are still too heavy 1.2kg + fuel^800g+)

was toying round with the idea of a quad fitted with a zinc air 10,000mAh battery, 4xGenesys alternators and 2x super capacitors

Barry Densley


问:
How can i connect to AWS Robomaker simulation job using ros_bridge?
We have a web app which we are using to show details of robot on including video, position and feeds like lidar feed.

We are using http://wiki.ros.org/rosbridge_suite Rosbridge for this successfully on our development systems using gazebo simulations.

How can I do the same using simulation jobs on robomaker? How can I connect to simulation job using my dev system?

答:
You can configure a VPC for your simulation job which enables out bound network access to your VPC from the simulation host.

https://docs.aws.amazon.com/robomaker/latest/dg/vpc.html

Currently, we don’t allow inbound network traffic to the simulation host.

One solution for communicating with your ROS code in simulation using rosbridge is to run rosbridge in the simulation host as part of the simulation or robot applications and opening a reverse SSH tunnel from the simulation host to an EC2 host in your VPC.

You can run rosbridge modifying your package.xml and launch file.

1) Add a dependency on rosbridge_suite to your package.xml:

rosbridge_suite

2) Add the following to your .launch file:

Lastly, you can modify your launch file to open a reverse tunnel to an EC2 host in your VPC. Once this is established you can communicate with rosbridge from your EC2 host. Note: you’ll need to include ssh as a dependency like we did for rosbridge_suite above.

A non-rosbridge option for connecting to the simulation from your dev system is a pub/sub mechanism like MQTT. The AWS IoT Bridge Example is a good example of this approach: https://github.com/aws-robotics/aws-iot-bridge-example/blob/master/README.md

ContentLicense: CC BY-SA 4.0


问:
Where can I buy iRobot Create?
I'm looking to buy iRobot Create, I can't find it on Amazon or any other place. I'm in Chile, would there be any shipping options?</p>

答:
You can order them from iRobot. I checked their site and it said they offer international shipping to Chile but probably your best place to start would be contacting iRobot Customer Care.

Or just get any Roomba with a serial port and make or buy the cable from the instructions on the iRobot Create website

Title: Where can I buy iRobot Create?


问:
Razor IMU Arduino interfacing
I was looking into the  Razor IMU from Sparkfun, and realized that the only example code on sparkfun's website was for it was meant for hooking it up to a computer (the AHRS head tracker used a serial to usb chip). I looked on google and saw nothing but stories about how it did not work.

Is there any good way to hook up the  Razor IMU to an arduino uno (or any arduino without hardware support for more than one serial port), and if so does example code exist?

答:
The Razor IMU has an ATmega328 microcontroller on board that can be programmed with the Arduino IDE according to sparkfun's product page. You could use the tx/rx pins (serial communication) to connect to your other Arduino's rx/tx pins (tx to rx, tx to rx) and program a communication protocol to pass data from the Razor IMU to the Arduino Uno. The Razor IMU probably already has code on board to do this. It's a matter of writing the Uno's code to request and receive the data. The Razor IMU uses 3.3V logic so make sure you use an arduino variant that uses 3.3V or use a level shifter.

Another option is to hack an I2C connection. This involves soldering to a pin ATmega328 and modifying some of its code.

ContentLicense: CC BY-SA 3.0

Title: Razor IMU Arduino interfacing


问:
Electronic Speed Controller
What should be the specification of ESC that I should use for a 320KV 1820W brushless DC Motor?. Is it necessary to use an 80A ESC?, Basically, How can I choose the required ESC for a motor?</p>

答:
It depends on the voltage.

Say you are running 12V:

```<code>1820W / 12V = 151A
</code>```

With a 24V system:

```<code>1820W / 24 = 75A
</code>```

Title: Electronic Speed Controller

Body:
It depends on the voltage.

Say you are running 12V:

1820W / 12V = 151A

With a 24V system:

1820W / 24 = 75A


问:
KF/ EKF - Modelling and tuning noise matrices and other parameters
I am developing C++ code to estimate roll and pitch of a camera using accelerometer and gyroscope. The roll, pitch and yaw are in my state space ($X_t$) and the process is modeled as:

$\bar{X_t} = X_{t-1} + Eu$

Here $u$ is a vector of gyro rates in x, y and z axis while $E$  is the matrix to convert gyro rates to Euler rates. Note that even though yaw is part of the state space, it is not corrected by accelerometer. It is present so that the short term reliability of gyros can be made use of, in the future development of the project.

Now, the covariance matrix($P_t$) is calculated as:
$\bar{P_t} = GP_{t-1}G^T + Q$

and the Kalman gain($K_g$) is calculated as:
$K_g = PH^T(HPH^T + R)^{-1}$

The $Q$ is the process noise matrix and $R$ is the observation noise matrix. The $G$ is the Jacobian of process model. The observation model $H$ is an identity matrix (This model gets multiplied by state space vector to produce predicted observation. The actual observation contains roll and pitch angles calculated from accelerometer, and yaw angle which simply is a copy of predicted yaw).

I am getting good results in most poses of the camera. However, when one of the angles (roll or pitch) is close to zero, I see drift or zero crossing patterns in the plots of roll or pitch. Can I avoid them by better modeling or tuning parameters? I would like to know if there are any systematic methods for modeling:

1) The process noise $Q$? I am currently using a Gaussian matrix with  mean = 0 and std deviation of 1. I used this as reference. How can I model them better? What should be its order of magnitude?

2) All diagonal values of $P$ are set to an initial value of 0.05 to represent uncertainty in initialization. The initialization of state space vector is done by calculating roll and pitch values from initial readings of accelerometer. The yaw is initially set to 0. I prefer the accelerometer to be trusted more than gyro. Hence the initial uncertainty, 0.05, is a value lower than the lowest value(0.059) in $Q$. Is this a good approach? Are there better ways?

3) The observation noise $R$? Right now, I have calculated std deviation of accelerometer readings in x, y and z. I use their square as first, second and third diagonal elements of $R$. The rest of the values in the matrix are 0. As I type this question, I have realized that I should first convert accelerometer readings to roll, pitch angles before calculating std deviation. However, are there better suggestions to model this?

Edit:
1) In the above situation only either roll or pitch are close to zero. Not both.

2) My intention is to code the Gaussian noise models in C++, rather than using readily available functions in Matlab or Excel, if they are the most suitable models. I am also looking for suggestions on better models, if any.

答:
The issue related to zero crossing patterns, which is one of the key questions, was related to the implementation. The issue was resolved and this program was actually completed almost 11-12 months ago. An answer was not posted considering that the main issue was not explained properly.

However, I have recently learned that the interest on this question is geared towards setting the noise matrices. I would like to add my understanding as an answer.

1) The noise is assumed to have zero mean and a variance. The matrix $Q$ represents the variance of process noise and this depends on gyroscope readings. First a large number of gyro readings were taken at a known position and orientation without any motion. The mean and std. deviation of this data was calculated for x, y and z axes. The std. deviations corresponding to the three axes were denoted as $noise\_gx$, $noise\_gy$ and $noise\_gz$.

The last part of this page shows how gyro readings
are converted to Euler angle rates.

$\begin{bmatrix}\dot \phi\\\dot \theta\\\dot \psi\end{bmatrix} = \begin{bmatrix}p + qsin(\phi)tan(\theta) + rcos(\phi)tan(\theta)\\qcos(\phi) -rsin(\phi)\\qsin(\phi)/cos(\theta) + rcos(\phi)/ cos(\theta)\end{bmatrix}$

Here $p, q, r $ are gyro rates and $\dot \phi, \dot \theta, \dot \psi$ are Euler rates. This is then multiplied by appropriate time quantity to obtain change in roll, pitch and yaw, required to update the state. A similar logic is used to convert the raw noise values from the gyroscope into values inside matrix $Q$. Substitute $noise\_gx, noise\_gy, noise\_gz$ on the RHS instead of $p, q, r$. Multiply the result with time. This result will have three values. Square the first value and set it as the first diagonal element of $Q$. Then the square the second value and set it as the second diagonal element. Repeat the same for the third value.

The rest of the values are zero. This is done under the assumption that there is no covariance between the different variables of the state. However, this is not always true and should be considered for accurate modeling.

2) The initial value for uncertainty was set based on information on the system and some trail and error.

3) The matrix $R$ was calculated in a method similar to that of $Q$. However, in this case, $noise\_ax, noise\_ay, noise\_az$ were calculated after converting sensor reading to angles (I don't quite remember how this value was obtained for yaw. Will update after checking notes). So, these values were squared and set as diagonal elements of $R$.

So, as a general approach:

1) Take sample data (in large quatity) from the sensor.

2) Calculate std. deviation before or after manipulating the data to bring it to the same space or physical dimensions of the state variables or observation variables, depending on convenience and the implementation.

3) Square the std. deviation values or multiply them to generate variance or covariance depending on assumptions regarding the independence of variables involved.


问:
How to use a map created with odometry
I'm using ROS Melodic with Gazebo 9 in an Ubuntu 18.04.2 LTS.

I'm studying a robotics subject at the university and I have to create a map of a closed room with one obstacle using only odometry. The idea is to know where are the obstacle and the walls to avoid them when the robot navigates to a goal position.

To do that I will do the following:

I will move the robot using the keyboard to map the entire room. I will use the odom topic from a diffdrive controller which its type is nav_msgs/Odometry and store its geometry_msgs/Pose.msg Pose data into a text file. I will store its x and y coordinates. I will filter them, and only store a new location if this new location differs from the previous one with an amount (0.1).

I can make the map autonomously using a bumper and making the robot follows a "snake" pattern. But this is not my big problem. My problem here is that I don't know how to use the map.

I've thought to use A* to move to robot to its goal. To use A* I've thought to create a 2D matrix with all the points in the text file. Each row will be the x location (I will have as many rows as many different x location I have), and the same for the rows (y location). If there is an obstacle, in the cell will be 0, and a 1 is the location is free.

I have a lot of questions but I can only ask one here:

If I want to use A*, is it correct what I did with the map?

NOTE: Beware that I'm not asking about how to do it with ROS, I'm asking if it is correct what I did with the map to allow me to use it with A*.

答: Nope, most of these maps are defined as adjacency matrices not maps describing a physical scene. Moreover, switch the parity of the elements since vanilla A* algorithms on the internet use minimum weight, not maximum weight. </p>

Title: How to use a map created with odometry


问:
Does anyone have documentation for a CoroWare Explorer?
I have inherited a CoroWare Explorer from someone who used it for their PhD research years ago. They have no documentation on the robot, and I cannot find any online. Does anyone have a user's manual or any other documentation?</p>

答:
The basic specifications of the CoroWare Explorer are available on the Robosavvy website (although they no longer carry the product):

Explorer Specifications

Dimensions: 23”L x 21”W x 16”H

CPU: 2.0 GHz

RAM: 1 GB

Disk Space / ROM: 80 GB

Wi-Fi: 802.11 b/g/n

GPS: Yes

Voltage Sensor: Yes

Maximum Speed: 2 feet per second

Base Payload Capacity: 15 lbs

Base Type: Articulated 4 wheel drive

Steering: Skid

Obstacle Handling: Can clear 6" obstacles

Camera: High quality 2 MegaPixel color camera

Digital Inputs: 8

Digital Outputs: 8

Analog Inputs: 7

Optional Pan/Tilt Camera: Yes

Battery: 13 AH

Battery Life: 2.5 - 4 hours

Windows: XP, Supporting C-language API

Linux: Ubuntu, Supporting Player

Player / Stage: Yes

Sample Software: Yes

The manual for the basic Corobot is available in pdf form from the Robotshop website.

Since the CoroWare Explorer was apparently built to:

"... expand on the capabilities of the CoroBot and deliver a rugged indoor/outdoor robot that can withstand environmental elements such as dirt, dust, leaf debris, sand, gravel and shallow puddles."

This may help get you started. The Explorer has 'extra ports and surface mounting space', but the pages I found don't say much about other differences.

The  CoroWare website is unhelpful, to put it mildly.  It states that it is "under construction" with a copyright date of 2023!

However, Satarchy Robotics were apparently in partnership with CoroWare, and offer a contact option on their webpage.  They may be able to help with more documentation.


问:
Observed position update after motion of the robot
The equation (14) in this paper,
$$
P_{Cj}=RP_{Pj}+T+e_j
$$
where $P_{Cj}$ and $P_{Pj}$ are the observed positions of feature $j$ prior to and after the current robot motion, $R$(otation) and $T$(ranslation)

If ignoring $e_j$ and assuming there is no translation,

I don't understand why applying $R$ and not $R^{-1}$.

For example,

the previous robot orientation is GREEN and the blue dot in GREEN coord is $(0,3)$.

Then the robot rotates clockwise $\frac{\pi}{2}$ degree to RED coord and the blue dot in RED coord is (-3,0)

If clockwise rotation is negative,

$R$ in this case is:

\begin{bmatrix}\cos(\frac{-\pi}{2})&-sin(\frac{-\pi}{2})\\sin(\frac{-\pi}{2})&cos(\frac{-\pi}{2})\end{bmatrix}

equal to

\begin{bmatrix}0&1\\-1&0\end{bmatrix}

So to get $(-3,0)$, $R^{-1}$ seems to be the correct one.

Do I misunderstand anything?

Thank you for precious time on my question.

答:
It's been years since I've used any of this math, so I'll appeal to Wikipedia and hope I'm not off-base.

The examples in this article apply to active rotations of vectors counterclockwise in a right-handed coordinate system by pre-multiplication. If any one of these is changed (such as rotating axes instead of vectors, a passive transformation), then the inverse of the example matrix should be used, which coincides with its transpose.

So it's the rotation of the coordinate system GREEN into RED that uses the inverse
$$\color{red}{C} = R^{-1}\color{lime}{C}$$
and determining the location of a fixed point under the new coordinates uses $R$ itself.


问:
question about car-like robot localization based on dead-reckoning
I have a question about car-like robot localization using only dead-reckoning. Given:

robot position (at current time step) in the form $\begin{bmatrix}x & y & \theta\end{bmatrix}$ (theta is the heading)

steering angle

distance traveled between two time steps

How can I estimate the position of the robot at the next time step?

答:
Assuming that this doesn't count as a duplicate of the math that Daniel Oertwig provided in his question "Calculate position of differential drive robot", the calculations are as follows (for each time step):

First, calculate the distance travelled.
$$
\Delta d = \frac{\Delta L + \Delta R}{2} = \Delta t * s
$$
Where $L$ is the left wheel odometry, $R$ is the right wheel odometry, and s is the vehicle speed.

Next, calculate the change in $x, y$ position.
$$
\Delta x = \Delta d \cdot cos(\theta) \\
\Delta y = \Delta d \cdot sin(\theta)
$$

Where $\theta$ is the orientation angle (in radians) of the robot.

Next, calculate the change in the heading.
$$
\Delta \theta = \frac{\Delta R - \Delta L}{w}
$$

Where $w$ is the distance betweeen the two wheels.

The accuracy of this technique is inversely proportional to the size of the time steps ($\Delta{t}$), and will accumulate error over time.  You can improve estimation if you have a compass, as you can detect some slippage of the wheels by comparing the actual vs expected orientation.


问:
How to convert PointCloud2 message to a grid?
I'm using a Velodyne sensor which publishes on /velodyne_points topic, and its class type is PointCloud2.

Now I want to convert PointCloud2 message into a grid space (cylindrical) instead of spherical space. In other words, I want to maps/project Velodyne points (3D) to a grid/panoramic-view (2D) with a const resolution, which each grid cell has a range. Also, this grid's height is const too.

答:
What you're looking for is a coordinate transformation. You could make a node that takes in a pointcloud2 message and outputs a message with the data in a cylindrical format.

This website has a thorough overview of what's needed:
https://math.libretexts.org/Bookshelves/Calculus/Book%3A_Calculus_(OpenStax)/12%3A_Vectors_in_Space/12.7%3A_Cylindrical_and_Spherical_Coordinates


问:
Manipulability Measures of Serial Robots?
I need to create a dataset of dexterous workspaces for a significantly large number of serial robots with varying DoFs.
My question is if there is an efficient way of measuring a robot's manipulability.
Most solutions that I have found are based on inverse kinematics, which in my particular case would take too long. Are there any time-efficient alternatives?</p>

答:
The most common manipulability measure is by Yoshikawa [1] which is purely kinematic, ie. it ignores dynamics such as inertia and motor torques.  It is simply
$$
\sqrt{\det( J J^T)}
$$
where $J$ is the manipulator Jacobian that gives spatial velocity in world coordinates.  The measure says something about how spherical the 6D velocity ellipsoid is.

The measure is a bit problematic because it is a norm of mixed units (m/s and rad/s).  It can be more insightful to take the translational 3x3 part (upper left sub matrix) or the rotational 3x3 part (lower right sub matrix).  This is discussed in §8.2.2 of [2].

Using the Robotics Toolbox for MATLAB we can easily compute this measure

>> mdl_puma560  % define a robot model and some poses
>> p560.maniplty(qn)
Manipulability: translation 0.111181, rotation 2.44949
>> p560.maniplty(qz)
Manipulability: translation 0.0842946, rotation 0
>> p560.maniplty(qs)
Manipulability: translation 0.00756992, rotation 2.44949
>> p560.maniplty(qr)
Manipulability: translation 0.00017794, rotation 0
```

where qr = [0, 1.5708, -1.5708, 0, 0, 0], qs = [0, 0, -1.5708, 0, 0, 0] and
qn = [0, 0.7854, 3.1416, 0, 0.7854, 0].

We can see that pose qn (elbow up, wrist pointing down) is quite well conditioned whereas qr (arm straight up) is close to singular.

If you have Denavit-Hartenberg models for all your robots then this would be an easy task to automate.

Taking dynamics into account involves measures based on the force ellipsoid and is discussed in §9.2.7 of [2].  It requires that you know the inertial parameters of the robot which in general is not the case. Use the 'asada' option to the maniplty method to compute this.

[1] Manipulability of Robotic Mechanisms, T. Yoshikawa, IJRR 1985.

[2] Robotics, Vision & Control, P. Corke, Springer, 2017.

[3] A geometrical representation of manipulator dynamics and its application to arm design. H. Asada H, 1983, J.Dyn.Syst.-T ASME 105:131.

Body:
The most common manipulability measure is by Yoshikawa [1] which is purely kinematic, ie. it ignores dynamics such as inertia and motor torques.  It is simply
$$
\sqrt{\det( J J^T)}
$$
where $J$ is the manipulator Jacobian that gives spatial velocity in world coordinates.  The measure says something about how spherical the 6D velocity ellipsoid is.

The measure is a bit problematic because it is a norm of mixed units (m/s and rad/s).  It can be more insightful to take the translational 3x3 part (upper left sub matrix) or the rotational 3x3 part (lower right sub matrix).  This is discussed in §8.2.2 of [2].

Using the Robotics Toolbox for MATLAB we can easily compute this measure

>> mdl_puma560  % define a robot model and some poses
>> p560.maniplty(qn)
Manipulability: translation 0.111181, rotation 2.44949
>> p560.maniplty(qz)
Manipulability: translation 0.0842946, rotation 0
>> p560.maniplty(qs)
Manipulability: translation 0.00756992, rotation 2.44949
>> p560.maniplty(qr)
Manipulability: translation 0.00017794, rotation 0

where qr = [0, 1.5708, -1.5708, 0, 0, 0], qs = [0, 0, -1.5708, 0, 0, 0] and
qn = [0, 0.7854, 3.1416, 0, 0.7854, 0].

We can see that pose qn (elbow up, wrist pointing down) is quite well conditioned whereas qr (arm straight up) is close to singular.

If you have Denavit-Hartenberg models for all your robots then this would be an easy task to automate.

Taking dynamics into account involves measures based on the force ellipsoid and is discussed in §9.2.7 of [2].  It requires that you know the inertial parameters of the robot which in general is not the case. Use the 'asada' option to the maniplty method to compute this.

[1] Manipulability of Robotic Mechanisms, T. Yoshikawa, IJRR 1985.

[2] Robotics, Vision & Control, P. Corke, Springer, 2017.

[3] A geometrical representation of manipulator dynamics and its application to arm design. H. Asada H, 1983, J.Dyn.Syst.-T ASME 105:131.


问:
Kinematics with Product-of-Exponentials terminology: not forward, not inverse
I'm working on a kinematic estimation algorithm, and am trying to come up with the right terminology.

I'm using the Product-of-Exponentials formulation for kinematic chains (and ignoring position for now):

$R = e^{\omega_1 \theta_1}e^{\omega_2 \theta_2}...e^{\omega_n \theta_n}R_0$

where:

$R \in SO(3)$: orientation of end effector

$\theta_{1..n}$: joint coordinates

$\omega_{1..n} \in so(3)$: joint screw axes

Forward Kinematics: Solve for $R$ given $\omega_{1..n}, \theta_{1..n}$

Inverse Kinematics: Solve for $\theta_{1..n}$ given $R, \omega_{1..n}$

?___?: Solve for $\omega_{1..n}$ given $R, \theta_{1..n}$

My question is, what phrase fills that blank? I've been using the PoE formula for so long that I am starting to forget the DH paradigm but I'd imagine there's an equivalent with DH params too.

The literature I'm comparing against calls this "system identification" but I think that's because they're treating it like a dynamical system...I am treating it like a standard robot kinematics problem.

Is there an agreed-upon term for this process?

答:
Try looking for terms like robot calibration, robot kinematic calibration or kinematic calibration.  Have a look at Chapter 6 of [1].

[1] Springer Handbook of Robotics, Eds: B.Siciliano, O.Khatib, 2016


问:
Effective motor type for robotic arm?
I am trying to build an arm that will have about 5 by 5 by maybe 7 or so centimeters of room for a rotary motor capable of lifting it. The joint will basically allow the arm to rotate in a single degree of freedom in a circle that is perpendicular to the ground.The rest of the arm will probably be around 64 centimeters long and weigh around a minimum of 9 kilograms before it lifts anything.

What kind of motor type would give it the best chance of lifting the arm quickly† and reasonably accurately‡?

† Raising from straight down to out 90 degrees in around 1 to .5 seconds maximum.

‡ At least a centimeter at the end of the arm which means probably at the very least 300 positions for the motor.

答:
So you want to lift 9kg of mass, which means a force of around 90N, that's on an arm that's 64cm long, in one second.

$\frac{\left(90N\right)\left(0.64m\right)}{1s}\simeq58W$

So, that's probably doable.

You don't say anything at all about gearing -- how do you propose to take the high-speed, low-torque power that comes from most motors and turn it into the low-speed, high-torque (or high-force) power that you need for the arm?  Do you have space allocated for that, or were you planning on attaching your motor output directly to the arm?

Title: Effective motor type for robotic arm?


问:
Hand-Eye calibration of a 2D barcode scanner and a robot
I have a Keyence barcode scanner that can give me the coordinates of a detected barcode in pixels. I have a 6 DOF robot whose end effector pose I know at any given time. My ultimate goal is to place a new label on top of an existing label that is on a box. I am really looking for (x,y,z,theta) from the sensor and passing it on to the robot. I can work without having the Z values by incorporating sensor to know when to stop exploring in the Z.

I am figuring out how to calibrate this robot end effector to the barcode scanner. AFAIK, the scanner cannot detect a checkerboard pattern.

If I mount a barcode onto a sheet and attach it to the robot and note a set of (pixels,6D pose) readings, how would I figure out the 4x4 transform between the arm and the scanner?

答: As the scanner gives you the corner points of a the barcode, you can compute the pose of the scanner relative to the barcode (e.g. with OpenCV and solvePnP) and with that information, run most hand-eye calibration algorithms. The normal checkerboard pattern is also only a tool to easily locate known features on a planar surface so there is no big difference between using the corners of the checkerboard or the corners of you barcode. </p>


问:
Building a stationary robot. ROS the right tool for me?
I'm wondering if ROS is the right system for me. I'm currently involved in a project which consists of building a device that has the purpose to take spectroscopic measurements using a laser and a spectrometer, controlling servos and reading outputs of many different sensors.

The project involves

Bring the laser to the right spot using a proximity sensor and a servo

Firing the laser and doing a measurement with the spectrometer

Continuously monitor various temperature, vibration, flow etc sensors

The devices are either ethernet connected or send out voltage/current signals. All devices can be communicated to using Python and libraries.

The software will run on a single Linux PC.

From what I gather then ROS should be great for this. F.x. by creating python scripts for each device, which connect to a "mother" script through the publisher/subscriber method.

But before I dive into coding this, it would be great to get someone's opinion on in ROS is the right system for this?

Cross-Post at answers.ros.org

答: ROS sounds like a good way to go. You will most likely only use the core tools (topic, actions, launch files, bag files, RVIZ) but they will definitely simplify your development as you can divide your application in smaller parts with clearly defined interfaces. </p>


问:
Drone Mapping Project
I'm mapping my college campus with a drone (as part of an approved science project). I want to film, measure the temperature, and take infrared video at the same time. What drones are good for interfacing with multiple sensors at once?</p>

答:
All autonomous drone are already interfacing with multiple sensors: barometric, magnetic,  accelerometer, gyroscopic, GPS, temperature, ect. Some flight controller even allow you to run redundancy on those sensors. But since you are talking about video, it would be easier to post process the sensor/camera data.

Your drone choice will be base on the payload you want to carry, and the flight time you want to achieve. Depending on your situation and budget, you could do multiple flight and change the payload. Yes, having a huge drone that can lift 4 cameras and a full PC is an option, but the complexity goes with it.

Do a bit more research on your requirements first, then post a question that is narrower and less opinion base.

Title: Drone Mapping Project


问:
Why does singularity condition for a serial manipulator never involve the first joint variable
In planar 2R the singularity condition involves the second joint variable. In spatial 3R, singularities involve second and third link lengths and angles. Why does the first joint parameter never feature in the singularity condition?</p>

答:
Singularity is related to the shape of the arm, not its orientation.

Consider an RR arm.  It is singular if the two links are parallel: either fully outstretched or folded back on itself.  If the arm is straight, a function of $\theta_2$, then it doesn't matter what $\theta_1$ is, it will still be a straight arm, just pointing in a different direction. You can extend this argument to additional DOF.


问:
What sort of dev boards or standalone microprocessors are used for controlling robotics projects?
I've been using arduino boards for powering my robotics projects, however I want to move towards a more professional method of controlling electronics. I am not sure whether standalone microprocessors/microcontrolers are used to control the electric parts or whether they are integrated in custom PCBs or whether premade dev boards are being used. What exactly is most commonly used in the robotics industry regarding this topic? I have heard about AVR, ARM, PIC, as well as intel processors. I saw MIT's video where they controlled an autonomous plane using and Intel Atom processor. How can you control electronics with an Intel processor? If I want to get into professional robotics electronics, what hardware do I need? </p>

答:
If I want to get into professional robotics electronics, what hardware do I need?

Define professional robotics electronics.

I saw MIT's video where they controlled an autonomous plane using and Intel Atom processor.

A college/university program is less likely to use "professional" equipment because, even at a university like MIT, they're still operating on typically a pretty tight budget. If an Arduino or Raspberry Pi would do the trick, they'd probably use it.

I am not sure whether standalone microprocessors/microcontrolers are used to control the electric parts or whether they are integrated in custom PCBs or whether premade dev boards are being used.

There's a lot of stuff going on in this statement, so I'll try to explain it as straightforwardly as I can.

If you're going to build a robotic system, there is a bunch of stuff that can (will) go wrong. When troubleshooting, you want to be methodical and so you'll try to work through each item one at a time.

In building a robotic system, it helps if you can kind of do the opposite - focus on building one layer at a time. If you have a new control algorithm, on a prototype PCB, connected to a new actuator, and you don't get satisfactory results (or any results at all), what aspect is to blame?

The approach I, and I believe most robotics developers, would take is to try to introduce one "new" thing at a time, thoroughly test it, and then add the next new thing. This is where development boards are useful - if you want to try a new processor, don't try to use it on a board you created yourself, because then it's not clear if you're having some bus issue because you wired it wrong, or because you're calling the library wrong, etc.

The development board is something that runs a particular chip, that generally has a programmer and debugger built in, that might have some handy auxiliary circuit(s) included like an analog to digital convert (ADC) or a digital to analog converter (DAC), etc. It's already been tested so you can use that hardware with relatively high certainty that it will work. This means that, if you're having an issue, it probably lies with your software or with the components you have attached to the development board.

Once you've got your program running well, you understand how the board is used, and you're getting generally good results, then you might want to switch to a board you design. Development boards are generally more expensive because they DO feature the programming interface, aux hardware, etc. They can also be kind of a pain to use because they may not always have good mounts.

Creating a board is not free, though - it costs your time to design it, the cost to print it, populate the board, test, etc.

There are only two times I can think of when I would really push to move away from a development board and to a custom board (and I think this gets to the heart of your question):

When the total cost of a custom board is less than the cost of continuing to use a development board, or

When you need a particular footprint for your board that cannot be met by using a stock development board.

For point 1, this would generally be if you're going to produce some quantity of product. For example, if you're going to make 10 robot arms to outfit a classroom, then maybe you want to just stick with the development board. If you're going to produce 100 for sale on a teaching website, then maybe you go the custom board route. A development board might cost \$20 where a custom board, with a reduced hardware set and smaller board footprint, might be \$10. Not really worth the effort for development again unless you're going to do some large quantity or if the development board won't fit in your device.

Finally,

What exactly is most commonly used in the robotics industry regarding this topic? I have heard about AVR, ARM, PIC, as well as intel processors.

The answer here is generally "choose the least expensive one that meets your needs." Factors that determine the cost to you may include things other than price - does the chip really do what you need it to do? Does the chip have a large support community, so you can get help if you need it? Does the chip require external devices for things like DAC and ADCs, or can it do those tasks natively? Does the chip have enough I/O pins or would you need an external multiplexer? Does the chip have enough memory for your program? Does it run fast enough?

Maybe you can answer all of these questions up front, but realistically you might have an okay guess at most of the answers. Then it's up to you to try your algorithm on a variety of devices you think might be competing (again, typically on I/O quantity, memory size, price, etc.) and see which chips you think are the best for your application.

Again, this is where the development board comes in. It'd be nice, if you're going to port your program to run on 3 or 4 devices, if you could just focus on the task of hooking up your I/O and buses in software and not have to worry about whether you've accidentally swapped the MOSI and MISO lines or something like that.

Then, once you've released your first product on a particular device, you'll probably find you'll use that code as the basis for your next project, and then inertia sets in and you'll just keep using that particular hardware family from now on because it's what you're comfortable working with.

So, the tl;dr here is that you should probably stick with the hardware you've been using unless you have some need to do something different. If you need something different now because of a footprint requirement, try making a custom board for the hardware you're used to using. This will give you a lot of insight into the task of designing a board while producing an end object that is useful for your current projects. Don't prematurely optimize - don't go making a task for yourself because you think you might need it in the future. Do your work now on the hardware you have now. If you find it's insufficient, then you should look at migrating.


问:
First steps in robotics
I am a High School student and a beginner coming to Robotics and I have no idea where to start. I have spent days searching tutorials and books I could read to start building and programming my first robot but most of them just makes me much more confuse, most of them requires me to buy pre-assembled components and just assemble the components I ordered as a puzzle, but I want to learn to build a robot from scratch.

My questions are:
 1. What should I read / learn first?
 2. What programming language should I use? (I know a variety of programming languages. C++ being the one I know the best )
 3. What should I learn from physics? ( Circuits, Electricity, etc )
 4. How do you think I should start from this point where I know absolutely nothing but to program?

答:
Answering for others with the same question... I understand the OP has long since moved on

I don't disagree with the others here, but have a different take. Direct answers to your questions (with an FTC Robotics perspective in mind):

Just as you need at least a minimal computer to learn programming, you will need a at least a minimal robot to learn Robotics... You are going to have to acquire something. 2 motors bolted to a hunk of metal with a Rev Expansion Hub, 2 (FTC compatible) android phones, and a Logitech controller are about the minimum you can get away with. Unfortunately it's about a $400 minimum investment. Hopefully your school or club will supply these things. Start with learning to build (by doing it) a minimal or better physical robot.

For FTC, you have only two choices of programming language... Block programming as available in the FTC controller apps, or Java. Even though you know C++, review and play with the blocks for at least a few minutes before diving into Java. This will give you a sense of what others find important, etc. As blocks are just a visual representation of what someone else wrote in Java.

You will need to know some very basic electronics... The idea of positive and negative voltage, etc. But really nothing else comes up in FTC until the highest level of competition. I'm not saying you shouldn't strive for that. But it would likely be an inefficient use of time to start studying any particular subject based on a recommendation here, when you will soon see exactly what is important to you by getting to the point where you need skills beyond what you already have.

I recommend building a robot. Then deploy one of the built-in sample programs (op modes) and get it to work. Then get into that program and change it in some way and get that to work. By the time you have done that, all of this advice will be obsolete and you will be well on your way.

Good luck!

Title: First steps in robotics


问:
How to create a stable 48V 10A power supply?
I'm shopping for batteries and it's easy to find a 48V lithium ion battery that has like 30A max continuous discharge rating. However, I know that the battery supply has a variable voltage from 54V - 42V depending on how much energy has been drained.

I'm using a 48V to 24V buck converter to power many of my electronics for a stable 24V power supply. However, I still have some 48V motors that takes 10A max for my robotics application. I can't figure out a way to power my 48V motors with a stable power supply.

I found a 36V to 48V step up converter but it only outputs 5A.

答:
You indicate the need to have both a stable 24V and a stable 48V power supply from a single battery. And that you are already using a 48V to 24V buck converter to meet the stable 24V need.

If you intend to continue with this design, you may need to choose a battery voltage between 24V and 48V. Then continue using a buck converter to get the 24V, while adding a boost converter (in parallel from the battery) to get a second line with 48V. Of course, you will need to make sure you use or construct a battery that can sustain the level of current for both outputs.

Most DC-DC converters have a fairly wide range of input. So if you switch to a 40V battery, you may be able to continue using the same buck converter. Search for "20A boost converter" or "30A boost converter" to see several options for your 48V line.

Be sure to confirm the input voltage of your converters includes 33V through 46V if you use a 40V lithium ion battery.

Good luck!


问:
Do I need a camera along with LIDAR for SLAM?
Equipment:

Pi 3 B

Mega

2x Encoder Motor 12VDC 299RPM

MPU 6050

12V bat 2000mAh

LIDAR or Kinect ?

I want to implement EKF SLAM. I have referred bot NOX ROS wandering robot, Hussarian CORE and Robotics weekend. I have achieved localisation and sensor fusion of MPU and Encoder on Mega.

For the Mapping part, I am confused as to which sensor should be used either LIDAR or KINECT? What is the advantage of using both of them?

答:
Using a raspberry pi you will not have enough computational power for dealing with a Kinect.
Moreover, a Kinect is sensitive in general to more artifacts than a lidar.

So take the easy path and implement a LIDAR-based SLAM for now.


问:
Questions about customized stereo camera
I am designing my robot and I have quite design issues with the available stereo cameras on a market.
For the prototype I am using ZED M but it is too expensive and quite large.

The question is, do I really need ZED M if I am using my own algorithms to compute the depth? So is having a global shutter, usb 3.0 connection, fixed baseline and wide fisheye lenses will do the job for me?

I am thinking to get the components which are very small and lense+sensor should be no larger that 14mm x 9mm x 5mm and looks like that the sensors are very small  with small lenses also on a market.

I am using stereo camera for SLAM and obstalc detection.

答:
There are several factors that you should consider before creating your own stereo camera:

How fast do you expect your robot is going to move. This will influence the synchronization requirements. The main advantage of cameras like ZED or RealSense is that they are usually hardware synchronized. If you just use two USB 3.0 cameras they will not be synchronized and that might have a significant impact on the accuracy of your stereo matching.

You have to make sure that the cameras are rigidly fixed to each other. If they are not robot vibrations would invalidate you calibration and that will also have a significant impact on accuracy.

You have to ensure that the cameras are well calibrated. There are methods to do this but this is an additional step that you will have to do by yourself.

Camera parameter control is another issue that you will have to take care of. Usually USB cameras have an automatic camera parameter control algorithm (controlling of exposure time and sensor gain). This is fine for doing general computer vision, but if you have two cameras you have to make sure that both of them take images with identical parameters. If that is not ensured you might end up with situation where one camera sees a white wall and another does not. In this case they would produce images that do not look similar. This will again have significant impact on stereo matching quality. To overcome this you can set one camera as master and control the second camera parameters manually. But that will again introduce latency.

These are the main points that you have to consider when building a stereo camera.


答:
With a vehicle with steered wheels the simple approach is to calculate the centre of rotation for the vehicle and then, given the speed of the vehicle, the distance travelled around the arc can be calculated. This results in a change in position and heading.

The centre of rotation can be determined by projecting lines along the axles of the four wheels and finding where they intersect. Normally the rear wheels are non steering so they project a line along the rear axle line. If the steering geometry is 100% Ackermann, the lines projected from the front axles will intersect at the same point on the rear axle line, giving the centre of rotation.

The 'AckerMann Steering Geometry' and 'Slip Angle' entries on Wikipedia cover this quite nicely without getting bogged down in the maths.

Note that this is a simple model which ignores wheel slip, static toe etc

A slightly more complex approach is to calculate the angle of the wheels relative to the motion of the vehicle (aka the slip angle) and then determine the force vector generated by each wheel.
Each wheel has a longitudinal force (rolling resistance and driving/braking torque) and a lateral force (generated by the slip) which combine to give the force vector.
Each of these forces act upon the vehicle to give a net acceleration (both linear and rotational)

This approach requires knowledge of the wheel loads and, at the least, an estimation of the tyre slip-force curves, although you could assume the force is linearly dependent on slip angle for low speed modelling.

If you want to really simplify matters you can treat the vehicle as a bicycle model i.e. two wheels on the centreline, one steering.
The position calculation can then be approximated by using the steering angle to generate a rotation around the centre of gravity (the steering angle is roughly proportional to a force which acts along the axle line of the wheel) and then travel in a straight line using the vehicle velocity over the sampling interval. In some regards this is similar to the calculations required for a tracked vehicle.

Title: question about car-like robot localization based on dead-reckoning

Body:
I have a question about car-like robot localization using only dead-reckoning. Given:

robot position (at current time step) in the form $\begin{bmatrix}x & y & \theta\end{bmatrix}$ (theta is the heading)

steering angle

distance traveled between two time steps

How can I estimate the position of the robot at the next time step?


问:
Self Powered Quadcoptor
I have this idea or a very curious question in my mind. I am no where near professional though, but i would like it to be answered. </p>

<p>We all know how wind turbines can be used to generate electricity. So is it possible to create a quadcoptor that will start with some minimal power by small battery but in time will sustain and keep its system on by self generating electricity and keep on rotating its rotors on its own without other external supply? </p>

答:
I have thought of that too, I am not very sure but I feel we can improve the battery life of a quadcopter by doing the following:

We can have a secondary winding on the quadcopter motors.

As the motor is powered to rotate even the secondary winding rotates too hence cuts magnetic field hence creating electricity (we need to make sure that the secondary winding is on primary winding but they shouldn't be connected).

Later somehow we can drain the energy produced by the secondary coil from the motors using some wires and slip rings.

The energy could either be used for led lighting on the quadcopter or for charging the battery, hence increasing the battery life.

Title: Self Powered Quadcoptor


答:
Please see this link which will give you good idea about differences between LIDAR and Depth Cameras (Kinect is one example).

http://lidarradar.com/info/differences-between-the-lidar-systems-and-depth-camera

based on your SLAM application you can use LIDAR, Depth Camera, or both. Deciding factors are:

Cost of application; LIDAR is more expensive and higher performance

indoor, outdoor, or both

environment complexity; does it have walls only or many other objects

Required performance; LIDAR is faster in scanning

angle of scanning 360 or 120 or less ? LIDAR is wider coverage

Title: Do I need a camera along with LIDAR for SLAM?

Body:
Equipment:

Pi 3 B

Mega

2x Encoder Motor 12VDC 299RPM

MPU 6050

12V bat 2000mAh

LIDAR or Kinect ?

I want to implement EKF SLAM. I have referred bot NOX ROS wandering robot, Hussarian CORE and Robotics weekend. I have achieved localisation and sensor fusion of MPU and Encoder on Mega.

For the Mapping part, I am confused as to which sensor should be used either LIDAR or KINECT? What is the advantage of using both of them?


问:
Programming Robots with JavaScript
As somebody who is spending the majority of his time programming in JavaScript, what's the best route to get into small-robotics without needing to deviate too much from my current language focus?

Are there any project kits or tools that make use of the JavaScript language that might make the field more approachable for developers like myself? I would even be interested in virtual environments where all code is executed in a simulation.

答: It might be helpful to look for javascript-based robotics projects online as javascript-based robotics community has been growing rapidly since this question was asked. For examples, the blogger behind https://burningservos.com documented processes of building a four-legged robot from scratch and discuss multiple libraries javascript the blogger evaluated or used. There is also "hardware" section in glitch (or even at Adafruit and Hackster.io) where people share their javascript-based hardware hacking projects where you can check out libraries they used.</p>

Title: Programming Robots with JavaScript


问:
Given an initial position, a goal position and a duration find a trajectory
I have an initial position $X^R_{init}$ of the robot ($x$, $y$ and yaw) and a goal position $X^R_{goal}$ I need to create a trajectory of duration $T$ with $n$ waypoints to move the robot from its initial position to the goal position (on a straight line). This trajectory is in terms of velocities (linear x, y and angular z).

Although this looks like a simple problem, I can't find a proper way to do it.

My algorithm does the following:

```<code>delta_x = goal_x - init_x
delta_y = goal_y - init_y
delta_yaw = goal_yaw - init_yaw

magnitude = calculate mag of delta_x, delta_y, delta_yaw
unit_x = delta_x / magnitude
unit_y = delta_y / magnitude
unit_yaw = delta_yaw / magnitude

step_duration = T / n

linear_x = unit_x * step_duration
linear_y = unit_y * step_duration
angular_z = unit_yaw * step_duration

traj = empty_trajectory
for i .. n
   traj.add_waypoint(linear_x, linear_y, angular_z)
</code>```

So the above pseudocode should create a traj trajectory of length $T$ of $n$ waypoints that moves the robot from its initial position to the goal position.

What's wrong with the above?

答:
Your pseudocode seems to do what you expect but it is not up to the task at hand since the approach of doing path planning in velocity is fundamentally wrong. Instead, you should be doing path planning in position and motor control in velocity.

When you command a robot in velocity without taking into account the corrections required to compensate for even small deviations from the intended position path (this mode is called open-loop), then the robot inevitably ends up in a location different from $X^R_{goal}$. This happens both in a simulation where the integration of velocity cannot be perfect and, more importantly, with a real robot where impairments, noise, and unmodeled factors contribute to significant deviations from the ideal behavior.

To get around this, the simplest solution would be to implement a closed-loop velocity control over the planned position path. In particular, the controller can be a PI, that is a proportional-integral unit.

In essence, suppose we have a vector $traj$ containing position waypoints connecting $X^R_{init}$ and $X^R_{goal}$. For each dimension of $traj$ at each control instant $t=t_i$, you should compute the velocity command as:

$$
v[t_i] = K_P \cdot e[t_i] + K_I \cdot \sum_{t=t_0}^{t=t_i} e[t],
$$

where $e[t_i]=traj[t_i]-loc[t_i]$ represents the instantaneous error between the desired path and the actual location (i.e. the feedback) at time $t=t_i$. Further, $K_P$ and $K_I$ are the so-called proportional and integral gains of the PI controller that regulate the contributions of the corrections induced by the actual error and the error accumulated over time, respectively.

There are diverse methodologies to tune the gains, but you could easily come up with working values by setting up initially $K_I=0$ and slightly increase $K_P$ throughout subsequent sessions until you will get a decent tracking. The final displacement error can be compensated by playing with $K_I$.

Finally, you can even think of mixing open-loop and closed-loop modalities. In this context, the velocity command will resemble something like the following:

$$
v[t_i] = v_{OL}[t_i] + K_P \cdot e[t_i] + K_I \cdot \sum_{t=t_0}^{t=t_i} e[t],
$$

where $v_{OL}[t_i]$ is the open-loop vector (the so-called feed-forward term) that can be populated using your pseudocode. The gains $K_P$ and $K_I$ will assume different values compared to the case of a pure feedback controller. You will experience anyway that without the feedback term the robot won't attain the goal.


问:
Using brushless motors for very high torque
I'm currently building an robotic arm and I want the elbow joint to be comparable to a human one
But here's the problem, electric linear actuators are too slow and have low torque, same goes with regular hobby servos and stepper motors

Ideally I would want a brushless motor with no gearbox that could hold a 10kg weight at an arm's distance (let's say 40 cm) and move freely at around 100rpm (about 10rad/s)

Holding force: 40 N.m

No load moving velocity: 100rpm / 10 rad/s

I was thinking sensored brushless motors could do the trick but surely that load would be too much for those...

If this cannot be achieved, would it be possible to use a 3D printed 100:1 planetary gearbox and a low kv motor to do it?

Thanks in advance, if you have other types of motors that would be more suitable please comment them, any help is appreciated.

答:
R3D34THR4Y,
You are on right path. In this video skyentific explains why wide bldc motors are better fit for your problem. He uses OpenTorque Actuator, that was designed and developed by Gabrael Levine.

https://www.youtube.com/watch?v=Hd54ik_45Wo&list=PLsQ_UyfyUeRWpuD-_lvCiVP-Xg6XgwIZa

Regards,
Algocrat


问:
How to read data from the VN100 IMU on Ubuntu?
Hi I have a VectorNav VN100S Development kit, which has VN100 IMU unit. I want to set it up with Ubuntu 16.04 and ROS Kinetic, but unable to read anything from the VN-100.

So far I have been following official documentation but it doesn't contain any information about interfacing with Ubuntu/Linux.

Does anyone know of any good resource which might help me get started?

答:
Chapter 3.5 on page 26 of the user manual says that there are 3 ways to interface with the VN100.  (2 different serial types, and SPI).  SPI would be useful if you were interfacing with another microcontroller, but not so much for your computer.

Serial port 1 is "regular" RS232 logic levels.  Which is +-12 Volts.  If your computer has a serial port, you can use that.

Serial port 2 has 3 volt logic levels.  For this, you should use a FTDI cable.  For example: https://www.digikey.com/product-detail/en/ftdi-future-technology-devices-international-ltd/TTL-232RG-VREG3V3-WE/768-1071-ND/2441361

RS232 has many control wires, but you probably only need 4: V+, GND, RX, and TX.  Remember to connect the computer's RX line to the devices TX line, and vice-versa.

Then use a serial terminal emulator such as picocom or minicom to interface with your device.  Here is an example:

```<code>> picocom -b 9600 /dev/ttyUSB0
</code>```

(control-a, control-x to exit)

you probably have to put your user in the "dialout" or "tty" groups too.

Body:
Chapter 3.5 on page 26 of the user manual says that there are 3 ways to interface with the VN100.  (2 different serial types, and SPI).  SPI would be useful if you were interfacing with another microcontroller, but not so much for your computer.

Serial port 1 is "regular" RS232 logic levels.  Which is +-12 Volts.  If your computer has a serial port, you can use that.

Serial port 2 has 3 volt logic levels.  For this, you should use a FTDI cable.  For example: https://www.digikey.com/product-detail/en/ftdi-future-technology-devices-international-ltd/TTL-232RG-VREG3V3-WE/768-1071-ND/2441361

RS232 has many control wires, but you probably only need 4: V+, GND, RX, and TX.  Remember to connect the computer's RX line to the devices TX line, and vice-versa.

Then use a serial terminal emulator such as picocom or minicom to interface with your device.  Here is an example:

> picocom -b 9600 /dev/ttyUSB0

(control-a, control-x to exit)

you probably have to put your user in the "dialout" or "tty" groups too.


问:
Feedback linearization of a nonlinear MIMO system
I have to design a feedback linearization for  the model of a car with a single trailer. This picture shows the system:

And this is the kinematic model I got, where q_dot = [x_dot; y_dot; thA_dot; thP_dot; thR_dot].

I chose y1 = x and y2 = y as outputs. I proved that the system is controllable and observable. To complete the exercise, then, I calculated the time derivatives of y1 and y2. The classic iteration - if I'm not wrong - says to continue the derivatives until a dependance from both inputs comes out. So I calculated the second derivatives with respect to time, the third ones and the fourth ones, until I got two functions (the fourth derivatives of y1 and y2) depending on u1, du1/dt, d²u1/dt², d³u1/dt³ and u2 (the second input comes out only at this step). With these results, I thought to make a system extension: ξ1 = u1,  ξ2 = du1/dt and  ξ3 = d²u1/dt². The new inputs are w1 = d³u1/dt³ and w2 = u2. Finally I can write:

where v is a new control variable.
This was to explain the problem and how I got to this point. Now, my question is: how do I choose v? It should depend on 8 variables, I suppose: q1, q2, q3, q4, q5, ξ1, ξ2, ξ3. But I don't know how.

答:
You used feedback linearization, so you could use techniques for linear (time invariant) systems, such as pole placement or LQR. Namely you have to have LTI state space model which is two quadruple integrators

$$
\dot{x} =
\begin{bmatrix}
0 & I & 0 & 0 \\
0 & 0 & I & 0 \\
0 & 0 & 0 & I \\
0 & 0 & 0 & 0 \\
\end{bmatrix} x +
\begin{bmatrix}
0 \\
0 \\
0 \\
I \\
\end{bmatrix}v,
$$

with $x = \begin{bmatrix}y_1 & y_2 & \dot{y}_1 & \dot{y}_2 & \ddot{y}_1 & \ddot{y}_2 & \dddot{y}_1 & \dddot{y}_2\end{bmatrix}^\top$. You could try to find an expression for the derivatives of $y_1$ and $y_2$ as a function of $q$. If this does not have an explicit solution you could also use an observer, since if $y_1$ and $y_2$ are known the system is observable.


问:
Autonomous Navigation Bot
I'm trying to build an Autonomous parcel delivering rover using GPS.So after giving destination coordinates, I don't know how to make the robot understand to which direction it should move. Basically, My question is, How can I find out or calculate the direction(angle at which the the boat should move) from starting and destination coordinates?

My bot is actually a rover which is designed for parcel delivery purposes. I want to know how to calculate the direction( angle at which it should move) from the coordinates of current location and target location? for example, if my boat is at A and and it was moving on a straight line until it reached A. And now after reaching A, next target is B which is at an angle from the initial line of motion, I want to calculate this angle from coordinates of A and B.

答:
If you have know where the bot is in the world, and can get co-ordinates of the the bot on the world map, then you can overlay a grid, and can use something like Manhattan Distance to get the distance between A(Start) and B(goal).  Then you can associate velocity based upon your bot's base frame and motor output.

This should give you a good start. Later you can deploy obstacle avoidance and evasive maneuver algorithms based upon sensors you will be using and environment condition.

Also to make your task easy, you can rely on ROS (Tutorials) for low level controls, thereby not to reinvent wheel and focus more on development.
Check Navigation Stack in ROS which might help.

Title: Autonomous Navigation Bot


问:
Kalman Filter: Do we need to measure each entry of the output-sequence, or can we derive them?
A Kalman-Filter gets applied to a state-space model in order to obtain estimates of the state-vector.

Example: Assume a car moving on a straight line in x-direction (this is a 1-dimensional problem). The State-space model could be described by:

$$
\begin{bmatrix}
x_k \\ \dot{x}_k \\ \ddot{x}_k
\end{bmatrix} =
\begin{bmatrix}
1 & T & \frac12\,T^2 \\ 0 & 1 & T \\ 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x_{k-1} \\ \dot{x}_{k-1} \\ \ddot{x}_{k-1}
\end{bmatrix} + w_{k-1}
$$

$$
\begin{bmatrix}
y_k \\ \dot{y}_k \\ \ddot{y}_k
\end{bmatrix} =
\begin{bmatrix}
1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x_k \\ \dot{x}_k \\ \ddot{x}_k
\end{bmatrix} + v_k
$$

The y-vector is our measurement-sequence. And here comes my question: For the Kalman-Filter to work, is it necessary to measure each of the entries of the y-vector?

Coming back to the car: I can measure the number of rotations of the driving-shaft using a wheel-encoder. From this I can infer the distance travelled, which is my x-coordinate assuming a movement on a straight line in x-direction.

I cannot measure the velocity directly. But I can infer the velocity from the number of edges detected within a certain time-gap, using the wheel encoder.
And I can derivate velocity in order to obtain acceleration.

So, what I am saying is: In order to obtain each entry of the y-vector, I am using but one sensor: The wheel encoder. Is this valid when applying the Kalman-Filter equations?

答:
If you formulate your Kalman filter with the output matrix as eye(3) -
$$
\left[\begin{array} \\
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}\right]
$$

then you need to provide all those measurements, but you could alternatively define the output matrix as eye(1,3) -

$$
\left[\begin{array} \\
1 & 0 & 0 \\
\end{array}\right]
$$

and then that should let you supply just the feedback measurement on encoder position and have the Kalman filter provide the speed and acceleration estimates. This would be the preferred way to do it, instead of trying to manually derive the speed and then passing that speed "measurement" to the Kalman filter.


问:
Stuck pneumatic cylinder
I've just received a baomain pneumatic cylinder from amazon (50 mm bore 100 mm stroke). When I tried to move it back and forth by hand, it wouldn't budge. Ive never used pneumatic cylinders for robotics before, but I'm fairly certain that they should be movable by hand. Does anyone know the awnser to this issue, or if it is even an issue?</p>

答:
Sometimes the seals can stick a bit if they've sat for a long time, but once you get past the initial pop they should move relatively freely. You're using a 50 mm bore, though, which is quite large, so there's a lot of surface contact for the seal.

Hook your cylinder up to an air compressor and try to move it. You should do this sooner rather than later so you can return it within your return window if the cylinder is defective.

As a side note, pneumatics are okay, but air is compressible. You should be able to calculate the force your actuator is going to output (acting surface area times air pressure), but the difficulty for control is that it's hard to quickly and accurately modulate the air pressure. It takes time to build up the air pressure and it also takes time to bleed the air pressure, because air is compressible.

You also have to take into account the shaft diameter when calculating acting surface area - the "extend" action uses the full bore diameter, but the "retract" action can only act on the surface area that is exposed, which is the area of the full bore diameter minus the area of the shaft diameter - $A = \pi \left(\left(r_{bore}\right)^2 - \left(r_{shaft}\right)^2\right)$.

Hydraulics are superior from a control aspect because you get near-instantaneous force modulation because you can change pressure so quickly in a hydraulic fluid, because it's not compressible. Tiny fluid volume changes result in immense pressure changes.

Title: Stuck pneumatic cylinder


问:
Inverse Kinematics "Can not converge" issue
I'm a complete beginner with LabView and I have been practicing forward kinematics with the help of a tutorial I found. It's been a learning curve but I've managed to understand a few things.

However, I have not been able to implement an inverse kinematics vi.

I've been trying to replicate this tutorial but I have been unsuccessful so far.

I'm working with a SCARA serial arm. The image below shows my work-in-progress attempt.

When I run my vi I receive the following error:

```<code>Error -310040 occured at NI_Kinematics.lvlib: Inverse Kinematics (Point).vi->Inverse Kinematics Attempt-1.vi

LabVIEW Robotics: (Hex 0xFFFB44E8) LabVIEW cannot converge to a solution in the number of steps you specified. Make sure that the serial arm can achieve the transform you desire.
</code>```

My objective is to set the X, Y and Z input fields to the values representing a point in space and move the endeffector to that point.

I would really appreciate some guidance?

答:
It's telling you it can't reach the solution in the number of steps you've given it. As Akshay Kumar stated, you need to be sure that the robot arm can actually reach the desired target. I've used LabVIEW, but it's been a long time - I don't know what your parameters are doing or what you have set on the front panel, but it looks like you're passing a lot of zeros to the arm initialization. What are the arm link lengths that you're providing? If you've told it that every link is length zero, and you're commanding it to reach <1, 0, 0>, then it's going to fail because no combination of zero-length links will ever reach a position of 1.

You asked how to determine if the pose is achievable. The real answer is complex, but you can do a quick check by finding the distance to the target position from the base of the arm (target = t, base = b) $\sqrt{(t_x-b_x)^2 + (t_y-b_y)^2 + (t_z-b_z)^2}$ and comparing that to the sum of the link lengths. If your target position's distance is greater than the sum of your link lengths then there's absolutely no way you can reach it.

It is possible to have a point inside your "sphere of maximum reach" that is still not reachable, because of joint constraints or link lengths, but that is a much harder problem to solve (generally no analytic solution, only iterative approaches).

If you're trying what should be a simple test case, then I think you may have initialized your arm incorrectly, or your length and target units are in disagreement.


问:
Iterative calculation of trajectory
In the answer https://robotics.stackexchange.com/a/7512/22953 there is an example for trapetzoid trajectory planning that results in the following table.

\begin{array} {|r|r|}
\hline
time        & t & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\
\hline
acceleration& a & 0 & 2 & 2 & 2 & 0 & 0 & 0 & -2 & -2 & -2\\
velocity    & v & 0 & 2 & 4 & 6 & 6 & 6 & 6 & 4 & 2 & 0\\
position    & d & 0 & 1 & 4 & 9 & 15 & 21 & 27 & 32 & 35 & 36\\
\hline
\end{array}

By ocular inspection it seems that

v[t] = v[t - 1] + a[t]
d[t] = d[t - 1] + (v[t - 1] + v[t]) / 2
```

What is the mathematical basis for this? Why is the average velocity used but not the average accelation? What would the corresponding table look like for a third degree trajectory (i.e. constant jerk instead of constant acceleration)?

答:
A trapezoidal move is defined by its instantaneous change in acceleration (and thus linear change in velocity) during the acceleration and deceleration phases.

Also, if a trapezoidal move never gets up to the peak velocity, because the distance is too short, it degenerates into a 'triangular' move, with the deceleration phase starting immediately after the acceleration phase ends.

If the velocity profiles use constant jolt (jerk) then it is no longer a trapezoidal trajectory, and the maths become much harder. You can approximate it with a table as above, just add a jolt row above acceleration and many more columns, but you really need to be using the polynomials to calculate the values.

From a practical point of view, calculating an acceleration and velocity profile from desired time, distance, maximum jolt, maximum acceleration and maximum velocity parameters, is much more complicated than doing the same for the time, distance, maximum acceleration and maximum velocity of a trapezoidal profile.

If you are interested in those equations, Constant Jerk Equations for a trajectory generator seems to be a pretty good summary.

Title: Iterative calculation of trajectory


答:
Trapezoidal trajectory is basically a piecewise quadratic function. Since the function is quadratic, its second derivative is a constant. The trajectory is then basically comprises segments of constant accelerations.

Denoting a trajectory function as $x(t)$, for each segment we would have
$$
x''(t) = a(t) = a,
$$
where $a$ is the constant acceleration of that segment.
Integrating the above equation with respect to time, we would then have the velocity equation
$$
x'(t) = v(t) = at + v_0,
$$
where the constant of the integration is $v_0$, which is the initial velocity of that segment.
We finally obtain the displacement equation by integrating the above equation
$$
x(t) = \frac{1}{2}at^2 + v_0t + x_0,
$$
where the constant of the integration is $x_0$, which is the initial displacement of the segment.

If we substitute $at = v(t) - v_0$ (from the velocity equation) into the displacement equation, we would then have
$$
\begin{align}
x(t) &= \frac{1}{2}(v(t) - v_0)t + v_0t + x_0\\
&= \frac{1}{2}(v(t) + v_0)t + x_0.
\end{align}
$$
Now you can probably see how it comes to be the average of the velocities.

From the given table, you can view it as the trajectory being given as segments where each segment has duration of 1 second.

For a third degree (piecewise cubic) trajectory, the idea is pretty much the same. You start from the fact that the jerk for each segment is constant, i.e.
$$
x'''(t) = j(t) = j.
$$
Then all the remaining equations can be derived by integrating the above equation accordingly.

Title: Iterative calculation of trajectory

Body:
In the answer https://robotics.stackexchange.com/a/7512/22953 there is an example for trapetzoid trajectory planning that results in the following table.

\begin{array} {|r|r|}
\hline
time        & t & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\
\hline
acceleration& a & 0 & 2 & 2 & 2 & 0 & 0 & 0 & -2 & -2 & -2\\
velocity    & v & 0 & 2 & 4 & 6 & 6 & 6 & 6 & 4 & 2 & 0\\
position    & d & 0 & 1 & 4 & 9 & 15 & 21 & 27 & 32 & 35 & 36\\
\hline
\end{array}

By ocular inspection it seems that

v[t] = v[t - 1] + a[t]
d[t] = d[t - 1] + (v[t - 1] + v[t]) / 2
```

What is the mathematical basis for this? Why is the average velocity used but not the average accelation? What would the corresponding table look like for a third degree trajectory (i.e. constant jerk instead of constant acceleration)?


问:
What are the differences between trajectory planning, trajectory tracking, path planning, path following and motion planning?
What are the differences between trajectory planning, trajectory tracking, path planning, path following and motion planning? And what are the basic methods they use?</p>

答:
To begin with, let's first define the term trajectory and path. Once these definitions are clear, the rest will follow.

Path is the set of all points a robot places itself at, to move from point A to point B.

Trajectory is path with time information. Simple!

So let's say if a robot moves from A(0,0) to B(4,4) along y = x curve, we say that the line joining the points A and B is the path the robot followed. However, if I say that the robot traversed along the path such that at t=0, it is at (0,0), at t=1, (1,1), at t=2, (2,2) and so on, then, not only I'm specifying the robot's position on the path, but also the time instants at which the robot is at a particular points on the path. This is trajectory. This is why you often hear SpaceX guys saying "trajectory looking nominal" and not "path looking nomimal", the reason being that they have designed the rocket such that it must be at some defined points at defined time instants, in order to get out of Earth's atmosphere.

Few observations from the distinction between the two definitions; From trajectory, we can get velocity and acceleration values along with the position. But a path only defines the position and says nothing about the velocity and acceleration. The robot can take whole day to move from A to B, or it can take 1 min, 1hr or 1sec to move from A to B, we don't know!

Definitions:

Trajectory tracking - the process of observing the positions of the robot along with the time instants at which it is present at the desired positions

Trajectory planning - the process of planning the motion of the robot between point A to point B such that it covers the distance between the points in a time controlled manner i.e. it moves from A to B by traversing portions the path between A and B in defined time intervals. We also make sure that the robot moves exactly along the path we want it to move on.

Path planning - same as trajectory planning, but we don't consider the time constraints. We are concerned only with making the robot move from A to B.

Motion planning deals with path planning considering the external factors encountered during the motion like traffic, obstacles, bumps, dead points etc. So in motion planning you would not only move from A to B, but you would move in such a way that you don't collide with other objects(for eg.) or you would follow some walls, or follow some lines etc.
One example of motion planning will be autopilot! Autopilot makes the aircraft move from one airport to another in such a way that the aircraft doesn't collide with other aircrafts in air. Only path planning will give you n number of ways to reach Airport B, but motion planning will give you the most appropriate one which obeys the constraints you defined for the motion.

Basic methods of motion planning are Bug1, Bug2, tangent bug, wavefront planner, A*, Djikstras. The list is endless!


问:
Free Multibody Dynamics Software?
I'm working on modelling a feller buncher, its end effector consists of a saw to cut trees and claws to bundle them together. I'm looking for a free/open source software that can simulate dynamics of multiple constrained bodies, any recommendations?</p>

答:
I think FreeCAD already has some capabilities in this regard. Also, if you are a hobbyist or a startup below $100K/year income, you are eligible to have Autodesk Fusion 360 for a year for free. It is the little brother of the Autodesk Inventor with more limited capabilities and using cloud to compute and store your models. It has dynamic simulation and constraining features. Personally, I am using the latter, but only because I used to Autodesk products already. Had a look on FreeCad too, it looks really promising for me considering that it is completely free.

If you don't want to create your 3D model, then Matlab has various really nice toolboxes, oh right, that would not be free... Hope this helps a bit.

Title: Free Multibody Dynamics Software?


答:
If you are comfortable with programming, you can use a free physics engine, like Bullet or DART to create your model. There are also many other ones.

If you are less comfortable with programming (as in you will still need to code, but this softwear at least has a GUI) you can use a robotics framework for simulation like Gazebo.

You could take a look at MBDyn which has a declarative way of defining a simulation. May be simpler then the ones above.

I doubt that any automotive simulation framework would allow you to implement the mechanical linkages of yout vehicle.

If you have some CAD tools available, most of them have add-onds for simulating multi-body systems, but most-of them are not free...

If you do not want to code, I do not know any free solutions. If this is a hobby project, you could try the Matlab Home edition (Mechatronics option) for under 300 USD, (if it is a commercial project the matlab licenses will cost well above 15k). Students also get free/cheap Matlab versions. Other then Matlab, you can try MapleSim or other commercial software.

Title: Free Multibody Dynamics Software?

Body: I'm working on modelling a feller buncher, its end effector consists of a saw to cut trees and claws to bundle them together. I'm looking for a free/open source software that can simulate dynamics of multiple constrained bodies, any recommendations?</p>


问:
AWS Robomaker - success story?
I've struggled to get my head around Robomaker and still have not gotten even a simple robotic example to work. Have you located any documentation that is more complete than one Amazon offers?</p>

答:
I'm a product manager from the AWS RoboMaker team. We have a tutorial that can help you get started with the service: Projects on AWS:
How to Train a Robot Using Reinforcement Learning
with AWS RoboMaker

If you have any questions or feedback for the service, please reach out to me and I would love to help and take your feedback to improve our service.

Title: AWS Robomaker - success story?


问:
Stepper Motor power supplies
Being new to the world of stepper motors, I have a Longs Stepper Motor 23HS9430 bought from eBay it's a 3.0 A 5 V motor.

Although I have been reading about the supply voltage for the motor, the controller I have, again from eBay, has a supply voltage of 9-42 V DC.

What would be the best controller and supply voltage to run the stepper? The application is a antenna controller with a worm drive gearbox connected to the hardware that moves the antennas.

答:
I would recommend adhering to the specs of the motor for power supply.

Please see the following for driver:

AMIS-30543 Stepper Motor Driver Carrier

3A UNIPOLAR STEPPER MOTOR DRIVER

Title: Stepper Motor power supplies


问:
Target Recognition for Microcontrollers
I'm building a device using microcontrollers, and part of the device necessitates target recognition. That is to say, if there are three targets, A B and C, I want my device to know when I'm pointing at no target, or Target A, or Target B, etc. I was thinking originally of finding different wavelengths of IR LEDs and putting them around each target (each would have a different wavelength) but I want this to ideally be able to reach across a room, let's say 30 ft. Is this feasible with IR receivers and transmitters, or is there a better alternative? And, is the varied wavelength idea with these transmitters feasible otherwise?</p>

答:
An IR transmitter is a circuit and an LED.  An IR receiver is an optical filter (essentially a piece of colored plastic, but the "color" is in the IR), a phototransistor or photodiode, and a circuit.

To make what you want using different wavelengths, you need to find IR LEDs with non-overlapping emissions (so they don't interfere with each other), and you need to find three different kinds of IR filter material, each that passes the light from one of your LED types but not from the other two.

Just off the bat, this doesn't sound feasible for a commercial application, much less hobby.  If you were getting a PhD in robotics and had a friend down the hall researching optical filter materials -- maybe you could do it.

The suggestion of using a TV remote would work, more or less, although TV remote receivers have automatic gain control, so it would be difficult to make fine distinctions in direction.

Part of my background is in radio and communications signal processing, so the technique that leaps to my mind is to have each LED beacon use identical LEDs, but pulse at a different frequency.  You'd want the frequencies separated enough for easy discrimination with filters, and probably not harmonically related.  So, for example, 50, 55 and 60kHz.  If you build the receiver circuit correctly you can amplify the output of the photodetectors with a circuit that has a passband of 50-60kHz, then either run them into three separate discriminator circuits, or run them into an ADC that samples sufficiently fast (200kHz is my knee-jerk "fast enough" suggestion, but there's wiggle room there) and do the discrimination in software.

Doing the "sample first then process in software" option requires a sufficiently powerful microprocessor to do the discrimination -- my gut feel is that anything 8-bit would be woefully inadequate, but an ARM Cortex M4 or better core running fast and with reasonably efficient code would do it.  It requires a healthy dose of DSP chops to write the software.

Doing the "discriminate in circuitry" option requires a filter bank of three filters centered on the pulse frequencies, with reasonably well-balanced gains, followed by some sort of amplitude detection into three times as many ADC channels.  It requires a healthy dose of analog circuits chops to design the circuits, and you'll need to deal with component variation and find the board space for the circuitry.

No matter how you do the discrimination, once you get your "channel per target" into your actual direction-finding software, you can use whatever technique would work for a single beacon to find each one of the three.

Title: Target Recognition for Microcontrollers


问:
Making a tunnel follower robot with 2 IR side sensors and 1 ultrasonic sensor
We have a tunnel and the distance from the walls to the robot is about 30cm when the robot is centered, the tunnel curves to the right. The robot has an infrared sensor on its left and one on its right and has an ultrasonic sensor at its front (so basically its eyes). How can I make the robot turn appropriately while its moving so that it's centered in the tunnel. I just need an idea for this algorithm because I can't find any. All what the infrared sensors can do is measure the distance to the walls.</p>

答:
I agree with @NikolaPi in principle.
But the controlling/driving mechanism is important here. If you are using PID controlling, then steering the robot can be very smooth. All you have to do is to tune the variables so that when robot starts getting closer to lets say, left wall, left motor's pwm increases w.r.t. the right one and vice versa. This way the robot will remain in an imaginary boundary/lane that is slightly wider than the robot but significantly smaller than the Tunnel's width. But the tuning will take a little effort to find the sweet spot where the correction neither occurs too often nor too late (Hint: You robot should move almost straight without compromising on speed. If its is moving in the form of the letter "S", your limits are too generous).

On the other hand, if you are using the simpler On/Off Controlling technique (also known as band bang approach), you take a limit of IR sensor reading from one wall and program according to that. If it crosses the limit, stop the other sides motor for some time so that the robot comes back to its center position. But beware that in this approach, with the battery voltage drop, the response from the motors changes. What I mean is that if you tune the robot to switch off motor for 100 ms in case of limit detection and it comes back to the good position, when the battery would get drained a little, the robot would need 130 or 150 ms of switching off to make the same correction. Of course it won't be able to as you have set it to 100 ms so there will be an error in the robots's position every time an adjustment is made. Eventually, these errors will pile up and the robot will collide with a wall.


问:
How to use tensor flow on arduino robot
I'm in the process of learning Tensor Flow, and I really want to use it on a new robot I'm going to build. I want the robot to be able to do image recognition, and move towards an image of interest, or follow a path, using neural networks. Is this even possible with tensor flow?

Is the Arduino capable of running neural network frameworks, such as Tensor Flow?

Thanks.

答: Check out an app on Google play (Arduino Object Detection and tracking by Gemcode Studios) It uses both opencv and tensor flow and sends image details over Bluetooth to an Arduino for further robot control and processing. </p>

Title: How to use tensor flow on arduino robot


问:
Depth map with Raspberry Pi
Is it possible to get two images from the Raspberry Pi camera mounted on a remote controlled bot and have them sent to a computer through Wi-Fi and process the images in the computer to generate a depth map?

All this is to be done in a very short time so that the robot can be helped with its locomotion without making it completely autonomous.

答: Yes, it is possible. This is a form of stereo vision. You will need an accurate model of how the robot moved between frames. Then you can use stereo vision techniques to calculate the disparity.</p>

Title: Depth map with Raspberry Pi


问:
Encoder values for PID control
I'm working on a two-wheeled robot and I'm trying to implement a PID control for the motors. But I have a problem, all sources I found online said I have to calculate the error with my encoder values.

For the robot I'm programming I got 2 functions. One that gets the absolute encoder values and one that gets the speed in ticks/s.

The sources I found didn't specify if I use absolute encoder values or the speed encoder values. I tried both already but it didn't work out too well, so I would like to know if some already have some experience with a motor PID control using the encoders.

This is my PID code I wanted to use:

```<code>e_func_r = v_des-v_act_r;

r_mot_r = r_old_r
    + (1/K_P)*(e_func_r-e_old_r)
    + K_I*(e_func_r+e_old_r)/2
    + K_D*(e_func_r-2*e_old_r+e_old2_r);

if(r_mot_r >= 100)
{
    r_mot_r = 100;
}
if(r_mot_r <= -100)
{
    r_mot_r = 100;
}

r_old_r  = r_mot_r;
e_old2_r = e_old_r;
e_old_r  = e_func_r;
</code>```

答:
Looking at the code in Embedded Robotics by Thomas Bräunl, DOI: 10.1.1.474.8129 this appears to be an 'optimised' (i.e. difficult to follow) version of an integer PID controller for velocity control.

It sounds like you want control position rather than velocity though, so you need a position PID controller, as described by Chuck♦, which is more directly applicable to your problem and easier to understand.

If you do want a velocity controller however, read on...

The code in question is on page 93, Program 5.7: PID controller code:

```<code>static int r_old=0, e_old=0, e_old2=0;
...
e_func = v_des - v_act;    /* error in velocity */
r_mot  = r_old + Kp*(e_func-e_old) + Ki*(e_func+e_old)/2
               + Kd*(e_func - 2* e_old + e_old2);
                           /* motor output */
r_mot = min(r_mot, +100);  /* limit motor output */
r_mot = max(r_mot, -100);  /* limit motor output */
r_old  = r_mot;            /* store this motor output */
e_old2 = e_old;            /* store last velocity error */
e_old  = e_func;           /* store this velocity error */
</code>```

In this snippet I've restored the static line (which is important as it shows this is an integer controller and not a floating point controller), left the original max functions in place, as they are easier to understand, and added comments.

In this code, the v_des is the desired velocity per controller period, the v_act is the current actual velocity per controller period.

Your changes appear to be:

The addition of the _r suffix (presumably to designate the right motor, and I assume there is similar code for the left motor)

Replacing the max function with a pair of hard coded if statements

Defining $K_P$ in terms of it's reciprocal.

The problem is the last change combined with the fact that we are using integer arithmetic.

Calculating 1/K_P will evaluate to either 0 for K_P>1) and 1 for K_P==1, assuming sensible values of $K_P>0$.

So you are effectively turning your Proportional Integral Derivative controller into a Integral Derivative controller for any value of $K_P$ other than 1.

If you went back to using K_P directly rather than trying to use (1/K_P) then you should be able to tune your motor for velocity control.

Title: Encoder values for PID control

Body:
Looking at the code in Embedded Robotics by Thomas Bräunl, DOI: 10.1.1.474.8129 this appears to be an 'optimised' (i.e. difficult to follow) version of an integer PID controller for velocity control.

It sounds like you want control position rather than velocity though, so you need a position PID controller, as described by Chuck♦, which is more directly applicable to your problem and easier to understand.

If you do want a velocity controller however, read on...

The code in question is on page 93, Program 5.7: PID controller code:

static int r_old=0, e_old=0, e_old2=0;
...
e_func = v_des - v_act;    /* error in velocity */
r_mot  = r_old + Kp*(e_func-e_old) + Ki*(e_func+e_old)/2
               + Kd*(e_func - 2* e_old + e_old2);
                           /* motor output */
r_mot = min(r_mot, +100);  /* limit motor output */
r_mot = max(r_mot, -100);  /* limit motor output */
r_old  = r_mot;            /* store this motor output */
e_old2 = e_old;            /* store last velocity error */
e_old  = e_func;           /* store this velocity error */

In this snippet I've restored the static line (which is important as it shows this is an integer controller and not a floating point controller), left the original max functions in place, as they are easier to understand, and added comments.

In this code, the v_des is the desired velocity per controller period, the v_act is the current actual velocity per controller period.

Your changes appear to be:

The addition of the _r suffix (presumably to designate the right motor, and I assume there is similar code for the left motor)

Replacing the max function with a pair of hard coded if statements

Defining $K_P$ in terms of it's reciprocal.

The problem is the last change combined with the fact that we are using integer arithmetic.

Calculating 1/K_P will evaluate to either 0 for K_P>1) and 1 for K_P==1, assuming sensible values of $K_P>0$.

So you are effectively turning your Proportional Integral Derivative controller into a Integral Derivative controller for any value of $K_P$ other than 1.

If you went back to using K_P directly rather than trying to use (1/K_P) then you should be able to tune your motor for velocity control.


问:
How to get longest flight time on octocopter that has decent payload already on it?
I want to design an octocopter that will respond to incidences of crime and terrorist attacks. Survey and gather intel and come back to HQ. I have used a 16000mAh 6S lipo battery with no lead, but only can  flight 20mins.
I want this Octocopter to carry radioactive/chemical testing equipment and have a flight time of 45 mins
How likely am i to achieve 45min flight times?
There must be a way of optimizing flight time. I know i can double the amount of batteries but this may make the craft unstable I may need to scale up on motor size to make payload less of an issue..
The larger the craft the more dangerous and costly the craft. So i'm really interested in optimizing it the best i can.
I know there are hydrogen fuel cells, maybe some other sort of alternative battery.
Please help thanks</p>

答: As much capacity as possible and the same time make the batteries lightweight  </p>


问:
Force controller with feedback issues
I'm implementing a force controller on a robotic arm, where the force input comes from torque sensors in the joints. I have calculated the cartesian force on the end-effector from the joint torques, and I can move the arm by setting cartesian velocities.

I'm trying to make a simple admittance controller to move the arm with as little resistance as possible. The controller can therefore be written most simply as a = 1/m * F. Where we want the virtual mass, m, to be as small as possible. The problem is that since F is derived from torque sensors in the arm, it is not completely independent from the acceleration. Therefore, the acceleration is amplified for each iteration and ends up oscillating wildly.

I have tried putting on a damper C*v on the controller, but it needs a lot of damping to decrease the oscillations, which makes the robot hard to move again.

Any tips on what could be done to get rid of these feedback oscillations?

答:
You can try the following.

Set an admittance you want as

$ F_e = m_d \ddot q + c_d \dot q$

then, you can solve for $q$ as the velocity reference

$q_r = \frac{F_e -  m_d \ddot q_r}{c_d}$

and approximate the acceleration through a forward euler with the velocity commands as

$\ddot q _r = \frac{q_{r_{k}}- q_{r_{k-1}}}{dt}$

and insert that in the equation.

note that $F_e$ is the difference from what you get from the torque sensors in the joints (that is the torque between the motors and eternal force) minus your model that includes not only gravity but coriolis and cetrifugal and mass, for which you also need to use the acceleration (filtered).

so $F_e = \tau_{sensors} - \tau_{robot model}$.

All this ideas are exposed in

Bekker, M., Pedersen, R.L., Mendez, J.D., Rasmussen, M.H., & Bak, T. (2018). Implementation of Admittance Control on a Construction Robot Using Load Cells. 2018 IEEE Conference on Control Technology and Applications (CCTA), 273-279.

Title: Force controller with feedback issues


问:
Interfacing HMC5883l Compass with Arduino
I'm using an HMC5883l compass module to find the angle at which my module is pointed from magnetic North. I found this code as an example with "HMC5883L_Simple.h" library.

And the results I'm getting right now are like this. Is it the angle at which my module is pointed from magnetic North in degrees? If not, How can find the pointing angle

答: I saw the code and yes, it is in degrees. It also would not make sense to be in radians cause it would mean a lot of turns. </p>


问:
Why do I need impedance control?
I am having a hard time understanding the impedance controller.

I see that it looks at the manipulator as impedance and the environment as admittance. However, it is hard to grasp the concept and differentiate between position/force control.

Can someone tell it to me with an actual example?

答:
Imagine that you hold a position very stiff in your arm. You are holding your muscles tight to keep that position and hold it very tightly. Then you walk to move your arm without moving your arm with your arm muscles and crash into a wall. You will hurt yourself cause you tried to go there very stiff and didn't care what you would came in contact with as long as the position is hold.

Now imagine that you hold in front a memory-pillow in front of your arm. That can be analog to have another link in your serial robot configuration. Then you crash into a wall but the pillow will compress (not very stiff spring) itself loosing position and reducing the contact force (impedance).

In a very broad sense the impedance controller looks similar to a PD controller (computed torque or augmented computed torque). It is also possible to do an impedance controller without a force sensor (no shape of the apparent inertia) and the main difference with a position controller is the lack of an integral gain that will make it converge to a zero steady state error.

The force controller requires a measurement/estimation of the force to close the control loop and a force reference is needed to be tracked, the impedance controller does not need a force to track.

Title: Why do I need impedance control?


问:
Calculate the inertia matrix of complex robotic mechanism
Motor, irregular rigid body of Different materials Forming a single robotic.

For example, Industrial robot, every geometric shape of the link is very complex. But we can find inertia matrix form CAD software, how these software tools calculate the inertia matrix of a single robotic arm? Is this inertia matrix accurate or equivalent?

答: It is approximate and very accurate as long as the material properties are well defined. Many methods are combined to get it. Moment of inertia, parallel axes, mass distribution, etc etc. Simplification methods are implemented to make the computations efficient. All the bodies are simplified as well using triangles to make them convex. </p>