问:
Sensors in Collaborative Robots
I'm currently doing some research on collaborative robotics. One area of interest is the type of sensor(s) used in these kind of machines.

I had a look at some robots by FANUC and Universal Robots and I've noticed that they do not come equipped with sensors; they are sold as an add-on.

Is this inherent with collaborative robots? Do customers need to buy sensors as an add-on - which has advantages and disadvantages.

Thanks for your help.

答:
The other answers and comments point to the ambiguity about what people mean when they say "collaborative" robot (or "cobot" for short), so I won't belabor that point. In my experience, most people refer to a cobot as one that does not require a safety barrier (e.g. laser barrier or monitored cage) while operating and where humans can be in the robot's workspace without worrying about getting seriously injured or killed.

The mechanism to ensure this safety is often internal force/torque sensors that come with the robot and are not add-ons - they are the very thing that make them safe to be around. For example, FANUC's line of cobots have force sensors in the base to detect contact with the robot and ensure a limit on the force that would be applied on contact. Many robots, such as the KUKA iiwa, UR robots, and Sawyer have joint torque sensors that allow force-limiting.

Collaborative features that are useful but not necessary for ensuring safe co-habitance between the robot and human are typically add-ons that need to be purchased. For example, wrist force/torque sensors are usually sold as add-ons since they are only needed by people that need to perform tasks requiring higher-fidelity force monitoring at the end-effector. The wrist sensor can improve safety, but since it only monitors contacts past the wrist it will not guarantee safe operation. Tactile sensors (e.g. tactile skin) I think would be good for ensuring safety if they cover a large extent of the robot, but they are generally quite expensive and is likely why they are not more popular for this purpose.

As others have mentioned, safety for cobots can come not just from the robot's internal sensors but also external sensors setup in the robot's environment. For example, a laser scanner can be used to detect when a human enters the robot's workspace, and operate at a slower speed instead of completely terminating motion. Vision sensors like RGB and depth cameras can also be used to monitor the robot's workspace for human presence and even do things like human intent prediction.

Mechanical compliance is another mechanism to aid in safety. For example, the Baxter robot uses Series Elastic Actuators that have a spring between the motor and the actuator output that make them deformable if a human was contacted (I'll note Baxter also has sonar sensors in its head to monitor workspace proximity). Some of the FANUC cobots are coated in a soft deformable material to reduce impact force and prevent pinching. An interesting extreme of this idea is soft robots.

Lastly, I'll point you to Robotiq's free e-book on cobots. They keep updating it with the newest iterations of cobots and it's definitely worth a read if you're considering purchasing a cobot.

Title: Sensors in Collaborative Robots


问:
Potential field algorithm implementation
I'm studying robotics at the university and as a practice, I have to implement potential field in the simulator (I'm going to use ROS and Gazebo).

I'm having troubles about how to implement it, especially in the data structures that I'm going to need. By the way, I'm going to do it with C++.

If I have understand it well, goal attracts the robot and obstacles repel it. So, the first thing I need is:

A map with the obstacles, and goal location.

I will also need a function that computes the force between the robot's current location and goal, taking repelling force into consideration.

With the map and the previous function, I will move the robot to goal location.

Do you think I need something else?

答:
I am assuming you need a force field mapping of a two-dimensional space.

You will need an array to hold the goals, unless there is only one.  You will need an array to hold the obstacles.  Both of these arrays must be two-dimensional to contain the coordinates of the locations.

You will need an algorithm that, for a given point in your space, sums the attractors and repulsors to come up with a vector force at that location in your field.  You can do a vector summation - add all of the $F \cos \theta$ terms and all of the $F \sin \theta$ terms.  This algorithm likely contains some factor based on the distance between locations.  You might start by using a negative coefficient times the gravity equation for obstacles, and a positive coefficient for goals.  This becomes more difficult to do when the obstacles are larger than point masses.  You can play with the value of the coefficients to change the magnitude of the force field.

You will (probably, depending on the assignment) need a method to loop through the x and y coordinates of your space, computing the vector force for each location.   If this is required, you will need to store this data.

Finally, you may need a way to display the force vectors.  You can do this by displaying scaled lines in the direction of each vector, although your instructor may want some other representation.

Hopefully this will get you past your stuck point.

ContentLicense: CC BY-SA 4.0


问:
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?

答:
By searching for a different topic I found your post and I work with the Sparkfun Razor 9DOF IMU too. Actually it was a pain in the rear to get it all work.

First of all you have to do the tutorial razor-9dof-ahrs form ptrbrtz. When this is working you can do the next steps. Btw: read it carefully and you should be able to do it on your own!

First I tried to get it work with an Arduino Uno and a SoftwareSerial. Sadly I wasn’t able to get it work with a SoftwareSerial, I received with Text and Binary output only rubbish data. I worked a whole day on this topic and I wasn’t able to do it and I could say I have a lot experience with Arduino programming. If you are able to get it work with a SoftwareSerial please post an answer.

With the Uno I was only able to receive data with this configuration: http://blog.mobileapes.com/2010/09/read-data-from-9dof-razor-imu-via.html.
But be aware the TX should go to RX and the RX to TX! The description in the picture (Rx to Rx and Tx to Tx) is false.

If you are able to use an Arduino MEGA, which has at least 4 UARTs, you could use the code I developed. Once I got it to work on an Uno but I searched for the code and I didn’t find it anymore, with a little try and fail you should be able to do it. But be aware, if you are sending data to the PC and receiving data from the IMU on only one UART, you could probably negatively influence the serial communication.

```<code>/**************************** INFO ********************************/

// This code expects a message in the format: H 12.00,-345.00,678.00

/******************************************************************/

#include <TextFinder.h>

/*** Defines the frequency at which the data is requested ***/
/*** frequency f=1/T, T=period; ie. 100ms --> f=10Hz, 200ms --> f=5Hz ***/
#define PERIOD      100 // [ms]

/*** Vars for IMU ***/
TextFinder  finder(Serial3);
const int NUMBER_OF_FIELDS = 3; // how many comma separated fields we expect
float rpy[NUMBER_OF_FIELDS];    // array holding values for all the fields

/************************************************************/
/*** Setup
/************************************************************/
void setup()
{
  Serial.begin(57600);  // init the Serial port to print the data to PC
  Serial3.begin(57600); // init the Serial3 port to get data from the IMU

  delay(500);

  initIMU();
}

/************************************************************/
/*** Loop
/************************************************************/
void loop()
{
  // print manager timer
  static unsigned long timer = 0;
  static unsigned long currentTime = 0;

  /************************************************************/
  /*** Request after a specific period for the data
  /************************************************************/
  currentTime = millis();
  if(currentTime - timer >= PERIOD)
  {
    // Request one output frame from the IMU
    // #f only requests one reply, replies are still bound to the internal 20ms (50Hz) time raster.
    // So worst case delay that #f can add is 19.99ms.
    Serial3.write("#f");

    /************************************************************/
    /*** Get the IMU values
    /************************************************************/

    // the current field being received
    int fieldIndex = 0;

    // search the Serial Buffer as long as the header character is found
    boolean found_HeaderChar = finder.find("H");

    if (found_HeaderChar)
    {
      // Get all 3 values (yaw, pitch, roll) from the Serial Buffer
      while(fieldIndex < NUMBER_OF_FIELDS)
      {
        rpy[fieldIndex++] = finder.getFloat();
      }
    }

    /************************************************************/
    /*** Print out the values
    /*** Format: yaw, pitch, roll, left_Encoder, right_Encoder
    /************************************************************/
    if (found_HeaderChar)
    {
      // print Interval
      Serial.print(currentTime - timer);
      Serial.print(",");

      // print IMU values
      for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
      {
        Serial.print(rpy[fieldIndex]);
        Serial.print(",");
      }
      Serial.println("");
    }

    timer = millis();
  }
}

/********************************/
/*** Initialize Functions
/********************************/

void initIMU()
{
  // Output angles in TEXT format & Turn off continuous streaming output & Disable error message output
  Serial3.write("#ot#o0#oe0");
  Serial3.flush();
}
</code>```

Edit: Oh I forgot to say that you must edit the Output.ino from the Razor AHRS firmware. Search for the function output_angles() and change it to:

```<code>// Output angles: yaw, pitch, roll
void output_angles()
{
  if (output_format == OUTPUT__FORMAT_BINARY)
  {
    float ypr[3];
    ypr[0] = TO_DEG(yaw);
    ypr[1] = TO_DEG(pitch);
    ypr[2] = TO_DEG(roll);

    Serial.write((byte*) ypr, 12);  // No new-line
  }
  else if (output_format == OUTPUT__FORMAT_TEXT)
  {
    Serial.print("H ");
    Serial.print(TO_DEG(yaw)); Serial.print(",");
    Serial.print(TO_DEG(pitch)); Serial.print(",");
    Serial.print(TO_DEG(roll)); Serial.println();
  }
}
</code>```

ContentLicense: CC BY-SA 3.0

Title: Razor IMU Arduino interfacing

Body:
By searching for a different topic I found your post and I work with the Sparkfun Razor 9DOF IMU too. Actually it was a pain in the rear to get it all work.

First of all you have to do the tutorial razor-9dof-ahrs form ptrbrtz. When this is working you can do the next steps. Btw: read it carefully and you should be able to do it on your own!

First I tried to get it work with an Arduino Uno and a SoftwareSerial. Sadly I wasn’t able to get it work with a SoftwareSerial, I received with Text and Binary output only rubbish data. I worked a whole day on this topic and I wasn’t able to do it and I could say I have a lot experience with Arduino programming. If you are able to get it work with a SoftwareSerial please post an answer.

With the Uno I was only able to receive data with this configuration: http://blog.mobileapes.com/2010/09/read-data-from-9dof-razor-imu-via.html.
But be aware the TX should go to RX and the RX to TX! The description in the picture (Rx to Rx and Tx to Tx) is false.

If you are able to use an Arduino MEGA, which has at least 4 UARTs, you could use the code I developed. Once I got it to work on an Uno but I searched for the code and I didn’t find it anymore, with a little try and fail you should be able to do it. But be aware, if you are sending data to the PC and receiving data from the IMU on only one UART, you could probably negatively influence the serial communication.

/**************************** INFO ********************************/

// This code expects a message in the format: H 12.00,-345.00,678.00

/******************************************************************/

#include <TextFinder.h>

/*** Defines the frequency at which the data is requested ***/
/*** frequency f=1/T, T=period; ie. 100ms --> f=10Hz, 200ms --> f=5Hz ***/
#define PERIOD      100 // [ms]

/*** Vars for IMU ***/
TextFinder  finder(Serial3);
const int NUMBER_OF_FIELDS = 3; // how many comma separated fields we expect
float rpy[NUMBER_OF_FIELDS];    // array holding values for all the fields

/************************************************************/
/*** Setup
/************************************************************/
void setup()
{
  Serial.begin(57600);  // init the Serial port to print the data to PC
  Serial3.begin(57600); // init the Serial3 port to get data from the IMU

  delay(500);

  initIMU();
}

/************************************************************/
/*** Loop
/************************************************************/
void loop()
{
  // print manager timer
  static unsigned long timer = 0;
  static unsigned long currentTime = 0;

  /************************************************************/
  /*** Request after a specific period for the data
  /************************************************************/
  currentTime = millis();
  if(currentTime - timer >= PERIOD)
  {
    // Request one output frame from the IMU
    // #f only requests one reply, replies are still bound to the internal 20ms (50Hz) time raster.
    // So worst case delay that #f can add is 19.99ms.
    Serial3.write("#f");

    /************************************************************/
    /*** Get the IMU values
    /************************************************************/

    // the current field being received
    int fieldIndex = 0;

    // search the Serial Buffer as long as the header character is found
    boolean found_HeaderChar = finder.find("H");

    if (found_HeaderChar)
    {
      // Get all 3 values (yaw, pitch, roll) from the Serial Buffer
      while(fieldIndex < NUMBER_OF_FIELDS)
      {
        rpy[fieldIndex++] = finder.getFloat();
      }
    }

    /************************************************************/
    /*** Print out the values
    /*** Format: yaw, pitch, roll, left_Encoder, right_Encoder
    /************************************************************/
    if (found_HeaderChar)
    {
      // print Interval
      Serial.print(currentTime - timer);
      Serial.print(",");

      // print IMU values
      for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
      {
        Serial.print(rpy[fieldIndex]);
        Serial.print(",");
      }
      Serial.println("");
    }

    timer = millis();
  }
}

/********************************/
/*** Initialize Functions
/********************************/

void initIMU()
{
  // Output angles in TEXT format & Turn off continuous streaming output & Disable error message output
  Serial3.write("#ot#o0#oe0");
  Serial3.flush();
}

Edit: Oh I forgot to say that you must edit the Output.ino from the Razor AHRS firmware. Search for the function output_angles() and change it to:

// Output angles: yaw, pitch, roll
void output_angles()
{
  if (output_format == OUTPUT__FORMAT_BINARY)
  {
    float ypr[3];
    ypr[0] = TO_DEG(yaw);
    ypr[1] = TO_DEG(pitch);
    ypr[2] = TO_DEG(roll);

    Serial.write((byte*) ypr, 12);  // No new-line
  }
  else if (output_format == OUTPUT__FORMAT_TEXT)
  {
    Serial.print("H ");
    Serial.print(TO_DEG(yaw)); Serial.print(",");
    Serial.print(TO_DEG(pitch)); Serial.print(",");
    Serial.print(TO_DEG(roll)); Serial.println();
  }
}


问:
Compute vector of attraction plus repulsion forces in a 2D force field mapping
I'm developing a force field mapping of a two-dimensional space to move a robot to a goal avoiding obstacles.

My problem is that I don't know how to move it using attraction force and repulsion forces. I think I will get a vector (with a magnitude and direction), because they are forces. How can I get this vector?

In other words, what is the formula to compute that vector?

答:
In the simplest case where targets and obstacles are just points in your space, it's not that difficult to come up with good representations of attractive and repulsive forces.

For the sake of simplicity, let's stick to one-dimensional space and deal with massless points. Then, knowing the complete state of your robot in terms of position and velocity $\left(x,\dot{x}\right)$, together with the target $x_d$, the attractive acceleration $\ddot{x}$ is given by:

$$
\ddot{x} = K \cdot \left( x_d-x \right) - D \cdot \dot{x},
$$

where $K$ and $D$ are the stiffness and damping factors, respectively, responsible for generating the attractive force toward the target (stiffness) as well as a drag (damping) that suitably decelerates the robot avoiding oscillations around $x_d$.

Once you have $\ddot{x}$, you can integrate it twice in time to get the temporal evolution.

The extension to the 2D and 3D cases is pretty immediate, whereas to account for the repulsive force yielded by the obstacle $x_o$, you have to invert the sign of the term $K\cdot\left(x_o-x\right)$.


问:
Is not this guy using a flightcontroller?
I know this will not be a good way of asking something but I cannot think a better way.

In this video : https://youtu.be/wg8ZbiC9IBw

He builds a fixed wing an makes it fly, my question is related to the things happening between minutes 3 and 4;

I think he must be using a flight controller so that, as it can be seen in the beginning of 3rd minute, the airplane flies nice, but then he says that

I put that 3-axis gyro so that it can fly more stable

I am confused at that point, doesn't a flightcontroller has its own gyroscope already? What is the need of the external one?

答:
Not all flight controllers are equal. There may be some without built in gyroscopes.

We dont know which controller the guy used, so its difficult to know why he has an external gyro....he may also have just not know the controller he bought has one built it...or it was junk.

For example, the ICM20602 on the Raceflight Revolt V2, or the ICM20689 on the Kakute F4, both can run at 32KHz. However it’s reported that these IMU are more susceptible to noise than the older MPU6000 therefore these FC’s generally require soft-mounting and filtering capacitors to reduce the amount of noise getting to the Gryo.


问:
How to access Raspberry Pi over wifi?
I have to use Raspberry Pi with Arduino on a mobile robot and access Raspberry Pi on a PC through WiFi. Is it possible? Please explain how to do it?</p>

答:
To access your RPi over the WiFi, you can use any SSH client like PuTTY.

Once you have established a connection between your RPi and computer, then you can control  GPIOs through a TCP connection. Use Socket Library in Python for this. You have to set a static IP for your RPi though, and use it in your code. Hope it would help.

Title: How to access Raspberry Pi over wifi?


问:
How can we manage stepper motor cables?
I need to actuate 3 or 4 Cnc-like Nema 23 (~1N.m torque) stepper motors, I would like some cable solution to connect easily the motor to the motor driver.

I have not yet bought anything, I have searched various robotic stores and ebay, but did not yet found a triple (motor, cables, driver) which would be "plug and play".

As stepper motors usually have 4 to 6 cables, and there are multiple motors, manual soldering everything would be too time consuming, error prone and messy.

Is there a standard way to deal with cables for stepper motors ?

答:
Don't worry about the cables; plan to make them yourself.  I recommend using one of the wide variety of crimp-on connectors available to you, depending on what you can find for your ESC and steppers connections.

Here are a handful of connectors representing part of what we stock in our lab:

The white connector is the Molex Minifit, the black one to its right is the Molex Microfit, and the 1/8" miniplug is for scale.  Using these connectors can involve either soldering them to a board, or using a crimp tool and crimp-on terminations which are then snapped into the plug body.

This allows the cables to be run much more precisely than they would be if you just made solder connections in the middle of the cable length.

Title: How can we manage stepper motor cables?


问:
State of a Robot
I saw the expression "robot state" in many articles and resources, but I could not understand what that exactly mean.

What does state of a robot exactly refers to ?

答:
The state of the Robot refers to the properties of the robot that you want to estimate. If you take a 2D robot as an example, then you might be interested in its 2d position which refers to
$$
   X(t) =
\begin{bmatrix}
  x(t) \\
  y(t) \\
\end{bmatrix}
$$

If you also want to estimate its velocity, then you can add another element to its state vector and estimate its velocity in your equations.

If you scale your robot to 3d and want to estimate its orientation and position, then you may want to add quaternion(orientation) to your state vector

$$
   X(t) =
\begin{bmatrix}
  x(t) \\
  y(t) \\
  z(t) \\
  q_w(t) \\
  q_x(t) \\
  q_y(t) \\
  q_z(t) \\
\end{bmatrix}
$$

Normally a filter such as Kalman filter in Linear conditions or Extended or Unscented Kalman filter in non-linear conditions are used as state estimators.

Title: State of a Robot


答:
To extends the answer from the_parzival a bit:

There are different kind of robots so that 'robot state' can have different meanings. If you have a drone or Roomba-robot, the most important state is related to its pose (position, orientation, speed, acceleration, ...). Other states are the Battery state, Motor speeds (and temperatures), essentially every value of your system that can change over time.

The other group of robots have a fixed position, but are themselves more complex: Robot arms ( or CNC mills and similar machines). Their base has a fixed position, but their position is described by a set of joint angles (and speed, acceleration,...). In this case, the robot state can be the set of angles, or also the pose of the end-effector (or a combination).

So the 'robot state' depends on how your robot looks like and what you are interested in.

Title: State of a Robot

Body:
I saw the expression "robot state" in many articles and resources, but I could not understand what that exactly mean.

What does state of a robot exactly refers to ?


答:
The answer by parzival is only a partial answer. Especially with robots with more than 3 axes, the matrix cannot be solved for a deterministic state, a famous example of this is Dirac's belt trick, where with only the 3 DOF that a human arm and shoulder provide, you cannot have any deterministic state using the matrix provided above. The true state of a robot is actually represented by:
$$
J_{s} =
\begin{bmatrix}
  J_{1} \\
  J_{2} \\
  J_{3} \\
  ... \\
  J_{n} \\
\end{bmatrix}$$

Where $J_{n}$ is the absolute rotation or linear distance from zero of joint n. Hereon, this is referred to as the $J$ matrix, and the matrix in parzival's answer is the $X$ matrix.

Let's do an example.
Here is a 6-axis robot (Joints highlighted) with a Cartesian absolute of [780,65,200,-180,0,90] where the parameters are [X,Y,Z,yaw,pitch,roll], in mm and deg. This is also known as Euler-Cartesian, or XYZWPR representation. most industrial robots use this. It's very rare to see Quaternion-Cartesian representation.

The absolute state of the robot in the J matrix is [0.102,-36.487,-12.657,0,-77.343,-270.102].

This is plainly, a jumbled mess, and it makes sense to use XYZWPR, as it's many times easier to visualize. For example, raising the arm by 200mm, the new $J$ matrix is [0.102,-35.138,-2.241,0,-87.759,-270.102]. You may be able to generally tell what happened, but it's not obvious at all the magnitude.

So what's the deal with these two positioning systems, and why use $J$, and not $X$? The answer is a P vs NP problem. To convert $J$ to $X$ is trivial, and does some vector addition you probably learned in secondary school. just take the angles of all of the joints, and add on the magnitude to get XYZ components, and add those components together to get a final position. Converting from $X$ to $J$ however, is a bit more advanced, and this robot for example, has up to six $J$ matrices for almost every possible $X$!
Take the example above. Let's find a second $J$ associated with the $X$ above.

A configuration such as this:

can produce very similar results. Where the $X$ matrix is the same, the $J$ for this pose is something close to [-180, -31, 210, 180,-120,0], but $X$ is still [780,65,200,-180,0,90]. Ok. but what about an absolute match? This is actually easier than you think. Take a look at the image below. People with an astute sense of robotics may notice that the $J$ is different, but the $X$ is exactly the same!

Spot the difference yet!? The J4 axis has rotated 180 degrees! Thus the new $J$ and the old $J$ AND the alternative $J$ ALL correspond to the same $X$!

\begin{array} {|c|c|}
\hline
J & X \\
\hline
[0.095,-36.710,-12.529,180.000,77.171,-90.195] & \downdownarrows \\
\hline
[0.102,-36.487,-12.657,0.000,-77.343,-270.102] & [780,65,200,-180,0,90] \\
\hline
[-180.000, -31.000, 210.000, 180.000,-120.000,0.000] &  \upuparrows\\ \hline
\end{array}

So in short, the pose of a robot is it's joint positions, either in absolute encoder pulses, or rotational degrees, and the state of the robot is the same thing, but including velocities (always in deg / sec. or rad / sec.). Velocity will have the same errors if the velocities are stored as XYZWPR. Some robots even include acceleration and jerk, but most do not, or store a target velocity, and acceleration and jerk limits (always joint acceleration and jerk limits, NEVER EVER Cartesian limits).

Title: State of a Robot


问:
Multiple robots performing a set of tasks (Optimization)
Consider a situation where you have a 'm' number of robots and 'n' number of tasks. Each task is at a different location. What optimization algorithm should I use in order to assign a set of tasks to the robot. The constraints I am taking are battery percentage and distance.
How should I assign the tasks to the robots taking into account the constraints.</p>

答: Try looking to Linear Integer Programming LIP where you are doing optimization by maximizing task allocation or Utility function at the same time minimizing distance and energy constraints. You will have to formulate the set of equations and use available LIP solvers.</p>


问:
Automatic forward and reverse Brushless Motor
The video Here shows a motor using rotational motion to move a load forward and then reverse back, without manually switching it to reverse.

How can I program my brushless motor to operate like the motor in the video.

Can I achieve it using what I already have?, if yes, how?

If not, what additional parts (Drivers/Controllers/Arduino) do i need?

What additional software do i need?

What I have:

Brushless motor

ESC

DC Motor Speed Controller

ESC Programmer

RC Program Card Electronic Speed Controller Programmer

Brushless DC Motor Controller, DROK 6.5-24V 12V 12A Sensorless Hallless Three-phase Electronic Motor Speed Driver

答: This motor in video is stepper motor. If you want to move brushless motor that you have, you have to buy ESC that can support 2-way rotation. You can also add a relay that switches 2 phases from ESC, then rotation direction changes.</p>


问:
Mavlink data parsing offline from buffer, on Linux in C
I am a beginner with mavlink and even pixahawk.
I need to just parse mavlink data coming from pixahawk. (Mavlink v1, pixahawk v5plus), on Linux PC (Ubuntu). I have 2 processes in context of this question. (The Pixahwak is already cofigured to send some messages HEARTBEAT, ATTITUDE etc).

I have written C code that reads serial port data which gets mavlink v1 data from telemetry1 port of pixhackv5plus and saves each byte by byte in shared memory segment created using shmget()/shmat(). That shared memory segment remains intact even after this process exits.

Now, I run another process that reads data from this shared memory buffer and parses byte by byte. This parser process has not been completely written by me but I took code from

https://github.com/mavlink/c_uart_interface_example and for mavlink v1, reusing c library from https://github.com/mavlink/c_library_v1 (My pixahawk sends Mavlink v1 data).

In file serial_port.cpp in c uart example above, I have removed code that calls read(fd..) but taking shared memory data byte by byte and passing to mavlink_parse_char().
This is not working, I am getting msgReceived as false through out, though I know
this data contains valid mavlink messages.

Am I right in this methodology?
Please guide. Once this works, I have to replicate parser on an embedded platform, in C.

Code for reading serial data from pixhack at:

https://github.com/developb/mavlink_read_buffer/blob/master/main_rx.c

Code where data(each byte) is read from shared memory and fed to mavlink_parse_char() is at:
https://github.com/developb/mavlinkv1_parse_v0/blob/master/serial_port.cpp

Here, this is the line I modify that makes each byte be taken from shared memory instead of serial port:

```<code> int result = _read_port(cp);
 //cp = (unsigned char)(*(unsigned char*)shm_current_addr_temp);
</code>```

答:
To use file parsing functions with in-memory data, you need to make sure the memory layout matches the file layout.

Likely problem sources are leaving out header info or using data structures optimized for memory (all c structures that have not been packed) when providing data to the parser.


问:
Preventing leaks in motor shafts for underwater bots
Whenever building an aquatic bot, we always have to take care to prevent leakages, for obvious reasons. Now, holes for wires can be made watertight easily--but what about motors? We can easily seal the casing in place (and fill in any holes in the casing), but the part where the axle meets the casing is still left unprotected.

Water leaking into the motor is still quite bad. I doubt there's any way to seal up this area properly, since any solid seal will not let the axle move, and any liquid seal (or something like grease) will rub off eventually.

I was thinking of putting a second casing around the motor, maybe with a custom rubber orifice for the shaft. Something like (forgive the bad drawing, not used to GIMP):

This would probably stop leakage, but would reduce the torque/rpm significantly via friction.

So, how does one prevent water from leaking into a motor without significantly affecting the motor's performance?

(To clarify, I don't want to buy a special underwater motor, I'd prefer a way to make my own motors watertight)

答:
I have come across all the suggestions in the other posts. I don't understand why people are suggesting complex and expensive solutions which are also not feasible.

A mechanical seal is the simplest answer for sealing the motor or making it of IP 68. We can use this motor to a depth of 20 m in sea water.

The construction is like a WET pit.

Such types of motor are used in sewage submersible pumps which work to the depth of 20 m in water.

The cost of such a seal is also very low.


问:
Need Suggestions for real-time number or object detection with Arduino + MATLAB?
I'm working on a line follower robot. its a kind of waiter robot. and i am facing  problems in detecting customer table. can you guys please suggest me some ideas to detect customer table. i want to include some image processing methods to achieve this goal. can you guys suggest me some article or tutorial with code to understand this?.  or if have any other reliable and easy suggestion for me then that would be appreciated :)</p>

答: If you want to do some basic obstacle detection with an arduino your best bet is either using an ultrasonic sensor or a LIDAR. Image processing is likely to be too complex for an arduino that is also managing the rest of the robots functions. https://circuitdigest.com/microcontroller-projects/arduino-obstacle-avoding-robot This robot uses an ultrasonic sensor to detect objects in front of it, so something similar to this except it stops when it senses a table may be suitable for your needs</p>


问:
How come LIDAR is not commonly used for indoor navigation?
I'm reading this survey on the state-of-the-art techniques for indoor positioning and navigation. I noticed that LIDAR isn't mentioned at all in the paper. Is LIDAR not meant to be a common method for indoor navigation? I believe I've seen some industrial LIDAR robots some time ago though.</p>

答:
I think LiDAR is common for indoor navigation. Definitely, LiDAR is the easiest and accurate solution for indoor navigation or SLAM. Many commercial robot vacuums are already in use of LiDAR for indoor navigation and mapping. Those are even cheaper and simpler than RGBD modules which is why low-cost LiDARs are hired over RGBD in mass production models.

It is just that indoor navigation is a vast topic. I haven't seen any survey paper that covers all types of sensors. We can't cover few thousands of papers in a single survey paper. The paper you linked has some specific coverage and it is ok not to mention other sensors out of the scope such as LiDAR or camera.


问:
Accelerometer and gyroscope noise and bias
I am doing an EKF (Extended Kalman Filter) to fusion Visual Odometry with IMU information. I am using a ROS package called ethzasl-msf (I am using the multi sensor fusion because then I have to add some GPS data).

But the problem is that I need the noise and bias of the accelerometer and gyroscope. I am using an AR.Drone 2.0, and I don't have the IMU model, so I can't even guess those values.

As specified in the .yaml document, those values for an ADIS 16448 are:

accelerometer noise: 0.0022563

gyroscope noise: 0.04

accelerometer noise bias: 8e-5 (it is not fixed)

gyroscope noise bias: 3e-6 (it is not fixed)

I suppose that the noise of AR.Drone 2.0's IMU is worse, because it's a cheap quacopter. But I couldn't find any information about them. What values do you recommend me to use?

Thanks

答:
Bias should be automatically measured while the sensor is stationary at the beginning of each run. This is simply because the biases have different starting values at each run according to the ambient temperature and chip temperature. But I am not sure why they put bias values in the yaml file. You need to have a look at the code to see if they are really using the input bias.

accelerometer noise, gyroscope noise are just weighting factor. You might able to run the code with your new IMU with the values from ADIS 16448. If it does not work, the simplest way is running a calibration between IMU and camera which will give you those values. You can use kalibr which is from the same lab.


问:
Why do strong rotations affect Monocular Vision based Visual Odometry?
In context of the paper Semi Dense Visual Odometry for a Monocular Camera J Engel, J Sturms, D Cremers

At page 7, last paragraph the author writes

The achieved tracking accuracy for two feasible sequences - that is, sequences which do not contain strong rotations without simultaneous translation - is given in Table 1.

Here the Author implies that the method is not feasible (fails ?) on datasets that contain strong rotation. In the paper, Visual Odometry is performed in two parts inverse depth estimation of points  and tracking of camera. I want to analyze how these parts are affected when the camera undergoes strong rotations?

Here is what I think (kindly correct me and or add missing details)

Part I

Inverse depth estimation is based on disparity among two successive frames. The observed pixel disparity is equal to scaled inverse depth for the pixel.

When camera undergoes strong rotation it causes apparent pixel disparity however the pixel would still be at the same depth wrt the camera. So this results in false disparity and subsequently wrong depth estimation (?)

Part II

The tracking of camera is being done via image alignment (using depth map). The image alignment is formulated as a photometric error minimization problem:

$$ E(\xi) := \sum_{i}\frac{\alpha(r_i(\xi))}{\sigma_{d_i}^2}r_i(\xi)$$
where $$r_i(\xi) = (I_2(~{\color{blue}w(x_i, d_i, \xi)}~) - I_1(x_i))^2$$
and ${\color{blue}w}$ is a warp function that maps each point $x_i$ in reference image $I_1$ to the respective point in the new image $I_2$

The warp function requires depth $d_i$ to calculate the new position of a pixel in image $I_2$ that was observed earlier in $I_1$. With wrong depth estimate the minimization problem would yield wrong value for $\xi$ (?)

Also, are there techniques to deal with pure camera rotation in case of Monocular Vision based Odometry?

答: The problem of the pure strong rotation is that the image will become easily blurred unless you use 1000FPS camera. This kind of super-strong rotation often occurs in hand-held camera motion. Simply turn on your mobile camera in a slightly dark place and try to make a translational and rotational motion. You will see rotation make huge blurriness in the image where tracking or depth estimation will surely fail. </p>


问:
Do self-driving robots use object-level SLAM?
How do self-driving bots usually deal with transient objects, e.g., parked cars on the side of roads when they can come and go? These aren't moving objects at the time of capture, but they do move at a later time. Is it common to run a CNN to detect static/dynamic objects prior to feature extraction? It's certainly much more computationally expensive, but otherwise how are dynamic objects dealt with or filtered out?</p>

答:
How do self-driving bots usually deal with transient objects, e.g., parked cars on the side of roads when they can come and go?

No. In most of the open-source slams, dynamic objects are ignored which means they are just mapped as a stationary object. But there are few papers that deal with this in the way you think.

These aren't moving objects at the time of capture, but they do move at a later time. Is it common to run a CNN to detect static/dynamic objects prior to feature extraction?

It is not common. There are some papers that introduced object-level features but simply it is not very useful.

It's certainly much more computationally expensive, but otherwise how are dynamic objects dealt with or filtered out?

Any features from dynamic objects should be filtered out by either deep learning approach or conventional soft outlier rejection scheme. You will find the most of optimization-based slams are using M-estimator whereas some of the recent papers introduced deep learning approach.

This kind of topic is refered as semantic SLAM. You can find some related papers in ICRA, IROS 17,18,19.


问:
Relative quaternion to global with uncertainty
in this perfect tutorial i found how i can compose two poses with uncertainty and how i can transform one representation to another with uncertainty  http://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf.
Let's suppose I have one global point which represent 6 dof and 6 confidence and another one also representing by 6 dof and 6 confidence. How can I get "mean" point with uncertainty.</p>

答:
This is more of a statistics question. Convolude 2 normal distributions with the means and deviations as you describe, and you get something akin to the answer posted here.

Or to sum it up simply, you add the means of the points ($\mu_{A+B} = \mu_{a}+ \mu_{b}$), and those are your new means, and a variance of $\sigma^{2}_{a+b}=\sigma ^{2}_{a}+\sigma ^{2}_{b}$ .

I assume you know your standard deviation, as without it your confidence intervals are useless.


问:
How to get position (X Y values) from a USB optical mouse
I want to use an optical mouse to measure displacement in X and Y direction of my robot. I'm using Ubuntu mate 18.04 on raspberry pi and wrote the following python code :

```<code>mouse = file('/dev/input/mouse0')
while True:
status, dx, dy = tuple(ord(c) for c in mouse.read(3))

def to_signed(n):
    return n - ((0x80 & n) << 1)

dx = to_signed(dx)
dy = to_signed(dy)
print "%#02x %d %d" % (status, dx, dy)
</code>```

But these displacement values are velocities dependent. I just want the displacement value, which is acceleration independent.

答:
I am not sure what you mean by 'displacement value which is acceleration independent'. The conversion of relative positioning you're getting from /dev/input/mouse will always depend on the DPI of the mouse. All you'd have to do is figure out the DPI (either from the specs or from measurements, and hence the conversion between reported dx/dy values, and then accumulate them once you start moving from the origin. Here are some resources that could be useful to you:

http://kodedevil.com/2017/07/09/optical-mouse-odometer-rpi/ (notice the scaling factor in the code)

http://blog.makezine.com/2012/09/15/turning-a-cheap-optical-mouse-into-a-robot-odometer/


答:
The tutorial you linked is a good one but does not deal with the uncertainty well. Unfortunately, what @tuskiomi suggested is for euclidian space variable with single-dimension. Following is a better way of doing your problem. Although it is two poses example, it can be extended to more poses easily.

Fusing multiple observations of a pose.

\begin{equation}
p(\textbf{z} | \textbf{x}) = \prod_{i=1}^{k} p(\textbf{z}_i | \textbf{x})
\end{equation}

Two observation example

\begin{equation}
ln(p(\textbf{z} | \textbf{x}))=ln(p(\textbf{z}_1 | \textbf{x})p(\textbf{z}_2 | \textbf{x}))
\end{equation}

\begin{equation}
ln(p(\textbf{z} | \textbf{x}))=c(\textbf{x}^T\Sigma^{-1}\textbf{x}-2\textbf{x}^T\Sigma^{-1}\textbf{z}+\textbf{z}^T\Sigma^{-1}\textbf{z})
\end{equation}

\begin{equation}
\begin{split}
ln(p(\textbf{z}_1 | \textbf{x})p(\textbf{z}_2 | \textbf{x}))&=c(\textbf{x}^T\Sigma_1^{-1}\textbf{x}-2\textbf{x}^T\Sigma_1^{-1}\textbf{z}_1+\textbf{z}_1^T\Sigma_1^{-1}\textbf{z}_1+\\
&\textbf{x}^T\Sigma_2^{-1}\textbf{x}-2\textbf{x}^T\Sigma_2^{-1}\textbf{z}_2+\textbf{z}_2^T\Sigma_2^{-1}\textbf{z}_2)
\end{split}
\end{equation}

Here is your new uncertainty
\begin{equation}
\begin{split}
\textbf{x}^T\Sigma^{-1}\textbf{x}=\textbf{x}^T(\Sigma_1^{-1}+\Sigma_2^{-1})\textbf{x}
\end{split}
\end{equation}

\begin{equation}
\Sigma=(\Sigma_1^{-1}+\Sigma_2^{-1})^{-1}
\end{equation}

and mean.
\begin{equation}
\begin{split}
\textbf{x}^T\Sigma^{-1}\textbf{z}=\textbf{x}^T(\Sigma_1^{-1}\textbf{z}_1+\Sigma_2^{-1}\textbf{z}_2)
\end{split}
\end{equation}

\begin{equation}
\textbf{z}=\Sigma(\Sigma_1^{-1}\textbf{z}_1+\Sigma_2^{-1}\textbf{z}_2)
\end{equation}

It might work but occasionally it will suffer from the singularity problem.

The proper way of doing this is fusing them on manifold. If you want to learn more about uncertainty fusion of SE3 poses you should read State estimation for robotics by Prof. Tim Barfoot.

Title: Relative quaternion to global with uncertainty

Body:
in this perfect tutorial i found how i can compose two poses with uncertainty and how i can transform one representation to another with uncertainty  http://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf.
Let's suppose I have one global point which represent 6 dof and 6 confidence and another one also representing by 6 dof and 6 confidence. How can I get "mean" point with uncertainty.</p>


问:
Unable to read pushbutton press properly in Arduino
I am trying to use a push button in order to know and print number of time a push button is pressed using a counter.But everytime i press the button , counter get incremented to sometime 3 and sometime 5 and some time counter does start >100 and continue.

I had preferred the this link for wiring PUSH button with arduino.

and here is my code

```<code>const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
int count = 0;
void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
    buttonState = digitalRead(buttonPin);
  digitalWrite(ledPin,LOW);
}

void loop(){
    // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {

    // turn LED on:
    digitalWrite(ledPin, HIGH);
    count = count + 1;
    Serial.print(count);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}
</code>```

I dont know why count is coming absurdly and unevenly.

答:
A switch does not have a quick low to high or high to low transition, instead something like this. This is called switch bounce.

image source: piconix.com

Just to add to the answers here.
There are two commonly used methods to avoid switch bouncing:

Using a capacitor with the switch, called RC debouncing. The
capacitor tries to smoothen the transition and so
avoiding voltage spikes.
This method works fine but still there are chances that some
big
spikes of voltages may still be sent to the Arduino and Arduino
senses it as a button press(false button press). So it is not a
'sure' method to avoid bounce. Also
additional hardware is required for this method.

Software denouncing: It is better method using which you can
almost entirely remove the problem of switch bounce. In
software too there are two majorly used methods, one is called
polling and other is interrupt method. As Chris wrote, polling
with a delay of 10-50 ms (depending on the quality of switch you
are using) can avoid switch bouce. Polling is used in simple
projects
where time is not a very crucial aspect of project functioning.
Polling is easy to implement. On the other hand using interrupt
can be a little painstaking for beginners but it is a better way
because the normal functioning of the code is not haulted while
the debouncing is done(unlike polling where where we use
delay and stop the processor from doing anything in that
duration of time) . There can be many
ways to do so.

Here is a pseudo code that I often useuse to avoid switch bounce:

```<code>//If button is pressed an interrupt, say, INTERRUPT1 is triggered
//Following is the interrupt service routine for INTERRUPT1:
ISR(INTERRUPT1) {
//do something you wanted to do on button press
disable INTERRUPT1 //so that other button spike don't trigger it
enable, say, INTERRUPT2 Timer
INTERRUPT2 Timer is set to interrupt after, say 10ms
}

//Following is the interrupt service routine for INTERRUPT2:
ISR(INTERRUPT2) {
disable INTERRUPT2 Timer
enable INTERRUPT1 //button press can be recognized now after 10ms have been elapsed
}
</code>```

Body:
A switch does not have a quick low to high or high to low transition, instead something like this. This is called switch bounce.

image source: piconix.com

Just to add to the answers here.
There are two commonly used methods to avoid switch bouncing:

Using a capacitor with the switch, called RC debouncing. The
capacitor tries to smoothen the transition and so
avoiding voltage spikes.
This method works fine but still there are chances that some
big
spikes of voltages may still be sent to the Arduino and Arduino
senses it as a button press(false button press). So it is not a
'sure' method to avoid bounce. Also
additional hardware is required for this method.

Software denouncing: It is better method using which you can
almost entirely remove the problem of switch bounce. In
software too there are two majorly used methods, one is called
polling and other is interrupt method. As Chris wrote, polling
with a delay of 10-50 ms (depending on the quality of switch you
are using) can avoid switch bouce. Polling is used in simple
projects
where time is not a very crucial aspect of project functioning.
Polling is easy to implement. On the other hand using interrupt
can be a little painstaking for beginners but it is a better way
because the normal functioning of the code is not haulted while
the debouncing is done(unlike polling where where we use
delay and stop the processor from doing anything in that
duration of time) . There can be many
ways to do so.

Here is a pseudo code that I often useuse to avoid switch bounce:

//If button is pressed an interrupt, say, INTERRUPT1 is triggered
//Following is the interrupt service routine for INTERRUPT1:
ISR(INTERRUPT1) {
//do something you wanted to do on button press
disable INTERRUPT1 //so that other button spike don't trigger it
enable, say, INTERRUPT2 Timer
INTERRUPT2 Timer is set to interrupt after, say 10ms
}

//Following is the interrupt service routine for INTERRUPT2:
ISR(INTERRUPT2) {
disable INTERRUPT2 Timer
enable INTERRUPT1 //button press can be recognized now after 10ms have been elapsed
}


问:
Can't Read current on Pololu Dual MC33926 Motor Driver Shield for Arduino
I purchased a Pololu Dual MC33926 Motor Driver Shield for Arduino, and for some reason I cannot read current from the motor controller. On the Serial.println() it just prints weird data (garbage), and when I use ROS (Robot Operating System) I only see -0.0 (minus zero) value for both motors.

All I've done is plug the shield on my Arduino UNO R3 model, and run the demo that comes with the sample library --
http://github.com/pololu/dual-mc33926-motor-shield .

How can I fix this issue?

答:
I know this thread is old but it's high on Google results and I would like to clarify for anyone who stumbles upon it in the future an answer not yet listed: this chip is not designed to read current accurately below 0.3A and only gives 20% accuracy above that.  This is not listed in the board spec sheet but rather the chip spec sheet.  If you're running motors under no load, you'll get garbage by design.  I honestly don't know why they don't include a warning on this. Relevant thread:

https://forum.pololu.com/t/current-sensing-on-dual-mc33926-motor-driver-shield-for-arduino-low-values/13033


问:
Multiple machine ROS image transmission error
I'm currently trying to establish communication between my Raspberry Pi based robot and a Cluster which are on the same network. Although I am able to ping and SSH one device using the other, I'm still not able to initialise the Raspicam Node(Ubiquiti Robotics node) when roscore is running on the cluster. Also, in the exact opposite circumstances(Roscore running on Raspi) I'm not able to initialise the ORB-SLAM node (ORB-SLAM-ROSNode). The following error shows up in both scenarios:

```<code>... logging to /home/pi/.ros/log/721ad8f6-d0dc-11e5-8411-a74b8992ecaa/roslaunch-pi-14554.log

Checking log directory for disk usage. This may take awhile.

Press Ctrl-C to interrupt

Done checking log file disk usage. Usage is <1GB.

RLException: Unable to contact my own server at [http://19.117.56.330:36875/].

This usually means that the network is not configured properly.

A common cause is that the machine cannot ping itself. Please check

for errors by running:

`ping` [`19.117.56.330`](http://19.117.56.330:36875)

For more tips, please see

[`http://www.ros.org/wiki/ROS/NetworkSetup`](http://www.ros.org/wiki/ROS/NetworkSetup)

The traceback for the exception was written to the log file.
</code>```

Please take note that the basic talker and listener as mentioned in the suggested link are working perfectly. Is there someone who can tell me what is going on exactly and what's the problem. Also, Is there some other way to transmit images(I'm trying to use FLASK and all but failing since Raspicam sends H.264 codec and OpenCV[VideoCapture() function] is failing to interpret the data). I've heard about LCM(Lightweight Communication and Marshalling) has someone done this before using LCM or is there any resource that can help.

edit 1:
All the work was done over an Ethernet-based connection. I experimented by running the simple tutorial. Please take a note that I ran roscore on raspi during the first experiment, and "rqt_graph" and "rosnode list" commands worked perfectly on the cluster. During the second run i ran roscore on the cluster and did the same experiment again by running "rqt_graph" and
"rosnode list" on the raspi and I was able to see all the rosnodes during both the experiments. Here is a screenshot of the /.bashrc file.

答:
Communicating with ROS master

It sounds like you need to point to ROS with the use of user-defined environment variables. I have a set of variables defined in my ~/.bashrc file that define where ROS is located. This is what I have defined on my device that runs roscore:

```<code># ROs
source /opt/ros/kinetic/setup.bash
# SOurce the local workspace
source /home/$USER/catkin_ws/devel/setup.bash
# Grab the machine IP addresses
machine_ip=(`hostname -I`)
rosport=':11311'
rosmasterbegin='http://'
# Now we set the ip location for roscore
export ROS_MASTER_URI=$rosmasterbegin${machine_ip[0]}$rosport
# This is the hostname of the current machine.
export ROS_HOSTNAME=${machine_ip[0]}
# This is the ROS distribution that we are running
export ROS_DISTRO=kinetic
# Sometimes you need to set ROS_IP for transforms and the parameter server
# https://answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/
export ROS_IP=${machine_ip[0]}
</code>```

I suggest you set the ROS_MASTER_URI variable on your Raspi to the cluster running roscore to the output of hostname -I on the cluster. Do make sure that you use the correct ip addresses since you may have many address (wifi, ethernet, etc). Just because you can ping another machine on the network does not mean that ROS can be found. If you could post the outputs of echo $ROS_MASTER_URI and echo $ROS_HOSTNAME in the question, that would allow more people to be able to help you. My suspicion is that you are using the default environment variables and they are not working for you. I suggest you checkout out this link for more information on ROS environment variables.

Body:
Communicating with ROS master

It sounds like you need to point to ROS with the use of user-defined environment variables. I have a set of variables defined in my ~/.bashrc file that define where ROS is located. This is what I have defined on my device that runs roscore:

# ROs
source /opt/ros/kinetic/setup.bash
# SOurce the local workspace
source /home/$USER/catkin_ws/devel/setup.bash
# Grab the machine IP addresses
machine_ip=(`hostname -I`)
rosport=':11311'
rosmasterbegin='http://'
# Now we set the ip location for roscore
export ROS_MASTER_URI=$rosmasterbegin${machine_ip[0]}$rosport
# This is the hostname of the current machine.
export ROS_HOSTNAME=${machine_ip[0]}
# This is the ROS distribution that we are running
export ROS_DISTRO=kinetic
# Sometimes you need to set ROS_IP for transforms and the parameter server
# https://answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/
export ROS_IP=${machine_ip[0]}

I suggest you set the ROS_MASTER_URI variable on your Raspi to the cluster running roscore to the output of hostname -I on the cluster. Do make sure that you use the correct ip addresses since you may have many address (wifi, ethernet, etc). Just because you can ping another machine on the network does not mean that ROS can be found. If you could post the outputs of echo $ROS_MASTER_URI and echo $ROS_HOSTNAME in the question, that would allow more people to be able to help you. My suspicion is that you are using the default environment variables and they are not working for you. I suggest you checkout out this link for more information on ROS environment variables.


问:
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 think there should be things clarified:

In short: there are 3 components needed for control. A motor, a driver, and a power supply.

When you want to use a stepper motor in a project, you need to use a stepper driver. A stepper driver takes in the STEP and DIR(ection) signals to modulate the pulses to the motor. When you are looking at the specifications of the stepper motor, what you need is a stepper driver that can power the current requirements (amperes) of the motor. Once you have a stepper driver that can supply the required current, you then need to find a power supply that can power the stepper driver.

My suspicion is that the power supply you have is okay, but you need to pick out a stepper driver still. This is where I cannot answer, but rather suggest companies that make these sort of things. Circuit Specialists has stepper drivers that would fit your needs as they have high current and high precision. I suggest you do more research as any further answering would be opinionated.

Title: Stepper Motor power supplies


问:
Any ideas for a robot?
I am in the FLL (First Lego League), and while we are waiting for the competitions, we want to work on a robot. Anyone have any ideas?</p>

答:
I have worked as a robot design judge at my local qualifiers and regional events for 3 years now. There are several major areas where successful teams tend to excel. Following are a few in no particular order:

Sensors: Learning to use sensors is simultaneously the hardest and best thing you can do to improve performance. Using sensors well can increase reliability and repeatability when performing tasks. In other words it can improve the performance of the robot by making it more accurate. Start with something simple like learning how to use bump sensors. Then try something a little more complicated like learning how to use color sensors considering how their output changes given different lighting conditions. If you are really up for a challenge then you can learn how to do line following. The most successful teams I have seen make line following a core component.

Programming: Many tasks require the same functionality. For instance, you can use line following to get from home base to the various challenges. You can either put this functionality into each of your programs directly or you can use My Blocks to build the functionality once and use it over and over in your programs. Doing so has the added benefit of making your code more reliable because once it has been written and tested you know it works. It has the added benefit of making your programs smaller allowing you to fit more programs. This can be great for testing. But be careful, too many programs can make switching programs during a challenge time consuming.

Attachments: Changing attachments during the competition is a major time sink. Learning to design attachments that can be used to perform multiple tasks saves time and helps score many points. Try making different types of attachments and focus on learning how to make them rigid and strong.

Stability: Tipping over during a challenge can cost you points as a result of touching the robot while it's away from home base. Practice building chassis that avoiding tipping when the robot turns and interacts with objects in the environment.

Team: FLL emphasizes team building for a reason. A good team can divide the numerous tasks necessary to be successful and can help each other when challenges arise. Learn how to communicate with your team members especially when you disagree. This will show through when you are in the various judging rooms which can earn you a prize in-and-of-itself.

Title: Any ideas for a robot?


问:
I need to read a lot of analog signals without any analog pins
I have an nvidia xavier with gpio running linux. It should work very similarly to raspberry pis. I need to connect a bunch of pressure sensors, thermistor, potentiometers, and vibration sensors to my robot. I expect to have over 100 analog sensors that I need to read from so I can control my servo motors accordingly.

Is there a good on the market chip with a linux library that makes it easy for me to daisy chain and read analog values from over 100 sensors?

If not, what are the key components I would need to create a circuit that accomplishes such a goal?

答:
Since we don't know what kind of sensors you want, here is the most specific-broad answer I (and maybe anybody) can give you:

The first order of business is to attach a device to the Jetson Xavier that allows for so many GPIO pins. Since I can't think of a single device, what you can do is use multiple devices, like a Teensy 3.6. They have a bunch of I/O pins (around 40 total), AND all digital input pins are interruptible. Then, for your analog input needs, you can use a chip like this to convert Analog to Digital readings into an SPI bus readout. This chip can then interface with the Teensy through SPI. The only issue is the voltage conversion, but Sparkfun also has a logic level shifter chip that can connect 2 different voltage devices. After all that, the Teensy board(s) can all connect to the Xavier through USB or CAN or I2C or whatever you choose. If you need more Teensy boards, add more as needed. At the moment, the Sparkfun website is down (presumably for maintenance, it is a Sunday night), so I can't link the level shifter in this answer now. Basically, your question is a bit broad, but that is what I would do. Also, as @jsotola said, "easy" is relative, and with 100s of sensors, nothing is easy, (please) don't lie to yourself: this is bound to be a wiring nightmare. Companies like Pololu sell wiring equipment so that you can either buy premade wires or make your own, but again: too much opinion/options/not specific in a question.


问:
What type of servos are used in industrial robot arms like Universal Robot UR5?
I've noticed that the industrial robot arms have very smooth, fast, and strong movement.  Does anyone know what type of servos they use.  I'm trying to build my own and don't want to have the jerky movement that is seen in a lot of DIY robot arms?  Thanks. </p>

答:
First of all industrial robots drive trains with basically no play/backlash, plus the whole construction is very rigid. AFAIK they all use harmonic drive gearing, which is extremely expensive. Most DIY'ers are not willing to spend that kind of money, and that is one reason why they have jerky movements.

With regards to Universal Robots. They use motors from Kollmorgen, with integrated harmonic drive gearing.

In the Universal Robots FAQ (link) I found the following.

Motors: Permanent Magnet AC Synchronous Drive motors are used in both CB3 and e-Series robots.

Motor drivers: Integrated Motor Drives, Space Vector (Field Oriented) Control @25Khzhttps://en.wikipedia.org/wiki/Vector_control_(motor)

Servo controller: Integrated Servo Controllers in each joint, based on a dual encoder system


问:
Camera pose to world coordinate transformation
I have managed to receive camera_pose for ORB-SLAM by following their code.

If I run

```<code>$ echo /world /camera_pose
</code>```

I receive something like this:

```<code>Translation [-0.8, 0.66, -0.04]

Rotation in Quaternion [ 0.2, -0.3, -0.2, 0.2]

         in RPY radian: [0.071, -0.032, -0.34]

         in RPY degree [0.4, -25.09, -3.2]
</code>```

Does this mean these are the translations and rotations of the camera_pose compared to the world coordinates?

How do I retrieve the estimate of the camera_pose in global coordinates (I want x,y,z,yaw,pitch, roll)?

答:
If you need to transform quaternion to euler angels you just need to use this equation:

def quaternion_to_euler(q):

    (x, y, z, w) = (q[0], q[1], q[2], q[3])
    t0 = +2.0 * (w * x + y * z)
    t1 = +1.0 - 2.0 * (x * x + y * y)
    roll = math.atan2(t0, t1)
    t2 = +2.0 * (w * y - z * x)
    t2 = +1.0 if t2 > +1.0 else t2
    t2 = -1.0 if t2 < -1.0 else t2
    pitch = math.asin(t2)
    t3 = +2.0 * (w * z + x * y)
    t4 = +1.0 - 2.0 * (y * y + z * z)
    yaw = math.atan2(t3, t4)
    return [yaw, pitch, roll]
```

I think translations are already in global coordinates.

Body:
If you need to transform quaternion to euler angels you just need to use this equation:

def quaternion_to_euler(q):

    (x, y, z, w) = (q[0], q[1], q[2], q[3])
    t0 = +2.0 * (w * x + y * z)
    t1 = +1.0 - 2.0 * (x * x + y * y)
    roll = math.atan2(t0, t1)
    t2 = +2.0 * (w * y - z * x)
    t2 = +1.0 if t2 > +1.0 else t2
    t2 = -1.0 if t2 < -1.0 else t2
    pitch = math.asin(t2)
    t3 = +2.0 * (w * z + x * y)
    t4 = +1.0 - 2.0 * (y * y + z * z)
    yaw = math.atan2(t3, t4)
    return [yaw, pitch, roll]

I think translations are already in global coordinates.


问:
ROS on Raspberry Pi Model 2: UbuntuARM vs ROSBerryPi
Before I ask my question, I'd better confirm that I've read the most prominent post about running ROS on Raspberry Pi devices.

That post contains some valuable information, but it's a bit dated, and ROS support for ARM devices is much better these days. In fact, ROS 2.0 is evidently going to have excellent support for running on embedded devices like the Raspberry Pi.

I just got a Pi model 2 for my birthday, and I'm really eager to get ROS running on it so I can build a robot I've been working on, which is based on the Wild Thumper 6WD platform.

From my perspective, here are a few pros & cons regarding UbuntuARM and ROSBerryPi:

UbuntuARM

Pros:

Ubuntu is the official ROS distro and is the most well-supported ROS OS

The best documentation on the ROS wiki for running on ARM devices is written for UbuntuARM

Cons:

Raspbian (on which ROSBerryPi is based) is the official distro for Rasbperry Pi and thus has the best support for the board.

ROSBerryPi

Pros:

Raspbian (on which ROSBerryPi is based) is the official distro for Rasbperry Pi and thus has the best support for the board.
Cons:

ROS is not well supported on OS's other than Ubuntu

To use the ROSBerryPi distro, you must build ROS from source.

My question is: can anyone provide any further insight into this dilemma? If you've been running ROS on your Raspberry Pi 2 (model 2 only please; the model B+ has completely different issues, like not being well-supported by Ubuntu), what's your experience been?

Which distro would/did you choose, and why?

答: This may be a bit late (and slightly opinionated), but I have found Ubuntu Mate a very effective operating system to run ROS on a RasPi. It can access the arm repos for ROS and it is Ubuntu, so it brings the best of both worlds. Ubuntu Mate is supported and can run pre-built binaries for kinetic and melodic without a hitch (I have done this). </p>


问:
Sampling time selection
I'm trying to design a compensator for a pendulum type plant with arduino mega. As you can see from the picture, the system bandwidth is 9 rad/sec.

I calculated the sampling time as ws=10*wb=90, so, max Ts=2*pi/90 = 0.07 sec. and I select Ts=0.1s.

Then I discretize my continuous compensator with this sampling time.
I setup arduino with 0.1s sampling time and feedback my controller with a sensor which has 0.1s sampling time.

But it does not stabilize the system.

The plant's transfer function is OK but Im not sure with the system delay time, code execution time and I do not know how to experimentally measure them.

what kinds of improvements do I need to make?

答:
I would change the sampling period to 0.05 sec to make sure the system is below the max period.  But otherwise your analysis seems correct.

Did you notice that the system is showing underdamped behavior?

Next is to choose the type of compensator you will implement.  Are you trying to place poles?  Or use PD or PID?  You’ve got to find a compensator that lets you add controller damping to the overall system, then conduct its analysis and implementation.

Title: Sampling time selection


问:
Screw based Jacobian
I am working on kinematics of 5-DOF robot. I already derived geometric Jacobian for position and orientation control.

But for singularity analysis, I require a simplified jacobian. And that can be obtained on base of screw theory called Screw Based Jacobian.

But I am not able to find the method to obtain screw based jacobian matrix; which completely explain the method to derive screw based jacobian.

Any advice on where I can get it? Please help me out.

答: Adding to Peter Corke's answer, there's also a Coursera course by Kevin Lynch which uses the Modern Robotics book as a reference and explains how to derive the screw based Jacobian. The Jacobian can be either with respect to the "space frame" (frame attached to base of the manipulator) or the "body frame" (frame attached to the end-effector). Here's a YouTube video from that course that explains the derivation.</p>

Title: Screw based Jacobian


答:
Depending on the resolution you need, you could use a few multi-channel ADC chips. The  TLC1543IN is a through-hole (would work in a breadboard) 10-bit 11-input ADC that communicates over SPI. Connect however many you need to the same SPI bus, and then wire each chip's CS (chip select) pin to a GPIO on the Xavier. Whenever a chip's CS line is held high (at VCC), it'll ignore all activity on the SPI bus, allowing you to have multiple identical chips on the same bus - simply set all CS lines to high except for that of the ADC chip you wish to communicate with. I doubt there's a Linux driver, but it shouldn't be too hard to slap something together in C/C++. You could implement all of this with nothing but breadboards/perfboards, saving you the need to make a custom PCB.

Alternately, you could use a few microcontrollers communicating over SPI/I2C/CAN/your protocol of choice. something like an ATTINY828 could work - each chip is only \$1 or so, and has 28x 10-bit ADC channels. For more power and resolution, the STM32F303ZDT6 is a good choice - \$8/chip, but 40x 12-bit channels. Either way, that'll require some extra programming and probably PCB development.

Title: I need to read a lot of analog signals without any analog pins

Body:
I have an nvidia xavier with gpio running linux. It should work very similarly to raspberry pis. I need to connect a bunch of pressure sensors, thermistor, potentiometers, and vibration sensors to my robot. I expect to have over 100 analog sensors that I need to read from so I can control my servo motors accordingly.

Is there a good on the market chip with a linux library that makes it easy for me to daisy chain and read analog values from over 100 sensors?

If not, what are the key components I would need to create a circuit that accomplishes such a goal?


问:
Robotic arm chassis
I've been curious about how the plastic chassises of the robotic arms in robotic competitions are manufactured. For instance, the following arms clearly have 10-20 plastic parts each, if not more:

Injection moulding such large parts can easily cost \$5k per mould, so it wouldn't quite make sense to me that university projects would spend \$100k into the chassis production alone when only merely several units are needed. By looking at the finishing, they don't seem to be 3D printed. How are the chassises actually made though?

答:
The robot manufacturers or the industries that use them will sponsor these competitions; these sponsorships generally take the form of donated equipment.

Beyond the tax writeoff of donating the equipment, a robot arm manufacturer gets the university to turn out students that have experience with their particular arm. Similar benefit for industries.

If you are, say, an automotive company, then maybe you'll donate the same kind of robot arms and PLCs that you use to a university. Everyone in the engineering department at that university will then train up on your company's preferred robot arms, using your company's preferred PLCs, and then you can come hire up the best-performing students from the graduating classes.

The company gets good PR for sponsoring the competition, a tax writeoff for donating the equipment, and gets a steady stream of people that already have a working knowledge of interfacing to the equipment they'll use in their professional career.

A lot of companies will do this, to get people used to using their software, etc. My university had everyone using Microsoft Office (Word vs. LaTeX),  Matlab (vs. Mathematica), Autodesk Inventor (vs. Solidworks) and so on. Those were all provided free to me while I was a student.

Title: Robotic arm chassis


问:
Effects of distance between wheels on differential line following robots
I have been working on a line following robot for a line tracing competition. It has 7 IR sensors for line detection and the robot size is limited based on the competition rules. The robot structure is similar to the one shown in this question Length and Width of a Line Following Robot.

My questions is, given a fixed robot length and fixed distance between the wheels and the caster wheel, should be distance between the differential wheels be as big as possible or as small as possible, if there are sharp turns (90 degrees and more) in the competition map?

I watched this youtube video Control of Mobile Robots- 2.2 Differential Drive Robotsand it says the car turning speed is $R*(v_l-v_r)/L$ where $R$ is the wheel radius, $L$ is distance between wheels, $v_l$ and $v_r$ are angular speed of left and right wheels. From this equation, it seems the $L$ should be as small as possible, and $R$ should be as big as possible, to allow fast turning. However, I saw so many designs with big $L$ and very small $R$, like the one showing below. So I am not sure if I understood the equation correctly or I missed something.

答: Huge R, Small L can be the theoretic optimum, but you want to build a physical robot with real motors. If your robot is turning very fast, you have to be able to control the motor very accurately otherwise you robot will rotate very fast, but most likely not into the direction you want it to face. Large L also improves the weight distribution between the wheels so that at least the slip is similar for both wheels. </p>


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

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

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

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

What is the best way, and why?

答:
Though using polling or Interrupt won't cause any significant change in a simple line follower robot, but it's often good to use Interrupts.

Though Timer Interrupts are very well used in a number of cases but I would suggest, in this case, that you can better use a simple Interrupt which gets triggered when a specific input comes from the sensor (like white colour detected, and sensor gives a logic high). Doing this you will be sure about what exactly your microcontroller is doing when it encounters the white patch. Also, there is least delay between getting the input and performing the corresponding output.

Though, in the case of simple line follower you can just leave interrupts and continue with polling. But if you are multitasking with your robot (like having multiple sensors for actuating various things) you will probably need interrupts. One more benefit is that you can set up the priority for these events in interrupts. Like what would happen if you are doing task A and and an interrupt comes and asks for doing task B. You can make one of them more important by setting one of them to higher priority. Doing this, the action with more priority will be completed first.

Title: Polling or Timer interrupt?


问:
Looking for solution to 6R inverse kinematics
I graduated from college a few years ago and over that past year have been trying to self-study robot kinematics. My long term goal is to purchase a used industrial robot and retrofit it with a real-time PLC and servo motion control system. This is purely for fun/hobby/education and I'm not sure what it will be used for once I do get it done.

I have mainly worked through the textbook "Introduction to Robotics: Mechanics and Control" by John J. Craig and tried to find video recordings of lectures which went along with the book.

I have a solid understanding of the forward kinematics and have been working through the chapter on inverse kinematics. I am having a hard time jumping from the concept of developing inverse kinematics from one frame to another all the way to developing the equations required to describe the motion of a 6 axis robot.

Does anyone know a good place to find a worked through solution of inverse kinematics for a robot with a spherical wrist? I'd like to be able to derive the equations and write code to calculate all the possible joint angle solutions for the robot to achieve a particular position. There is a lot that needs to be looked into beyond that, but this is where I am stuck now.

Thanks!

Mike

答:
TL;DR

In order to implement the inverse kinematics of a 6R robot (with spherical wrist), you need to use a technique called kinematic decoupling. Kinematic decoupling is when you separate the task of orienting the end effector with the task of translating the end effector.

The book that I think talks about this well is Robot Dynamics and Control
Second Edition, W. Spong, Seth Hutchinson, and M. Vidyasagar.

For this next part, I am assuming you have learned about D-H parameters already (and therefore have developed the forward-kinematics frame transforms for your 6R robot). If not, the Wikipedia page is a great source on the subject.

First 3 Joints Analysis

When looking at a 6R robot, and as you already mentioned, there is a spherical wrist at the end effector (ee). This sperical wrist determines the orientation of the ee and therefore all of the calculations for solving for the location of the ee can be solved pretty easily. This is because the first 3 joints, or 3 equations, all contribute to the location of the center of the wrist. You know the location of the wrist by doing the inverse transform of the ee along the local Z-axis by the robot's physical offset. (This is known as the approach vector, which is the Z-component of the rotation matrix, also known as the 3rd column unit vector. The offset distance along this vector is a constant known value that can be changed to somebody's needs and the math does not change.)
You can then solve for the first 3 joint angles by solving the X-Y-Z equations for the location of the center of the wrist, which would be frame transforms T0-1 to T2-3 multiplied together. These calculations may result in multiple solutions, so you need to be mindful of including all possible solutions.

Spherical Wrist Analysis

Once you have decided which 3 joint values you want for the first 3 joints, you can then solve for the wrist. Since you know the frame transforms T3-6 from your D-H table, you can then look at the rotation component of the frame transform. I don't remember off the top of my head what it looks like, but there are specific elements in the matrix that have fewer symbolic terms involved in the mathematical definition which allow you to systematically solve for the rotations of the last 3 joints.

After a quick google search, I found  resources on how to solve spherical wrists with pretty pictures. This one also happens to show how to do the first 3 joints as well. I don't want to take credit for other people's work, but there are many presentations out there that explain this out fully pretty well. I also didn't want to make this a simple link answer, but rather explain what is going on, then share a reference link.

I am writing this without all of my books in front of me, but hopefully it gives you more of a direction. You just need to understand kinematic decoupling and this problem will look a lot simpler to you. I would happily share a pdf of a book, but, let's just say I don't know how legal that would be... LoL hope that helps

(If this answer helped you, a vote up or green check-mark is greatly appreciated).


问:
Help understanding decoupled inverse kinematics
I've been researching decoupled inverse kinematics with respect to industrial robots. The assumptions made in the decoupled equations greatly simply the equations, however I am having a hard time understanding how these are actually applied once a tool is attached to the robot.

According to one source, "The spherical wrist assumption makes the position of the wrist center point is independent on the end-effector orientation."

This is great since many industrial robots are built this way, but what happens once you attach a tool, say a MIG welding gun? The length of the tool creates an offset from the wrist center which then makes it such that the position of the wrist center IS influenced by the orientation of the end effector. All of the derivations of inverse kinematics using decoupled equations stop at J6 and do not include a tool frame. To me, this really causes a issue? Am I missing something here?lop

答: An End-Of-Arm-Tooling (EoAT) is simply a hard-coded frame transform offset form the real-robot ee. It does not change the inverse kinematics equations for the 6R robot. You just need to make sure you correctly define the transformation matrix so that you don't run into any issues. Just before you calculate the IK, you apply the inverse of the frame transform offset given by the EAoT and then you are good to go. The math does not get any more complicated than a single extra math operation.</p>


问:
Can ROS run on a Raspberry Pi?
Can ROS run on a Raspberry Pi?

ROS is resigned to run on a network of machines, with different machines, even different cores on the same machine doing different jobs. Can one of those machines be a Raspberry Pi?

I am considering using an R-Pi as the EtherCAT master on a mobile robot, communicating with the main PC over WiFi, using a dongle.

Can an R-Pi even run ROS at all?

Would an R-Pi have enough processing power to do some 1kHz servoing?

Would it be possible to run some servoing on the host through the WiFi connecion?

答:
I have experience installing ROS on a Raspi using Ubuntu Mate as an operating system. It is essentially a regular ubuntu operating system, but on an arm device. It can install ROS through pre-built binaries. It requires no more configuring than a regular Ubuntu laptop. I know that there is one version of the Pi that is not officially supported (I think it is the 3B+, it's been a while since installation thankfully), but somebody figured out how to get around that issue on a forum post I googled.

Update:

With official support for UBUNTU on Raspberry Pi, installing ROS 1 on a Raspberry Pi is a non-issue. You can install Ubuntu following Canonical's docs here.

Title: Can ROS run on a Raspberry Pi?


问:
Path planning or 2D Mapping
i want to collect some ideas about this video. https://www.youtube.com/watch?v=q-ZDB8xqI7M
Is the Left Vacuum cleaner using some 2D Mapping or OpenCV to navigate through the room ?
Or is it just a Hard coded Algorithm to do the path planning? </p>

答: Left one has LiDAR and it does 2D SLAM. OpenCV is an image processing library not a tool for robot navigation. The path is planned in the onboard embedded system based on the built map.</p>

Title: Path planning or 2D Mapping


问:
Performing the proper coordinate system transformation
I could use some guidance regarding a coordinate system transform problem. My situation is this: my system begins at some unknown location, which I initialize the location (x y) and orientation (roll, pitch, and yaw) all to zero. I establish a frame of reference at this point, which I call the "local" coordinate frame. It is fixed in the world and does not move. At system startup, the body frame is perfectly aligned with the local frame, where body +x points forward, +y to the right and +z down. The body frame is fixed to my system, and travels with the system as it moves.

I have an estimation routine that provides me with the x and y position, as well as the roll, pitch, and yaw of the system. Yaw is rotation about the z axis of the local frame. Pitch and roll are with respect to the body frame (I.e.,if the robot pitches up, I always get a positive value. If it rolls right, I get a positive value.)

How can I take the known roll and pitch values and transform them to be with respect to the local (fixed) frame?

答:
I introduced a different frame of reference, which I called $\mathbf{R}_p$, or position of the robot on the ground plane, instead of the "body" frame that I asked about.

$\mathbf{R}_p$ moves with the robot, but only in yaw and X and Y position. The pitch and roll (provided by the estimator) are relative to this frame, so the roll ($\phi$) and pitch ($\theta$) are relative to the frame $\mathbf{R}_p$. To transform a point from $\mathbf{R}_p$, to the local frame $\mathbf{L}$, we just rotate $\psi$, (yaw) about the Z axis of $\mathbf{R}_p$ of e.g.:

$$
\mathbf{T}_R^L = \begin{vmatrix} cos(\psi) & -sin(\psi) & 0 & 0 \\ sin(\psi) & cos(\psi) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{vmatrix}
$$

$$
P_L = \mathbf{T}_R^L * \begin{vmatrix} \phi \\ \theta \\ 0 \\ 0 \end{vmatrix}
$$

This gives me the attitude with respect to the local frame that I established when I initialized my system.


问:
Calculating the distance of a point from point cloud data
I'm getting the x,y,z values for three points as follows:

x : -0.357200  y: -0.205010  z: 0.940000

x : -0.310266  y: -0.200437  z: 0.961000

x : -0.299289  y: -0.140374  z: 0.927000

and the point cloud :

Why are some of the values negative?

Does z: 0.961000 mean it is 0.961 meter away towards the z axis?

Also, how is the center of these x,y,z axes computed?

答:
The XYZ readings from the camera are in the reference frame of the camera. @FooBar is correct about the X/Y values: they are planar about the center of the camera, just like the OpenGL viewing window. I don't know the maximum range of the point-cloud data, but my suspicion is that the maximum z value is 1. (This could change, however, depending if you have a multi-camera setup, but I don't have the experimental dtaa to prove one way or the other, and that is outside the scope of the original question.)

RViz is built on OpenGL (though the robotics frames are not necessarily following the same standard, just that they share many  similar design choices), so I suggest you look up the documentation for versions 4.X. Here is a great explanation of OpenGL coordinate frames, not that you needed to go into that much detail, but it helped me a lot.

Back to ROS: If you want to get the coordinates in the world frame rather than the local camera frame, there are 2 things you need.

The location of the camera w.r.t. world frame

The Point cloud data

You can then create a new frame transform object with no rotation offset from the camera (Unit quaternion with 0 rotations).
You can then take your camera frame and the newly computed frame and then extract the frame transform

For clarity:

World frame

Camera frame

Point frame

Since I don't know what language you are using, I refer will refer you to these links regarding frame transforms.

```<code>https://wiki.ros.org/tf
https://wiki.ros.org/tf/Overview/Transformations
https://docs.ros.org/kinetic/api/tf/html/c++/index.html
https://answers.ros.org/question/210572/what-is-a-frame/
</code>```

Body:
The XYZ readings from the camera are in the reference frame of the camera. @FooBar is correct about the X/Y values: they are planar about the center of the camera, just like the OpenGL viewing window. I don't know the maximum range of the point-cloud data, but my suspicion is that the maximum z value is 1. (This could change, however, depending if you have a multi-camera setup, but I don't have the experimental dtaa to prove one way or the other, and that is outside the scope of the original question.)

RViz is built on OpenGL (though the robotics frames are not necessarily following the same standard, just that they share many  similar design choices), so I suggest you look up the documentation for versions 4.X. Here is a great explanation of OpenGL coordinate frames, not that you needed to go into that much detail, but it helped me a lot.

Back to ROS: If you want to get the coordinates in the world frame rather than the local camera frame, there are 2 things you need.

The location of the camera w.r.t. world frame

The Point cloud data

You can then create a new frame transform object with no rotation offset from the camera (Unit quaternion with 0 rotations).
You can then take your camera frame and the newly computed frame and then extract the frame transform

For clarity:

World frame

Camera frame

Point frame

Since I don't know what language you are using, I refer will refer you to these links regarding frame transforms.

https://wiki.ros.org/tf
https://wiki.ros.org/tf/Overview/Transformations
https://docs.ros.org/kinetic/api/tf/html/c++/index.html
https://answers.ros.org/question/210572/what-is-a-frame/


问:
How to send commands to iRobot Create 2?
I bought a iRobot Create 2 last week and it does not have any manual to control from my computer, so I have two questions: How can I send commands to my iRobot Create 2? And what programs can I do?

答:
There is documentation on the website about this very robot.

```<code>https://www.irobot.com/about-irobot/stem/create-2/projects
</code>```

I suggest you go to the bottom of the page and look at the Arduino and Raspi pdf files that they provide. The Raspi documentation tells you how to command the robot. I think from there you can follow their instructions. I would provide more of an answer, but it seems the OP simply does not know where the docs are for their robot.

Body:
There is documentation on the website about this very robot.

https://www.irobot.com/about-irobot/stem/create-2/projects

I suggest you go to the bottom of the page and look at the Arduino and Raspi pdf files that they provide. The Raspi documentation tells you how to command the robot. I think from there you can follow their instructions. I would provide more of an answer, but it seems the OP simply does not know where the docs are for their robot.


问:
What is the definition of the contents of PointCloud2?
What does the contents of PointCloud2 means in ROS?

fields.offset?

fields.datatype?

fields.count?

point_step?

row_step?

Its documentation is poor

Here is a published PointCloud2 message by Velodyne LiDAR:

```<code>header:
  seq: 1071
  stamp:
    secs: 1521699326
    nsecs: 676390000
  frame_id: "velodyne"
height: 1
width: 66811
fields:
  -
    name: "x"
    offset: 0
    datatype: 7
    count: 1
  -
    name: "y"
    offset: 4
    datatype: 7
    count: 1
  -
    name: "z"
    offset: 8
    datatype: 7
    count: 1
  -
    name: "intensity"
    offset: 16
    datatype: 7
    count: 1
  -
    name: "ring"
    offset: 20
    datatype: 4
    count: 1
is_bigendian: False
point_step: 32
row_step: 2137952
data: [235, 171, 54, 190, 53, 107, 250, ...
</code>```

Why height in Velodyne-HDL64e LiDAR is equal to one? I expected it to be 64.

Finally, for example, what is 171 value in data? is Y or is a range (for which one of the beams)?

答:
I get why you are confused.

Looking at the definition of PointCloud2, you see that the field that holds the "actual" point cloud data is a 1-dimensional array. Now, you might think, wait: why aren't there 3 dimensions, one for X, Y, and Z? Well, this is why we have PointCloud2: so we can have a single array in memory contain all the info we need, regardless of data associated with the point. The offset is simply where the definition of that part of the first and next point starts in that honkin' huge array. This array not only contains XYZ data, but it also contains other data, like, as the documentation for the message says, normals, intensity, etc.. The PointField message simply tells ROS how the data is formatted (kind of like how you might add a message header to the data being sent through a socket, but that is outside the scope of the question).

I suggest you read the overview on pcl on the ROS website as well as on this link.

The other questions specific to Velodyne I would not be able to answer since I don't know anything about your configuration.


问:
Do I need to use Inverse Kinematics if I have the coordinates of all joints?
So I have the positions of all the joints (x,y,z) of a robot arm. I need to calculate the angles of the joints to feed them to another similar robot arm. I cannot get the angles from the robot I need to calculate them from the positions.

Let's say:

J1: (x1,y1,z1)-------------J2: (x2,y2,z2)----------------End: (x3,y3,z3)

x is the depth towards the screen, z is vertical axis and y is horizontal axis

let's say J1 rotates around y1 and x1, and J2 rotates around x2 and z2

My first instinct is, this is easy! I just need to calculate the angles between (x1,y1,z1) and (x2,y2,z2) to get the angles of J1, and between (x2,y2,z2) and (x3,y3,z3) to get the angles of J2.

For J1:
I use atan (x1/z1) to get the angle around y1 and atan (z1/y1) for the angle around x1.

For J2:
angle around x2 = atan (z2/y2).
angle around z2 = atan (y2/x2).

Now I know I'm wrong, because this didn't work. Also because if  this works, why would people use complex inverse kinematics solutions. The problem is, I have no idea why this is wrong. Can someone explain to me the mistakes in my method/understanding?

Thank you.

The refrence arm:

The controlled arm:

I forgot to add joints labels from top to bottom (J1, J2, End)
I'm controlling the arm by rotating around the y-axis and around the x-axis of J1 for J1-J2 and around the z-axis and around the x-axis of J2 for J2-End.

答:
People use complex inverse kinematics because they do not have the joint positions. In the case of an industrial robto, you know the you want the end effector at a certain position, and you calculate (or the robot's software) calculates what joint angles correspond for that position. (actually one of the ways of doing this is to calculate the xyz position of some joints and calculate angles from those coordinates)

Since you already have the joint positions...your task is somewhat easier.

If you have the joint positions, you are right, you can use these coordinates the identify the angles. However, you need to take care what coordinates you are using.

Your robot is at a root coordinate system (cs), usually different then the world cs. Angles are always expressed relatively between two local cs, and not in world cs. For example, two consecutive joints, which share a parallel axis of rotation are set top 90 degrees and -90 degrees. In worldCS the element after the second joint would have 0 degrees rotation, in the local CS it has -90 degrees. So you need to make sure that the coordinates you are using in your trigonometric equations are relative coordinates. Currently it seems that you are using world (absolute coordinates). I am not sure if the atan function is the right choice, if there is no drawing, I do not comment on trig. relations. So assuming that atan is the correct function to use, in relative coordinates, it would become:

rot_x2 = atan ((z2-z1)/(y2-y1))

also, I would advise to use atan2() instead of atan(). It handles all the finge cases atan does not.
and please note that rot_x2 in this case will become the angle between J1 and J2.


问:
Picking up a cheap timer
I am currently working on ATmega328 timers. But it has maximum timer of only 16 bit. Even with a prescalar of 1024 and 16MHz clock, I can only produce a time interval of about 4 seconds. Although I can code ATmega 328 to get higher time intervals by some methods but I wish to have a 32 bit timer.
Is there any microcontroller from ATMEL(I find them easy to use) which has this capability at the same or lower price?

And what are some other timer options available for longer time durations(days or hours) ?

Thanks!

答:
Choosing a different controller is really unnecessary. Its absolutely common to implement long delays with 16 bit timers. The only thing you need to to is using a simple additional counter variable (software pre-scaler).

Timer/Counter2 allows Clocking from external 32kHz low frequency crystal (watch crystal). So a good option would be, to use such a crystal connected to pins TOSC1 and TOSC2 (or similar).

The clock source can then be configured to increment the before mentioned hardware timer asynchronously. By setting the correct prescaler, you can achieve a Interrupt interval of exactly 1s for example. So within the ISR, you can just increment your global second counter.

Take a look at application note 1259 and/or the datasheet section for Timer/Counter2.

Title: Picking up a cheap timer


问:
Max motor voltage for RoboClaw controller
The RoboClaw data sheet from ServoCity mentions various current limits, but what about voltage? Can I run a 110 Vdc treadmill motor?</p>

答:
As mentioned on page 7 of the datasheet,

The main power input can be from 6VDC to 34VDC on a standard RoboClaw and 10.5VDC to 60VDC or 80VDC on an HV (High Voltage) RoboClaw.